am 1ce1a24c: Fixes #1937447. Home was not saving the appropriate state when losing focus.

Merge commit '1ce1a24cba4dc41bccfeab6fccb2f3355423841a'

* commit '1ce1a24cba4dc41bccfeab6fccb2f3355423841a':
  Fixes #1937447. Home was not saving the appropriate state when losing focus.
This commit is contained in:
Romain Guy 2009-06-23 17:54:59 -07:00 committed by The Android Open Source Project
commit 77ee002f77
9 changed files with 31 additions and 20 deletions

View File

@ -90,7 +90,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignTop="@id/gestures_actions" android:layout_alignTop="@id/gestures_actions"
android:layout_marginRight="10dip" android:layout_marginRight="5dip"
android:layout_marginTop="-22dip" /> android:layout_marginTop="-47dip" />
</com.android.launcher.GesturesPanel> </com.android.launcher.GesturesPanel>

View File

@ -100,7 +100,7 @@ class ApplicationInfo extends ItemInfo {
String titleStr = title != null ? title.toString() : null; String titleStr = title != null ? title.toString() : null;
values.put(LauncherSettings.BaseLauncherColumns.TITLE, titleStr); values.put(LauncherSettings.BaseLauncherColumns.TITLE, titleStr);
String uri = intent != null ? intent.toURI() : null; String uri = intent != null ? intent.toUri(0) : null;
values.put(LauncherSettings.BaseLauncherColumns.INTENT, uri); values.put(LauncherSettings.BaseLauncherColumns.INTENT, uri);
if (customIcon) { if (customIcon) {

View File

@ -519,6 +519,8 @@ public final class Launcher extends Activity implements View.OnClickListener, On
mRestoring = true; mRestoring = true;
} }
mCurrentGesture = (Gesture) savedState.get(RUNTIME_STATE_PENDING_GESTURE);
boolean gesturesShowing = savedState.getBoolean(RUNTIME_STATE_GESTURES_PANEL, false); boolean gesturesShowing = savedState.getBoolean(RUNTIME_STATE_GESTURES_PANEL, false);
if (gesturesShowing) { if (gesturesShowing) {
final Gesture gesture = (Gesture) savedState.get(RUNTIME_STATE_GESTURES_PANEL_GESTURE); final Gesture gesture = (Gesture) savedState.get(RUNTIME_STATE_GESTURES_PANEL_GESTURE);
@ -536,8 +538,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On
} }
}); });
} }
mCurrentGesture = (Gesture) savedState.get(RUNTIME_STATE_PENDING_GESTURE);
} }
/** /**
@ -1056,12 +1056,14 @@ public final class Launcher extends Activity implements View.OnClickListener, On
outState.putParcelable(RUNTIME_STATE_PENDING_GESTURE, mCurrentGesture); outState.putParcelable(RUNTIME_STATE_PENDING_GESTURE, mCurrentGesture);
} }
if (mGesturesWindow != null && mGesturesWindow.isShowing() && isConfigurationChange) { if (mGesturesWindow != null && mGesturesWindow.isShowing()) {
outState.putBoolean(RUNTIME_STATE_GESTURES_PANEL, true); outState.putBoolean(RUNTIME_STATE_GESTURES_PANEL, true);
final Gesture gesture = mGesturesOverlay.getGesture(); if (mCurrentGesture == null || !mWaitingForResult) {
if (gesture != null) { final Gesture gesture = mGesturesOverlay.getGesture();
outState.putParcelable(RUNTIME_STATE_GESTURES_PANEL_GESTURE, gesture); if (gesture != null) {
outState.putParcelable(RUNTIME_STATE_GESTURES_PANEL_GESTURE, gesture);
}
} }
} }
} }
@ -2427,6 +2429,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On
mMatcher.gesture = overlay.getGesture(); mMatcher.gesture = overlay.getGesture();
if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) { if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) {
overlay.clear(false); overlay.clear(false);
if (mGesturesAction.intent != null) {
mGesturesAction.intent = null;
setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
}
} else { } else {
mMatcher.run(); mMatcher.run();
} }
@ -2436,6 +2442,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On
mMatcher.gesture = overlay.getGesture(); mMatcher.gesture = overlay.getGesture();
if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) { if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) {
overlay.clear(false); overlay.clear(false);
if (mGesturesAction.intent != null) {
mGesturesAction.intent = null;
setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
}
} else { } else {
overlay.postDelayed(mMatcher, GesturesConstants.MATCH_DELAY); overlay.postDelayed(mMatcher, GesturesConstants.MATCH_DELAY);
} }
@ -2473,6 +2483,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
} }
if (!match){ if (!match){
mGesturesAction.intent = null;
if (animate) { if (animate) {
setGesturesNextPrompt(null, getString(R.string.gestures_unknown)); setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
} else { } else {
@ -2488,7 +2499,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
private void updatePrompt(ApplicationInfo info, boolean animate) { private void updatePrompt(ApplicationInfo info, boolean animate) {
if (mGesturesAction.intent != null && if (mGesturesAction.intent != null &&
info.intent.toURI().equals(mGesturesAction.intent.toURI()) && info.intent.toUri(0).equals(mGesturesAction.intent.toUri(0)) &&
info.title.equals(((TextView) mGesturesPrompt.getCurrentView()).getText())) { info.title.equals(((TextView) mGesturesPrompt.getCurrentView()).getText())) {
return; return;
} }

View File

@ -641,7 +641,7 @@ public class LauncherModel {
final String intentUri = c.getString(intentIndex); final String intentUri = c.getString(intentIndex);
if (intentUri != null) { if (intentUri != null) {
final Intent shortcut = Intent.getIntent(intentUri); final Intent shortcut = Intent.parseUri(intentUri, 0);
if (Intent.ACTION_MAIN.equals(shortcut.getAction())) { if (Intent.ACTION_MAIN.equals(shortcut.getAction())) {
final ComponentName name = shortcut.getComponent(); final ComponentName name = shortcut.getComponent();
if (name != null) { if (name != null) {
@ -773,7 +773,7 @@ public class LauncherModel {
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
intentDescription = c.getString(intentIndex); intentDescription = c.getString(intentIndex);
try { try {
intent = Intent.getIntent(intentDescription); intent = Intent.parseUri(intentDescription, 0);
} catch (java.net.URISyntaxException e) { } catch (java.net.URISyntaxException e) {
continue; continue;
} }
@ -843,7 +843,7 @@ public class LauncherModel {
intent = null; intent = null;
if (intentDescription != null) { if (intentDescription != null) {
try { try {
intent = Intent.getIntent(intentDescription); intent = Intent.parseUri(intentDescription, 0);
} catch (java.net.URISyntaxException e) { } catch (java.net.URISyntaxException e) {
// Ignore, a live folder might not have a base intent // Ignore, a live folder might not have a base intent
} }
@ -1259,7 +1259,7 @@ public class LauncherModel {
final ContentResolver cr = context.getContentResolver(); final ContentResolver cr = context.getContentResolver();
Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI, Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI,
new String[] { "title", "intent" }, "title=? and intent=?", new String[] { "title", "intent" }, "title=? and intent=?",
new String[] { title, intent.toURI() }, null); new String[] { title, intent.toUri(0) }, null);
boolean result = false; boolean result = false;
try { try {
result = c.moveToFirst(); result = c.moveToFirst();
@ -1437,7 +1437,7 @@ public class LauncherModel {
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
intentDescription = c.getString(intentIndex); intentDescription = c.getString(intentIndex);
try { try {
intent = Intent.getIntent(intentDescription); intent = Intent.parseUri(intentDescription, 0);
} catch (java.net.URISyntaxException e) { } catch (java.net.URISyntaxException e) {
return null; return null;
} }

View File

@ -563,7 +563,7 @@ public class LauncherProvider extends ContentProvider {
intent.setComponent(cn); intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
values.put(Favorites.INTENT, intent.toURI()); values.put(Favorites.INTENT, intent.toUri(0));
values.put(Favorites.TITLE, info.loadLabel(packageManager).toString()); values.put(Favorites.TITLE, info.loadLabel(packageManager).toString());
values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPLICATION); values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPLICATION);
values.put(Favorites.SPANX, 1); values.put(Favorites.SPANX, 1);

View File

@ -32,7 +32,7 @@ class LauncherSettings {
/** /**
* The Intent URL of the gesture, describing what it points to. This * The Intent URL of the gesture, describing what it points to. This
* value is given to {@link android.content.Intent#getIntent} to create * value is given to {@link android.content.Intent#parseUri(String, int)} to create
* an Intent that can be launched. * an Intent that can be launched.
* <P>Type: TEXT</P> * <P>Type: TEXT</P>
*/ */

