Add preference that, if set, allows board to display in landscape

orientation.  Later a test for screen size will do the same (with
debug pref overriding it to ease testing.)  Board looks like crap in
that mode; will fix next.
This commit is contained in:
Eric House 2014-07-16 20:11:55 -07:00
parent d37ed8ca2a
commit 694d88bbdb
8 changed files with 679 additions and 651 deletions

File diff suppressed because it is too large Load diff

View file

@ -65,6 +65,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>
<!-- database keys whose entries aren't visible prefs -->
<string name="key_closed_langs">key_closed_langs</string>

View file

@ -2263,4 +2263,6 @@
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>
</resources>

View file

@ -332,6 +332,12 @@
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_force_tablet"
android:title="@string/force_tablet_title"
android:summary="@string/force_tablet_summary"
android:defaultValue="false"
/>
<!-- For broken devices like my Blaze 4G that report a download
directory that doesn't exist, allow users to set it. Mine:
/sdcard/external_sd/download

View file

@ -1935,4 +1935,6 @@
ni\n• Woh trams eht tobor reyalp si\n• Tahw sdrow era
lagel.\n\nKcehc eht \"Wohs elbadaolnwod\" xob ta eht pot ot ees
tahw\'s elbaliava.</string>
<string name="force_tablet_title">Ecrof telbat tuoyal</string>
<string name="force_tablet_summary">Neve fi ym neercs si oot llams</string>
</resources>

View file

@ -1935,4 +1935,6 @@
IN\n• HOW SMART THE ROBOT PLAYER IS\n• WHAT WORDS ARE
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>
</resources>

View file

@ -36,9 +36,14 @@ public class BoardActivity extends XWActivity {
m_dlgt = new BoardDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
if ( 9 <= Integer.valueOf( android.os.Build.VERSION.SDK ) ) {
setRequestedOrientation( ActivityInfo.
SCREEN_ORIENTATION_SENSOR_PORTRAIT );
int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
if ( XWPrefs.getIsTablet( this ) ) {
orientation = ActivityInfo.SCREEN_ORIENTATION_USER;
} else if ( 9 <= Integer.valueOf( android.os.Build.VERSION.SDK ) ) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
}
if ( ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED != orientation ) {
setRequestedOrientation( orientation );
}
} // onCreate

View file

@ -464,4 +464,11 @@ public class XWPrefs {
{
return getPrefsBoolean( context, key_checked_upgrades, false );
}
public static boolean getIsTablet( Context context )
{
boolean fakeTablet =
getPrefsBoolean( context, R.string.key_force_tablet, false );
return fakeTablet;
}
}