make force-tablet debug pref a three-way

Rather than force/don't, which doesn't let tablets force themselves to
be phones, allow choice between OS default and forcing either way.
This commit is contained in:
Eric House 2017-04-08 10:48:51 -07:00
parent 32140ff4e5
commit 1f3d1cbb79
4 changed files with 30 additions and 11 deletions

View file

@ -471,9 +471,17 @@ public class XWPrefs {
public static boolean getIsTablet( Context context )
{
boolean result = isTablet( context ) ||
getPrefsBoolean( context, R.string.key_force_tablet, false );
// DbgUtils.logf( "getIsTablet() => %b", result );
boolean result = isTablet( context );
String setting = getPrefsString( context, R.string.key_force_tablet );
if ( setting.equals( context.getString(R.string.force_tablet_os) ) ) {
// Leave it alone
} else if ( setting.equals( context.getString(R.string.force_tablet_tablet) ) ) {
result = true;
} else if ( setting.equals( context.getString(R.string.force_tablet_phone) ) ) {
result = false;
}
// Log.d( TAG, "getIsTablet() => %b (got %s)", result, setting );
return result;
}

View file

@ -68,7 +68,7 @@
<string name="key_summary_field">key_summary_field</string>
<string name="key_default_loc">key_default_loc</string>
<string name="key_force_tablet">key_force_tablet</string>
<string name="key_force_tablet">key_force_tablet2</string>
<string name="key_disable_dualpane">key_disable_dualpane2</string>
<string name="key_force_radio">key_force_radio</string>
<string name="key_addrs_pref">key_addrs_pref</string>
@ -315,6 +315,12 @@
<item>@string/radio_name_cdma</item>
</string-array>
<string-array name="force_tablet_names">
<item>@string/force_tablet_os</item>
<item>@string/force_tablet_phone</item>
<item>@string/force_tablet_tablet</item>
</string-array>
<!-- Keep in sync with LocSearcher SHOW_BYS enum -->
<string-array name="loc_filters">
<item>@string/loc_filters_all</item>

View file

@ -2315,8 +2315,11 @@
legal.\n\nCheck the \"Show downloadable\" box at the top to see
what\'s available.</string>
<string name="force_tablet_title">Force tablet layout</string>
<string name="force_tablet_summary">Even if my screen is too small</string>
<string name="force_tablet_title">Use tablet (side-by-side) layout?</string>
<string name="force_tablet_os">OS decides</string>
<string name="force_tablet_tablet">Force tablet layout</string>
<string name="force_tablet_phone">Force phone layout</string>
<string name="disable_dualpane_summary">Side-by-side views on tablets</string>
<!-- Nagging: title of notification reminder message -->

View file

@ -429,10 +429,12 @@
/>
</PreferenceScreen>
<CheckBoxPreference android:key="@string/key_force_tablet"
<org.eehouse.android.xw4.XWListPreference
android:key="@string/key_force_tablet"
android:title="@string/force_tablet_title"
android:summary="@string/force_tablet_summary"
android:defaultValue="false"
android:entries="@array/force_tablet_names"
android:entryValues="@array/force_tablet_names"
android:defaultValue="@string/force_tablet_os"
/>
<PreferenceScreen android:title="@string/pref_group_l10n_title"