Accomodating multiple preview screen with ViewPager for the users to

swipe across, along with some UI refinements.

Change-Id: I9487bcce88cdab490a4b6baa752224acddc5be52
This commit is contained in:
Noah Wang
2016-01-12 09:00:57 -08:00
parent 4ccc2c3537
commit 49fabb9b47
13 changed files with 317 additions and 132 deletions

View File

@@ -41,7 +41,7 @@ public class ToggleFontSizePreferenceFragment extends PreviewSeekBarPreferenceFr
super.onCreate(savedInstanceState);
mActivityLayoutResId = R.layout.font_size_activity;
mPreviewSampleResId = R.layout.font_size_preview;
mPreviewSampleResIds = new int[]{R.layout.font_size_preview};
Resources res = getContext().getResources();
// Mark the appropriate item in the preferences list.
@@ -82,7 +82,11 @@ public class ToggleFontSizePreferenceFragment extends PreviewSeekBarPreferenceFr
return InstrumentedFragment.ACCESSIBILITY_FONT_SIZE;
}
private int floatToIndex(float val, String[] indices) {
/**
* Utility function that returns the index in a string array with which the represented value is
* the closest to a given float value.
*/
static int floatToIndex(float val, String[] indices) {
float lastVal = Float.parseFloat(indices[0]);
for (int i=1; i<indices.length; i++) {
float thisVal = Float.parseFloat(indices[i]);