Skip to content

Commit

Permalink
work on layout, screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarolus committed May 2, 2015
1 parent 31e25aa commit 4408277
Show file tree
Hide file tree
Showing 21 changed files with 424 additions and 560 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jwtc.android.chess"
android:versionCode="116"
android:versionName="8.4.4"
android:versionCode="117"
android:versionName="8.5.0"
android:installLocation="auto"
>
<application android:icon="@drawable/icon" android:label="@string/app_name"
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/java/jwtc/android/chess/setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.pm.ActivityInfo;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.util.DisplayMetrics;
Expand Down Expand Up @@ -420,6 +421,38 @@ protected void onResume() {
super.onResume();

_view.OnResume();
/////////////////////////////////////////////////////////////////////////////

Window window = getWindow();
final View v = window.getDecorView();
v.post(new Runnable() {
@Override
public void run() {
Rect rectangle= new Rect();
v.getWindowVisibleDisplayFrame(rectangle);
int availableHeight = rectangle.bottom - rectangle.top;
int availableWidth = rectangle.right - rectangle.left;
int length;

if(availableHeight > availableWidth){
length = availableWidth / 8;
} else {
length = availableHeight / 8;
}
//int contentViewTop = window.findViewById(Window.ID_ANDROID_CONTENT).getTop();
//int titleBarHeight= contentViewTop - statusBarHeight;

Log.i("ChessViewBase", "availableHeight 2 " + availableHeight);

LayoutParams params = new LayoutParams(length, length);
for(int i = 0; i < _arrSelImages.length; i++){
_arrSelImages[i].setLayoutParams(params);
}
}
});


/////////////////////////////////////////////////////////////////////////////

String sFEN = null;
if(_uri != null){
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
</LinearLayout>
<ScrollView android:id="@+id/VScrollViewHistory"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:textColor="@color/textColor" android:background="@color/bgColor"
android:textColor="@color/textColor" android:background="@color/bgColorLight"
android:paddingRight="2dp"
android:layout_marginTop="2dp"
android:layout_marginLeft="2dp"
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout-land/pgn_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
android:layout_margin="1dip"
>
<TextView android:id="@+id/TextViewNumMove"
android:background="@color/bgColor"
android:background="@color/bgColorText"
android:textColor="@color/textColor"
android:padding="2dip"
android:paddingLeft="2dip" android:paddingRight="2dip"
android:paddingTop="4dip" android:paddingBottom="4dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/TextViewMove"
android:textColor="@color/textColor"
Expand Down
143 changes: 71 additions & 72 deletions app/src/main/res/layout-land/practice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,84 @@
android:background="@color/bgColorText" android:gravity="center"
android:id="@+id/LayoutMain"
>

<include android:id="@+id/includeboard"
android:layout_width="wrap_content" android:layout_height="wrap_content"
layout="@layout/board"
/>

<!--
<TextView android:id="@+id/includeboard" android:layout_width="280dp" android:layout_height="280dp" />
-->


<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_toRightOf="@id/includeboard"
android:layout_marginLeft="8dp"
>
<TableLayout android:id="@+id/LayoutTurn"
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal"
>
<include android:id="@+id/includeboard"
android:layout_width="wrap_content" android:layout_height="wrap_content"
>
<TableRow android:gravity="center">
<ViewSwitcher android:id="@+id/ImageTurn"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
>
<ImageView
android:src="@drawable/turnblack"
android:layout_height="wrap_content" android:layout_width="wrap_content"
/>
<ImageView
android:src="@drawable/turnwhite"
layout="@layout/board"
/>

<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_toRightOf="@id/includeboard"
android:layout_marginLeft="8dp"
>
<TableLayout android:id="@+id/LayoutTurn"
android:layout_width="wrap_content" android:layout_height="wrap_content"
>
<TableRow android:gravity="center">
<ViewSwitcher android:id="@+id/ImageTurn"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
>
<ImageView
android:src="@drawable/turnblack"
android:layout_height="wrap_content" android:layout_width="wrap_content"
/>
<ImageView
android:src="@drawable/turnwhite"
android:layout_height="wrap_content" android:layout_width="wrap_content"
/>
</ViewSwitcher>
<TextView android:id="@+id/TextViewPracticeTime"
android:layout_height="wrap_content" android:layout_width="50dp"
android:text="00:00"
style="@style/MyNormalTextStyle"
/>
</ViewSwitcher>
<TextView android:id="@+id/TextViewPracticeTime"
android:layout_height="wrap_content" android:layout_width="50dp"
android:text="00:00"
style="@style/MyNormalTextStyle"
/>


</TableRow>
</TableRow>

</TableLayout>
<TextView android:id="@+id/TextViewPracticeAvgTime"
android:layout_below="@id/LayoutTurn"
android:layout_height="wrap_content" android:layout_width="wrap_content"
style="@style/MyNormalTextStyle" android:paddingLeft="8dip" android:paddingRight="8dip"
/>
<TextView android:id="@+id/TextViewPracticeMove"
android:text=" to move, mate in "
android:layout_width="fill_parent" android:layout_height="wrap_content"
style="@style/MyHeaderTextStyle"
android:layout_below="@id/TextViewPracticeAvgTime"
</TableLayout>
<TextView android:id="@+id/TextViewPracticeAvgTime"
android:layout_below="@id/LayoutTurn"
android:layout_height="wrap_content" android:layout_width="wrap_content"
style="@style/MyNormalTextStyle" android:paddingLeft="8dip" android:paddingRight="8dip"
/>
<TextView android:id="@+id/TextViewPracticeMove"
android:text=" to move, mate in "
android:layout_width="120dip" android:layout_height="wrap_content"
style="@style/MyHeaderTextStyle"
android:layout_below="@id/TextViewPracticeAvgTime"
/>
<ImageView android:id="@+id/ImageStatus" android:src="@drawable/indicator_none"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
android:layout_below="@id/TextViewPracticeMove"
/>
<ImageView android:id="@+id/ImageStatus" android:src="@drawable/indicator_none"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
android:layout_below="@id/TextViewPracticeMove"
/>
<ImageButton android:id="@+id/ButtonPracticePause"
android:src="@drawable/av_pause"
android:layout_height="40dp" android:layout_width="40dp" android:scaleType="fitXY"
android:layout_below="@id/ImageStatus"
/>
<ImageButton android:id="@+id/ButtonPracticeHelp"
android:src="@drawable/action_about"
android:layout_height="40dp" android:layout_width="40dp" android:scaleType="fitXY"
android:layout_below="@id/ButtonPracticePause"
/>
<Button android:id="@+id/ButtonPracticeShow"
android:text="@string/button_show" android:paddingLeft="8dip" android:paddingRight="8dip"
android:layout_height="40dip" android:layout_width="wrap_content"
android:layout_below="@id/ButtonPracticeHelp"
/>
<ImageButton android:id="@+id/ButtonPracticeNext" android:src="@drawable/navigation_next_item"
android:layout_height="40dip" android:layout_width="40dip" android:scaleType="fitXY"
android:layout_below="@id/ButtonPracticeShow"
/>

</RelativeLayout>
<ImageButton android:id="@+id/ButtonPracticePause"
android:src="@drawable/av_pause"
android:layout_height="40dp" android:layout_width="40dp" android:scaleType="fitXY"
android:layout_below="@id/ImageStatus"
/>
<ImageButton android:id="@+id/ButtonPracticeHelp"
android:src="@drawable/action_about"
android:layout_height="40dp" android:layout_width="40dp" android:scaleType="fitXY"
android:layout_below="@id/ButtonPracticePause"
/>
<Button android:id="@+id/ButtonPracticeShow"
android:text="@string/button_show" android:paddingLeft="8dip" android:paddingRight="8dip"
android:layout_height="40dip" android:layout_width="wrap_content"
android:layout_below="@id/ButtonPracticeHelp"
/>
<ImageButton android:id="@+id/ButtonPracticeNext" android:src="@drawable/navigation_next_item"
android:layout_height="40dip" android:layout_width="40dip" android:scaleType="fitXY"
android:layout_below="@id/ButtonPracticeShow"
/>

</RelativeLayout>
</RelativeLayout>

</RelativeLayout>
69 changes: 26 additions & 43 deletions app/src/main/res/layout-land/puzzle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,47 @@
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@color/bgColorText" android:gravity="center" android:id="@+id/LayoutMain"
>

<include android:id="@+id/includeboard"
android:layout_width="wrap_content" android:layout_height="wrap_content"
layout="@layout/board"
/>

<!--
<TextView android:id="@+id/includeboard" android:layout_width="280dip" android:layout_height="280dip" />
-->


<TableLayout android:id="@+id/LayoutButtons" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/includeboard"
android:layout_marginLeft="8dip"
>
<TableRow>
<RelativeLayout android:layout_width="wrap_content" android:layout_height="fill_parent"
android:gravity="center_horizontal"
>
<include android:id="@+id/includeboard"
android:layout_width="wrap_content" android:layout_height="wrap_content"
layout="@layout/board"
/>

<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true"
android:layout_toRightOf="@id/includeboard"
android:layout_marginLeft="8dp"
>
<ImageButton android:id="@+id/ButtonPuzzleHelp" android:src="@drawable/action_about"
android:layout_height="40dip" android:layout_width="40dip" android:scaleType="fitXY"
/>
</TableRow>
<TableRow>
<ImageButton android:id="@+id/ButtonPuzzlePrevious" android:src="@drawable/navigation_previous_item"
android:layout_height="40dip" android:layout_width="40dip" android:scaleType="fitXY"
/>
</TableRow>
<TableRow>
<ImageButton android:id="@+id/ButtonPuzzleNext" android:src="@drawable/navigation_next_item"
android:layout_height="40dip" android:layout_width="40dip" android:scaleType="fitXY"
/>
</TableRow>
<TableRow>
<Button android:id="@+id/ButtonPuzzle" android:layout_width="wrap_content" android:layout_height="40dip"
android:text="@string/button_show" android:paddingLeft="8dip" android:paddingRight="8dip"
/>
</TableRow>
<TableRow>
<ImageView android:id="@+id/ImageStatus" android:src="@drawable/indicator_none"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginTop="8dip"
/>
</TableRow>
</TableLayout>


<TextView android:id="@+id/TextViewPuzzleText"
android:text="..."
android:layout_width="fill_parent" android:layout_height="wrap_content"
style="@style/MyTextStyle"
android:layout_below="@id/LayoutButtons"
android:layout_toRightOf="@id/includeboard"
android:layout_marginLeft="8dip"
/>
<ImageView android:id="@+id/ImageTurn" android:src="@drawable/turnwhite"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_below="@id/TextViewPuzzleText"
android:layout_toRightOf="@id/includeboard"
android:layout_marginLeft="8dip"
/>

<ImageView android:id="@+id/ImageTurn" android:src="@drawable/turnwhite"
android:layout_height="wrap_content" android:layout_width="wrap_content"
/>
<TextView android:id="@+id/TextViewPuzzleText"
android:text="..."
android:layout_width="140dip" android:layout_height="wrap_content"
android:minHeight="60dip"
android:ellipsize="end"
style="@style/MyTextStyle"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Loading

0 comments on commit 4408277

Please sign in to comment.