Fix bug #10624988 Incorrect mirroring of RAM and Internal Storage for Apps screens in Settings

- well this CL is only for preventing a wrong rendering (the real CL would need to be one latter
and would need to fix the onDraw(Canvas) for LinearColorBar so that it takes care of the layout direction)
- force LTR layout direction on the LinearColorBar, hence preventing the two TextView to render their
text "in the middle".
- use BidiFormatter to wrap number strings

Change-Id: Ie164e5509c0364a81c85a3ac69f97a89f20a4130
This commit is contained in:
Fabrice Di Meglio
2013-09-05 17:02:28 -07:00
parent 5aacc54289
commit 37f3c8f574
4 changed files with 29 additions and 12 deletions

View File

@@ -50,6 +50,7 @@ import android.provider.Settings;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.text.BidiFormatter;
import android.text.format.Formatter;
import android.util.Log;
import android.view.LayoutInflater;
@@ -385,20 +386,21 @@ public class ManageApplications extends Fragment implements
return;
}
if (mTotalStorage > 0) {
BidiFormatter bidiFormatter = BidiFormatter.getInstance();
mColorBar.setRatios((mTotalStorage-mFreeStorage-mAppStorage)/(float)mTotalStorage,
mAppStorage/(float)mTotalStorage, mFreeStorage/(float)mTotalStorage);
long usedStorage = mTotalStorage - mFreeStorage;
if (mLastUsedStorage != usedStorage) {
mLastUsedStorage = usedStorage;
String sizeStr = Formatter.formatShortFileSize(
mOwner.getActivity(), usedStorage);
String sizeStr = bidiFormatter.unicodeWrap(
Formatter.formatShortFileSize(mOwner.getActivity(), usedStorage));
mUsedStorageText.setText(mOwner.getActivity().getResources().getString(
R.string.service_foreground_processes, sizeStr));
}
if (mLastFreeStorage != mFreeStorage) {
mLastFreeStorage = mFreeStorage;
String sizeStr = Formatter.formatShortFileSize(
mOwner.getActivity(), mFreeStorage);
String sizeStr = bidiFormatter.unicodeWrap(
Formatter.formatShortFileSize(mOwner.getActivity(), mFreeStorage));
mFreeStorageText.setText(mOwner.getActivity().getResources().getString(
R.string.service_background_processes, sizeStr));
}