diff --git a/res/layout/preference_dialog_animation_scale.xml b/res/layout/preference_dialog_animation_scale.xml new file mode 100644 index 00000000000..1ffca2bea57 --- /dev/null +++ b/res/layout/preference_dialog_animation_scale.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + diff --git a/res/values/aosip_attrs.xml b/res/values/aosip_attrs.xml new file mode 100644 index 00000000000..902a9463afd --- /dev/null +++ b/res/values/aosip_attrs.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index dd74e51fffc..e71ef156e19 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -251,19 +251,19 @@ android:title="@string/force_rtl_layout_all_locales" android:summary="@string/force_rtl_layout_all_locales_summary"/> - - - mMax) { + float temp = mMax; + mMax = mMin; + mMin = temp; + } + + setMax(convertFloatToProgress(mMax)); + setProgressFloat(mDefault); + + seekBarType.recycle(); + } + + /* + * Converts from SeekBar units (which the SeekBar uses), to scale units + * (which are saved). + * This operation is the inverse of setFontScaling. + */ + public float getProgressFloat() { + return (getProgress() / mMultiplier) + mMin; + } + + /* + * Converts from scale units (which are saved), to SeekBar units + * (which the SeekBar uses). This also sets the SeekBar progress. + * This operation is the inverse of getProgressFloat. + */ + public void setProgressFloat(float progress) { + setProgress(convertFloatToProgress(progress)); + } + + private int convertFloatToProgress(float value) { + return Math.round((value - mMin) * mMultiplier); + } + + public float getMinimum() { + return mMin; + } + + public float getMaximum() { + return mMax; + } + + public float getDefault() { + return mDefault; + } + + public void setMaximum(float max) { + mMax = max; + setMax(convertFloatToProgress(mMax)); + } + + public void setMinimum(float min) { + mMin = min; + } +}