mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-06 20:45:54 +01:00
use "pct." to indicate what thumb scale choices mean. '%' triggers a
known crasher in Android.
This commit is contained in:
parent
7be3a3bef8
commit
75d9752024
4 changed files with 15 additions and 6 deletions
|
@ -2192,4 +2192,6 @@
|
|||
means that any time a board that\'s missing a player is open, you
|
||||
can tap a nearby person\'s device to invite him/her to
|
||||
play – if he/she is also using NFC.</string>
|
||||
|
||||
<string name="pct_suffix">\u0020pct.</string>
|
||||
</resources>
|
||||
|
|
|
@ -119,10 +119,11 @@
|
|||
android:defaultValue="true"
|
||||
/>
|
||||
|
||||
<!-- " 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"
|
||||
android:defaultValue="30 pct."
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
|
|
|
@ -350,10 +350,13 @@ public class XWPrefs {
|
|||
public static int getThumbPct( Context context )
|
||||
{
|
||||
String pct = getPrefsString( context, R.string.key_thumbsize );
|
||||
int result = 30;
|
||||
if ( null != pct && 2 <= pct.length() ) {
|
||||
// result = Integer.parseInt( pct.substring( 0, pct.length() - 1 ) );
|
||||
result = Integer.parseInt( pct );
|
||||
int result;
|
||||
try {
|
||||
String suffix = context.getString( R.string.pct_suffix );
|
||||
result = Integer.parseInt( pct.substring( 0, pct.length()
|
||||
- suffix.length() ) );
|
||||
} catch (Exception ex ) {
|
||||
result = 30;
|
||||
}
|
||||
DbgUtils.logf( "pct: %s => %d", pct, result );
|
||||
return result;
|
||||
|
|
|
@ -24,10 +24,12 @@ import android.content.Context;
|
|||
import android.util.AttributeSet;
|
||||
|
||||
public class XWThumbListPreference extends XWListPreference {
|
||||
private Context m_context;
|
||||
|
||||
public XWThumbListPreference( Context context, AttributeSet attrs )
|
||||
{
|
||||
super( context, attrs );
|
||||
m_context = context;
|
||||
}
|
||||
|
||||
// Why I exist: insert the rowid and gameid lines if debug is on
|
||||
|
@ -37,8 +39,9 @@ public class XWThumbListPreference extends XWListPreference {
|
|||
|
||||
CharSequence[] newEntries = new CharSequence[6];
|
||||
int indx = 0;
|
||||
String suffix = m_context.getString( R.string.pct_suffix );
|
||||
for ( int pct = 20; pct <= 45; pct += 5 ) {
|
||||
newEntries[indx++] = String.format( "%d", pct );
|
||||
newEntries[indx++] = String.format( "%d%s", pct, suffix );
|
||||
}
|
||||
setEntries( newEntries );
|
||||
setEntryValues( newEntries );
|
||||
|
|
Loading…
Add table
Reference in a new issue