DroidFish: Use custom title bar also for edit board mode. Most title bar widgets are hidden though.

This commit is contained in:
Peter Osterlund 2012-09-21 19:39:29 +00:00
parent 9e44414235
commit 75fd15d3bf
4 changed files with 27 additions and 1 deletions

View File

@ -13,6 +13,11 @@
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/title">
</include>
<TextView
android:text=""
android:id="@+id/eb_status"

View File

@ -4,6 +4,11 @@
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/title">
</include>
<view
class="org.petero.droidfish.activities.ChessBoardEdit"
android:id="@+id/eb_chessboard"

View File

@ -24,6 +24,7 @@ import org.petero.droidfish.gamelogic.Piece;
import org.petero.droidfish.gamelogic.Position;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
@ -55,7 +56,9 @@ public class ChessBoardEdit extends ChessBoard {
@Override
protected void computeOrigin(int width, int height) {
x0 = (width - sqSize * 8) / 2;
y0 = (height - (sqSize * 10 + gap)) / 2;
Configuration config = getResources().getConfiguration();
boolean landScape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
y0 = landScape ? 0 : (height - (sqSize * 10 + gap)) / 2;
}
private final int extraPieces(int x, int y) {

View File

@ -51,6 +51,7 @@ import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
@ -61,12 +62,15 @@ public class EditBoard extends Activity {
private TextView status;
private Button okButton;
private Button cancelButton;
private TextView whiteTitleText, blackTitleText, engineTitleText;
private View secondTitleLine;
boolean egtbHints;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
initUI();
@ -106,6 +110,15 @@ public class EditBoard extends Activity {
okButton = (Button)findViewById(R.id.eb_ok);
cancelButton = (Button)findViewById(R.id.eb_cancel);
whiteTitleText = (TextView)findViewById(R.id.white_clock);
whiteTitleText.setText(R.string.edit_board);
blackTitleText = (TextView)findViewById(R.id.black_clock);
blackTitleText.setVisibility(View.GONE);
engineTitleText = (TextView)findViewById(R.id.title_text);
engineTitleText.setVisibility(View.GONE);
secondTitleLine = findViewById(R.id.second_title_line);
secondTitleLine.setVisibility(View.GONE);
okButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
sendBackResult();