DocumentsUI: Move intent related constants to BaseActivity.DocumentsIntent.

BUG=None
Change-Id: I81d367d5f8d727a5fa76bc22b2fe871ae441dbcf
This commit is contained in:
Daichi Hirono
2015-04-15 13:41:18 +09:00
parent c96e494ac7
commit 1a2fdb496e
3 changed files with 16 additions and 14 deletions

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);
}
}