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

Commit 86c05760 authored by Steve McKay's avatar Steve McKay
Browse files

Clear selection after copy and when back is pressed.

Change-Id: I5240c825016b9e21bc147591b72bb969eb765597
parent dd2b31c7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -492,6 +492,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();
        }
    }