use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by DirtyUnicorns.
the class DashboardSummary method onResume.
@Override
public void onResume() {
long startTime = System.currentTimeMillis();
super.onResume();
((SettingsDrawerActivity) getActivity()).addCategoryListener(this);
mSummaryLoader.setListening(true);
final int metricsCategory = getMetricsCategory();
for (Condition c : mConditionManager.getConditions()) {
if (c.shouldShow()) {
mMetricsFeatureProvider.visible(getContext(), metricsCategory, c.getMetricsConstant());
}
}
if (DEBUG_TIMING) {
Log.d(TAG, "onResume took " + (System.currentTimeMillis() - startTime) + " ms");
}
}
use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by DirtyUnicorns.
the class DashboardSummary method onPause.
@Override
public void onPause() {
super.onPause();
((SettingsDrawerActivity) getActivity()).remCategoryListener(this);
mSummaryLoader.setListening(false);
for (Condition c : mConditionManager.getConditions()) {
if (c.shouldShow()) {
mMetricsFeatureProvider.hidden(getContext(), c.getMetricsConstant());
}
}
if (!getActivity().isChangingConfigurations()) {
mAdapter.onPause();
}
}
use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by DirtyUnicorns.
the class DashboardAdapter method onBindConditionAndSuggestion.
@VisibleForTesting
void onBindConditionAndSuggestion(final SuggestionAndConditionContainerHolder holder, int position) {
// If there is suggestions to show, it will be at position 0 as we don't show the suggestion
// header anymore.
final List<Tile> suggestions = mDashboardData.getSuggestions();
if (position == SUGGESTION_CONDITION_HEADER_POSITION && suggestions != null && suggestions.size() > 0) {
mSuggestionAdapter = new SuggestionAdapter(mContext, (List<Tile>) mDashboardData.getItemEntityByPosition(position), mSuggestionsShownLogged);
mSuggestionDismissHandler = new SuggestionDismissController(mContext, holder.data, mSuggestionParser, mCallback);
holder.data.setAdapter(mSuggestionAdapter);
} else {
ConditionAdapter adapter = new ConditionAdapter(mContext, (List<Condition>) mDashboardData.getItemEntityByPosition(position), mDashboardData.getSuggestionConditionMode());
adapter.addDismissHandling(holder.data);
holder.data.setAdapter(adapter);
}
holder.data.setLayoutManager(new LinearLayoutManager(mContext));
}
use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by crdroidandroid.
the class DashboardData method getConditionsToShow.
private List<Condition> getConditionsToShow(List<Condition> conditions) {
if (conditions == null) {
return null;
}
List<Condition> result = new ArrayList<Condition>();
final int size = conditions == null ? 0 : conditions.size();
for (int i = 0; i < size; i++) {
final Condition condition = conditions.get(i);
if (condition.shouldShow()) {
result.add(condition);
}
}
return result;
}
use of com.android.settings.dashboard.conditional.Condition in project android_packages_apps_Settings by crdroidandroid.
the class DashboardSummary method onPause.
@Override
public void onPause() {
super.onPause();
((SettingsDrawerActivity) getActivity()).remCategoryListener(this);
// Settings, Won't refresh when Fragment 'onPause()', 2018-2-3, end
for (Condition c : mConditionManager.getConditions()) {
if (c.shouldShow()) {
mMetricsFeatureProvider.hidden(getContext(), c.getMetricsConstant());
}
}
if (!getActivity().isChangingConfigurations()) {
mAdapter.onPause();
}
}
Aggregations