mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-17 11:12:17 +01:00
DroidFish: Added option to control title bar scrolling.
This commit is contained in:
@@ -262,6 +262,8 @@ you are not actively using the program.\
|
|||||||
<string name="prefs_user_interface_behavior">Behavior</string>
|
<string name="prefs_user_interface_behavior">Behavior</string>
|
||||||
<string name="prefs_animateMoves_title">Animate Moves</string>
|
<string name="prefs_animateMoves_title">Animate Moves</string>
|
||||||
<string name="prefs_animateMoves_summary">Animate piece movements</string>
|
<string name="prefs_animateMoves_summary">Animate piece movements</string>
|
||||||
|
<string name="prefs_autoScrollTitle_title">Titlebar Scrolling</string>
|
||||||
|
<string name="prefs_autoScrollTitle_summary">Auto scroll titlebar if player names are too long</string>
|
||||||
<string name="prefs_quickMoveInput_title">Quick Move Input</string>
|
<string name="prefs_quickMoveInput_title">Quick Move Input</string>
|
||||||
<string name="prefs_quickMoveInput_summary">From and To squares can be touched in any order. Move is played as soon as uniquely defined.</string>
|
<string name="prefs_quickMoveInput_summary">From and To squares can be touched in any order. Move is played as soon as uniquely defined.</string>
|
||||||
<string name="prefs_soundEnabled_title">Enable Sounds</string>
|
<string name="prefs_soundEnabled_title">Enable Sounds</string>
|
||||||
|
|||||||
@@ -173,6 +173,12 @@
|
|||||||
android:summary="@string/prefs_animateMoves_summary"
|
android:summary="@string/prefs_animateMoves_summary"
|
||||||
android:defaultValue="true">
|
android:defaultValue="true">
|
||||||
</CheckBoxPreference>
|
</CheckBoxPreference>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="autoScrollTitle"
|
||||||
|
android:title="@string/prefs_autoScrollTitle_title"
|
||||||
|
android:summary="@string/prefs_autoScrollTitle_summary"
|
||||||
|
android:defaultValue="true">
|
||||||
|
</CheckBoxPreference>
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="colors"
|
android:key="colors"
|
||||||
android:title="@string/prefs_colors_title"
|
android:title="@string/prefs_colors_title"
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ import android.text.Spannable;
|
|||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.text.style.BackgroundColorSpan;
|
import android.text.style.BackgroundColorSpan;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
@@ -190,6 +191,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
private MediaPlayer moveSound;
|
private MediaPlayer moveSound;
|
||||||
private boolean vibrateEnabled;
|
private boolean vibrateEnabled;
|
||||||
private boolean animateMoves;
|
private boolean animateMoves;
|
||||||
|
private boolean autoScrollTitle;
|
||||||
private boolean showMaterialDiff;
|
private boolean showMaterialDiff;
|
||||||
|
|
||||||
private final static String bookDir = "DroidFish";
|
private final static String bookDir = "DroidFish";
|
||||||
@@ -415,7 +417,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Create directory structure on SD card. */
|
/** Create directory structure on SD card. */
|
||||||
private void createDirectories() {
|
private final void createDirectories() {
|
||||||
File extDir = Environment.getExternalStorageDirectory();
|
File extDir = Environment.getExternalStorageDirectory();
|
||||||
String sep = File.separator;
|
String sep = File.separator;
|
||||||
new File(extDir + sep + bookDir).mkdirs();
|
new File(extDir + sep + bookDir).mkdirs();
|
||||||
@@ -842,6 +844,8 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
soundEnabled = settings.getBoolean("soundEnabled", false);
|
soundEnabled = settings.getBoolean("soundEnabled", false);
|
||||||
vibrateEnabled = settings.getBoolean("vibrateEnabled", false);
|
vibrateEnabled = settings.getBoolean("vibrateEnabled", false);
|
||||||
animateMoves = settings.getBoolean("animateMoves", true);
|
animateMoves = settings.getBoolean("animateMoves", true);
|
||||||
|
autoScrollTitle = settings.getBoolean("autoScrollTitle", true);
|
||||||
|
setTitleScrolling();
|
||||||
|
|
||||||
custom1ButtonActions.readPrefs(settings, actionFactory);
|
custom1ButtonActions.readPrefs(settings, actionFactory);
|
||||||
custom2ButtonActions.readPrefs(settings, actionFactory);
|
custom2ButtonActions.readPrefs(settings, actionFactory);
|
||||||
@@ -905,7 +909,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
/**
|
/**
|
||||||
* Change the Pieces into figurine or regular (i.e. letters) display
|
* Change the Pieces into figurine or regular (i.e. letters) display
|
||||||
*/
|
*/
|
||||||
private void setFigurineNotation(boolean displayAsFigures, int fontSize) {
|
private final void setFigurineNotation(boolean displayAsFigures, int fontSize) {
|
||||||
if (displayAsFigures) {
|
if (displayAsFigures) {
|
||||||
// increase the font cause it has different kerning and looks small
|
// increase the font cause it has different kerning and looks small
|
||||||
float increaseFontSize = fontSize * 1.1f;
|
float increaseFontSize = fontSize * 1.1f;
|
||||||
@@ -919,7 +923,17 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtons() {
|
/** Enable/disable title bar scrolling. */
|
||||||
|
private final void setTitleScrolling() {
|
||||||
|
TextUtils.TruncateAt where = autoScrollTitle ? TextUtils.TruncateAt.MARQUEE
|
||||||
|
: TextUtils.TruncateAt.END;
|
||||||
|
whiteTitleText.setEllipsize(where);
|
||||||
|
blackTitleText.setEllipsize(where);
|
||||||
|
whiteFigText.setEllipsize(where);
|
||||||
|
blackFigText.setEllipsize(where);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final void updateButtons() {
|
||||||
boolean largeButtons = settings.getBoolean("largeButtons", false);
|
boolean largeButtons = settings.getBoolean("largeButtons", false);
|
||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
int bWidth = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics()));
|
int bWidth = (int)Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 36, r.getDisplayMetrics()));
|
||||||
@@ -950,7 +964,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
setButtonData(redoButton, bWidth, bHeight, R.raw.right, svg);
|
setButtonData(redoButton, bWidth, bHeight, R.raw.right, svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setButtonData(ImageButton button, int bWidth, int bHeight,
|
private final void setButtonData(ImageButton button, int bWidth, int bHeight,
|
||||||
int svgResId, SVG touched) {
|
int svgResId, SVG touched) {
|
||||||
SVG svg = SVGParser.getSVGFromResource(getResources(), svgResId);
|
SVG svg = SVGParser.getSVGFromResource(getResources(), svgResId);
|
||||||
button.setBackgroundDrawable(new SVGPictureDrawable(svg));
|
button.setBackgroundDrawable(new SVGPictureDrawable(svg));
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import android.graphics.Typeface;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -66,7 +67,8 @@ public class EditBoard extends Activity {
|
|||||||
private Button cancelButton;
|
private Button cancelButton;
|
||||||
private TextView whiteTitleText, blackTitleText, engineTitleText;
|
private TextView whiteTitleText, blackTitleText, engineTitleText;
|
||||||
|
|
||||||
boolean egtbHints;
|
private boolean egtbHints;
|
||||||
|
private boolean autoScrollTitle;
|
||||||
private TextView whiteFigText;
|
private TextView whiteFigText;
|
||||||
private TextView blackFigText;
|
private TextView blackFigText;
|
||||||
private TextView summaryTitleText;
|
private TextView summaryTitleText;
|
||||||
@@ -79,11 +81,13 @@ public class EditBoard extends Activity {
|
|||||||
|
|
||||||
figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
|
figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
|
||||||
|
|
||||||
initUI();
|
|
||||||
|
|
||||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
egtbHints = settings.getBoolean("tbHintsEdit", false);
|
egtbHints = settings.getBoolean("tbHintsEdit", false);
|
||||||
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
||||||
|
autoScrollTitle = settings.getBoolean("autoScrollTitle", true);
|
||||||
|
|
||||||
|
initUI();
|
||||||
|
|
||||||
Util.setFullScreenMode(this, fullScreenMode);
|
Util.setFullScreenMode(this, fullScreenMode);
|
||||||
|
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
@@ -138,6 +142,13 @@ public class EditBoard extends Activity {
|
|||||||
summaryTitleText = (TextView) findViewById(R.id.title_text_summary);
|
summaryTitleText = (TextView) findViewById(R.id.title_text_summary);
|
||||||
summaryTitleText.setVisibility(View.GONE);
|
summaryTitleText.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
TextUtils.TruncateAt where = autoScrollTitle ? TextUtils.TruncateAt.MARQUEE
|
||||||
|
: TextUtils.TruncateAt.END;
|
||||||
|
whiteTitleText.setEllipsize(where);
|
||||||
|
blackTitleText.setEllipsize(where);
|
||||||
|
whiteFigText.setEllipsize(where);
|
||||||
|
blackFigText.setEllipsize(where);
|
||||||
|
|
||||||
okButton.setOnClickListener(new OnClickListener() {
|
okButton.setOnClickListener(new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
sendBackResult();
|
sendBackResult();
|
||||||
|
|||||||
Reference in New Issue
Block a user