packages/apps/Launcher
Révision | d819747cfdb6039cf4953939012fc01b0501c1e5 (tree) |
---|---|
l'heure | 2010-01-13 08:19:14 |
Auteur | The Android Open Source Project <initial-contribution@andr...> |
Commiter | The Android Open Source Project |
android-2.1_r1 snapshot
@@ -52,13 +52,13 @@ | ||
52 | 52 | <string name="menu_gestures" msgid="514678675575912237">"Gestus"</string> |
53 | 53 | <string name="menu_settings" msgid="6233960148378443661">"Indstillinger"</string> |
54 | 54 | <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> | |
56 | 56 | <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> | |
58 | 58 | <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> | |
60 | 60 | <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> | |
62 | 62 | <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> | |
64 | 64 | </resources> |
@@ -52,9 +52,9 @@ | ||
52 | 52 | <string name="menu_gestures" msgid="514678675575912237">"Bewegungen"</string> |
53 | 53 | <string name="menu_settings" msgid="6233960148378443661">"Einstellungen"</string> |
54 | 54 | <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> | |
56 | 56 | <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> | |
58 | 58 | <string name="permlab_read_settings" msgid="3452408290738106747">"Einstellungen und Shortcuts für Startseite lesen"</string> |
59 | 59 | <string name="permdesc_read_settings" msgid="8377434937176025492">"Ermöglicht einer Anwendung, die Einstellungen und Shortcuts auf der Startseite zu lesen."</string> |
60 | 60 | <string name="permlab_write_settings" msgid="1360567537236705628">"Einstellungen und Shortcuts für Startseite schreiben"</string> |
@@ -39,7 +39,7 @@ | ||
39 | 39 | <string name="add_clock" msgid="2337943840175865746">"时钟"</string> |
40 | 40 | <string name="add_photo_frame" msgid="3154058437359487954">"相框"</string> |
41 | 41 | <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> | |
43 | 43 | <string name="shortcut_installed" msgid="7071557296331322355">"已创建“<xliff:g id="NAME">%s</xliff:g>”快捷方式。"</string> |
44 | 44 | <string name="shortcut_uninstalled" msgid="2129499669449749995">"已删除“<xliff:g id="NAME">%s</xliff:g>”快捷方式。"</string> |
45 | 45 | <string name="shortcut_duplicate" msgid="4757756326465060694">"“<xliff:g id="NAME">%s</xliff:g>”快捷方式已存在。"</string> |
@@ -52,13 +52,13 @@ | ||
52 | 52 | <string name="menu_gestures" msgid="514678675575912237">"手势"</string> |
53 | 53 | <string name="menu_settings" msgid="6233960148378443661">"设置"</string> |
54 | 54 | <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> | |
56 | 56 | <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> | |
62 | 62 | <string name="search_hint" msgid="6974176141372467453">"Google 搜索"</string> |
63 | 63 | <string name="gadget_error_text" msgid="8359351016167075858">"载入窗口小部件时出现问题"</string> |
64 | 64 | </resources> |
@@ -1641,6 +1641,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On | ||
1641 | 1641 | if (tag instanceof ApplicationInfo) { |
1642 | 1642 | // Open shortcut |
1643 | 1643 | 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())); | |
1644 | 1648 | startActivitySafely(intent); |
1645 | 1649 | } else if (tag instanceof FolderInfo) { |
1646 | 1650 | handleFolderClick((FolderInfo) tag); |
@@ -16,7 +16,6 @@ | ||
16 | 16 | |
17 | 17 | package com.android.launcher; |
18 | 18 | |
19 | -import static android.util.Log.d; | |
20 | 19 | import static android.util.Log.w; |
21 | 20 | |
22 | 21 | import android.appwidget.AppWidgetHost; |
@@ -60,7 +59,7 @@ public class LauncherProvider extends ContentProvider { | ||
60 | 59 | |
61 | 60 | private static final String DATABASE_NAME = "launcher.db"; |
62 | 61 | |
63 | - private static final int DATABASE_VERSION = 4; | |
62 | + private static final int DATABASE_VERSION = 5; | |
64 | 63 | |
65 | 64 | static final String AUTHORITY = "com.android.launcher.settings"; |
66 | 65 |
@@ -68,7 +67,6 @@ public class LauncherProvider extends ContentProvider { | ||
68 | 67 | static final String EXTRA_BIND_TARGETS = "com.android.launcher.settings.bindtargets"; |
69 | 68 | |
70 | 69 | static final String TABLE_FAVORITES = "favorites"; |
71 | - static final String TABLE_GESTURES = "gestures"; | |
72 | 70 | static final String PARAMETER_NOTIFY = "notify"; |
73 | 71 | |
74 | 72 | /** |
@@ -372,36 +370,90 @@ public class LauncherProvider extends ContentProvider { | ||
372 | 370 | } |
373 | 371 | |
374 | 372 | 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; | |
394 | 379 | } |
395 | 380 | } |
396 | 381 | |
397 | 382 | if (version != DATABASE_VERSION) { |
398 | 383 | Log.w(LOG_TAG, "Destroying all old data."); |
399 | 384 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES); |
400 | - db.execSQL("DROP TABLE IF EXISTS " + TABLE_GESTURES); | |
401 | 385 | onCreate(db); |
402 | 386 | } |
403 | 387 | } |
404 | 388 | |
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 | + | |
405 | 457 | /** |
406 | 458 | * Upgrade existing clock and photo frame widgets into their new widget |
407 | 459 | * equivalents. This method allocates appWidgetIds, and then hands off to |
@@ -591,7 +643,7 @@ public class LauncherProvider extends ContentProvider { | ||
591 | 643 | final int iconResId = a.getResourceId(R.styleable.Favorite_icon, 0); |
592 | 644 | final int titleResId = a.getResourceId(R.styleable.Favorite_title, 0); |
593 | 645 | |
594 | - Intent intent = null; | |
646 | + Intent intent; | |
595 | 647 | String uri = null; |
596 | 648 | try { |
597 | 649 | uri = a.getString(R.styleable.Favorite_uri); |