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

Commit 6035b3cc authored by Steve McKay's avatar Steve McKay
Browse files

Fix broken copy after recent copy related chagnes.

Also, add a label to Downloads app, and enabled drag and drop by default.
Cleanued up menu handling in BaseActivity (use switch statement).

Bug: 26033335
Change-Id: I3cef89a4a9f9e30b4e926411e94cf06bc2dc0f8d
parent c53d71dc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
        <activity
            android:name=".DownloadsActivity"
            android:theme="@style/DocumentsFullScreenTheme"
            android:label="@string/downloads_label"
            android:icon="@drawable/ic_doc_text">
            <intent-filter>
                <action android:name="android.provider.action.MANAGE_ROOT" />
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@
    <!-- Title of the standalone files activity. [CHAR LIMIT=32] -->
    <string name="files_label">Files</string>

    <!-- Title of the standalone downloads activity. [CHAR LIMIT=32] -->
    <string name="downloads_label">Downloads</string>

    <!-- Action bar title prompting user to choose a location to open a document from [CHAR LIMIT=32] -->
    <string name="title_open">Open from</string>
    <!-- Action bar title prompting user to choose a location to save a document to [CHAR LIMIT=32] -->
+54 −42
Original line number Diff line number Diff line
@@ -223,50 +223,62 @@ public abstract class BaseActivity extends Activity {

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        final int id = item.getItemId();
        if (id == android.R.id.home) {

        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
        } else if (id == R.id.menu_create_dir) {

            case R.id.menu_create_dir:
                showCreateDirectoryDialog();
                return true;
        } else if (id == R.id.menu_search) {

            case R.id.menu_search:
                return false;
        } else if (id == R.id.menu_sort_name) {

            case R.id.menu_sort_name:
                setUserSortOrder(State.SORT_ORDER_DISPLAY_NAME);
                return true;
        } else if (id == R.id.menu_sort_date) {

            case R.id.menu_sort_date:
                setUserSortOrder(State.SORT_ORDER_LAST_MODIFIED);
                return true;
        } else if (id == R.id.menu_sort_size) {
            case R.id.menu_sort_size:
                setUserSortOrder(State.SORT_ORDER_SIZE);
                return true;
        } else if (id == R.id.menu_grid) {

            case R.id.menu_grid:
                setUserMode(State.MODE_GRID);
                return true;
        } else if (id == R.id.menu_list) {

            case R.id.menu_list:
                setUserMode(State.MODE_LIST);
                return true;
        } else if (id == R.id.menu_paste_from_clipboard) {

            case R.id.menu_paste_from_clipboard:
                DirectoryFragment.get(getFragmentManager())
                    .pasteFromClipboard();
              return true;
        } else if (id == R.id.menu_advanced) {

            case R.id.menu_advanced:
                setDisplayAdvancedDevices(!LocalPreferences.getDisplayAdvancedDevices(this));
                return true;
        } else if (id == R.id.menu_file_size) {

            case R.id.menu_file_size:
                setDisplayFileSize(!LocalPreferences.getDisplayFileSize(this));
                return true;
        } else if (id == R.id.menu_settings) {

            case R.id.menu_settings:
                final RootInfo root = getCurrentRoot();
                final Intent intent = new Intent(DocumentsContract.ACTION_DOCUMENT_ROOT_SETTINGS);
                intent.setDataAndType(root.getUri(), DocumentsContract.Root.MIME_TYPE_ITEM);
                startActivity(intent);
                return true;
        }

            default:
                return super.onOptionsItemSelected(item);
        }
    }

    void showCreateDirectoryDialog() {
        CreateDirectoryFragment.show(getFragmentManager());
+8 −2
Original line number Diff line number Diff line
@@ -369,10 +369,16 @@ public class FilesActivity extends BaseActivity {
                // TODO: Should be statically bound using alphabeticShortcut. See b/21330356.
                dir = DirectoryFragment.get(getFragmentManager());
                dir.copySelectedToClipboard();
        }

                return true;
            case KeyEvent.KEYCODE_V:
                // TODO: Should be statically bound using alphabeticShortcut. See b/21330356.
                dir = DirectoryFragment.get(getFragmentManager());
                dir.pasteFromClipboard();
                return true;
            default:
                return super.onKeyShortcut(keyCode, event);
        }
    }

    @Override
    void saveStackBlocking() {
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class DirectoryFragment extends Fragment {
    public static final int REQUEST_COPY_DESTINATION = 1;

    private static final int LOADER_ID = 42;
    private static final boolean DEBUG_ENABLE_DND = false;
    private static final boolean DEBUG_ENABLE_DND = true;

    private static final String EXTRA_TYPE = "type";
    private static final String EXTRA_ROOT = "root";