change divider attr to multiplication
This commit is contained in:
parent
d4f17d2c9a
commit
1ede004545
@ -2,7 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<declare-styleable name="SeekBarPreference">
|
<declare-styleable name="SeekBarPreference">
|
||||||
<attr name="sbpMaxValue" format="integer"/>
|
<attr name="sbpMaxValue" format="integer"/>
|
||||||
<attr name="sbpSummaryValueDivider" format="float"/>
|
<attr name="sbpSummaryValueMultiplication" format="float"/>
|
||||||
<attr name="sbpSummaryValueAddition" format="float"/>
|
<attr name="sbpSummaryValueAddition" format="float"/>
|
||||||
<attr name="sbpSummaryText" format="string"/>
|
<attr name="sbpSummaryText" format="string"/>
|
||||||
<attr name="sbpSummaryFormat" format="string"/>
|
<attr name="sbpSummaryFormat" format="string"/>
|
||||||
|
@ -43,8 +43,9 @@ THE SOFTWARE.
|
|||||||
vanilla:sbpMaxValue="150"
|
vanilla:sbpMaxValue="150"
|
||||||
vanilla:sbpSummaryFormat="%s%+.1fdB"
|
vanilla:sbpSummaryFormat="%s%+.1fdB"
|
||||||
vanilla:sbpSummaryValueAddition="-75"
|
vanilla:sbpSummaryValueAddition="-75"
|
||||||
vanilla:sbpSummaryValueDivider="5"
|
vanilla:sbpSummaryValueMultiplication="0.2"
|
||||||
/>
|
/>
|
||||||
|
<!-- x0.2 = /5 -->
|
||||||
<ch.blinkenlights.android.vanilla.SeekBarPreference
|
<ch.blinkenlights.android.vanilla.SeekBarPreference
|
||||||
android:key="replaygain_untagged_debump"
|
android:key="replaygain_untagged_debump"
|
||||||
android:negativeButtonText="@null"
|
android:negativeButtonText="@null"
|
||||||
@ -55,7 +56,7 @@ THE SOFTWARE.
|
|||||||
vanilla:sbpSummaryText="@string/replaygain_untagged_debump_summary"
|
vanilla:sbpSummaryText="@string/replaygain_untagged_debump_summary"
|
||||||
vanilla:sbpSummaryFormat="%s %.1fdB"
|
vanilla:sbpSummaryFormat="%s %.1fdB"
|
||||||
vanilla:sbpSummaryValueAddition="-150"
|
vanilla:sbpSummaryValueAddition="-150"
|
||||||
vanilla:sbpSummaryValueDivider="10" />
|
vanilla:sbpSummaryValueMultiplication="0.1" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
|
@ -44,6 +44,6 @@ THE SOFTWARE.
|
|||||||
android:title="@string/shake_threshold_title"
|
android:title="@string/shake_threshold_title"
|
||||||
android:defaultValue="80"
|
android:defaultValue="80"
|
||||||
vanilla:sbpMaxValue="300"
|
vanilla:sbpMaxValue="300"
|
||||||
vanilla:sbpSummaryValueDivider="10"
|
vanilla:sbpSummaryValueMultiplication="0.1"
|
||||||
android:dependency="enable_shake" />
|
android:dependency="enable_shake" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@ -64,9 +64,9 @@ public class SeekBarPreference extends DialogPreference implements SeekBar.OnSee
|
|||||||
*/
|
*/
|
||||||
private float mSummaryValueAddition;
|
private float mSummaryValueAddition;
|
||||||
/**
|
/**
|
||||||
* Divide summary value by this value
|
* Multiply summary value by this value
|
||||||
*/
|
*/
|
||||||
private float mSummaryValueDivider;
|
private float mSummaryValueMultiplication;
|
||||||
/**
|
/**
|
||||||
* TextView to display current summary
|
* TextView to display current summary
|
||||||
*/
|
*/
|
||||||
@ -89,7 +89,7 @@ public class SeekBarPreference extends DialogPreference implements SeekBar.OnSee
|
|||||||
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SeekBarPreference);
|
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SeekBarPreference);
|
||||||
|
|
||||||
mMaxValue = a.getInteger(R.styleable.SeekBarPreference_sbpMaxValue, 0);
|
mMaxValue = a.getInteger(R.styleable.SeekBarPreference_sbpMaxValue, 0);
|
||||||
mSummaryValueDivider = a.getFloat(R.styleable.SeekBarPreference_sbpSummaryValueDivider, 0f);
|
mSummaryValueMultiplication = a.getFloat(R.styleable.SeekBarPreference_sbpSummaryValueMultiplication, 0f);
|
||||||
mSummaryValueAddition = a.getFloat(R.styleable.SeekBarPreference_sbpSummaryValueAddition, 0f);
|
mSummaryValueAddition = a.getFloat(R.styleable.SeekBarPreference_sbpSummaryValueAddition, 0f);
|
||||||
mSummaryFormat = a.getString(R.styleable.SeekBarPreference_sbpSummaryFormat);
|
mSummaryFormat = a.getString(R.styleable.SeekBarPreference_sbpSummaryFormat);
|
||||||
mSummaryFormat = (mSummaryFormat == null ? "%s %.1f" : mSummaryFormat);
|
mSummaryFormat = (mSummaryFormat == null ? "%s %.1f" : mSummaryFormat);
|
||||||
@ -128,8 +128,8 @@ public class SeekBarPreference extends DialogPreference implements SeekBar.OnSee
|
|||||||
|
|
||||||
if (mSummaryValueAddition != 0f)
|
if (mSummaryValueAddition != 0f)
|
||||||
fValue = fValue + mSummaryValueAddition;
|
fValue = fValue + mSummaryValueAddition;
|
||||||
if (mSummaryValueDivider != 0f)
|
if (mSummaryValueMultiplication != 0f)
|
||||||
fValue = fValue / mSummaryValueDivider;
|
fValue = fValue * mSummaryValueMultiplication;
|
||||||
|
|
||||||
return String.format(mSummaryFormat, mSummaryText, fValue);
|
return String.format(mSummaryFormat, mSummaryText, fValue);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user