moving shared preferences initialization
This commit is contained in:
parent
feaa8f2de7
commit
cb12d04111
|
@ -58,11 +58,11 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calculator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initVariables(Context context) {
|
private void initVariables(Context context) {
|
||||||
|
prefs = initPrefs(context);
|
||||||
final int defaultColor = context.getResources().getColor(R.color.dark_grey);
|
final int defaultColor = context.getResources().getColor(R.color.dark_grey);
|
||||||
final int newBgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, defaultColor);
|
final int newBgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, defaultColor);
|
||||||
final ComponentName component = new ComponentName(context, MyWidgetProvider.class);
|
final ComponentName component = new ComponentName(context, MyWidgetProvider.class);
|
||||||
|
|
||||||
prefs = initPrefs(context);
|
|
||||||
remoteViews = new RemoteViews(context.getPackageName(), R.layout.activity_main);
|
remoteViews = new RemoteViews(context.getPackageName(), R.layout.activity_main);
|
||||||
remoteViews.setViewVisibility(R.id.btn_reset, View.VISIBLE);
|
remoteViews.setViewVisibility(R.id.btn_reset, View.VISIBLE);
|
||||||
remoteViews.setInt(R.id.calculator_holder, "setBackgroundColor", newBgColor);
|
remoteViews.setInt(R.id.calculator_holder, "setBackgroundColor", newBgColor);
|
||||||
|
|
Loading…
Reference in New Issue