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_alignParentRight="true"
android:layout_alignTop="@id/gestures_actions"
android:layout_marginRight="10dip"
android:layout_marginTop="-22dip" />
android:layout_marginRight="5dip"
android:layout_marginTop="-47dip" />
</com.android.launcher.GesturesPanel>

View File

@ -100,7 +100,7 @@ class ApplicationInfo extends ItemInfo {
String titleStr = title != null ? title.toString() : null;
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);
if (customIcon) {

View File

@ -519,6 +519,8 @@ public final class Launcher extends Activity implements View.OnClickListener, On
mRestoring = true;
}
mCurrentGesture = (Gesture) savedState.get(RUNTIME_STATE_PENDING_GESTURE);
boolean gesturesShowing = savedState.getBoolean(RUNTIME_STATE_GESTURES_PANEL, false);
if (gesturesShowing) {
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);
}
if (mGesturesWindow != null && mGesturesWindow.isShowing() && isConfigurationChange) {
if (mGesturesWindow != null && mGesturesWindow.isShowing()) {
outState.putBoolean(RUNTIME_STATE_GESTURES_PANEL, true);
final Gesture gesture = mGesturesOverlay.getGesture();
if (gesture != null) {
outState.putParcelable(RUNTIME_STATE_GESTURES_PANEL_GESTURE, gesture);
if (mCurrentGesture == null || !mWaitingForResult) {
final Gesture gesture = mGesturesOverlay.getGesture();
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();
if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) {
overlay.clear(false);
if (mGesturesAction.intent != null) {
mGesturesAction.intent = null;
setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
}
} else {
mMatcher.run();
}
@ -2436,6 +2442,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On
mMatcher.gesture = overlay.getGesture();
if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) {
overlay.clear(false);
if (mGesturesAction.intent != null) {
mGesturesAction.intent = null;
setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
}
} else {
overlay.postDelayed(mMatcher, GesturesConstants.MATCH_DELAY);
}
@ -2473,6 +2483,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
}
if (!match){
mGesturesAction.intent = null;
if (animate) {
setGesturesNextPrompt(null, getString(R.string.gestures_unknown));
} else {
@ -2488,7 +2499,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
private void updatePrompt(ApplicationInfo info, boolean animate) {
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())) {
return;
}

View File

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

View File

@ -563,7 +563,7 @@ public class LauncherProvider extends ContentProvider {
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| 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.ITEM_TYPE, Favorites.ITEM_TYPE_APPLICATION);
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
* 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.
* <P>Type: TEXT</P>
*/

View File

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

View File

@ -63,7 +63,7 @@ class LiveFolderInfo extends FolderInfo {
values.put(LauncherSettings.Favorites.TITLE, title.toString());
values.put(LauncherSettings.Favorites.URI, uri.toString());
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.DISPLAY_MODE, displayMode);

View File

@ -53,7 +53,7 @@ public class UninstallShortcutReceiver extends BroadcastReceiver {
try {
while (c.moveToNext()) {
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 Uri uri = LauncherSettings.Favorites.getContentUri(id, false);
cr.delete(uri, null, null);