use of com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction in project android_packages_apps_Settings by omnirom.
the class BatteryTipPreferenceController method handlePreferenceTreeClick.
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
final BatteryTip batteryTip = mBatteryTipMap.get(preference.getKey());
if (batteryTip != null) {
if (batteryTip.shouldShowDialog()) {
BatteryTipDialogFragment dialogFragment = BatteryTipDialogFragment.newInstance(batteryTip, mFragment.getMetricsCategory());
dialogFragment.setTargetFragment(mFragment, REQUEST_ANOMALY_ACTION);
dialogFragment.show(mFragment.getFragmentManager(), TAG);
} else {
final BatteryTipAction action = BatteryTipUtils.getActionForBatteryTip(batteryTip, mSettingsActivity, mFragment);
if (action != null) {
action.handlePositiveAction(mFragment.getMetricsCategory());
}
if (mBatteryTipListener != null) {
mBatteryTipListener.onBatteryTipHandled(batteryTip);
}
}
return true;
}
return super.handlePreferenceTreeClick(preference);
}
use of com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipDialogFragment method onClick.
@Override
public void onClick(DialogInterface dialog, int which) {
final BatteryTipListener lsn = (BatteryTipListener) getTargetFragment();
if (lsn == null) {
return;
}
final BatteryTipAction action = BatteryTipUtils.getActionForBatteryTip(mBatteryTip, (SettingsActivity) getActivity(), (InstrumentedPreferenceFragment) getTargetFragment());
if (action != null) {
action.handlePositiveAction(mMetricsKey);
}
lsn.onBatteryTipHandled(mBatteryTip);
}
use of com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipPreferenceController method handlePreferenceTreeClick.
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
final BatteryTip batteryTip = mBatteryTipMap.get(preference.getKey());
if (batteryTip != null) {
if (batteryTip.shouldShowDialog()) {
BatteryTipDialogFragment dialogFragment = BatteryTipDialogFragment.newInstance(batteryTip, mFragment.getMetricsCategory());
dialogFragment.setTargetFragment(mFragment, REQUEST_ANOMALY_ACTION);
dialogFragment.show(mFragment.getFragmentManager(), TAG);
} else {
final BatteryTipAction action = BatteryTipUtils.getActionForBatteryTip(batteryTip, mSettingsActivity, mFragment);
if (action != null) {
action.handlePositiveAction(mFragment.getMetricsCategory());
}
if (mBatteryTipListener != null) {
mBatteryTipListener.onBatteryTipHandled(batteryTip);
}
}
return true;
}
return super.handlePreferenceTreeClick(preference);
}
use of com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction in project android_packages_apps_Settings by omnirom.
the class BatteryTipDialogFragment method onClick.
@Override
public void onClick(DialogInterface dialog, int which) {
final BatteryTipListener lsn = (BatteryTipListener) getTargetFragment();
if (lsn == null) {
return;
}
final BatteryTipAction action = BatteryTipUtils.getActionForBatteryTip(mBatteryTip, (SettingsActivity) getActivity(), (InstrumentedPreferenceFragment) getTargetFragment());
if (action != null) {
action.handlePositiveAction(mMetricsKey);
}
lsn.onBatteryTipHandled(mBatteryTip);
}
Aggregations