Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 957c742f authored by Steve McKay's avatar Steve McKay Committed by Android (Google) Code Review
Browse files

Merge "Clear selection after copy and when back is pressed."

parents 9a115b27 cbee544a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -491,6 +491,10 @@ public abstract class BaseActivity extends Activity implements SearchManagerList
            return;
        }

        if (DirectoryFragment.get(getFragmentManager()).onBackPressed()) {
            return;
        }

        if (!mState.hasLocationChanged()) {
            super.onBackPressed();
            return;
+11 −4
Original line number Diff line number Diff line
@@ -642,10 +642,7 @@ public class DirectoryFragment extends Fragment implements DocumentsAdapter.Envi
                    return true;

                case R.id.menu_copy_to_clipboard:
                    if (!selection.isEmpty()) {
                        copySelectionToClipboard(selection);
                        mode.finish();
                    }
                    copySelectedToClipboard();
                    return true;

                case R.id.menu_select_all:
@@ -664,6 +661,15 @@ public class DirectoryFragment extends Fragment implements DocumentsAdapter.Envi
        }
    }

    public final boolean onBackPressed() {
        if (mSelectionManager.hasSelection()) {
            if (DEBUG) Log.d(TAG, "Clearing selection on back pressed.");
            mSelectionManager.clearSelection();
            return true;
        }
        return false;
    }

    private void cancelThumbnailTask(View view) {
        final ImageView iconThumb = (ImageView) view.findViewById(R.id.icon_thumb);
        if (iconThumb != null) {
@@ -993,6 +999,7 @@ public class DirectoryFragment extends Fragment implements DocumentsAdapter.Envi
        Selection selection = mSelectionManager.getSelection(new Selection());
        if (!selection.isEmpty()) {
            copySelectionToClipboard(selection);
            mSelectionManager.clearSelection();
        }
    }