Merge branch 'froyo' into froyo-release

This commit is contained in:
The Android Automerger committed 2010-04-29 13:34:17 -07:00
commit d8e796f87a
29 files changed
+186 -37

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 474 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

+5 -4
View File
@@ -77,8 +77,9 @@
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
android:layout_width="@dimen/button_bar_height_portrait"
android:layout_height="match_parent"
android:layout_width="@dimen/delete_zone_size"
android:layout_height="@dimen/delete_zone_size"
android:paddingLeft="@dimen/delete_zone_padding"
android:layout_marginBottom="@dimen/half_status_bar_height"
android:layout_gravity="right|center_vertical"
@@ -94,13 +95,13 @@
android:layout_width="@dimen/button_bar_height_portrait"
android:layout_gravity="right|center_vertical"
android:layout_marginBottom="@dimen/half_status_bar_height"
android:padding="4dip"
>
<com.android.launcher2.HandleView
style="@style/HotseatButton"
android:id="@+id/all_apps_button"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:src="@drawable/all_apps_button"
launcher:direction="vertical"
+6 -4
View File
@@ -71,8 +71,9 @@
<com.android.launcher2.DeleteZone
android:id="@+id/delete_zone"
android:layout_width="wrap_content"
android:layout_height="@dimen/button_bar_height"
android:layout_width="@dimen/delete_zone_size"
android:layout_height="@dimen/delete_zone_size"
android:paddingTop="@dimen/delete_zone_padding"
android:layout_gravity="bottom|center_horizontal"
android:scaleType="center"
@@ -86,13 +87,14 @@
android:layout_width="fill_parent"
android:layout_height="@dimen/button_bar_height"
android:layout_gravity="bottom|center_horizontal"
android:padding="4dip"
android:paddingTop="2dip"
>
<com.android.launcher2.HandleView
style="@style/HotseatButton"
android:id="@+id/all_apps_button"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:src="@drawable/all_apps_button"
launcher:direction="horizontal"
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="hotseats" translatable="false">
<item>intent:#Intent;action=android.intent.action.MAIN;component=com.android.contacts/.ContactsLaunchActivity;end</item>
<item>*BROWSER*</item>
</string-array>
<array name="hotseat_icons" translatable="false">
<item>@drawable/hotseat_phone</item>
<item>@drawable/hotseat_browser</item>
</array>
</resources>
+6
View File
@@ -27,4 +27,10 @@
<!-- roughly half a status bar (for vertically centering the right-hand
button cluster in landscape) -->
<dimen name="half_status_bar_height">12dip</dimen>
<!-- height & width of the drop rectangle for the trash icon -->
<dimen name="delete_zone_size">70dip</dimen>
<!-- delete_zone_size_full - button_bar_height_portrait -->
<dimen name="delete_zone_padding">14dip</dimen>
</resources>
+6
View File
@@ -141,4 +141,10 @@
<!-- Text to show user in place of a gadget when we can't display it properly -->
<string name="gadget_error_text">Problem loading widget</string>
<!-- URL to use when detecting the current default browser.
Attempts to mimic homepage_base in Browser; {CID} should be replaced
by the client-id, e.g. "android-google". -->
<string name="default_browser_url" translatable="false">
http://www.google.com/m?client=ms-{CID}&amp;source=android-home-hotseat</string>
</resources>
+10 -1
View File
@@ -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" />
<appwidget
launcher:packageName="com.android.vending"
launcher:className="com.android.vending.MarketWidgetProvider"
launcher:screen="2"
launcher:x="1"
launcher:y="2"
launcher:spanX="2"
launcher:spanY="2" />
<!-- Right screen [3] -->
<appwidget
launcher:packageName="com.android.music"
+141 -27
View File
@@ -35,8 +35,10 @@ import android.content.Intent.ShortcutIconResource;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Rect;
@@ -74,6 +76,7 @@ import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
@@ -203,13 +206,10 @@ public final class Launcher extends Activity
// Hotseats (quick-launch icons next to AllApps)
// TODO: move these intial intents out to Uris in an XML resource
private static final int NUM_HOTSEATS = 2;
private Intent[] mHotseats = new Intent[] {
new Intent(Intent.ACTION_MAIN)
.setComponent(ComponentName.unflattenFromString(
"com.android.contacts/.ContactsLaunchActivity")),
new Intent(Intent.ACTION_WEB_SEARCH, Uri.EMPTY),
};
private CharSequence[] mHotseatLabels = new CharSequence[2];
private String[] mHotseatConfig = null;
private Intent[] mHotseats = null;
private Drawable[] mHotseatIcons = null;
private CharSequence[] mHotseatLabels = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -368,37 +368,144 @@ public final class Launcher extends Activity
wpm.suggestDesiredDimensions(width * WALLPAPER_SCREENS_SPAN, height);
}
// Note: This doesn't do all the client-id magic that BrowserProvider does
// in Browser. (http://b/2425179)
private Uri getDefaultBrowserUri() {
String url = getString(R.string.default_browser_url);
if (url.indexOf("{CID}") != -1) {
url = url.replace("{CID}", "android-google");
}
return Uri.parse(url);
}
// Load the Intent templates from arrays.xml to populate the hotseats. For
// each Intent, if it resolves to a single app, use that as the launch
// intent & use that app's label as the contentDescription. Otherwise,
// retain the ResolveActivity so the user can pick an app.
private void loadHotseats() {
if (mHotseatConfig == null) {
mHotseatConfig = getResources().getStringArray(R.array.hotseats);
if (mHotseatConfig.length > 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<mHotseatConfig.length; i++) {
// load icon for this slot; currently unrelated to the actual activity
try {
mHotseatIcons[i] = hotseatIconDrawables.getDrawable(i);
} catch (ArrayIndexOutOfBoundsException ex) {
Log.w(TAG, "Missing hotseat_icons array item #" + i);
mHotseatIcons[i] = null;
}
}
hotseatIconDrawables.recycle();
}
PackageManager pm = getPackageManager();
for (int i=0; i<mHotseats.length; i++) {
Intent intent = mHotseats[i];
for (int i=0; i<mHotseatConfig.length; i++) {
Intent intent = null;
if (mHotseatConfig[i].equals("*BROWSER*")) {
// magic value meaning "launch user's default web browser"
// replace it with a generic web request so we can see if there is indeed a default
String defaultUri = getString(R.string.default_browser_url);
intent = new Intent(
Intent.ACTION_VIEW,
((defaultUri != null)
? Uri.parse(defaultUri)
: getDefaultBrowserUri())
).addCategory(Intent.CATEGORY_BROWSABLE);
// note: if the user launches this without a default set, she
// will always be taken to the default URL above; this is
// unavoidable as we must specify a valid URL in order for the
// chooser to appear, and once the user selects something, that
// URL is unavoidably sent to the chosen app.
} else {
try {
intent = Intent.parseUri(mHotseatConfig[i], 0);
} catch (java.net.URISyntaxException ex) {
Log.w(TAG, "Invalid hotseat intent: " + mHotseatConfig[i]);
// bogus; leave intent=null
}
}
if (intent == null) {
mHotseats[i] = null;
mHotseatLabels[i] = getText(R.string.activity_not_found);
continue;
}
if (LOGD) {
Log.d(TAG, "loadHotseats: hotseat " + i
+ " initial intent=[" + intent.toUri(Intent.URI_INTENT_SCHEME)
+ " initial intent=["
+ intent.toUri(Intent.URI_INTENT_SCHEME)
+ "]");
}
// fix up the default intents
if (intent.getAction().equals(Intent.ACTION_WEB_SEARCH)
&& intent.getData().equals(Uri.EMPTY)) {
// use this to represent "default web browser"
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com/"));
ResolveInfo bestMatch = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
List<ResolveInfo> 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"
+1 -1
View File
@@ -1096,13 +1096,13 @@ public class LauncherModel extends BroadcastReceiver {
}
final boolean first = i <= batchSize;
final Callbacks callbacks = tryGetCallbacks(oldCallbacks);
final ArrayList<ApplicationInfo> added = mAllAppsList.added;
mAllAppsList.added = new ArrayList<ApplicationInfo>();
mHandler.post(new Runnable() {
public void run() {
final long t = SystemClock.uptimeMillis();
final Callbacks callbacks = tryGetCallbacks(oldCallbacks);
if (callbacks != null) {
if (first) {
mBeforeFirstLoad = false;