View File

@ -116,7 +116,7 @@ class LiveFolderAdapter extends CursorAdapter {
if (holder.intentIndex != -1) { if (holder.intentIndex != -1) {
try { try {
holder.intent = Intent.getIntent(cursor.getString(holder.intentIndex)); holder.intent = Intent.parseUri(cursor.getString(holder.intentIndex), 0);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
// Ignore // Ignore
} }

View File

@ -63,7 +63,7 @@ class LiveFolderInfo extends FolderInfo {
values.put(LauncherSettings.Favorites.TITLE, title.toString()); values.put(LauncherSettings.Favorites.TITLE, title.toString());
values.put(LauncherSettings.Favorites.URI, uri.toString()); values.put(LauncherSettings.Favorites.URI, uri.toString());
if (baseIntent != null) { if (baseIntent != null) {
values.put(LauncherSettings.Favorites.INTENT, baseIntent.toURI()); values.put(LauncherSettings.Favorites.INTENT, baseIntent.toUri(0));
} }
values.put(LauncherSettings.Favorites.ICON_TYPE, LauncherSettings.Favorites.ICON_TYPE_RESOURCE); values.put(LauncherSettings.Favorites.ICON_TYPE, LauncherSettings.Favorites.ICON_TYPE_RESOURCE);
values.put(LauncherSettings.Favorites.DISPLAY_MODE, displayMode); values.put(LauncherSettings.Favorites.DISPLAY_MODE, displayMode);

View File

@ -53,7 +53,7 @@ public class UninstallShortcutReceiver extends BroadcastReceiver {
try { try {
while (c.moveToNext()) { while (c.moveToNext()) {
try { try {
if (intent.filterEquals(Intent.getIntent(c.getString(intentIndex)))) { if (intent.filterEquals(Intent.parseUri(c.getString(intentIndex), 0))) {
final long id = c.getLong(idIndex); final long id = c.getLong(idIndex);
final Uri uri = LauncherSettings.Favorites.getContentUri(id, false); final Uri uri = LauncherSettings.Favorites.getContentUri(id, false);
cr.delete(uri, null, null); cr.delete(uri, null, null);