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

Commit da20086a 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 ae605db8 86c05760
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -491,6 +491,10 @@ public abstract class BaseActivity extends Activity implements SearchManagerList
            return;
            return;
        }
        }


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

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


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


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