summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/widget
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-01-31 17:18:32 -0800
committerJohn Reck <jreck@google.com>2011-01-31 17:18:32 -0800
commit9291bd1c9b5d1398e14d80ddea91cebf574cc63e (patch)
tree068f51ba3be4b101d82b460b05051420cb2d5141 /src/com/android/browser/widget
parenta4af6dce2ebe6c4979524461047fcc0eb76fce84 (diff)
downloadpackages_apps_Browser-9291bd1c9b5d1398e14d80ddea91cebf574cc63e.tar.gz
packages_apps_Browser-9291bd1c9b5d1398e14d80ddea91cebf574cc63e.tar.bz2
packages_apps_Browser-9291bd1c9b5d1398e14d80ddea91cebf574cc63e.zip
Implement empty design for bookmark widget
Bug: 3355018 Change-Id: Ie64ed52c64445771037c980be181978de4caf250
Diffstat (limited to 'src/com/android/browser/widget')
-rw-r--r--src/com/android/browser/widget/BookmarkThumbnailWidgetService.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java b/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
index 1c7856f3a..631bf84d1 100644
--- a/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
@@ -16,6 +16,7 @@
package com.android.browser.widget;
+import com.android.browser.BrowserActivity;
import com.android.browser.BrowserBookmarksPage;
import com.android.browser.R;
@@ -95,9 +96,15 @@ public class BookmarkThumbnailWidgetService extends RemoteViewsService {
public int onStartCommand(Intent intent, int flags, int startId) {
String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) {
- Intent view = new Intent(intent);
- view.setComponent(null);
- startActivity(view);
+ if (intent.getData() == null) {
+ startActivity(new Intent(BrowserActivity.ACTION_SHOW_BROWSER, null,
+ this, BrowserActivity.class)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+ } else {
+ Intent view = new Intent(intent);
+ view.setComponent(null);
+ startActivity(view);
+ }
} else if (ACTION_REMOVE_FACTORIES.equals(action)) {
int[] ids = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (ids != null) {
@@ -242,8 +249,10 @@ public class BookmarkThumbnailWidgetService extends RemoteViewsService {
.putExtra(Bookmarks._ID, nfi);
} else {
fillin = new Intent(Intent.ACTION_VIEW)
- .setData(Uri.parse(res.mUrl))
.addCategory(Intent.CATEGORY_BROWSABLE);
+ if (!TextUtils.isEmpty(res.mUrl)) {
+ fillin.setData(Uri.parse(res.mUrl));
+ }
}
views.setOnClickFillInIntent(R.id.list_item, fillin);
// Set the title of the bookmark. Use the url as a backup.
@@ -396,6 +405,18 @@ public class BookmarkThumbnailWidgetService extends RemoteViewsService {
}
bookmarks.add(res);
}
+ if (bookmarks.size() == 0) {
+ RenderResult res = new RenderResult(0, "", "");
+ Bitmap thumbnail = BitmapFactory.decodeResource(
+ mContext.getResources(),
+ R.drawable.thumbnail_bookmarks_widget_no_bookmark_holo);
+ Bitmap favicon = Bitmap.createBitmap(1, 1, Config.ALPHA_8);
+ res.mThumbnail = thumbnail;
+ res.mIcon = favicon;
+ for (int i = 0; i < 6; i++) {
+ bookmarks.add(res);
+ }
+ }
return bookmarks;
}
} catch (IllegalStateException e) {