Search in sources :

Example 1 with AnomalyPreference

use of com.android.settings.fuelgauge.anomaly.AnomalyPreference in project android_packages_apps_Settings by crdroidandroid.

the class PowerUsageAnomalyDetails method refreshUi.

void refreshUi() {
    mAbnormalListGroup.removeAll();
    for (int i = 0, size = mAnomalies.size(); i < size; i++) {
        final Anomaly anomaly = mAnomalies.get(i);
        Preference pref = new AnomalyPreference(getPrefContext(), anomaly);
        pref.setSummary(mBatteryUtils.getSummaryResIdFromAnomalyType(anomaly.type));
        Drawable icon = getBadgedIcon(anomaly.packageName, UserHandle.getUserId(anomaly.uid));
        if (icon != null) {
            pref.setIcon(icon);
        }
        mAbnormalListGroup.addPreference(pref);
    }
}
Also used : AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Preference(android.support.v7.preference.Preference) AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Drawable(android.graphics.drawable.Drawable) Anomaly(com.android.settings.fuelgauge.anomaly.Anomaly)

Example 2 with AnomalyPreference

use of com.android.settings.fuelgauge.anomaly.AnomalyPreference in project android_packages_apps_Settings by SudaMod.

the class PowerUsageAnomalyDetails method onPreferenceTreeClick.

@Override
public boolean onPreferenceTreeClick(Preference preference) {
    if (preference instanceof AnomalyPreference) {
        AnomalyPreference anomalyPreference = (AnomalyPreference) preference;
        final Anomaly anomaly = anomalyPreference.getAnomaly();
        AnomalyDialogFragment dialogFragment = AnomalyDialogFragment.newInstance(anomaly, MetricsProto.MetricsEvent.FUELGAUGE_ANOMALY_DETAIL);
        dialogFragment.setTargetFragment(this, REQUEST_ANOMALY_ACTION);
        dialogFragment.show(getFragmentManager(), TAG);
        return true;
    }
    return super.onPreferenceTreeClick(preference);
}
Also used : AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) AnomalyDialogFragment(com.android.settings.fuelgauge.anomaly.AnomalyDialogFragment) Anomaly(com.android.settings.fuelgauge.anomaly.Anomaly)

Example 3 with AnomalyPreference

use of com.android.settings.fuelgauge.anomaly.AnomalyPreference in project android_packages_apps_Settings by SudaMod.

the class PowerUsageAnomalyDetails method refreshUi.

void refreshUi() {
    mAbnormalListGroup.removeAll();
    for (int i = 0, size = mAnomalies.size(); i < size; i++) {
        final Anomaly anomaly = mAnomalies.get(i);
        Preference pref = new AnomalyPreference(getPrefContext(), anomaly);
        pref.setSummary(mBatteryUtils.getSummaryResIdFromAnomalyType(anomaly.type));
        Drawable icon = getBadgedIcon(anomaly.packageName, UserHandle.getUserId(anomaly.uid));
        if (icon != null) {
            pref.setIcon(icon);
        }
        mAbnormalListGroup.addPreference(pref);
    }
}
Also used : AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Preference(android.support.v7.preference.Preference) AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Drawable(android.graphics.drawable.Drawable) Anomaly(com.android.settings.fuelgauge.anomaly.Anomaly)

Example 4 with AnomalyPreference

use of com.android.settings.fuelgauge.anomaly.AnomalyPreference in project android_packages_apps_Settings by DirtyUnicorns.

the class PowerUsageAnomalyDetails method refreshUi.

void refreshUi() {
    mAbnormalListGroup.removeAll();
    for (int i = 0, size = mAnomalies.size(); i < size; i++) {
        final Anomaly anomaly = mAnomalies.get(i);
        Preference pref = new AnomalyPreference(getPrefContext(), anomaly);
        pref.setSummary(mBatteryUtils.getSummaryResIdFromAnomalyType(anomaly.type));
        Drawable icon = getBadgedIcon(anomaly.packageName, UserHandle.getUserId(anomaly.uid));
        if (icon != null) {
            pref.setIcon(icon);
        }
        mAbnormalListGroup.addPreference(pref);
    }
}
Also used : AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Preference(android.support.v7.preference.Preference) AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Drawable(android.graphics.drawable.Drawable) Anomaly(com.android.settings.fuelgauge.anomaly.Anomaly)

Example 5 with AnomalyPreference

use of com.android.settings.fuelgauge.anomaly.AnomalyPreference in project platform_packages_apps_Settings by BlissRoms.

the class PowerUsageAnomalyDetails method refreshUi.

void refreshUi() {
    mAbnormalListGroup.removeAll();
    for (int i = 0, size = mAnomalies.size(); i < size; i++) {
        final Anomaly anomaly = mAnomalies.get(i);
        Preference pref = new AnomalyPreference(getPrefContext(), anomaly);
        pref.setSummary(mBatteryUtils.getSummaryResIdFromAnomalyType(anomaly.type));
        Drawable icon = getBadgedIcon(anomaly.packageName, UserHandle.getUserId(anomaly.uid));
        if (icon != null) {
            pref.setIcon(icon);
        }
        mAbnormalListGroup.addPreference(pref);
    }
}
Also used : AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Preference(android.support.v7.preference.Preference) AnomalyPreference(com.android.settings.fuelgauge.anomaly.AnomalyPreference) Drawable(android.graphics.drawable.Drawable) Anomaly(com.android.settings.fuelgauge.anomaly.Anomaly)

Aggregations

Anomaly (com.android.settings.fuelgauge.anomaly.Anomaly)12 AnomalyPreference (com.android.settings.fuelgauge.anomaly.AnomalyPreference)12 Drawable (android.graphics.drawable.Drawable)6 Preference (android.support.v7.preference.Preference)6 AnomalyDialogFragment (com.android.settings.fuelgauge.anomaly.AnomalyDialogFragment)6