fix so prefs doesn't crash when pct_suffix is translated

This commit is contained in:
Eric House 2015-03-16 07:10:41 -07:00
parent 84a291216e
commit a055815b70
3 changed files with 9 additions and 7 deletions

View file

@ -2682,7 +2682,7 @@ pouvez utiliser l\'application des Paramètres Android pour l\'allumer.</string>
<string name="sms_ready_text">Toucher le périphérique récepteur maintenant</string>
<!--<string name="pct_suffix">\u0020pct.</string>-->
<string name="pct_suffix">\u0020pct.</string>
<string name="pct_suffix">\u0020prct.</string>
<!--<string name="menu_rateme">Rate Crosswords</string>-->
<string name="menu_rateme">Évaluer Crosswords</string>

View file

@ -102,11 +102,10 @@
android:key="@string/prefs_appearance"
>
<!-- " pct." below must match R.string.pct_suffix -->
<org.eehouse.android.xw4.XWThumbListPreference
android:key="@string/key_thumbsize"
android:title="@string/summary_thumbsize"
android:defaultValue="30 pct."
android:defaultValue="30"
/>
<org.eehouse.android.xw4.XWSumListPreference

View file

@ -40,11 +40,14 @@ public class XWThumbListPreference extends XWListPreference {
super.onAttachedToActivity();
CharSequence[] newEntries = new CharSequence[7];
int indx = 0;
newEntries[indx++] = LocUtils.getString( m_context, R.string.thumb_off );
newEntries[0] = LocUtils.getString( m_context, R.string.thumb_off );
CharSequence[] newEntryValues = new CharSequence[7];
newEntryValues[0] = "0";
String suffix = LocUtils.getString( m_context, R.string.pct_suffix );
for ( int pct = 20; pct <= 45; pct += 5 ) {
newEntries[indx++] = String.format( "%d%s", pct, suffix );
for ( int ii = 1; ii < newEntries.length; ++ii ) {
int pct = 15 + (ii * 5);
newEntries[ii] = String.format( "%d%s", pct, suffix );
newEntryValues[ii] = String.format( "%d", pct );
}
setEntries( newEntries );
setEntryValues( newEntries );