diff --git a/res/drawable-hdpi/hotseat_bg_center.9.png b/res/drawable-hdpi/hotseat_bg_center.9.png index 0567b77650..468e766c4d 100644 Binary files a/res/drawable-hdpi/hotseat_bg_center.9.png and b/res/drawable-hdpi/hotseat_bg_center.9.png differ diff --git a/res/drawable-hdpi/hotseat_bg_left.9.png b/res/drawable-hdpi/hotseat_bg_left.9.png index aaf42c4f0c..433a10e1ba 100644 Binary files a/res/drawable-hdpi/hotseat_bg_left.9.png and b/res/drawable-hdpi/hotseat_bg_left.9.png differ diff --git a/res/drawable-hdpi/hotseat_bg_right.9.png b/res/drawable-hdpi/hotseat_bg_right.9.png index 2b8149b6e1..4ea2a734b2 100644 Binary files a/res/drawable-hdpi/hotseat_bg_right.9.png and b/res/drawable-hdpi/hotseat_bg_right.9.png differ diff --git a/res/drawable-hdpi/hotseat_browser_focused.png b/res/drawable-hdpi/hotseat_browser_focused.png index 6044238ca1..6717ad28c0 100644 Binary files a/res/drawable-hdpi/hotseat_browser_focused.png and b/res/drawable-hdpi/hotseat_browser_focused.png differ diff --git a/res/drawable-hdpi/hotseat_browser_normal.png b/res/drawable-hdpi/hotseat_browser_normal.png index e6eb94e379..d02fdd95b1 100644 Binary files a/res/drawable-hdpi/hotseat_browser_normal.png and b/res/drawable-hdpi/hotseat_browser_normal.png differ diff --git a/res/drawable-hdpi/hotseat_browser_pressed.png b/res/drawable-hdpi/hotseat_browser_pressed.png index 918afb4430..71df2d1980 100644 Binary files a/res/drawable-hdpi/hotseat_browser_pressed.png and b/res/drawable-hdpi/hotseat_browser_pressed.png differ diff --git a/res/drawable-land-hdpi/hotseat_bg_center.9.png b/res/drawable-land-hdpi/hotseat_bg_center.9.png index f6a59fa6da..958b4a4af1 100644 Binary files a/res/drawable-land-hdpi/hotseat_bg_center.9.png and b/res/drawable-land-hdpi/hotseat_bg_center.9.png differ diff --git a/res/drawable-land-hdpi/hotseat_bg_left.9.png b/res/drawable-land-hdpi/hotseat_bg_left.9.png index 8320e73926..9ea8f9d3e5 100644 Binary files a/res/drawable-land-hdpi/hotseat_bg_left.9.png and b/res/drawable-land-hdpi/hotseat_bg_left.9.png differ diff --git a/res/drawable-land-hdpi/hotseat_bg_right.9.png b/res/drawable-land-hdpi/hotseat_bg_right.9.png index 2d74f2bb9f..ce8f1e2d26 100644 Binary files a/res/drawable-land-hdpi/hotseat_bg_right.9.png and b/res/drawable-land-hdpi/hotseat_bg_right.9.png differ diff --git a/res/drawable-land-mdpi/hotseat_bg_center.9.png b/res/drawable-land-mdpi/hotseat_bg_center.9.png new file mode 100644 index 0000000000..691ab01e06 Binary files /dev/null and b/res/drawable-land-mdpi/hotseat_bg_center.9.png differ diff --git a/res/drawable-land-mdpi/hotseat_bg_left.9.png b/res/drawable-land-mdpi/hotseat_bg_left.9.png new file mode 100644 index 0000000000..bd235f30cb Binary files /dev/null and b/res/drawable-land-mdpi/hotseat_bg_left.9.png differ diff --git a/res/drawable-land-mdpi/hotseat_bg_right.9.png b/res/drawable-land-mdpi/hotseat_bg_right.9.png new file mode 100644 index 0000000000..6d87f0de8a Binary files /dev/null and b/res/drawable-land-mdpi/hotseat_bg_right.9.png differ diff --git a/res/drawable-mdpi/home_button_focused.png b/res/drawable-mdpi/home_button_focused.png index 29fcbd0697..701772b75f 100644 Binary files a/res/drawable-mdpi/home_button_focused.png and b/res/drawable-mdpi/home_button_focused.png differ diff --git a/res/drawable-mdpi/home_button_normal.png b/res/drawable-mdpi/home_button_normal.png index 58ff95887b..cc7e3b02b8 100644 Binary files a/res/drawable-mdpi/home_button_normal.png and b/res/drawable-mdpi/home_button_normal.png differ diff --git a/res/drawable-mdpi/home_button_pressed.png b/res/drawable-mdpi/home_button_pressed.png index 32337d623b..ee8ddbe842 100644 Binary files a/res/drawable-mdpi/home_button_pressed.png and b/res/drawable-mdpi/home_button_pressed.png differ diff --git a/res/drawable-mdpi/hotseat_bg_center.9.png b/res/drawable-mdpi/hotseat_bg_center.9.png index a551652cd5..28c340283b 100644 Binary files a/res/drawable-mdpi/hotseat_bg_center.9.png and b/res/drawable-mdpi/hotseat_bg_center.9.png differ diff --git a/res/drawable-mdpi/hotseat_bg_left.9.png b/res/drawable-mdpi/hotseat_bg_left.9.png old mode 100755 new mode 100644 index cd46c6c2fe..605eb1eb50 Binary files a/res/drawable-mdpi/hotseat_bg_left.9.png and b/res/drawable-mdpi/hotseat_bg_left.9.png differ diff --git a/res/drawable-mdpi/hotseat_bg_right.9.png b/res/drawable-mdpi/hotseat_bg_right.9.png index dba0961d1b..5df3f00196 100644 Binary files a/res/drawable-mdpi/hotseat_bg_right.9.png and b/res/drawable-mdpi/hotseat_bg_right.9.png differ diff --git a/res/drawable-mdpi/hotseat_browser_focused.png b/res/drawable-mdpi/hotseat_browser_focused.png index de8defc304..5b858409da 100644 Binary files a/res/drawable-mdpi/hotseat_browser_focused.png and b/res/drawable-mdpi/hotseat_browser_focused.png differ diff --git a/res/drawable-mdpi/hotseat_browser_normal.png b/res/drawable-mdpi/hotseat_browser_normal.png index 35205a2365..4c662fdfb5 100644 Binary files a/res/drawable-mdpi/hotseat_browser_normal.png and b/res/drawable-mdpi/hotseat_browser_normal.png differ diff --git a/res/drawable-mdpi/hotseat_browser_pressed.png b/res/drawable-mdpi/hotseat_browser_pressed.png index d0a072e28f..ed10c189d2 100644 Binary files a/res/drawable-mdpi/hotseat_browser_pressed.png and b/res/drawable-mdpi/hotseat_browser_pressed.png differ diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml index 22b4825bfe..1f13f1fb3c 100644 --- a/res/layout-land/launcher.xml +++ b/res/layout-land/launcher.xml @@ -77,8 +77,9 @@ + + + intent:#Intent;action=android.intent.action.MAIN;component=com.android.contacts/.ContactsLaunchActivity;end + *BROWSER* + + + @drawable/hotseat_phone + @drawable/hotseat_browser + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 5e3bb98efb..26cb7e630d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -27,4 +27,10 @@ 12dip + + + 70dip + + + 14dip diff --git a/res/values/strings.xml b/res/values/strings.xml index 73c6a8ae8d..86c1b3c1f6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -141,4 +141,10 @@ Problem loading widget + + + http://www.google.com/m?client=ms-{CID}&source=android-home-hotseat + diff --git a/res/xml/default_workspace.xml b/res/xml/default_workspace.xml index 20df8185b3..d369377190 100644 --- a/res/xml/default_workspace.xml +++ b/res/xml/default_workspace.xml @@ -38,10 +38,19 @@ launcher:className="com.android.protips.ProtipWidget" launcher:screen="2" launcher:x="0" - launcher:y="3" + launcher:y="1" launcher:spanX="4" launcher:spanY="1" /> + + 0) { + mHotseats = new Intent[mHotseatConfig.length]; + mHotseatLabels = new CharSequence[mHotseatConfig.length]; + mHotseatIcons = new Drawable[mHotseatConfig.length]; + } else { + mHotseats = null; + mHotseatIcons = null; + mHotseatLabels = null; + } + + TypedArray hotseatIconDrawables = getResources().obtainTypedArray(R.array.hotseat_icons); + for (int i=0; i allMatches = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); + if (LOGD) { + Log.d(TAG, "Best match for intent: " + bestMatch); + Log.d(TAG, "All matches: "); + for (ResolveInfo ri : allMatches) { + Log.d(TAG, " --> " + ri); + } } - ComponentName com = intent.resolveActivity(pm); - mHotseats[i] = new Intent(Intent.ACTION_MAIN).setComponent(com); + // did this resolve to a single app, or the resolver? + if (allMatches.size() == 0 || bestMatch == null) { + // can't find any activity to handle this. let's leave the + // intent as-is and let Launcher show a toast when it fails + // to launch. + mHotseats[i] = intent; - // load the labels for accessibility - try { - ActivityInfo ai = pm.getActivityInfo(com, 0); - mHotseatLabels[i] = ai.loadLabel(pm); - } catch (PackageManager.NameNotFoundException ex) { - mHotseatLabels[i] = ""; + // set accessibility text to "Not installed" + mHotseatLabels[i] = getText(R.string.activity_not_found); + } else { + boolean found = false; + for (ResolveInfo ri : allMatches) { + if (bestMatch.activityInfo.name.equals(ri.activityInfo.name) + && bestMatch.activityInfo.applicationInfo.packageName + .equals(ri.activityInfo.applicationInfo.packageName)) { + found = true; + break; + } + } + + if (!found) { + if (LOGD) Log.d(TAG, "Multiple options, no default yet"); + // the bestMatch is probably the ResolveActivity, meaning the + // user has not yet selected a default + // so: we'll keep the original intent for now + mHotseats[i] = intent; + + // set the accessibility text to "Select shortcut" + mHotseatLabels[i] = getText(R.string.title_select_shortcut); + } else { + // we have an app! + // now reconstruct the intent to launch it through the front + // door + ComponentName com = new ComponentName( + bestMatch.activityInfo.applicationInfo.packageName, + bestMatch.activityInfo.name); + mHotseats[i] = new Intent(Intent.ACTION_MAIN).setComponent(com); + + // load the app label for accessibility + mHotseatLabels[i] = bestMatch.activityInfo.loadLabel(pm); + } } if (LOGD) { Log.d(TAG, "loadHotseats: hotseat " + i - + " intent=[" + mHotseats[i].toUri(Intent.URI_INTENT_SCHEME) + + " final intent=[" + + ((mHotseats[i] == null) + ? "null" + : mHotseats[i].toUri(Intent.URI_INTENT_SCHEME)) + "] label=[" + mHotseatLabels[i] + "]" ); @@ -622,8 +729,12 @@ public final class Launcher extends Activity mHandleView.setOnClickListener(this); mHandleView.setOnLongClickListener(this); - findViewById(R.id.hotseat_left).setContentDescription(mHotseatLabels[0]); - findViewById(R.id.hotseat_right).setContentDescription(mHotseatLabels[1]); + ImageView hotseatLeft = (ImageView) findViewById(R.id.hotseat_left); + hotseatLeft.setContentDescription(mHotseatLabels[0]); + hotseatLeft.setImageDrawable(mHotseatIcons[0]); + ImageView hotseatRight = (ImageView) findViewById(R.id.hotseat_right); + hotseatRight.setContentDescription(mHotseatLabels[1]); + hotseatRight.setImageDrawable(mHotseatIcons[1]); mPreviousView = (ImageView) dragLayer.findViewById(R.id.previous_screen); mNextView = (ImageView) dragLayer.findViewById(R.id.next_screen); @@ -678,7 +789,10 @@ public final class Launcher extends Activity index = 1; } - if (index >= 0 && mHotseats[index] != null) { + // reload these every tap; you never know when they might change + loadHotseats(); + if (index >= 0 && index < mHotseats.length && mHotseats[index] != null) { + Intent intent = mHotseats[index]; startActivitySafely( mHotseats[index], "hotseat" diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index a521d67a92..d5b5859001 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -1096,13 +1096,13 @@ public class LauncherModel extends BroadcastReceiver { } final boolean first = i <= batchSize; + final Callbacks callbacks = tryGetCallbacks(oldCallbacks); final ArrayList added = mAllAppsList.added; mAllAppsList.added = new ArrayList(); mHandler.post(new Runnable() { public void run() { final long t = SystemClock.uptimeMillis(); - final Callbacks callbacks = tryGetCallbacks(oldCallbacks); if (callbacks != null) { if (first) { mBeforeFirstLoad = false;