Search in sources :

Example 1 with SettingsDrawerActivity

use of com.android.settingslib.drawer.SettingsDrawerActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DashboardSummary method onStop.

@Override
public void onStop() {
    super.onStop();
    ((SettingsDrawerActivity) getActivity()).remCategoryListener(this);
    mSummaryLoader.setListening(false);
    for (Condition c : mConditionManager.getConditions()) {
        if (c.shouldShow()) {
            MetricsLogger.hidden(getContext(), c.getMetricsConstant());
        }
    }
    if (mAdapter.getSuggestions() == null) {
        return;
    }
    if (!getActivity().isChangingConfigurations()) {
        for (Tile suggestion : mAdapter.getSuggestions()) {
            String id = DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion);
            if (!mSuggestionsHiddenLogged.contains(id)) {
                mSuggestionsHiddenLogged.add(id);
                MetricsLogger.action(getContext(), MetricsEvent.ACTION_HIDE_SETTINGS_SUGGESTION, id);
            }
        }
    }
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) Tile(com.android.settingslib.drawer.Tile) SettingsDrawerActivity(com.android.settingslib.drawer.SettingsDrawerActivity)

Example 2 with SettingsDrawerActivity

use of com.android.settingslib.drawer.SettingsDrawerActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SummaryLoader method setSummary.

public void setSummary(SummaryProvider provider, final CharSequence summary) {
    final ComponentName component = mSummaryMap.get(provider);
    mHandler.post(new Runnable() {

        @Override
        public void run() {
            // we need to always get the latest one.
            if (!(mActivity instanceof SettingsDrawerActivity)) {
                if (DEBUG) {
                    Log.d(TAG, "Can't get category list.");
                }
                return;
            }
            final List<DashboardCategory> categories = ((SettingsDrawerActivity) mActivity).getDashboardCategories();
            final Tile tile = getTileFromCategory(categories, component);
            if (tile == null) {
                if (DEBUG) {
                    Log.d(TAG, "Can't find tile for " + component);
                }
                return;
            }
            if (DEBUG) {
                Log.d(TAG, "setSummary " + tile.title + " - " + summary);
            }
            tile.summary = summary;
            mAdapter.notifyChanged(tile);
        }
    });
}
Also used : Tile(com.android.settingslib.drawer.Tile) ComponentName(android.content.ComponentName) ArrayList(java.util.ArrayList) List(java.util.List) SettingsDrawerActivity(com.android.settingslib.drawer.SettingsDrawerActivity)

Example 3 with SettingsDrawerActivity

use of com.android.settingslib.drawer.SettingsDrawerActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DashboardSummary method onStart.

@Override
public void onStart() {
    long startTime = System.currentTimeMillis();
    super.onStart();
    ((SettingsDrawerActivity) getActivity()).addCategoryListener(this);
    mSummaryLoader.setListening(true);
    for (Condition c : mConditionManager.getConditions()) {
        if (c.shouldShow()) {
            MetricsLogger.visible(getContext(), c.getMetricsConstant());
        }
    }
    if (mAdapter.getSuggestions() != null) {
        for (Tile suggestion : mAdapter.getSuggestions()) {
            MetricsLogger.action(getContext(), MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
        }
    }
    if (DEBUG_TIMING)
        Log.d(TAG, "onStart took " + (System.currentTimeMillis() - startTime) + " ms");
    updateSettings();
}
Also used : Condition(com.android.settings.dashboard.conditional.Condition) Tile(com.android.settingslib.drawer.Tile) SettingsDrawerActivity(com.android.settingslib.drawer.SettingsDrawerActivity)

Aggregations

SettingsDrawerActivity (com.android.settingslib.drawer.SettingsDrawerActivity)3 Tile (com.android.settingslib.drawer.Tile)3 Condition (com.android.settings.dashboard.conditional.Condition)2 ComponentName (android.content.ComponentName)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1