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

@@ -25,6 +25,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.Utils;
/**
* Custom preference for displaying power consumption as a bar and an icon on
@@ -47,8 +48,7 @@ public class PowerGaugePreference extends Preference {
public void setPercent(double percentOfMax, double percentOfTotal) {
mProgress = (int) Math.ceil(percentOfMax);
mProgressText = getContext().getResources().getString(
R.string.percentage, (int) (percentOfTotal+.5));
mProgressText = Utils.formatPercentage((int) (percentOfTotal + 0.5));
notifyChanged();
}