summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-01-31 17:41:49 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-31 17:41:49 -0800
commitd9e4d3adecffb11dc2661b024bd4545a1b8708d9 (patch)
treeda4d6f351c9467093a7109a9e5bad303551f4a35 /src/com/android
parenta0632c38ddb112fb726143f165fb732ae678d273 (diff)
parent9291bd1c9b5d1398e14d80ddea91cebf574cc63e (diff)
downloadpackages_apps_Browser-d9e4d3adecffb11dc2661b024bd4545a1b8708d9.zip
packages_apps_Browser-d9e4d3adecffb11dc2661b024bd4545a1b8708d9.tar.gz
packages_apps_Browser-d9e4d3adecffb11dc2661b024bd4545a1b8708d9.tar.bz2
Merge "Implement empty design for bookmark widget" into honeycomb
Diffstat (limited to 'src/com/android')
-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 1c7856f..631bf84 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) {