From a35c77aea61cd0701a921d245ce15bfbd923f117 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Thu, 25 Sep 2014 16:46:36 -0700 Subject: [PATCH] Always show the name of the last used Home app in ResolverActivity Bug 17629220 Change-Id: Ia1d0a188f8c0911e5b74b18ba44508a6e2139d0c --- .../android/internal/app/ResolverActivity.java | 18 +++++++----------- core/res/res/values/strings.xml | 5 ++++- core/res/res/values/symbols.xml | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 22600de1283dd..5685ad757e07d 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -128,7 +128,10 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic com.android.internal.R.string.whichSendApplicationNamed), DEFAULT(null, com.android.internal.R.string.whichApplication, - com.android.internal.R.string.whichApplicationNamed); + com.android.internal.R.string.whichApplicationNamed), + HOME(Intent.ACTION_MAIN, + com.android.internal.R.string.whichHomeApplication, + com.android.internal.R.string.whichHomeApplicationNamed); public final String action; public final int titleRes; @@ -142,7 +145,7 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic public static ActionTitle forAction(String action) { for (ActionTitle title : values()) { - if (action != null && action.equals(title.action)) { + if (title != HOME && action != null && action.equals(title.action)) { return title; } } @@ -165,26 +168,19 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic @Override protected void onCreate(Bundle savedInstanceState) { // Use a specialized prompt when we're handling the 'Home' app startActivity() - final int titleResource; final Intent intent = makeMyIntent(); final Set categories = intent.getCategories(); if (Intent.ACTION_MAIN.equals(intent.getAction()) && categories != null && categories.size() == 1 && categories.contains(Intent.CATEGORY_HOME)) { - titleResource = com.android.internal.R.string.whichHomeApplication; - // Note: this field is not set to true in the compatibility version. mResolvingHome = true; - } else { - titleResource = 0; } setSafeForwardingMode(true); - onCreate(savedInstanceState, intent, - titleResource != 0 ? getResources().getText(titleResource) : null, titleResource, - null, null, true); + onCreate(savedInstanceState, intent, null, 0, null, null, true); } /** @@ -336,7 +332,7 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic } protected CharSequence getTitleForAction(String action, int defaultTitleRes) { - final ActionTitle title = ActionTitle.forAction(action); + final ActionTitle title = mResolvingHome ? ActionTitle.HOME : ActionTitle.forAction(action); final boolean named = mAdapter.hasFilteredItem(); if (title == ActionTitle.DEFAULT && defaultTitleRes != 0) { return getString(defaultTitleRes); diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index fd4b40ff2b19a..9fc780150e4ce 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3440,7 +3440,10 @@ and a previously used application is known. --> Share with %1$s - Select a home app + Select a Home app + + Use %1$s as Home Use by default for this action.