Fix bug maintenance mode in share view

This commit is contained in:
davigonz 2016-12-28 10:27:05 +01:00 committed by AndyScherzinger
parent f38e0e12a0
commit 412ce69fcb
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 18 additions and 9 deletions

View file

@ -265,15 +265,19 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
// The Toast must be shown in the main thread to grant that will be hidden correctly; otherwise
// the thread may die before, an exception will occur, and the message will be left on the screen
// until the app dies
Toast.makeText(
getContext().getApplicationContext(),
ErrorMessageAdapter.getErrorCauseMessage(
result,
null,
getContext().getResources()
),
Toast.LENGTH_SHORT
).show();
// Edited: this toast message has no sense. If operation is being passed as null to getErrorCauseMessage(),
// the returned message is always null and therefore an empty toast is shown. Pending to review and change/delete
// Toast.makeText(
// getContext().getApplicationContext(),
// ErrorMessageAdapter.getErrorCauseMessage(
// result,
// null,
// getContext().getResources()
// ),
// Toast.LENGTH_SHORT
// ).show();
}
});
}

View file

@ -31,6 +31,7 @@ import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.operations.CreateShareViaLinkOperation;
import com.owncloud.android.operations.CreateShareWithShareeOperation;
import com.owncloud.android.operations.DownloadFileOperation;
import com.owncloud.android.operations.GetSharesForFileOperation;
import com.owncloud.android.operations.MoveFileOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation;
@ -309,6 +310,10 @@ public class ErrorMessageAdapter {
// Show a Message, operation finished without success
message = res.getString(R.string.copy_file_error);
}
} else if (operation instanceof GetSharesForFileOperation) {
if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
message = res.getString(R.string.maintenance_mode);
}
}
return message;