Search in sources :

Example 6 with AnomalyPreference

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

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 7 with AnomalyPreference

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

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 8 with AnomalyPreference

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

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 9 with AnomalyPreference

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

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 10 with AnomalyPreference

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

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)

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