为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

Gallery2支持默认WIGET添加于桌面

2018-04-15 3页 doc 14KB 21阅读

用户头像

is_083599

暂无简介

举报
Gallery2支持默认WIGET添加于桌面Gallery2支持默认WIGET添加于桌面 Gallery2 1. 修改,使支持默认WIGET添加于桌面 packages/apps/Gallery2/src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { android.util.Log...
Gallery2支持默认WIGET添加于桌面
Gallery2支持默认WIGET添加于桌面 Gallery2 1. 修改,使支持默认WIGET添加于桌面 packages/apps/Gallery2/src/com/android/gallery3d/gadget/PhotoAppWidgetProvider.java @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { android.util.Log.d(TAG, "ALog 1219 onUpdate"); // migrate gallery widgets from pre-JB releases to JB due to bucket ID change GalleryWidgetMigrator.migrateGalleryWidgets(context); WidgetDatabaseHelper helper = new WidgetDatabaseHelper(context); try { for (int id : appWidgetIds) { Entry entry = helper.getEntry(id); if (entry != null) { RemoteViews views = buildWidget(context, id, entry); appWidgetManager.updateAppWidget(id, views); } else { //添加以下代码,用于在Entry为空时,创建一个默认的Entry. entry = new Entry(); entry.type = 1; entry.widgetId=id; RemoteViews views = buildWidget(context, id, entry); appWidgetManager.updateAppWidget(id, views); Log.e(TAG, "cannot load widget: " + id); } } } finally { helper.close(); } super.onUpdate(context, appWidgetManager, appWidgetIds); } packages/apps/Gallery2/src/com/android/gallery3d/gadget/WidgetDatabaseHelper.java public static class Entry { public int widgetId; public int type; public String imageUri; public byte imageData[]; public String albumPath; public Entry() {} //使其外部可调用。 public Entry(int id, Cursor cursor) { widgetId = id; type = cursor.getInt(INDEX_WIDGET_TYPE); if (type == TYPE_SINGLE_PHOTO) { imageUri = cursor.getString(INDEX_IMAGE_URI); imageData = cursor.getBlob(INDEX_PHOTO_BLOB); } else if (type == TYPE_ALBUM) { albumPath = cursor.getString(INDEX_ALBUM_PATH); } } private Entry(Cursor cursor) { this(cursor.getInt(INDEX_APPWIDGET_ID), cursor); } } 2. dsf 3. sdf 4. dsf 5. df 6. df 7. df 8. df 9. df 10.
/
本文档为【Gallery2支持默认WIGET添加于桌面】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索