mirror of https://github.com/M66B/FairEmail.git
Clear widget data
This commit is contained in:
parent
3c721de1b9
commit
f7bee91349
|
@ -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) {
|
||||
update(context);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,23 @@ public class WidgetUnified 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 int getFontSizeSp(int size) {
|
||||
switch (size) {
|
||||
case 1: // small
|
||||
|
|
Loading…
Reference in New Issue