mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 14:15:44 +03:00
Revert styling changes
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
95931f229d
commit
15518734f6
3 changed files with 162 additions and 103 deletions
|
@ -1225,26 +1225,29 @@ public class FileDisplayActivity extends FileActivity
|
||||||
|
|
||||||
String synchFolderRemotePath =
|
String synchFolderRemotePath =
|
||||||
intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
|
intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
|
||||||
RemoteOperationResult syncResult = (RemoteOperationResult)
|
RemoteOperationResult synchResult = (RemoteOperationResult)
|
||||||
DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
|
DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
|
||||||
boolean sameAccount = getAccount() != null &&
|
boolean sameAccount = getAccount() != null &&
|
||||||
accountName.equals(getAccount().name) && getStorageManager() != null;
|
accountName.equals(getAccount().name) && getStorageManager() != null;
|
||||||
|
|
||||||
if (sameAccount) {
|
if (sameAccount) {
|
||||||
|
|
||||||
if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
|
if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
|
||||||
mSyncInProgress = true;
|
mSyncInProgress = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
OCFile currentFile = (getFile() == null) ? null :
|
OCFile currentFile = (getFile() == null) ? null :
|
||||||
getStorageManager().getFileByEncryptedRemotePath(getFile().getRemotePath());
|
getStorageManager().getFileByPath(getFile().getRemotePath());
|
||||||
OCFile currentDir = (getCurrentDir() == null) ? null :
|
OCFile currentDir = (getCurrentDir() == null) ? null :
|
||||||
getStorageManager().getFileByEncryptedRemotePath(getCurrentDir().getRemotePath());
|
getStorageManager().getFileByPath(getCurrentDir().getRemotePath());
|
||||||
|
|
||||||
if (currentDir == null) {
|
if (currentDir == null) {
|
||||||
// current folder was removed from the server
|
// current folder was removed from the server
|
||||||
DisplayUtils.showSnackMessage(
|
DisplayUtils.showSnackMessage(
|
||||||
getActivity(),
|
getActivity(),
|
||||||
R.string.sync_current_folder_was_removed,
|
R.string.sync_current_folder_was_removed,
|
||||||
synchFolderRemotePath);
|
synchFolderRemotePath
|
||||||
|
);
|
||||||
|
|
||||||
browseToRoot();
|
browseToRoot();
|
||||||
|
|
||||||
|
@ -1269,21 +1272,35 @@ public class FileDisplayActivity extends FileActivity
|
||||||
!RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event);
|
!RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event);
|
||||||
|
|
||||||
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) &&
|
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) &&
|
||||||
syncResult != null) {
|
synchResult != null) {
|
||||||
|
|
||||||
if (syncResult.isSuccess()) {
|
if (synchResult.isSuccess()) {
|
||||||
hideInfoBox();
|
hideInfoBox();
|
||||||
} else {
|
} else {
|
||||||
// TODO refactor and make common
|
// TODO refactor and make common
|
||||||
if (checkForRemoteOperationError(syncResult)) {
|
if (checkForRemoteOperationError(synchResult)) {
|
||||||
requestCredentialsUpdate(context);
|
requestCredentialsUpdate(context);
|
||||||
} else {
|
} else {
|
||||||
switch (syncResult.getCode()) {
|
switch (synchResult.getCode()) {
|
||||||
case SSL_RECOVERABLE_PEER_UNVERIFIED -> showUntrustedCertDialog(syncResult);
|
case SSL_RECOVERABLE_PEER_UNVERIFIED:
|
||||||
case MAINTENANCE_MODE -> showInfoBox(R.string.maintenance_mode);
|
showUntrustedCertDialog(synchResult);
|
||||||
case NO_NETWORK_CONNECTION -> showInfoBox(R.string.offline_mode);
|
break;
|
||||||
case HOST_NOT_AVAILABLE -> showInfoBox(R.string.host_not_available);
|
|
||||||
default -> hideInfoBox();
|
case MAINTENANCE_MODE:
|
||||||
|
showInfoBox(R.string.maintenance_mode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NO_NETWORK_CONNECTION:
|
||||||
|
showInfoBox(R.string.offline_mode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HOST_NOT_AVAILABLE:
|
||||||
|
showInfoBox(R.string.host_not_available);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// nothing to do
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1309,8 +1326,8 @@ public class FileDisplayActivity extends FileActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (syncResult != null && syncResult.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {
|
if (synchResult != null && synchResult.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {
|
||||||
mLastSslUntrustedServerResult = syncResult;
|
mLastSslUntrustedServerResult = synchResult;
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// avoid app crashes after changing the serial id of RemoteOperationResult
|
// avoid app crashes after changing the serial id of RemoteOperationResult
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class FetchRemoteFileTask extends AsyncTask<Void, Void, String> {
|
||||||
private final String fileId;
|
private final String fileId;
|
||||||
private final FileDataStorageManager storageManager;
|
private final FileDataStorageManager storageManager;
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
private final FileDisplayActivity fileDisplayActivity;
|
private final FileDisplayActivity fileDisplayActivity;
|
||||||
|
|
||||||
public FetchRemoteFileTask(User user,
|
public FetchRemoteFileTask(User user,
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
*/
|
*/
|
||||||
package com.owncloud.android.ui.fragment;
|
package com.owncloud.android.ui.fragment;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -268,7 +267,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = requireActivity().getIntent();
|
Intent intent = getActivity().getIntent();
|
||||||
|
|
||||||
if (intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT) != null) {
|
if (intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT) != null) {
|
||||||
searchEvent = intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT);
|
searchEvent = intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT);
|
||||||
|
@ -289,20 +288,19 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
Log_OC.i(TAG, "onAttach");
|
Log_OC.i(TAG, "onAttach");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mContainerActivity = (FileFragment.ContainerActivity) context;
|
mContainerActivity = (FileFragment.ContainerActivity) context;
|
||||||
setTitle();
|
setTitle();
|
||||||
|
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new IllegalArgumentException(context + " must implement " +
|
throw new IllegalArgumentException(context.toString() + " must implement " +
|
||||||
FileFragment.ContainerActivity.class.getSimpleName(), e);
|
FileFragment.ContainerActivity.class.getSimpleName(), e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
setOnRefreshListener((OnEnforceableRefreshListener) context);
|
setOnRefreshListener((OnEnforceableRefreshListener) context);
|
||||||
|
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new IllegalArgumentException(context + " must implement " +
|
throw new IllegalArgumentException(context.toString() + " must implement " +
|
||||||
OnEnforceableRefreshListener.class.getSimpleName(), e);
|
OnEnforceableRefreshListener.class.getSimpleName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,7 +421,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
setTitle();
|
setTitle();
|
||||||
|
|
||||||
FragmentActivity fragmentActivity;
|
FragmentActivity fragmentActivity;
|
||||||
if ((fragmentActivity = getActivity()) != null && fragmentActivity instanceof FileDisplayActivity fileDisplayActivity) {
|
if ((fragmentActivity = getActivity()) != null && fragmentActivity instanceof FileDisplayActivity) {
|
||||||
|
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) fragmentActivity;
|
||||||
fileDisplayActivity.updateActionBarTitleAndHomeButton(fileDisplayActivity.getCurrentDir());
|
fileDisplayActivity.updateActionBarTitleAndHomeButton(fileDisplayActivity.getCurrentDir());
|
||||||
}
|
}
|
||||||
listDirectory(MainApp.isOnlyOnDevice(), false);
|
listDirectory(MainApp.isOnlyOnDevice(), false);
|
||||||
|
@ -433,7 +432,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
boolean hideItemOptions = args != null && args.getBoolean(ARG_HIDE_ITEM_OPTIONS, false);
|
boolean hideItemOptions = args != null && args.getBoolean(ARG_HIDE_ITEM_OPTIONS, false);
|
||||||
|
|
||||||
mAdapter = new OCFileListAdapter(
|
mAdapter = new OCFileListAdapter(
|
||||||
requireActivity(),
|
getActivity(),
|
||||||
accountManager.getUser(),
|
accountManager.getUser(),
|
||||||
preferences,
|
preferences,
|
||||||
syncedFolderProvider,
|
syncedFolderProvider,
|
||||||
|
@ -453,13 +452,25 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
if (isSearchEventSet(event)) {
|
if (isSearchEventSet(event)) {
|
||||||
|
|
||||||
switch (event.getSearchType()) {
|
switch (event.getSearchType()) {
|
||||||
case FILE_SEARCH -> currentSearchType = FILE_SEARCH;
|
case FILE_SEARCH:
|
||||||
case FAVORITE_SEARCH -> currentSearchType = FAVORITE_SEARCH;
|
currentSearchType = FILE_SEARCH;
|
||||||
case RECENTLY_MODIFIED_SEARCH -> currentSearchType = RECENTLY_MODIFIED_SEARCH;
|
break;
|
||||||
case SHARED_FILTER -> currentSearchType = SHARED_FILTER;
|
|
||||||
default -> {
|
case FAVORITE_SEARCH:
|
||||||
}
|
currentSearchType = FAVORITE_SEARCH;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RECENTLY_MODIFIED_SEARCH:
|
||||||
|
currentSearchType = RECENTLY_MODIFIED_SEARCH;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SHARED_FILTER:
|
||||||
|
currentSearchType = SHARED_FILTER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
// do nothing
|
// do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareActionBarItems(event);
|
prepareActionBarItems(event);
|
||||||
|
@ -470,7 +481,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
* register listener on FAB.
|
* register listener on FAB.
|
||||||
*/
|
*/
|
||||||
public void registerFabListener() {
|
public void registerFabListener() {
|
||||||
FileActivity activity = (FileActivity) requireActivity();
|
FileActivity activity = (FileActivity) getActivity();
|
||||||
|
|
||||||
if (mFabMain != null) {
|
if (mFabMain != null) {
|
||||||
// is not available in FolderPickerActivity
|
// is not available in FolderPickerActivity
|
||||||
|
@ -497,7 +508,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void createFolder() {
|
public void createFolder() {
|
||||||
CreateFolderDialogFragment.newInstance(mFile)
|
CreateFolderDialogFragment.newInstance(mFile)
|
||||||
.show(requireActivity().getSupportFragmentManager(), DIALOG_CREATE_FOLDER);
|
.show(getActivity().getSupportFragmentManager(), DIALOG_CREATE_FOLDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -506,9 +517,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
|
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
|
|
||||||
requireActivity().startActivityForResult(
|
getActivity().startActivityForResult(
|
||||||
Intent.createChooser(action, getString(R.string.upload_chooser_title)),
|
Intent.createChooser(action, getString(R.string.upload_chooser_title)),
|
||||||
FileDisplayActivity.REQUEST_CODE__SELECT_CONTENT_FROM_APPS);
|
FileDisplayActivity.REQUEST_CODE__SELECT_CONTENT_FROM_APPS
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -546,9 +558,11 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void uploadFiles() {
|
public void uploadFiles() {
|
||||||
UploadFilesActivity.startUploadActivityForResult(
|
UploadFilesActivity.startUploadActivityForResult(
|
||||||
requireActivity(),
|
getActivity(),
|
||||||
((FileActivity) requireActivity()).getUser().orElseThrow(RuntimeException::new),
|
((FileActivity) getActivity()).getUser().orElseThrow(RuntimeException::new),
|
||||||
FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM, getCurrentFile().isEncrypted());
|
FileDisplayActivity.REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM,
|
||||||
|
getCurrentFile().isEncrypted()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -682,7 +696,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void onDrawerClosed(@NonNull View drawerView) {
|
public void onDrawerClosed(@NonNull View drawerView) {
|
||||||
if (mActionModeClosedByDrawer && mSelectionWhenActionModeClosedByDrawer.size() > 0) {
|
if (mActionModeClosedByDrawer && mSelectionWhenActionModeClosedByDrawer.size() > 0) {
|
||||||
FragmentActivity actionBarActivity = requireActivity();
|
FragmentActivity actionBarActivity = getActivity();
|
||||||
actionBarActivity.startActionMode(mMultiChoiceModeListener);
|
actionBarActivity.startActionMode(mMultiChoiceModeListener);
|
||||||
|
|
||||||
getAdapter().setCheckedItem(mSelectionWhenActionModeClosedByDrawer);
|
getAdapter().setCheckedItem(mSelectionWhenActionModeClosedByDrawer);
|
||||||
|
@ -727,19 +741,16 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
mIsActionModeNew = true;
|
mIsActionModeNew = true;
|
||||||
|
|
||||||
// fake menu to be able to use bottom sheet instead
|
// fake menu to be able to use bottom sheet instead
|
||||||
MenuInflater inflater = requireActivity().getMenuInflater();
|
MenuInflater inflater = getActivity().getMenuInflater();
|
||||||
inflater.inflate(R.menu.custom_menu_placeholder, menu);
|
inflater.inflate(R.menu.custom_menu_placeholder, menu);
|
||||||
final MenuItem item = menu.findItem(R.id.custom_menu_placeholder_item);
|
final MenuItem item = menu.findItem(R.id.custom_menu_placeholder_item);
|
||||||
|
|
||||||
if (item.getIcon() != null) {
|
|
||||||
item.setIcon(viewThemeUtils.platform.colorDrawable(item.getIcon(), ContextCompat.getColor(requireContext(), R.color.white)));
|
item.setIcon(viewThemeUtils.platform.colorDrawable(item.getIcon(), ContextCompat.getColor(requireContext(), R.color.white)));
|
||||||
}
|
|
||||||
mode.invalidate();
|
mode.invalidate();
|
||||||
|
|
||||||
//set actionMode color
|
//set actionMode color
|
||||||
viewThemeUtils.platform.colorStatusBar(
|
viewThemeUtils.platform.colorStatusBar(
|
||||||
requireActivity(),
|
getActivity(),
|
||||||
ContextCompat.getColor(requireContext(), R.color.action_mode_background));
|
ContextCompat.getColor(getContext(), R.color.action_mode_background));
|
||||||
|
|
||||||
// hide FAB in multi selection mode
|
// hide FAB in multi selection mode
|
||||||
setFabVisible(false);
|
setFabVisible(false);
|
||||||
|
@ -817,7 +828,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mMultiChoiceModeListener.loadStateFrom(savedInstanceState);
|
mMultiChoiceModeListener.loadStateFrom(savedInstanceState);
|
||||||
}
|
}
|
||||||
((FileActivity) requireActivity()).addDrawerListener(mMultiChoiceModeListener);
|
((FileActivity) getActivity()).addDrawerListener(mMultiChoiceModeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -891,24 +902,18 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
String parentPath = null;
|
String parentPath = null;
|
||||||
if (mFile.getParentId() != FileDataStorageManager.ROOT_PARENT_ID) {
|
if (mFile.getParentId() != FileDataStorageManager.ROOT_PARENT_ID) {
|
||||||
parentPath = new File(mFile.getRemotePath()).getParent();
|
parentPath = new File(mFile.getRemotePath()).getParent();
|
||||||
if (parentPath != null) {
|
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath :
|
||||||
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath : parentPath + OCFile.PATH_SEPARATOR;
|
parentPath + OCFile.PATH_SEPARATOR;
|
||||||
}
|
parentDir = storageManager.getFileByPath(parentPath);
|
||||||
parentDir = storageManager.getFileByEncryptedRemotePath(parentPath);
|
|
||||||
moveCount++;
|
moveCount++;
|
||||||
} else {
|
} else {
|
||||||
parentDir = storageManager.getFileByEncryptedRemotePath(ROOT_PATH);
|
parentDir = storageManager.getFileByPath(ROOT_PATH);
|
||||||
}
|
}
|
||||||
while (parentDir == null) {
|
while (parentDir == null) {
|
||||||
|
|
||||||
if (parentPath != null) {
|
|
||||||
parentPath = new File(parentPath).getParent();
|
parentPath = new File(parentPath).getParent();
|
||||||
if (parentPath != null) {
|
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath :
|
||||||
parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath : parentPath + OCFile.PATH_SEPARATOR;
|
parentPath + OCFile.PATH_SEPARATOR;
|
||||||
}
|
parentDir = storageManager.getFileByPath(parentPath);
|
||||||
}
|
|
||||||
|
|
||||||
parentDir = storageManager.getFileByEncryptedRemotePath(parentPath);
|
|
||||||
moveCount++;
|
moveCount++;
|
||||||
} // exit is granted because storageManager.getFileByPath("/") never returns null
|
} // exit is granted because storageManager.getFileByPath("/") never returns null
|
||||||
mFile = parentDir;
|
mFile = parentDir;
|
||||||
|
@ -1030,18 +1035,25 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
} else if (mFileSelectable) {
|
} else if (mFileSelectable) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(FolderPickerActivity.EXTRA_FILES, file);
|
intent.putExtra(FolderPickerActivity.EXTRA_FILES, file);
|
||||||
requireActivity().setResult(Activity.RESULT_OK, intent);
|
getActivity().setResult(Activity.RESULT_OK, intent);
|
||||||
requireActivity().finish();
|
getActivity().finish();
|
||||||
} else if (!mOnlyFoldersClickable) {
|
} else if (!mOnlyFoldersClickable) {
|
||||||
// Click on a file
|
// Click on a file
|
||||||
if (PreviewImageFragment.canBePreviewed(file)) {
|
if (PreviewImageFragment.canBePreviewed(file)) {
|
||||||
// preview image - it handles the download, if needed
|
// preview image - it handles the download, if needed
|
||||||
if (searchFragment) {
|
if (searchFragment) {
|
||||||
VirtualFolderType type = switch (currentSearchType) {
|
VirtualFolderType type;
|
||||||
case FAVORITE_SEARCH -> VirtualFolderType.FAVORITE;
|
switch (currentSearchType) {
|
||||||
case GALLERY_SEARCH -> VirtualFolderType.GALLERY;
|
case FAVORITE_SEARCH:
|
||||||
default -> VirtualFolderType.NONE;
|
type = VirtualFolderType.FAVORITE;
|
||||||
};
|
break;
|
||||||
|
case GALLERY_SEARCH:
|
||||||
|
type = VirtualFolderType.GALLERY;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
type = VirtualFolderType.NONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
((FileDisplayActivity) mContainerActivity).startImagePreview(file, type, !file.isDown());
|
((FileDisplayActivity) mContainerActivity).startImagePreview(file, type, !file.isDown());
|
||||||
} else {
|
} else {
|
||||||
((FileDisplayActivity) mContainerActivity).startImagePreview(file, !file.isDown());
|
((FileDisplayActivity) mContainerActivity).startImagePreview(file, !file.isDown());
|
||||||
|
@ -1248,14 +1260,14 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
int requestCode = FileDisplayActivity.REQUEST_CODE__MOVE_OR_COPY_FILES;
|
int requestCode = FileDisplayActivity.REQUEST_CODE__MOVE_OR_COPY_FILES;
|
||||||
String extraAction = FolderPickerActivity.MOVE_OR_COPY;
|
String extraAction = FolderPickerActivity.MOVE_OR_COPY;
|
||||||
|
|
||||||
final Intent action = new Intent(requireActivity(), FolderPickerActivity.class);
|
final Intent action = new Intent(getActivity(), FolderPickerActivity.class);
|
||||||
final ArrayList<String> paths = new ArrayList<>(checkedFiles.size());
|
final ArrayList<String> paths = new ArrayList<>(checkedFiles.size());
|
||||||
for (OCFile file : checkedFiles) {
|
for (OCFile file : checkedFiles) {
|
||||||
paths.add(file.getRemotePath());
|
paths.add(file.getRemotePath());
|
||||||
}
|
}
|
||||||
action.putStringArrayListExtra(FolderPickerActivity.EXTRA_FILE_PATHS, paths);
|
action.putStringArrayListExtra(FolderPickerActivity.EXTRA_FILE_PATHS, paths);
|
||||||
action.putExtra(FolderPickerActivity.EXTRA_ACTION, extraAction);
|
action.putExtra(FolderPickerActivity.EXTRA_ACTION, extraAction);
|
||||||
requireActivity().startActivityForResult(action, requestCode);
|
getActivity().startActivityForResult(action, requestCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1301,7 +1313,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
if (mFile != null) {
|
if (mFile != null) {
|
||||||
directory = mFile;
|
directory = mFile;
|
||||||
} else {
|
} else {
|
||||||
directory = storageManager.getFileByEncryptedRemotePath(ROOT_PATH);
|
directory = storageManager.getFileByPath(ROOT_PATH);
|
||||||
if (directory == null) {
|
if (directory == null) {
|
||||||
return; // no files, wait for sync
|
return; // no files, wait for sync
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1335,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
directory,
|
directory,
|
||||||
storageManager,
|
storageManager,
|
||||||
onlyOnDevice,
|
onlyOnDevice,
|
||||||
mLimitToMimeType);
|
mLimitToMimeType
|
||||||
|
);
|
||||||
|
|
||||||
OCFile previousDirectory = mFile;
|
OCFile previousDirectory = mFile;
|
||||||
mFile = directory;
|
mFile = directory;
|
||||||
|
@ -1368,7 +1381,12 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
setGridSwitchButton();
|
setGridSwitchButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFabVisible(!mHideFab);
|
if (mHideFab) {
|
||||||
|
setFabVisible(false);
|
||||||
|
} else {
|
||||||
|
setFabVisible(true);
|
||||||
|
// registerFabListener();
|
||||||
|
}
|
||||||
|
|
||||||
// FAB
|
// FAB
|
||||||
setFabEnabled(mFile != null && mFile.canWrite());
|
setFabEnabled(mFile != null && mFile.canWrite());
|
||||||
|
@ -1420,7 +1438,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
public void switchLayoutManager(boolean grid) {
|
public void switchLayoutManager(boolean grid) {
|
||||||
int position = 0;
|
int position = 0;
|
||||||
|
|
||||||
|
@ -1466,13 +1483,23 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
protected void setTitle() {
|
protected void setTitle() {
|
||||||
// set title
|
// set title
|
||||||
|
|
||||||
if (requireActivity() instanceof FileDisplayActivity && currentSearchType != null) {
|
if (getActivity() instanceof FileDisplayActivity && currentSearchType != null) {
|
||||||
switch (currentSearchType) {
|
switch (currentSearchType) {
|
||||||
case FAVORITE_SEARCH -> setTitle(R.string.drawer_item_favorites);
|
case FAVORITE_SEARCH:
|
||||||
case GALLERY_SEARCH -> setTitle(R.string.drawer_item_gallery);
|
setTitle(R.string.drawer_item_favorites);
|
||||||
case RECENTLY_MODIFIED_SEARCH -> setTitle(R.string.drawer_item_recently_modified);
|
break;
|
||||||
case SHARED_FILTER -> setTitle(R.string.drawer_item_shared);
|
case GALLERY_SEARCH:
|
||||||
default -> setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), false);
|
setTitle(R.string.drawer_item_gallery);
|
||||||
|
break;
|
||||||
|
case RECENTLY_MODIFIED_SEARCH:
|
||||||
|
setTitle(R.string.drawer_item_recently_modified);
|
||||||
|
break;
|
||||||
|
case SHARED_FILTER:
|
||||||
|
setTitle(R.string.drawer_item_shared);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1481,27 +1508,44 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
protected void prepareActionBarItems(SearchEvent event) {
|
protected void prepareActionBarItems(SearchEvent event) {
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
switch (event.getSearchType()) {
|
switch (event.getSearchType()) {
|
||||||
case FAVORITE_SEARCH, RECENTLY_MODIFIED_SEARCH ->
|
case FAVORITE_SEARCH:
|
||||||
|
case RECENTLY_MODIFIED_SEARCH:
|
||||||
menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_SORT;
|
menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_SORT;
|
||||||
default -> {
|
break;
|
||||||
}
|
|
||||||
|
default:
|
||||||
// do nothing
|
// do nothing
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SearchType.FILE_SEARCH != currentSearchType && getActivity() != null) {
|
if (SearchType.FILE_SEARCH != currentSearchType && getActivity() != null) {
|
||||||
requireActivity().invalidateOptionsMenu();
|
getActivity().invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setEmptyView(SearchEvent event) {
|
protected void setEmptyView(SearchEvent event) {
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
switch (event.getSearchType()) {
|
switch (event.getSearchType()) {
|
||||||
case FILE_SEARCH -> setEmptyListMessage(SearchType.FILE_SEARCH);
|
case FILE_SEARCH:
|
||||||
case FAVORITE_SEARCH -> setEmptyListMessage(SearchType.FAVORITE_SEARCH);
|
setEmptyListMessage(SearchType.FILE_SEARCH);
|
||||||
case RECENTLY_MODIFIED_SEARCH -> setEmptyListMessage(SearchType.RECENTLY_MODIFIED_SEARCH);
|
break;
|
||||||
case SHARED_FILTER -> setEmptyListMessage(SearchType.SHARED_FILTER);
|
|
||||||
default -> setEmptyListMessage(SearchType.NO_SEARCH);
|
case FAVORITE_SEARCH:
|
||||||
|
setEmptyListMessage(SearchType.FAVORITE_SEARCH);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RECENTLY_MODIFIED_SEARCH:
|
||||||
|
setEmptyListMessage(SearchType.RECENTLY_MODIFIED_SEARCH);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SHARED_FILTER:
|
||||||
|
setEmptyListMessage(SearchType.SHARED_FILTER);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
setEmptyListMessage(SearchType.NO_SEARCH);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEmptyListMessage(SearchType.NO_SEARCH);
|
setEmptyListMessage(SearchType.NO_SEARCH);
|
||||||
|
@ -1774,7 +1818,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme default action bar according to provided parameters. Replaces back arrow with hamburger menu icon.
|
* Theme default action bar according to provided parameters.
|
||||||
|
* Replaces back arrow with hamburger menu icon.
|
||||||
*
|
*
|
||||||
* @param title string res id of title to be shown in action bar
|
* @param title string res id of title to be shown in action bar
|
||||||
*/
|
*/
|
||||||
|
@ -1789,16 +1834,16 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
* @param showBackAsMenu iff true replace back arrow with hamburger menu icon
|
* @param showBackAsMenu iff true replace back arrow with hamburger menu icon
|
||||||
*/
|
*/
|
||||||
protected void setTitle(final String title, Boolean showBackAsMenu) {
|
protected void setTitle(final String title, Boolean showBackAsMenu) {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
getActivity().runOnUiThread(() -> {
|
final ActionBar actionBar = ((FileDisplayActivity) getActivity()).getSupportActionBar();
|
||||||
ActionBar actionBar = ((FileDisplayActivity) getActivity()).getSupportActionBar();
|
final Context context = getContext();
|
||||||
Context context = getContext();
|
|
||||||
|
|
||||||
if (actionBar != null && context != null) {
|
if (actionBar != null && context != null) {
|
||||||
viewThemeUtils.files.themeActionBar(context, actionBar, title, showBackAsMenu);
|
viewThemeUtils.files.themeActionBar(context, actionBar, title, showBackAsMenu);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1842,13 +1887,11 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||||
public void selectAllFiles(boolean select) {
|
public void selectAllFiles(boolean select) {
|
||||||
OCFileListAdapter ocFileListAdapter = (OCFileListAdapter) getRecyclerView().getAdapter();
|
OCFileListAdapter ocFileListAdapter = (OCFileListAdapter) getRecyclerView().getAdapter();
|
||||||
|
|
||||||
if (ocFileListAdapter != null) {
|
|
||||||
if (select) {
|
if (select) {
|
||||||
ocFileListAdapter.addAllFilesToCheckedFiles();
|
ocFileListAdapter.addAllFilesToCheckedFiles();
|
||||||
} else {
|
} else {
|
||||||
ocFileListAdapter.clearCheckedItems();
|
ocFileListAdapter.clearCheckedItems();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < mAdapter.getItemCount(); i++) {
|
for (int i = 0; i < mAdapter.getItemCount(); i++) {
|
||||||
mAdapter.notifyItemChanged(i);
|
mAdapter.notifyItemChanged(i);
|
||||||
|
|
Loading…
Reference in a new issue