mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-02-06 20:29:10 +01:00
DroidFish: Support full-screen mode in edit board activity.
This commit is contained in:
parent
b4736fe3dc
commit
a224defe3f
|
@ -111,7 +111,6 @@ import android.view.MotionEvent;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.View.OnLongClickListener;
|
||||
|
@ -813,7 +812,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
invertScrollDirection = settings.getBoolean("invertScrollDirection", false);
|
||||
leftHanded = settings.getBoolean("leftHanded", false);
|
||||
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
||||
setFullScreenMode(fullScreenMode);
|
||||
Util.setFullScreenMode(this, fullScreenMode);
|
||||
useWakeLock = settings.getBoolean("wakeLock", false);
|
||||
setWakeLock(useWakeLock);
|
||||
|
||||
|
@ -1017,16 +1016,6 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||
blackFigText.setText(diff.black);
|
||||
}
|
||||
|
||||
private final void setFullScreenMode(boolean fullScreenMode) {
|
||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||
if (fullScreenMode) {
|
||||
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||
} else {
|
||||
attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
getWindow().setAttributes(attrs);
|
||||
}
|
||||
|
||||
private final void setBookOptions() {
|
||||
BookOptions options = new BookOptions(bookOptions);
|
||||
if (options.filename.length() > 0) {
|
||||
|
|
|
@ -10,7 +10,9 @@ import java.util.ArrayList;
|
|||
import org.petero.droidfish.gamelogic.Piece;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public final class Util {
|
||||
public final static String boldStart;
|
||||
|
@ -69,4 +71,15 @@ public final class Util {
|
|||
}
|
||||
return new MaterialDiff(whiteString, blackString);
|
||||
}
|
||||
|
||||
/** Enable/disable full screen mode for an activity. */
|
||||
public static void setFullScreenMode(Activity a, boolean fullScreenMode) {
|
||||
WindowManager.LayoutParams attrs = a.getWindow().getAttributes();
|
||||
if (fullScreenMode) {
|
||||
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||
} else {
|
||||
attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
a.getWindow().setAttributes(attrs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||
import org.petero.droidfish.ChessBoard;
|
||||
import org.petero.droidfish.R;
|
||||
import org.petero.droidfish.ChessBoard.SquareDecoration;
|
||||
import org.petero.droidfish.Util;
|
||||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
|
@ -71,6 +72,8 @@ public class EditBoard extends Activity {
|
|||
|
||||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
egtbHints = settings.getBoolean("tbHintsEdit", false);
|
||||
boolean fullScreenMode = settings.getBoolean("fullScreenMode", false);
|
||||
Util.setFullScreenMode(this, fullScreenMode);
|
||||
|
||||
Intent i = getIntent();
|
||||
Position pos;
|
||||
|
|
Loading…
Reference in New Issue
Block a user