summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Chen <cxr514033970@gmail.com>2012-09-18 23:48:00 +0800
committerRoger Chen <cxr514033970@gmail.com>2012-11-15 17:29:09 +0800
commit1c5596602dcc0ccbf04782333d0d61dbb090784c (patch)
tree14dd2ee73acab4ec27c0db6fbf0c81641cf5e881
parent8f33ff2f7dc236929ce45116b5560f96d494f7af (diff)
downloadMms-1c5596602dcc0ccbf04782333d0d61dbb090784c.tar.gz
Fix bugs in Mms Appwidget
1. Need to use PendingIntent instead to set the click listener for "View more conversations" 2. No need to lock sWidgetLock in getConversationCount(), since it was already locked outside. Change-Id: Ifacbbcb720c8b7126f93fbbc2cbe862e0b6558a6 Signed-off-by: Roger Chen <cxr514033970@gmail.com>
-rw-r--r--src/com/android/mms/widget/MmsWidgetService.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/android/mms/widget/MmsWidgetService.java b/src/com/android/mms/widget/MmsWidgetService.java
index 4497e670..a0644a86 100644
--- a/src/com/android/mms/widget/MmsWidgetService.java
+++ b/src/com/android/mms/widget/MmsWidgetService.java
@@ -16,6 +16,7 @@
package com.android.mms.widget;
+import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
@@ -183,9 +184,8 @@ public class MmsWidgetService extends RemoteViewsService {
if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) {
Log.v(TAG, "getConversationCount");
}
- synchronized (sWidgetLock) {
- return Math.min(mConversationCursor.getCount(), MAX_CONVERSATIONS_COUNT);
- }
+
+ return Math.min(mConversationCursor.getCount(), MAX_CONVERSATIONS_COUNT);
}
/*
@@ -301,8 +301,11 @@ public class MmsWidgetService extends RemoteViewsService {
RemoteViews view = new RemoteViews(mContext.getPackageName(), R.layout.widget_loading);
view.setTextViewText(
R.id.loading_text, mContext.getText(R.string.view_more_conversations));
- view.setOnClickFillInIntent(R.id.widget_loading,
- new Intent(mContext, ConversationList.class));
+ PendingIntent pendingIntent =
+ PendingIntent.getActivity(mContext, 0, new Intent(mContext,
+ ConversationList.class),
+ PendingIntent.FLAG_UPDATE_CURRENT);
+ view.setOnClickPendingIntent(R.id.widget_loading, pendingIntent);
return view;
}