Merge "Fix crash from battery saver switch" into nyc-dev
This commit is contained in:
@@ -87,7 +87,7 @@ public class DashboardSummary extends InstrumentedFragment
|
|||||||
mSummaryLoader = new SummaryLoader(getActivity(), categories);
|
mSummaryLoader = new SummaryLoader(getActivity(), categories);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
mConditionManager = ConditionManager.get(context);
|
mConditionManager = ConditionManager.get(context, false);
|
||||||
mSuggestionParser = new SuggestionParser(context,
|
mSuggestionParser = new SuggestionParser(context,
|
||||||
context.getSharedPreferences(SUGGESTIONS, 0), R.xml.suggestion_ordering);
|
context.getSharedPreferences(SUGGESTIONS, 0), R.xml.suggestion_ordering);
|
||||||
mSuggestionsChecks = new SuggestionsChecks(getContext());
|
mSuggestionsChecks = new SuggestionsChecks(getContext());
|
||||||
|
@@ -54,10 +54,15 @@ public class ConditionManager {
|
|||||||
|
|
||||||
private final ArrayList<ConditionListener> mListeners = new ArrayList<>();
|
private final ArrayList<ConditionListener> mListeners = new ArrayList<>();
|
||||||
|
|
||||||
private ConditionManager(Context context) {
|
private ConditionManager(Context context, boolean loadConditionsNow) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mConditions = new ArrayList<>();
|
mConditions = new ArrayList<>();
|
||||||
new ConditionLoader().execute();
|
if (loadConditionsNow) {
|
||||||
|
ConditionLoader loader = new ConditionLoader();
|
||||||
|
loader.onPostExecute(loader.doInBackground());
|
||||||
|
} else {
|
||||||
|
new ConditionLoader().execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAll() {
|
public void refreshAll() {
|
||||||
@@ -241,8 +246,12 @@ public class ConditionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ConditionManager get(Context context) {
|
public static ConditionManager get(Context context) {
|
||||||
|
return get(context, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConditionManager get(Context context, boolean loadConditionsNow) {
|
||||||
if (sInstance == null) {
|
if (sInstance == null) {
|
||||||
sInstance = new ConditionManager(context.getApplicationContext());
|
sInstance = new ConditionManager(context.getApplicationContext(), loadConditionsNow);
|
||||||
}
|
}
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user