mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
combine thumbnail prefs to reduce nesting
This commit is contained in:
parent
0b00f303bb
commit
42800851d3
6 changed files with 22 additions and 33 deletions
|
@ -58,7 +58,6 @@
|
|||
<string name="key_enable_sms">key_enable_sms</string>
|
||||
<string name="key_keep_screenon">key_keep_screenon</string>
|
||||
<string name="key_thumbsize">key_thumbsize3</string>
|
||||
<string name="key_thumb_enabled">key_thumb_disabled</string>
|
||||
|
||||
<string name="key_summary_field">key_summary_field</string>
|
||||
<string name="key_default_loc">key_default_loc</string>
|
||||
|
|
|
@ -2166,13 +2166,11 @@
|
|||
<string name="sel_gamesf">Games: %d</string>
|
||||
<string name="sel_groupsf">Groups: %d</string>
|
||||
<string name="summary_thumbsize">Thumbnail size</string>
|
||||
<string name="thumb_off">Disabled</string>
|
||||
<string name="sel_dictsf">Wordlists: %d</string>
|
||||
|
||||
<string name="thumb_enabled">Show thumbnails</string>
|
||||
<string name="summary_thumb_enabled">Display snapshots of games</string>
|
||||
<!-- <string name="summary_thumb_enabled">Display snapshots of games</string> -->
|
||||
|
||||
<string name="prefs_thumb">Thumbnails</string>
|
||||
<string name="prefs_thumb_summary">Setting for game snapshots</string>
|
||||
<string name="dropped_dupe">Invitation received but ignored: it
|
||||
has already been used to create a game.</string>
|
||||
<string name="cur_menu_markerf">%1$s (yours)</string>
|
||||
|
|
|
@ -110,22 +110,13 @@
|
|||
<PreferenceScreen android:title="@string/prefs_appearance"
|
||||
android:summary="@string/prefs_appearance_summary"
|
||||
>
|
||||
<PreferenceScreen android:title="@string/prefs_thumb"
|
||||
android:summary="@string/prefs_thumb_summary"
|
||||
>
|
||||
<CheckBoxPreference android:key="@string/key_thumb_enabled"
|
||||
android:title="@string/thumb_enabled"
|
||||
android:summary="@string/summary_thumb_enabled"
|
||||
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 pct."
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
<!-- " 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."
|
||||
/>
|
||||
|
||||
<org.eehouse.android.xw4.XWSumListPreference
|
||||
android:key="@string/key_summary_field"
|
||||
|
|
|
@ -45,7 +45,6 @@ public class PrefsActivity extends PreferenceActivity
|
|||
private String m_smsToasting;
|
||||
private String m_smsEnable;
|
||||
private String m_downloadPath;
|
||||
private String m_thumbEnabled;
|
||||
private String m_thumbSize;
|
||||
private String m_hideTitle;
|
||||
|
||||
|
@ -137,7 +136,6 @@ public class PrefsActivity extends PreferenceActivity
|
|||
m_smsToasting = getString( R.string.key_show_sms );
|
||||
m_smsEnable = getString( R.string.key_enable_sms );
|
||||
m_downloadPath = getString( R.string.key_download_path );
|
||||
m_thumbEnabled = getString( R.string.key_thumb_enabled );
|
||||
m_thumbSize = getString( R.string.key_thumbsize );
|
||||
m_hideTitle = getString( R.string.key_hide_title );
|
||||
|
||||
|
@ -202,8 +200,7 @@ public class PrefsActivity extends PreferenceActivity
|
|||
}
|
||||
}
|
||||
DictUtils.invalDictList();
|
||||
} else if ( key.equals( m_thumbEnabled )
|
||||
|| key.equals( m_thumbSize ) ) {
|
||||
} else if ( key.equals( m_thumbSize ) ) {
|
||||
DBUtils.clearThumbnails( this );
|
||||
} else if ( key.equals( m_hideTitle ) ) {
|
||||
if ( sp.getBoolean( key, false ) && ABUtils.haveActionBar() ) {
|
||||
|
|
|
@ -344,21 +344,24 @@ public class XWPrefs {
|
|||
|
||||
public static boolean getThumbEnabled( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_thumb_enabled, false );
|
||||
return 0 < getThumbPct( context );
|
||||
}
|
||||
|
||||
public static int getThumbPct( Context context )
|
||||
{
|
||||
String pct = getPrefsString( context, R.string.key_thumbsize );
|
||||
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;
|
||||
if ( context.getString( R.string.thumb_off ).equals( pct ) ) {
|
||||
result = 0;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ public class XWThumbListPreference extends XWListPreference {
|
|||
{
|
||||
super.onAttachedToActivity();
|
||||
|
||||
CharSequence[] newEntries = new CharSequence[6];
|
||||
CharSequence[] newEntries = new CharSequence[7];
|
||||
int indx = 0;
|
||||
newEntries[indx++] = m_context.getString( R.string.thumb_off );
|
||||
String suffix = m_context.getString( R.string.pct_suffix );
|
||||
for ( int pct = 20; pct <= 45; pct += 5 ) {
|
||||
newEntries[indx++] = String.format( "%d%s", pct, suffix );
|
||||
|
|
Loading…
Reference in a new issue