summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-06-23 17:34:54 -0700
committerRomain Guy <romainguy@android.com>2009-06-23 17:34:54 -0700
commit1ce1a24cba4dc41bccfeab6fccb2f3355423841a (patch)
tree277d1f889e4e5fb1977441fa75b4ba6153b46a68 /src/com/android/launcher
parent417d23428af00d928805c88c7731ccd0ece7fab2 (diff)
downloadandroid_packages_apps_Trebuchet-1ce1a24cba4dc41bccfeab6fccb2f3355423841a.tar.gz
android_packages_apps_Trebuchet-1ce1a24cba4dc41bccfeab6fccb2f3355423841a.tar.bz2
android_packages_apps_Trebuchet-1ce1a24cba4dc41bccfeab6fccb2f3355423841a.zip
Fixes #1937447. Home was not saving the appropriate state when losing focus.
Diffstat (limited to 'src/com/android/launcher')
-rw-r--r--src/com/android/launcher/ApplicationInfo.java2
-rw-r--r--src/com/android/launcher/Launcher.java25
-rw-r--r--src/com/android/launcher/LauncherModel.java10
-rw-r--r--src/com/android/launcher/LauncherProvider.java2
-rw-r--r--src/com/android/launcher/LauncherSettings.java2
-rw-r--r--src/com/android/launcher/LiveFolderAdapter.java2
-rw-r--r--src/com/android/launcher/LiveFolderInfo.java2
-rw-r--r--src/com/android/launcher/UninstallShortcutReceiver.java2
8 files changed, 29 insertions, 18 deletions
diff --git a/src/com/android/launcher/ApplicationInfo.java b/src/com/android/launcher/ApplicationInfo.java
index c9c8c5c97..cee9f3bfc 100644
--- a/src/com/android/launcher/ApplicationInfo.java
+++ b/src/com/android/launcher/ApplicationInfo.java
@@ -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) {
diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java
index 2e7281874..328a5ca2b 100644
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -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;
}
diff --git a/src/com/android/launcher/LauncherModel.java b/src/com/android/launcher/LauncherModel.java
index cd0ffd200..a1398d437 100644
--- a/src/com/android/launcher/LauncherModel.java
+++ b/src/com/android/launcher/LauncherModel.java
@@ -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;
}
diff --git a/src/com/android/launcher/LauncherProvider.java b/src/com/android/launcher/LauncherProvider.java
index 5316fa8f6..fc38cdd7f 100644
--- a/src/com/android/launcher/LauncherProvider.java
+++ b/src/com/android/launcher/LauncherProvider.java
@@ -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);
diff --git a/src/com/android/launcher/LauncherSettings.java b/src/com/android/launcher/LauncherSettings.java
index 062c8a6ef..8cc2559f7 100644
--- a/src/com/android/launcher/LauncherSettings.java
+++ b/src/com/android/launcher/LauncherSettings.java
@@ -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>
*/
diff --git a/src/com/android/launcher/LiveFolderAdapter.java b/src/com/android/launcher/LiveFolderAdapter.java
index 4a5c077c8..c40504167 100644
--- a/src/com/android/launcher/LiveFolderAdapter.java
+++ b/src/com/android/launcher/LiveFolderAdapter.java
@@ -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
}
diff --git a/src/com/android/launcher/LiveFolderInfo.java b/src/com/android/launcher/LiveFolderInfo.java
index 2432cc365..ec865a445 100644
--- a/src/com/android/launcher/LiveFolderInfo.java
+++ b/src/com/android/launcher/LiveFolderInfo.java
@@ -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);
diff --git a/src/com/android/launcher/UninstallShortcutReceiver.java b/src/com/android/launcher/UninstallShortcutReceiver.java
index 3bcdcbe58..9fd6298bd 100644
--- a/src/com/android/launcher/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher/UninstallShortcutReceiver.java
@@ -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);