moving shared preferences initialization

This commit is contained in:
tibbi 2016-01-03 19:35:37 +01:00
parent feaa8f2de7
commit cb12d04111
1 changed files with 1 additions and 1 deletions

View File

@ -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);