Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-Launcher: Commit

packages/apps/Launcher


Commit MetaInfo

Revisiond819747cfdb6039cf4953939012fc01b0501c1e5 (tree)
Time2010-01-13 08:19:14
AuthorThe Android Open Source Project <initial-contribution@andr...>
CommiterThe Android Open Source Project

Log Message

android-2.1_r1 snapshot

Change Summary

Incremental Difference

--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -52,13 +52,13 @@
5252 <string name="menu_gestures" msgid="514678675575912237">"Gestus"</string>
5353 <string name="menu_settings" msgid="6233960148378443661">"Indstillinger"</string>
5454 <string name="permlab_install_shortcut" msgid="1201690825493376489">"installer genveje"</string>
55- <string name="permdesc_install_shortcut" msgid="7429365847558984148">"Tillader et program at tilføje genveje uden brugerindgriben."</string>
55+ <string name="permdesc_install_shortcut" msgid="7429365847558984148">"Tillader, at et program tilføjer genveje uden brugerindgriben."</string>
5656 <string name="permlab_uninstall_shortcut" msgid="7696645932555926449">"afinstaller genveje"</string>
57- <string name="permdesc_uninstall_shortcut" msgid="959972195916090900">"Tillader et program at fjerne genveje uden brugerindgriben."</string>
57+ <string name="permdesc_uninstall_shortcut" msgid="959972195916090900">"Tillader, at et program fjerner genveje uden brugerindgriben."</string>
5858 <string name="permlab_read_settings" msgid="3452408290738106747">"læs indstillinger og genveje for Start"</string>
59- <string name="permdesc_read_settings" msgid="8377434937176025492">"Tillader et program at læse indstillingerne og genvejene i Start."</string>
59+ <string name="permdesc_read_settings" msgid="8377434937176025492">"Tillader, at et program læser indstillingerne og genvejene i Start."</string>
6060 <string name="permlab_write_settings" msgid="1360567537236705628">"skriv indstillinger og genveje for Start"</string>
61- <string name="permdesc_write_settings" msgid="1098648778383349818">"Tillader et program at ændre indstillingerne og genvejene i Start."</string>
61+ <string name="permdesc_write_settings" msgid="1098648778383349818">"Tillader, at et program ændrer indstillingerne og genvejene i Start."</string>
6262 <string name="search_hint" msgid="6974176141372467453">"Google-søgning"</string>
63- <string name="gadget_error_text" msgid="8359351016167075858">"Der er problemer med at indlæse widget"</string>
63+ <string name="gadget_error_text" msgid="8359351016167075858">"Der er problemer med indlæsning af widget"</string>
6464 </resources>
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -52,9 +52,9 @@
5252 <string name="menu_gestures" msgid="514678675575912237">"Bewegungen"</string>
5353 <string name="menu_settings" msgid="6233960148378443661">"Einstellungen"</string>
5454 <string name="permlab_install_shortcut" msgid="1201690825493376489">"Verknüpfungen installieren"</string>
55- <string name="permdesc_install_shortcut" msgid="7429365847558984148">"Ermöglicht einer Anwendung das Hinzufügen von Verknüpfungen ohne Eingriff des Benutzers."</string>
55+ <string name="permdesc_install_shortcut" msgid="7429365847558984148">"Ermöglicht einer Anwendung das Hinzufügen von Verknüpfungen ohne Eingriff des Nutzers."</string>
5656 <string name="permlab_uninstall_shortcut" msgid="7696645932555926449">"Verknüpfungen deinstallieren"</string>
57- <string name="permdesc_uninstall_shortcut" msgid="959972195916090900">"Ermöglicht einer Anwendung das Entfernen von Verknüpfungen ohne Eingriff des Benutzers."</string>
57+ <string name="permdesc_uninstall_shortcut" msgid="959972195916090900">"Ermöglicht einer Anwendung das Entfernen von Verknüpfungen ohne Eingriff des Nutzers."</string>
5858 <string name="permlab_read_settings" msgid="3452408290738106747">"Einstellungen und Shortcuts für Startseite lesen"</string>
5959 <string name="permdesc_read_settings" msgid="8377434937176025492">"Ermöglicht einer Anwendung, die Einstellungen und Shortcuts auf der Startseite zu lesen."</string>
6060 <string name="permlab_write_settings" msgid="1360567537236705628">"Einstellungen und Shortcuts für Startseite schreiben"</string>
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -39,7 +39,7 @@
3939 <string name="add_clock" msgid="2337943840175865746">"时钟"</string>
4040 <string name="add_photo_frame" msgid="3154058437359487954">"相框"</string>
4141 <string name="add_search" msgid="7104834713685095105">"搜索"</string>
42- <string name="out_of_space" msgid="8365249326091984698">"此主屏幕上已没有更多空间。"</string>
42+ <string name="out_of_space" msgid="8365249326091984698">"此主屏幕上已没有空间。"</string>
4343 <string name="shortcut_installed" msgid="7071557296331322355">"已创建“<xliff:g id="NAME">%s</xliff:g>”快捷方式。"</string>
4444 <string name="shortcut_uninstalled" msgid="2129499669449749995">"已删除“<xliff:g id="NAME">%s</xliff:g>”快捷方式。"</string>
4545 <string name="shortcut_duplicate" msgid="4757756326465060694">"“<xliff:g id="NAME">%s</xliff:g>”快捷方式已存在。"</string>
@@ -52,13 +52,13 @@
5252 <string name="menu_gestures" msgid="514678675575912237">"手势"</string>
5353 <string name="menu_settings" msgid="6233960148378443661">"设置"</string>
5454 <string name="permlab_install_shortcut" msgid="1201690825493376489">"安装快捷方式"</string>
55- <string name="permdesc_install_shortcut" msgid="7429365847558984148">"允许应用程序在无人操作的情况下添加快捷方式。"</string>
55+ <string name="permdesc_install_shortcut" msgid="7429365847558984148">"允许应用程序在没有用户介入的情况下添加快捷方式。"</string>
5656 <string name="permlab_uninstall_shortcut" msgid="7696645932555926449">"卸载快捷方式"</string>
57- <string name="permdesc_uninstall_shortcut" msgid="959972195916090900">"允许应用程序在无人操作的情况下删除快捷方式。"</string>
58- <string name="permlab_read_settings" msgid="3452408290738106747">"读取主屏幕设置和快捷方式"</string>
59- <string name="permdesc_read_settings" msgid="8377434937176025492">"允许应用程序读取主屏幕上的设置和快捷方式。"</string>
60- <string name="permlab_write_settings" msgid="1360567537236705628">"写入主屏幕设置和快捷方式"</string>
61- <string name="permdesc_write_settings" msgid="1098648778383349818">"允许应用程序更改主屏幕上的设置和快捷方式。"</string>
57+ <string name="permdesc_uninstall_shortcut" msgid="959972195916090900">"允许应用程序在没有用户介入的情况下删除快捷方式。"</string>
58+ <string name="permlab_read_settings" msgid="3452408290738106747">"读取主屏幕的设置和快捷方式"</string>
59+ <string name="permdesc_read_settings" msgid="8377434937176025492">"允许应用程序读取主屏幕的设置和快捷方式。"</string>
60+ <string name="permlab_write_settings" msgid="1360567537236705628">"写入主屏幕的设置和快捷方式"</string>
61+ <string name="permdesc_write_settings" msgid="1098648778383349818">"允许应用程序更改主屏幕的设置和快捷方式。"</string>
6262 <string name="search_hint" msgid="6974176141372467453">"Google 搜索"</string>
6363 <string name="gadget_error_text" msgid="8359351016167075858">"载入窗口小部件时出现问题"</string>
6464 </resources>
--- a/src/com/android/launcher/Launcher.java
+++ b/src/com/android/launcher/Launcher.java
@@ -1641,6 +1641,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On
16411641 if (tag instanceof ApplicationInfo) {
16421642 // Open shortcut
16431643 final Intent intent = ((ApplicationInfo) tag).intent;
1644+ int[] pos = new int[2];
1645+ v.getLocationOnScreen(pos);
1646+ intent.setSourceBounds(
1647+ new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight()));
16441648 startActivitySafely(intent);
16451649 } else if (tag instanceof FolderInfo) {
16461650 handleFolderClick((FolderInfo) tag);
--- a/src/com/android/launcher/LauncherProvider.java
+++ b/src/com/android/launcher/LauncherProvider.java
@@ -16,7 +16,6 @@
1616
1717 package com.android.launcher;
1818
19-import static android.util.Log.d;
2019 import static android.util.Log.w;
2120
2221 import android.appwidget.AppWidgetHost;
@@ -60,7 +59,7 @@ public class LauncherProvider extends ContentProvider {
6059
6160 private static final String DATABASE_NAME = "launcher.db";
6261
63- private static final int DATABASE_VERSION = 4;
62+ private static final int DATABASE_VERSION = 5;
6463
6564 static final String AUTHORITY = "com.android.launcher.settings";
6665
@@ -68,7 +67,6 @@ public class LauncherProvider extends ContentProvider {
6867 static final String EXTRA_BIND_TARGETS = "com.android.launcher.settings.bindtargets";
6968
7069 static final String TABLE_FAVORITES = "favorites";
71- static final String TABLE_GESTURES = "gestures";
7270 static final String PARAMETER_NOTIFY = "notify";
7371
7472 /**
@@ -372,36 +370,90 @@ public class LauncherProvider extends ContentProvider {
372370 }
373371
374372 if (version < 4) {
375- db.beginTransaction();
376- try {
377- db.execSQL("CREATE TABLE gestures (" +
378- "_id INTEGER PRIMARY KEY," +
379- "title TEXT," +
380- "intent TEXT," +
381- "itemType INTEGER," +
382- "iconType INTEGER," +
383- "iconPackage TEXT," +
384- "iconResource TEXT," +
385- "icon BLOB" +
386- ");");
387- db.setTransactionSuccessful();
388- version = 4;
389- } catch (SQLException ex) {
390- // Old version remains, which means we wipe old data
391- Log.e(LOG_TAG, ex.getMessage(), ex);
392- } finally {
393- db.endTransaction();
373+ version = 4;
374+ }
375+
376+ if (version < 5) {
377+ if (updateContactsShortcuts(db)) {
378+ version = 5;
394379 }
395380 }
396381
397382 if (version != DATABASE_VERSION) {
398383 Log.w(LOG_TAG, "Destroying all old data.");
399384 db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
400- db.execSQL("DROP TABLE IF EXISTS " + TABLE_GESTURES);
401385 onCreate(db);
402386 }
403387 }
404388
389+ private boolean updateContactsShortcuts(SQLiteDatabase db) {
390+ Cursor c = null;
391+ final String selectWhere = buildOrWhereString(LauncherSettings.Favorites.ITEM_TYPE,
392+ new int[] { LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT });
393+
394+ db.beginTransaction();
395+ try {
396+ // Select and iterate through each matching widget
397+ c = db.query(TABLE_FAVORITES, new String[] { LauncherSettings.Favorites._ID,
398+ LauncherSettings.Favorites.INTENT }, selectWhere, null, null, null, null);
399+
400+ if (LOGD) Log.d(LOG_TAG, "found upgrade cursor count=" + c.getCount());
401+
402+ final ContentValues values = new ContentValues();
403+ final int idIndex = c.getColumnIndex(LauncherSettings.Favorites._ID);
404+ final int intentIndex = c.getColumnIndex(LauncherSettings.Favorites.INTENT);
405+
406+ while (c != null && c.moveToNext()) {
407+ long favoriteId = c.getLong(idIndex);
408+ final String intentUri = c.getString(intentIndex);
409+ if (intentUri != null) {
410+ try {
411+ Intent intent = Intent.parseUri(intentUri, 0);
412+ android.util.Log.d("Home", intent.toString());
413+ final Uri uri = intent.getData();
414+ final String data = uri.toString();
415+ if (Intent.ACTION_VIEW.equals(intent.getAction()) &&
416+ (data.startsWith("content://contacts/people/") ||
417+ data.startsWith("content://com.android.contacts/contacts/lookup/"))) {
418+
419+ intent = new Intent("com.android.contacts.action.QUICK_CONTACT");
420+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
421+ Intent.FLAG_ACTIVITY_CLEAR_TOP |
422+ Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
423+
424+ intent.setData(uri);
425+ intent.putExtra("mode", 3);
426+ intent.putExtra("exclude_mimes", (String[]) null);
427+
428+ values.clear();
429+ values.put(LauncherSettings.Favorites.INTENT, intent.toUri(0));
430+
431+ String updateWhere = LauncherSettings.Favorites._ID + "=" + favoriteId;
432+ db.update(TABLE_FAVORITES, values, updateWhere, null);
433+ }
434+ } catch (RuntimeException ex) {
435+ Log.e(LOG_TAG, "Problem upgrading shortcut", ex);
436+ } catch (URISyntaxException e) {
437+ Log.e(LOG_TAG, "Problem upgrading shortcut", e);
438+ }
439+ }
440+ }
441+
442+ db.setTransactionSuccessful();
443+ } catch (SQLException ex) {
444+ Log.w(LOG_TAG, "Problem while upgrading contacts", ex);
445+ return false;
446+ } finally {
447+ db.endTransaction();
448+ if (c != null) {
449+ c.close();
450+ }
451+ }
452+
453+ return true;
454+ }
455+
456+
405457 /**
406458 * Upgrade existing clock and photo frame widgets into their new widget
407459 * equivalents. This method allocates appWidgetIds, and then hands off to
@@ -591,7 +643,7 @@ public class LauncherProvider extends ContentProvider {
591643 final int iconResId = a.getResourceId(R.styleable.Favorite_icon, 0);
592644 final int titleResId = a.getResourceId(R.styleable.Favorite_title, 0);
593645
594- Intent intent = null;
646+ Intent intent;
595647 String uri = null;
596648 try {
597649 uri = a.getString(R.styleable.Favorite_uri);
Show on old repository browser