mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #1801 from nextcloud/copyMoveOverflowMenu
Hide item options (share, overflow menu) & overflow items in move/copy dialog
This commit is contained in:
commit
e1966a0095
4 changed files with 61 additions and 78 deletions
|
@ -1,2 +1,2 @@
|
|||
DO NOT TOUCH; GENERATED BY DRONE
|
||||
<span class="mdl-layout-title">Lint Report: 367 warnings</span>
|
||||
<span class="mdl-layout-title">Lint Report: 366 warnings</span>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* Copyright (C) 2016 ownCloud Inc.
|
||||
|
@ -102,13 +102,17 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
|
||||
// Action bar setup
|
||||
setupToolbar();
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||
|
||||
if (getIntent().getStringExtra(EXTRA_ACTION) != null) {
|
||||
caption = getIntent().getStringExtra(EXTRA_ACTION);
|
||||
} else {
|
||||
caption = ThemeUtils.getDefaultDisplayNameForRootFolder();
|
||||
}
|
||||
getSupportActionBar().setTitle(caption);
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||
getSupportActionBar().setTitle(caption);
|
||||
}
|
||||
|
||||
setIndeterminate(mSyncInProgress);
|
||||
// always AFTER setContentView(...) ; to work around bug in its implementation
|
||||
|
@ -161,6 +165,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
Bundle args = new Bundle();
|
||||
args.putBoolean(OCFileListFragment.ARG_JUST_FOLDERS, true);
|
||||
args.putBoolean(OCFileListFragment.ARG_HIDE_FAB, true);
|
||||
args.putBoolean(OCFileListFragment.ARG_HIDE_ITEM_OPTIONS, true);
|
||||
listOfFiles.setArguments(args);
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.add(R.id.fragment_container, listOfFiles, TAG_LIST_OF_FOLDERS);
|
||||
|
@ -194,7 +199,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
if (listOfFiles != null) {
|
||||
return (OCFileListFragment)listOfFiles;
|
||||
}
|
||||
Log_OC.e(TAG, "Access to unexisting list of files fragment!!");
|
||||
Log_OC.e(TAG, "Access to non existing list of files fragment!!");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -222,19 +227,12 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
mSyncInProgress = true;
|
||||
|
||||
// perform folder synchronization
|
||||
RemoteOperation synchFolderOp = new RefreshFolderOperation( folder,
|
||||
currentSyncTime,
|
||||
false,
|
||||
getFileOperationsHelper().isSharedSupported(),
|
||||
ignoreETag,
|
||||
getStorageManager(),
|
||||
getAccount(),
|
||||
getApplicationContext()
|
||||
);
|
||||
synchFolderOp.execute(getAccount(), this, null, null);
|
||||
RemoteOperation refreshFolderOperation = new RefreshFolderOperation(folder, currentSyncTime, false,
|
||||
getFileOperationsHelper().isSharedSupported(), ignoreETag, getStorageManager(), getAccount(),
|
||||
getApplicationContext());
|
||||
|
||||
refreshFolderOperation.execute(getAccount(), this, null, null);
|
||||
setIndeterminate(true);
|
||||
|
||||
setBackgroundText();
|
||||
}
|
||||
|
||||
|
@ -277,6 +275,9 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.main_menu, menu);
|
||||
menu.findItem(R.id.action_switch_view).setVisible(false);
|
||||
menu.findItem(R.id.action_sync_account).setVisible(false);
|
||||
menu.findItem(R.id.action_select_all).setVisible(false);
|
||||
menu.findItem(R.id.action_sort).setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
@ -355,16 +356,15 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
}
|
||||
|
||||
protected void updateNavigationElementsInActionBar() {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
OCFile currentDir = getCurrentFolder();
|
||||
boolean atRoot = (currentDir == null || currentDir.getParentId() == 0);
|
||||
actionBar.setDisplayHomeAsUpEnabled(!atRoot);
|
||||
actionBar.setHomeButtonEnabled(!atRoot);
|
||||
actionBar.setTitle(
|
||||
atRoot
|
||||
? caption
|
||||
: currentDir.getFileName()
|
||||
);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
if (actionBar != null) {
|
||||
boolean atRoot = (currentDir == null || currentDir.getParentId() == 0);
|
||||
actionBar.setDisplayHomeAsUpEnabled(!atRoot);
|
||||
actionBar.setHomeButtonEnabled(!atRoot);
|
||||
actionBar.setTitle(atRoot ? caption : currentDir.getFileName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -443,39 +443,33 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
String event = intent.getAction();
|
||||
Log_OC.d(TAG, "Received broadcast " + event);
|
||||
String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
|
||||
String synchFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
|
||||
RemoteOperationResult synchResult = (RemoteOperationResult)
|
||||
String syncFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
|
||||
RemoteOperationResult syncResult = (RemoteOperationResult)
|
||||
DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
|
||||
boolean sameAccount = (getAccount() != null &&
|
||||
accountName.equals(getAccount().name) && getStorageManager() != null);
|
||||
boolean sameAccount = (getAccount() != null && accountName.equals(getAccount().name)
|
||||
&& getStorageManager() != null);
|
||||
|
||||
if (sameAccount) {
|
||||
|
||||
if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
|
||||
mSyncInProgress = true;
|
||||
|
||||
} else {
|
||||
OCFile currentFile = (getFile() == null) ? null :
|
||||
getStorageManager().getFileByPath(getFile().getRemotePath());
|
||||
getStorageManager().getFileByPath(getFile().getRemotePath());
|
||||
OCFile currentDir = (getCurrentFolder() == null) ? null :
|
||||
getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
|
||||
|
||||
if (currentDir == null) {
|
||||
// current folder was removed from the server
|
||||
DisplayUtils.showSnackMessage(
|
||||
getActivity(),
|
||||
R.string.sync_current_folder_was_removed,
|
||||
getCurrentFolder().getFileName()
|
||||
);
|
||||
DisplayUtils.showSnackMessage(getActivity(), R.string.sync_current_folder_was_removed,
|
||||
getCurrentFolder().getFileName());
|
||||
browseToRoot();
|
||||
|
||||
} else {
|
||||
if (currentFile == null && !getFile().isFolder()) {
|
||||
// currently selected file was removed in the server, and now we know it
|
||||
currentFile = currentDir;
|
||||
}
|
||||
|
||||
if (currentDir.getRemotePath().equals(synchFolderRemotePath)) {
|
||||
if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
|
||||
OCFileListFragment fileListFragment = getListOfFilesFragment();
|
||||
if (fileListFragment != null) {
|
||||
fileListFragment.listDirectory(currentDir, false, false);
|
||||
|
@ -487,20 +481,16 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.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) &&
|
||||
/// TODO refactor and make common
|
||||
synchResult != null && !synchResult.isSuccess()) {
|
||||
|
||||
if(ResultCode.UNAUTHORIZED.equals(synchResult.getCode()) ||
|
||||
(synchResult.isException() && synchResult.getException()
|
||||
instanceof AuthenticatorException)) {
|
||||
syncResult != null && !syncResult.isSuccess()) {
|
||||
|
||||
if (ResultCode.UNAUTHORIZED.equals(syncResult.getCode()) || (syncResult.isException()
|
||||
&& syncResult.getException() instanceof AuthenticatorException)) {
|
||||
requestCredentialsUpdate(context);
|
||||
|
||||
} else if(RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(synchResult.getCode())) {
|
||||
|
||||
showUntrustedCertDialog(synchResult);
|
||||
} else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED
|
||||
.equals(syncResult.getCode())) {
|
||||
showUntrustedCertDialog(syncResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public class FileListListAdapter extends BaseAdapter {
|
|||
private Vector<OCFile> mFilesAll = new Vector<OCFile>();
|
||||
private Vector<OCFile> mFiles = null;
|
||||
private boolean mJustFolders;
|
||||
private boolean mHideItemOptions;
|
||||
|
||||
private FileDataStorageManager mStorageManager;
|
||||
private Account mAccount;
|
||||
|
@ -96,17 +97,14 @@ public class FileListListAdapter extends BaseAdapter {
|
|||
|
||||
private ArrayList<ThumbnailsCacheManager.ThumbnailGenerationTask> asyncTasks = new ArrayList<>();
|
||||
|
||||
public FileListListAdapter(
|
||||
boolean justFolders,
|
||||
Context context,
|
||||
ComponentsGetter transferServiceGetter,
|
||||
OCFileListFragmentInterface OCFileListFragmentInterface
|
||||
) {
|
||||
public FileListListAdapter(boolean justFolders, Context context, ComponentsGetter transferServiceGetter,
|
||||
OCFileListFragmentInterface OCFileListFragmentInterface, boolean argHideItemOptions) {
|
||||
|
||||
this.OCFileListFragmentInterface = OCFileListFragmentInterface;
|
||||
mJustFolders = justFolders;
|
||||
mContext = context;
|
||||
mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
|
||||
mHideItemOptions = argHideItemOptions;
|
||||
|
||||
mTransferServiceGetter = transferServiceGetter;
|
||||
|
||||
|
@ -118,17 +116,6 @@ public class FileListListAdapter extends BaseAdapter {
|
|||
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
||||
}
|
||||
|
||||
public FileListListAdapter(
|
||||
boolean justFolders,
|
||||
Context context,
|
||||
ComponentsGetter transferServiceGetter,
|
||||
OCFileListFragmentInterface OCFileListFragmentInterface,
|
||||
FileDataStorageManager fileDataStorageManager
|
||||
) {
|
||||
this(justFolders, context, transferServiceGetter, OCFileListFragmentInterface);
|
||||
mStorageManager = fileDataStorageManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
return true;
|
||||
|
@ -326,8 +313,17 @@ public class FileListListAdapter extends BaseAdapter {
|
|||
hideOverflowMenuIcon(view, viewType);
|
||||
} else {
|
||||
checkBoxV.setVisibility(View.GONE);
|
||||
showShareIcon(view, file);
|
||||
showOverflowMenuIcon(view, file, viewType);
|
||||
|
||||
if (mHideItemOptions) {
|
||||
ImageView sharedIconView = (ImageView) view.findViewById(R.id.sharedIcon);
|
||||
sharedIconView.setVisibility(View.GONE);
|
||||
|
||||
ImageView overflowIndicatorView = (ImageView) view.findViewById(R.id.overflow_menu);
|
||||
overflowIndicatorView.setVisibility(View.GONE);
|
||||
} else {
|
||||
showShareIcon(view, file);
|
||||
showOverflowMenuIcon(view, file, viewType);
|
||||
}
|
||||
}
|
||||
|
||||
// this if-else is needed even though kept-in-sync icon is visible by default
|
||||
|
|
|
@ -125,6 +125,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
public final static String ARG_JUST_FOLDERS = MY_PACKAGE + ".JUST_FOLDERS";
|
||||
public final static String ARG_ALLOW_CONTEXTUAL_ACTIONS = MY_PACKAGE + ".ALLOW_CONTEXTUAL";
|
||||
public final static String ARG_HIDE_FAB = MY_PACKAGE + ".HIDE_FAB";
|
||||
public final static String ARG_HIDE_ITEM_OPTIONS = MY_PACKAGE + ".HIDE_ITEM_OPTIONS";
|
||||
|
||||
public static final String DOWNLOAD_BEHAVIOUR = "DOWNLOAD_BEHAVIOUR";
|
||||
public static final String DOWNLOAD_SEND = "DOWNLOAD_SEND";
|
||||
|
@ -312,13 +313,9 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
|
||||
Bundle args = getArguments();
|
||||
mJustFolders = (args != null) && args.getBoolean(ARG_JUST_FOLDERS, false);
|
||||
mAdapter = new FileListListAdapter(
|
||||
mJustFolders,
|
||||
getActivity(),
|
||||
mContainerActivity,
|
||||
this,
|
||||
mContainerActivity.getStorageManager()
|
||||
);
|
||||
boolean hideItemOptions = (args != null) && args.getBoolean(ARG_HIDE_ITEM_OPTIONS, false);
|
||||
|
||||
mAdapter = new FileListListAdapter(mJustFolders, getActivity(), mContainerActivity, this, hideItemOptions);
|
||||
setListAdapter(mAdapter);
|
||||
|
||||
mHideFab = (args != null) && args.getBoolean(ARG_HIDE_FAB, false);
|
||||
|
|
Loading…
Reference in a new issue