Merge "Register implicit broadcasts at runtime for updating widgets" am: 9d1aeb4d80 am: df7c6643ae
Change-Id: I358737606c3697dcd418cf618911769ac090d93a
This commit is contained in:
@@ -484,9 +484,6 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.android.Bugle.intent.action.ACTION_NOTIFY_CONVERSATIONS_CHANGED" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.appwidget.provider"
|
<meta-data android:name="android.appwidget.provider"
|
||||||
android:resource="@xml/widget_conversation_list" />
|
android:resource="@xml/widget_conversation_list" />
|
||||||
</receiver>
|
</receiver>
|
||||||
@@ -497,9 +494,6 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.android.Bugle.intent.action.ACTION_NOTIFY_MESSAGES_CHANGED" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.appwidget.provider"
|
<meta-data android:name="android.appwidget.provider"
|
||||||
android:resource="@xml/widget_conversation" />
|
android:resource="@xml/widget_conversation" />
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.appwidget.AppWidgetProvider;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.android.messaging.util.LogUtil;
|
import com.android.messaging.util.LogUtil;
|
||||||
@@ -78,6 +79,12 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnabled(Context context) {
|
||||||
|
super.onEnabled(context);
|
||||||
|
context.getApplicationContext().registerReceiver(this, new IntentFilter(getAction()));
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract String getAction();
|
protected abstract String getAction();
|
||||||
|
|
||||||
protected abstract int getListId();
|
protected abstract int getListId();
|
||||||
@@ -87,8 +94,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
*/
|
*/
|
||||||
protected abstract void updateWidget(Context context, int appWidgetId);
|
protected abstract void updateWidget(Context context, int appWidgetId);
|
||||||
|
|
||||||
private int getWidgetSize(AppWidgetManager appWidgetManager,
|
private int getWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) {
|
||||||
int appWidgetId) {
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize");
|
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize");
|
||||||
}
|
}
|
||||||
@@ -105,8 +111,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
final int columns = getCellsForSize(minWidth);
|
final int columns = getCellsForSize(minWidth);
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize row: " + rows +
|
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize row: " + rows
|
||||||
" columns: " + columns);
|
+ " columns: " + columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = SIZE_MEDIUM;
|
int size = SIZE_MEDIUM;
|
||||||
@@ -127,8 +133,8 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
|
|||||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, getListId());
|
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, getListId());
|
||||||
|
|
||||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
||||||
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize old size: " + savedSize +
|
LogUtil.v(TAG, "BaseWidgetProvider.getWidgetSize old size: " + savedSize
|
||||||
" new size saved: " + size);
|
+ " new size saved: " + size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user