|
|
@ -134,6 +134,23 @@ public class Widget extends AppWidgetProvider {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onDeleted(Context context, int[] appWidgetIds) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
|
|
|
|
for (int appWidgetId : appWidgetIds) {
|
|
|
|
|
|
|
|
String prefix = "widget." + appWidgetId + ".";
|
|
|
|
|
|
|
|
for (String key : prefs.getAll().keySet())
|
|
|
|
|
|
|
|
if (key.startsWith(prefix))
|
|
|
|
|
|
|
|
editor.remove(key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
editor.apply();
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void init(Context context, int appWidgetId) {
|
|
|
|
static void init(Context context, int appWidgetId) {
|
|
|
|
update(context);
|
|
|
|
update(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|