Merge "Don\'t show new-window item in Downloads per Gabe." into nyc-dev
am: fec0d188c1
* commit 'fec0d188c166e5a2c517f4494e83c1db11b31c68':
Don't show new-window item in Downloads per Gabe.
Change-Id: Ic8d6afb5e38c1ded0ca7750be4ac4822aefbe6c1
This commit is contained in:
@@ -442,6 +442,7 @@ public class VolumeInfo implements Parcelable {
|
|||||||
// note that docsui treats this as *force* show advanced. So sending
|
// note that docsui treats this as *force* show advanced. So sending
|
||||||
// false permits advanced to be shown based on user preferences.
|
// false permits advanced to be shown based on user preferences.
|
||||||
intent.putExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, isPrimary());
|
intent.putExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, isPrimary());
|
||||||
|
intent.putExtra(DocumentsContract.EXTRA_FANCY_FEATURES, true);
|
||||||
intent.putExtra(DocumentsContract.EXTRA_SHOW_FILESIZE, true);
|
intent.putExtra(DocumentsContract.EXTRA_SHOW_FILESIZE, true);
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ public final class DocumentsContract {
|
|||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public static final String EXTRA_SHOW_FILESIZE = "android.content.extra.SHOW_FILESIZE";
|
public static final String EXTRA_SHOW_FILESIZE = "android.content.extra.SHOW_FILESIZE";
|
||||||
|
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String EXTRA_FANCY_FEATURES = "android.content.extra.FANCY";
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public static final String EXTRA_TARGET_URI = "android.content.extra.TARGET_URI";
|
public static final String EXTRA_TARGET_URI = "android.content.extra.TARGET_URI";
|
||||||
|
|
||||||
|
|||||||
@@ -218,23 +218,18 @@ public abstract class BaseActivity extends Activity
|
|||||||
state.showAdvanced = Shared.shouldShowDeviceRoot(this, intent);
|
state.showAdvanced = Shared.shouldShowDeviceRoot(this, intent);
|
||||||
// Menu option is shown for whitelisted intents if advanced roots are not shown by default.
|
// Menu option is shown for whitelisted intents if advanced roots are not shown by default.
|
||||||
state.showAdvancedOption = !state.showAdvanced && (
|
state.showAdvancedOption = !state.showAdvanced && (
|
||||||
!directLaunch(intent) ||
|
Shared.shouldShowFancyFeatures(this)
|
||||||
state.action == ACTION_OPEN ||
|
|| state.action == ACTION_OPEN
|
||||||
state.action == ACTION_CREATE ||
|
|| state.action == ACTION_CREATE
|
||||||
state.action == ACTION_OPEN_TREE ||
|
|| state.action == ACTION_OPEN_TREE
|
||||||
state.action == ACTION_PICK_COPY_DESTINATION ||
|
|| state.action == ACTION_PICK_COPY_DESTINATION
|
||||||
state.action == ACTION_GET_CONTENT);
|
|| state.action == ACTION_GET_CONTENT);
|
||||||
|
|
||||||
if (DEBUG) Log.d(mTag, "Created new state object: " + state);
|
if (DEBUG) Log.d(mTag, "Created new state object: " + state);
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean directLaunch(Intent intent) {
|
|
||||||
return LauncherActivity.isLaunchUri(intent.getData())
|
|
||||||
&& intent.hasExtra(Shared.EXTRA_STACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRootsDrawerOpen(boolean open) {
|
public void setRootsDrawerOpen(boolean open) {
|
||||||
mNavigator.revealRootsDrawer(open);
|
mNavigator.revealRootsDrawer(open);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public class FilesActivity extends BaseActivity {
|
|||||||
createDir.setEnabled(canCreateDirectory());
|
createDir.setEnabled(canCreateDirectory());
|
||||||
pasteFromCb.setEnabled(mClipper.hasItemsToPaste());
|
pasteFromCb.setEnabled(mClipper.hasItemsToPaste());
|
||||||
settings.setVisible(root.hasSettings());
|
settings.setVisible(root.hasSettings());
|
||||||
newWindow.setVisible(true);
|
newWindow.setVisible(Shared.shouldShowFancyFeatures(this));
|
||||||
|
|
||||||
Menus.disableHiddenItems(menu, pasteFromCb);
|
Menus.disableHiddenItems(menu, pasteFromCb);
|
||||||
// It hides icon if searching in progress
|
// It hides icon if searching in progress
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.DocumentsContract;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -44,6 +45,15 @@ public class LauncherActivity extends Activity {
|
|||||||
private static final String LAUNCH_CONTROL_AUTHORITY = "com.android.documentsui.launchControl";
|
private static final String LAUNCH_CONTROL_AUTHORITY = "com.android.documentsui.launchControl";
|
||||||
private static final String TAG = "LauncherActivity";
|
private static final String TAG = "LauncherActivity";
|
||||||
|
|
||||||
|
// 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_FILESIZE,
|
||||||
|
DocumentsContract.EXTRA_SHOW_ADVANCED,
|
||||||
|
DocumentsContract.EXTRA_FANCY_FEATURES,
|
||||||
|
Shared.EXTRA_PRODUCTIVITY_MODE
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -94,11 +104,7 @@ public class LauncherActivity extends Activity {
|
|||||||
// Relay any config overrides bits present in the original intent.
|
// Relay any config overrides bits present in the original intent.
|
||||||
Intent original = activity.getIntent();
|
Intent original = activity.getIntent();
|
||||||
if (original != null) {
|
if (original != null) {
|
||||||
if (original.hasExtra(Shared.EXTRA_PRODUCTIVITY_MODE)) {
|
copyExtras(original, intent);
|
||||||
intent.putExtra(
|
|
||||||
Shared.EXTRA_PRODUCTIVITY_MODE,
|
|
||||||
original.getBooleanExtra(Shared.EXTRA_PRODUCTIVITY_MODE, false));
|
|
||||||
}
|
|
||||||
if (original.hasExtra(Intent.EXTRA_TITLE)) {
|
if (original.hasExtra(Intent.EXTRA_TITLE)) {
|
||||||
intent.putExtra(
|
intent.putExtra(
|
||||||
Intent.EXTRA_TITLE,
|
Intent.EXTRA_TITLE,
|
||||||
@@ -108,6 +114,14 @@ public class LauncherActivity extends Activity {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void copyExtras(Intent src, Intent dest) {
|
||||||
|
for (String extra : PERSISTENT_BOOLEAN_EXTRAS) {
|
||||||
|
if (src.hasExtra(extra)) {
|
||||||
|
dest.putExtra(extra, src.getBooleanExtra(extra, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Uri buildLaunchUri() {
|
private static Uri buildLaunchUri() {
|
||||||
return new Uri.Builder()
|
return new Uri.Builder()
|
||||||
.authority(LAUNCH_CONTROL_AUTHORITY)
|
.authority(LAUNCH_CONTROL_AUTHORITY)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.documentsui;
|
package com.android.documentsui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -180,13 +181,6 @@ public final class Shared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns true if app is running in "productivity mode".
|
|
||||||
*/
|
|
||||||
public static boolean productivityMode(Context context) {
|
|
||||||
return context.getResources().getBoolean(R.bool.productivity_device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true if app is running in "productivity mode".
|
* Returns true if app is running in "productivity mode".
|
||||||
*/
|
*/
|
||||||
@@ -210,4 +204,13 @@ public final class Shared {
|
|||||||
return isProductivityMode(context, intent)
|
return isProductivityMode(context, intent)
|
||||||
|| intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
|
|| 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class ReceiverActivity extends Activity {
|
|||||||
final Intent intent = new Intent(DocumentsContract.ACTION_BROWSE);
|
final Intent intent = new Intent(DocumentsContract.ACTION_BROWSE);
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
intent.putExtra(DocumentsContract.EXTRA_FANCY_FEATURES, true);
|
||||||
this.startActivity(intent);
|
this.startActivity(intent);
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
Log.e(MtpDocumentsProvider.TAG, "Failed to open device", exception);
|
Log.e(MtpDocumentsProvider.TAG, "Failed to open device", exception);
|
||||||
|
|||||||
Reference in New Issue
Block a user