diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-10-24 12:40:10 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-24 12:40:10 -0700 |
commit | 36dcadf0700b36050991419fbe59a00ae45dc391 (patch) | |
tree | c8a40cb06226daa0d48a7a5728bbd37c5e53e53c /packages/DocumentsUI | |
parent | 8e0164c5660ff821ad839014f87de4f90a6d8936 (diff) | |
parent | 909924de9fcf45b5d08e5d2b6b0301e7e0707d47 (diff) | |
download | frameworks_base-36dcadf0700b36050991419fbe59a00ae45dc391.zip frameworks_base-36dcadf0700b36050991419fbe59a00ae45dc391.tar.gz frameworks_base-36dcadf0700b36050991419fbe59a00ae45dc391.tar.bz2 |
am 909924de: am 8dd4c1d0: am 5ecfb557: Merge "Long-press on GET_CONTENT app shows its details." into klp-dev
* commit '909924de9fcf45b5d08e5d2b6b0301e7e0707d47':
Long-press on GET_CONTENT app shows its details.
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java | 32 |
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; |