Rechristen Downloads > Files.
Enable productivity mode by default.
- New window support.
- Documents root is shown and is home dir.
Use the Files icon, instead of downloads.
Cleanup Shared.foo settings logic a bit.
Eliminate use of ENABLE_PRODUCTIVITY_MODE (but don't remove just yet).
This will let folks like Ronald Ho test from master.
Change-Id: I038828ac398ec0625db033aa576b6951ea450736
diff --git a/src/com/android/documentsui/MenuManager.java b/src/com/android/documentsui/MenuManager.java
index 55d2b0e..0489123 100644
--- a/src/com/android/documentsui/MenuManager.java
+++ b/src/com/android/documentsui/MenuManager.java
@@ -303,8 +303,10 @@
mActivity = activity;
}
- public boolean shouldShowFancyFeatures() {
- return Shared.shouldShowFancyFeatures(mActivity);
+ // TODO: Inject necessary deps directly into MenuManager, rather than
+ // getting this info indirectly via DirectoryDetails.
+ public boolean isProductivityModeEnabled() {
+ return Shared.isProductivityMode(mActivity);
}
public boolean hasRootSettings() {
diff --git a/src/com/android/documentsui/base/Shared.java b/src/com/android/documentsui/base/Shared.java
index c580cee..d8374a0 100644
--- a/src/com/android/documentsui/base/Shared.java
+++ b/src/com/android/documentsui/base/Shared.java
@@ -55,13 +55,6 @@
"com.android.documentsui.PICK_COPY_DESTINATION";
/**
- * Extra flag allowing app to be opened in productivity mode (less downloadsy).
- * Useful developers and the likes. When set to true overrides the default
- * config value of productivity_device.
- */
- public static final String EXTRA_PRODUCTIVITY_MODE = "com.android.documentsui.PRODUCTIVITY";
-
- /**
* Extra boolean flag for {@link #ACTION_PICK_COPY_DESTINATION}, which
* specifies if the destination directory needs to create new directory or not.
*/
@@ -221,7 +214,7 @@
* Method can be overridden if the change of the behavior of the the child activity is needed.
*/
public static Uri getDefaultRootUri(Activity activity) {
- return shouldShowDocumentsRoot(activity, activity.getIntent())
+ return shouldShowDocumentsRoot(activity)
? DocumentsContract.buildHomeUri()
: DocumentsContract.buildRootUri(
"com.android.providers.downloads.documents", "downloads");
@@ -240,17 +233,15 @@
/*
* Returns true if app is running in "productivity mode".
*/
- private static boolean isProductivityMode(Context context, Intent intent) {
- return intent.getBooleanExtra(
- Shared.EXTRA_PRODUCTIVITY_MODE,
- context.getResources().getBoolean(R.bool.productivity_device));
+ public static boolean isProductivityMode(Context context) {
+ return context.getResources().getBoolean(R.bool.productivity_device);
}
/*
* Returns true if "Documents" root should be shown.
*/
- public static boolean shouldShowDocumentsRoot(Context context, Intent intent) {
- return isProductivityMode(context, intent);
+ public static boolean shouldShowDocumentsRoot(Context context) {
+ return isProductivityMode(context);
}
/*
@@ -261,15 +252,6 @@
return intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
}
- /**
- * Returns true if device root should be shown.
- */
- public static boolean shouldShowFancyFeatures(Activity activity) {
- Intent intent = activity.getIntent();
- return isProductivityMode(activity, intent)
- || intent.getBooleanExtra(DocumentsContract.EXTRA_FANCY_FEATURES, false);
- }
-
public static void checkMainLoop() {
if (Looper.getMainLooper() != Looper.myLooper()) {
Log.e(TAG, "Calling from non-UI thread!");
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index cc6a548..59b58f1 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -737,14 +737,6 @@
.withSrcs(srcs)
.build();
- // Relay any config overrides bits present in the original intent.
- Intent original = getActivity().getIntent();
- if (original != null && original.hasExtra(Shared.EXTRA_PRODUCTIVITY_MODE)) {
- intent.putExtra(
- Shared.EXTRA_PRODUCTIVITY_MODE,
- original.getBooleanExtra(Shared.EXTRA_PRODUCTIVITY_MODE, false));
- }
-
// Set an appropriate title on the drawer when it is shown in the picker.
// Coupled with the fact that we auto-open the drawer for copy/move operations
// it should basically be the thing people see first.
diff --git a/src/com/android/documentsui/files/FilesActivity.java b/src/com/android/documentsui/files/FilesActivity.java
index a62e6af..0c67b20 100644
--- a/src/com/android/documentsui/files/FilesActivity.java
+++ b/src/com/android/documentsui/files/FilesActivity.java
@@ -217,7 +217,7 @@
Intent intent = getIntent();
return (intent != null && intent.hasExtra(Intent.EXTRA_TITLE))
? intent.getStringExtra(Intent.EXTRA_TITLE)
- : getString(R.string.downloads_label);
+ : getString(R.string.app_label);
}
@Override
diff --git a/src/com/android/documentsui/files/LauncherActivity.java b/src/com/android/documentsui/files/LauncherActivity.java
index e76728f..a73d439 100644
--- a/src/com/android/documentsui/files/LauncherActivity.java
+++ b/src/com/android/documentsui/files/LauncherActivity.java
@@ -29,8 +29,6 @@
import android.support.annotation.Nullable;
import android.util.Log;
-import com.android.documentsui.base.Shared;
-
import java.util.List;
/**
@@ -50,9 +48,7 @@
// Array of boolean extras that should be copied when creating new launch intents.
// Missing intents will be ignored.
private static final String[] PERSISTENT_BOOLEAN_EXTRAS = {
- DocumentsContract.EXTRA_SHOW_ADVANCED,
- DocumentsContract.EXTRA_FANCY_FEATURES,
- Shared.EXTRA_PRODUCTIVITY_MODE
+ DocumentsContract.EXTRA_SHOW_ADVANCED
};
@Override
diff --git a/src/com/android/documentsui/files/MenuManager.java b/src/com/android/documentsui/files/MenuManager.java
index 839c245..e2ca4d7 100644
--- a/src/com/android/documentsui/files/MenuManager.java
+++ b/src/com/android/documentsui/files/MenuManager.java
@@ -135,7 +135,7 @@
@Override
protected void updateNewWindow(MenuItem newWindow) {
- newWindow.setVisible(mDirDetails.shouldShowFancyFeatures());
+ newWindow.setVisible(mDirDetails.isProductivityModeEnabled());
}
@Override
diff --git a/src/com/android/documentsui/sidebar/RootsFragment.java b/src/com/android/documentsui/sidebar/RootsFragment.java
index 4e9287e..88c98a4 100644
--- a/src/com/android/documentsui/sidebar/RootsFragment.java
+++ b/src/com/android/documentsui/sidebar/RootsFragment.java
@@ -259,7 +259,7 @@
final RootItem item = new RootItem(root, mActionHandler);
Activity activity = getActivity();
- if (root.isHome() && !Shared.shouldShowDocumentsRoot(activity, activity.getIntent())) {
+ if (root.isHome() && !Shared.shouldShowDocumentsRoot(activity)) {
continue;
} else if (root.isLibrary()) {
libraries.add(item);