diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2016-07-11 02:22:05 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-07-11 02:22:05 -0700 |
commit | b7f0f7f067f5979e7e7e52aa9836ed3dbcca475c (patch) | |
tree | 450016f19b349df303fb1a7a6fdec03423b6a8c1 /src/com/android/gallery3d/ui | |
parent | 94386cd469d1cb6248efb9777d709353683dc93f (diff) | |
parent | ad5509e1fcd462a95d6ded18cd2260bb2ea7f370 (diff) | |
download | android_packages_apps_Gallery2-b7f0f7f067f5979e7e7e52aa9836ed3dbcca475c.tar.gz android_packages_apps_Gallery2-b7f0f7f067f5979e7e7e52aa9836ed3dbcca475c.tar.bz2 android_packages_apps_Gallery2-b7f0f7f067f5979e7e7e52aa9836ed3dbcca475c.zip |
Merge "Gallery: Modify some layout according to UX."
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r-- | src/com/android/gallery3d/ui/MenuExecutor.java | 15 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PopupList.java | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java index c28fd097b..c57e848e3 100644 --- a/src/com/android/gallery3d/ui/MenuExecutor.java +++ b/src/com/android/gallery3d/ui/MenuExecutor.java @@ -25,6 +25,8 @@ import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; //import android.drm.DrmHelper; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Handler; import android.os.Message; @@ -46,6 +48,7 @@ import com.android.gallery3d.util.ThreadPool.Job; import com.android.gallery3d.util.ThreadPool.JobContext; import java.util.ArrayList; +import java.util.List; public class MenuExecutor { private static final String TAG = "MenuExecutor"; @@ -254,7 +257,17 @@ public class MenuExecutor { Intent intent = getIntentBySingleSelectedPath(Intent.ACTION_EDIT); if (intent != null) { intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - ((Activity) mActivity).startActivity(Intent.createChooser(intent, null)); + + List<ResolveInfo> resolveInfoList = mActivity.getPackageManager() + .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); + if (resolveInfoList != null && resolveInfoList.size() > 0) { + if (resolveInfoList.size() == 1) { + // only one app can resolve intent, don't use createChooser. + mActivity.startActivity(intent); + } else { + mActivity.startActivity(Intent.createChooser(intent, null)); + } + } } return; } diff --git a/src/com/android/gallery3d/ui/PopupList.java b/src/com/android/gallery3d/ui/PopupList.java index efbddd3ea..a9aa2570f 100644 --- a/src/com/android/gallery3d/ui/PopupList.java +++ b/src/com/android/gallery3d/ui/PopupList.java @@ -154,7 +154,7 @@ public class PopupList { } private PopupWindow createPopupWindow() { - PopupWindow popup = new PopupWindow(mContext); + PopupWindow popup = new PopupWindow(mContext, null, android.R.attr.popupMenuStyle); popup.setOnDismissListener(mOnDismissListener); popup.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff"))); |