summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-10-24 12:35:26 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-24 12:35:26 -0700
commit909924de9fcf45b5d08e5d2b6b0301e7e0707d47 (patch)
treee90bf19a6490cdee48b7fea83924090064f3d9ec /packages/DocumentsUI
parent46106ca28e8a679ce2f0609d03ae6ba4b95d7f30 (diff)
parent8dd4c1d062bfcfd46c48e568870856787852124c (diff)
downloadframeworks_base-909924de9fcf45b5d08e5d2b6b0301e7e0707d47.zip
frameworks_base-909924de9fcf45b5d08e5d2b6b0301e7e0707d47.tar.gz
frameworks_base-909924de9fcf45b5d08e5d2b6b0301e7e0707d47.tar.bz2
am 8dd4c1d0: am 5ecfb557: Merge "Long-press on GET_CONTENT app shows its details." into klp-dev
* commit '8dd4c1d062bfcfd46c48e568870856787852124c': Long-press on GET_CONTENT app shows its details.
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java b/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java
index fdbc3ab..58c5daf 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java
@@ -16,6 +16,8 @@
package com.android.documentsui;
+import static com.android.documentsui.DocumentsActivity.State.ACTION_GET_CONTENT;
+
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
@@ -25,7 +27,9 @@ import android.content.Intent;
import android.content.Loader;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.net.Uri;
import android.os.Bundle;
+import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.view.LayoutInflater;
@@ -33,6 +37,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
@@ -133,6 +138,13 @@ public class RootsFragment extends Fragment {
final State state = ((DocumentsActivity) context).getDisplayState();
state.showAdvanced = SettingsActivity.getDisplayAdvancedDevices(context);
+ if (state.action == ACTION_GET_CONTENT) {
+ mList.setOnItemLongClickListener(mItemLongClickListener);
+ } else {
+ mList.setOnItemLongClickListener(null);
+ mList.setLongClickable(false);
+ }
+
getLoaderManager().restartLoader(2, null, mCallbacks);
}
@@ -152,6 +164,13 @@ public class RootsFragment extends Fragment {
}
}
+ private void showAppDetails(ResolveInfo ri) {
+ final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ intent.setData(Uri.fromParts("package", ri.activityInfo.packageName, null));
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+ startActivity(intent);
+ }
+
private OnItemClickListener mItemListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@@ -167,6 +186,19 @@ public class RootsFragment extends Fragment {
}
};
+ private OnItemLongClickListener mItemLongClickListener = new OnItemLongClickListener() {
+ @Override
+ public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+ final Item item = mAdapter.getItem(position);
+ if (item instanceof AppItem) {
+ showAppDetails(((AppItem) item).info);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ };
+
private static abstract class Item {
private final int mLayoutId;