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

Commit 1a2fdb49 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

DocumentsUI: Move intent related constants to BaseActivity.DocumentsIntent.

BUG=None
Change-Id: I81d367d5f8d727a5fa76bc22b2fe871ae441dbcf
parent c96e494a
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -33,16 +33,6 @@ import com.android.documentsui.model.RootInfo;
import com.google.common.collect.Maps;

abstract class BaseActivity extends Activity {
    /** Intent action name to open copy destination. */
    public static String ACTION_OPEN_COPY_DESTINATION_STRING =
        "com.android.documentsui.OPEN_COPY_DESTINATION";

    /**
     * Extra boolean flag for ACTION_OPEN_COPY_DESTINATION_STRING, which
     * specifies if the destination directory needs to create new directory or not.
     */
    public static String EXTRA_DIRECTORY_COPY = "com.android.documentsui.DIRECTORY_COPY";

    public abstract State getDisplayState();
    public abstract RootInfo getCurrentRoot();
    public abstract void onStateChanged();
@@ -62,6 +52,18 @@ abstract class BaseActivity extends Activity {
        return (BaseActivity) fragment.getActivity();
    }

    public static abstract class DocumentsIntent {
        /** Intent action name to open copy destination. */
        public static String ACTION_OPEN_COPY_DESTINATION =
                "com.android.documentsui.OPEN_COPY_DESTINATION";

        /**
         * Extra boolean flag for ACTION_OPEN_COPY_DESTINATION_STRING, which
         * specifies if the destination directory needs to create new directory or not.
         */
        public static String EXTRA_DIRECTORY_COPY = "com.android.documentsui.DIRECTORY_COPY";
    }

    public static class State implements android.os.Parcelable {
        public int action;
        public String[] acceptMimes;
+2 −2
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ public class DirectoryFragment extends Fragment {
        // Pop up a dialog to pick a destination.  This is inadequate but works for now.
        // TODO: Implement a picker that is to spec.
        final Intent intent = new Intent(
                BaseActivity.ACTION_OPEN_COPY_DESTINATION_STRING,
                BaseActivity.DocumentsIntent.ACTION_OPEN_COPY_DESTINATION,
                Uri.EMPTY,
                getActivity(),
                DocumentsActivity.class);
@@ -694,7 +694,7 @@ public class DirectoryFragment extends Fragment {
                break;
            }
        }
        intent.putExtra(BaseActivity.EXTRA_DIRECTORY_COPY, directoryCopy);
        intent.putExtra(BaseActivity.DocumentsIntent.EXTRA_DIRECTORY_COPY, directoryCopy);
        startActivityForResult(intent, REQUEST_COPY_DESTINATION);
    }

+2 −2
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ public class DocumentsActivity extends BaseActivity {
            mState.action = ACTION_MANAGE;
        } else if (DocumentsContract.ACTION_BROWSE_DOCUMENT_ROOT.equals(action)) {
            mState.action = ACTION_BROWSE;
        } else if (ACTION_OPEN_COPY_DESTINATION_STRING.equals(action)) {
        } else if (DocumentsIntent.ACTION_OPEN_COPY_DESTINATION.equals(action)) {
            mState.action = ACTION_OPEN_COPY_DESTINATION;
        }

@@ -267,7 +267,7 @@ public class DocumentsActivity extends BaseActivity {
        }
        if (mState.action == ACTION_OPEN_COPY_DESTINATION) {
            mState.directoryCopy = intent.getBooleanExtra(
                    BaseActivity.EXTRA_DIRECTORY_COPY, false);
                    BaseActivity.DocumentsIntent.EXTRA_DIRECTORY_COPY, false);
        }
    }