X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcom%2Fandroid%2Fsettings%2Ffuelgauge%2Fbatterytip%2FBatteryTipDialogFragment.java;h=74c65f955ee62e79d6f0716aab00ade82857e2ff;hb=40bb1e8488dcfd90d2ce7c7f4a0dc106853c3444;hp=cb508b34c0bc837fb8b8325c7a32bc0c1fd18d55;hpb=895f7854703d260b8565c0b1ba16bd6da2e1dcbf;p=android-x86%2Fpackages-apps-Settings.git diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java index cb508b34c0..74c65f955e 100644 --- a/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java +++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java @@ -51,15 +51,19 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme DialogInterface.OnClickListener { private static final String ARG_BATTERY_TIP = "battery_tip"; + private static final String ARG_METRICS_KEY = "metrics_key"; @VisibleForTesting BatteryTip mBatteryTip; + @VisibleForTesting + int mMetricsKey; - public static BatteryTipDialogFragment newInstance(BatteryTip batteryTip) { + public static BatteryTipDialogFragment newInstance(BatteryTip batteryTip, int metricsKey) { BatteryTipDialogFragment dialogFragment = new BatteryTipDialogFragment(); Bundle args = new Bundle(1); args.putParcelable(ARG_BATTERY_TIP, batteryTip); + args.putInt(ARG_METRICS_KEY, metricsKey); dialogFragment.setArguments(args); return dialogFragment; @@ -71,6 +75,7 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme final Context context = getContext(); mBatteryTip = bundle.getParcelable(ARG_BATTERY_TIP); + mMetricsKey = bundle.getInt(ARG_METRICS_KEY); switch (mBatteryTip.getType()) { case BatteryTip.TipType.SUMMARY: @@ -97,7 +102,10 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme return new AlertDialog.Builder(context) .setMessage(getString(R.string.battery_tip_dialog_message, - highUsageTip.getHighUsageAppList().size())) + highUsageTip.getHighUsageAppList().size(), + StringUtil.formatRelativeTime(context, + highUsageTip.getLastFullChargeTimeMs(), + false /* withSeconds */))) .setView(view) .setPositiveButton(android.R.string.ok, null) .create(); @@ -163,7 +171,7 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme (SettingsActivity) getActivity(), (InstrumentedPreferenceFragment) getTargetFragment()); if (action != null) { - action.handlePositiveAction(); + action.handlePositiveAction(mMetricsKey); } lsn.onBatteryTipHandled(mBatteryTip); }