Start cleaning up percentage formatting in Settings.

This fixes some of the percentage formatting issues, but there are
still about ten strings with hard-coded %%s in them.

Bug: 15476051
Change-Id: I668b6b16e598425f6006f6de0005c980f613f5b2
This commit is contained in:
Elliott Hughes
2014-09-02 17:10:14 -07:00
parent b58b512704
commit 7253df35a0
9 changed files with 95 additions and 114 deletions

View File

@@ -26,6 +26,7 @@ import android.text.format.Formatter;
import android.util.Log;
import android.util.TimeUtils;
import com.android.settings.R;
import com.android.settings.Utils;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -489,10 +490,8 @@ public class BatteryHistoryChart extends View {
mCpuRunningLabel = getContext().getString(R.string.battery_stats_wake_lock_label);
mPhoneSignalLabel = getContext().getString(R.string.battery_stats_phone_signal_label);
mMaxPercentLabelString = getContext().getResources().getString(
R.string.percentage, 100);
mMinPercentLabelString = getContext().getResources().getString(
R.string.percentage, 0);
mMaxPercentLabelString = Utils.formatPercentage(100);
mMinPercentLabelString = Utils.formatPercentage(0);
mBatteryLevel = com.android.settings.Utils.getBatteryLevel(mBatteryBroadcast);
long remainingTimeUs = 0;
@@ -506,8 +505,7 @@ public class BatteryHistoryChart extends View {
mChargeLabelString = getContext().getResources().getString(
R.string.power_discharging_duration, mBatteryLevel, timeString);
} else {
mChargeLabelString = getContext().getResources().getString(
R.string.power_discharging, mBatteryLevel);
mChargeLabelString = Utils.formatPercentage(mBatteryLevel);
}
} else {
final long chargeTime = mStats.computeChargeTimeRemaining(elapsedRealtimeUs);