mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
DroidFish: Added preference setting for left-handed landscape mode.
This commit is contained in:
parent
9661e5a478
commit
a53834d21e
82
DroidFish/res/layout/main_left_handed.xml
Normal file
82
DroidFish/res/layout/main_left_handed.xml
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageButton
|
||||
android:id="@+id/modeButton"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@drawable/mode">
|
||||
</ImageButton>
|
||||
<ImageButton
|
||||
android:id="@+id/undoButton"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@drawable/left">
|
||||
</ImageButton>
|
||||
<ImageButton
|
||||
android:id="@+id/redoButton"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@drawable/right">
|
||||
</ImageButton>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:typeface="monospace"
|
||||
android:textSize="10dip"/>
|
||||
<RelativeLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<view
|
||||
class="org.petero.droidfish.MyScrollView"
|
||||
android:id="@+id/scrollViewBot"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/thinking"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:typeface="monospace"
|
||||
android:textSize="10dip"/>
|
||||
</view>
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_above="@+id/scrollViewBot"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:id="@+id/moveList"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:typeface="monospace"
|
||||
android:textSize="10dip"/>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
<view
|
||||
class="org.petero.droidfish.ChessBoard"
|
||||
android:id="@+id/chessboard"
|
||||
android:layout_weight="0"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
</LinearLayout>
|
|
@ -400,6 +400,8 @@ you are not actively using the program.\
|
|||
<string name="prefs_scrollSensitivity_summary">Scrolling speed for game navigation</string>
|
||||
<string name="prefs_invertScrollDirection_title">Invert Scroll Direction</string>
|
||||
<string name="prefs_invertScrollDirection_summary">Enable this if you think scrolling moves in the wrong direction</string>
|
||||
<string name="prefs_leftHanded_title">Left-handed mode</string>
|
||||
<string name="prefs_leftHanded_summary">Controls on left side in landscape mode</string>
|
||||
<string name="prefs_fontSize_title">Text Size</string>
|
||||
<string name="prefs_fontSize_summary">Font size for move list and game information</string>
|
||||
<string name="prefs_largeButtons_title">Large Buttons</string>
|
||||
|
|
|
@ -146,6 +146,12 @@
|
|||
android:summary="@string/prefs_invertScrollDirection_summary"
|
||||
android:defaultValue="false">
|
||||
</CheckBoxPreference>
|
||||
<CheckBoxPreference
|
||||
android:key="leftHanded"
|
||||
android:title="@string/prefs_leftHanded_title"
|
||||
android:summary="@string/prefs_leftHanded_summary"
|
||||
android:defaultValue="false">
|
||||
</CheckBoxPreference>
|
||||
<ListPreference
|
||||
android:key="fontSize"
|
||||
android:title="@string/prefs_fontSize_title"
|
||||
|
|
|
@ -168,6 +168,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
|
||||
private float scrollSensitivity;
|
||||
private boolean invertScrollDirection;
|
||||
private boolean leftHanded;
|
||||
private boolean soundEnabled;
|
||||
private MediaPlayer moveSound;
|
||||
private boolean animateMoves;
|
||||
|
@ -327,7 +328,9 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
private final void initUI(boolean initTitle) {
|
||||
if (initTitle)
|
||||
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
setContentView(R.layout.main);
|
||||
Configuration config = getResources().getConfiguration();
|
||||
boolean leftHanded = this.leftHanded && (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
setContentView(leftHanded ? R.layout.main_left_handed : R.layout.main);
|
||||
if (initTitle) {
|
||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);
|
||||
whiteClock = (TextView)findViewById(R.id.white_clock);
|
||||
|
@ -593,6 +596,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
|
||||
scrollSensitivity = Float.parseFloat(settings.getString("scrollSensitivity", "2"));
|
||||
invertScrollDirection = settings.getBoolean("invertScrollDirection", false);
|
||||
leftHanded = settings.getBoolean("leftHanded", false);
|
||||
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
||||
setFullScreenMode(fullScreenMode);
|
||||
useWakeLock = settings.getBoolean("wakeLock", false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user