Skip to content

Commit

Permalink
add compatibility for tablets, use constraint layout for homepage, mi…
Browse files Browse the repository at this point in the history
…n SDK version updated to 16
  • Loading branch information
loafyyy committed May 18, 2018
1 parent f03b0d5 commit 20584ba
Show file tree
Hide file tree
Showing 12 changed files with 306 additions and 114 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "com.egyptianratscrew.android"
minSdkVersion 17
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
Expand All @@ -21,6 +21,7 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.android.support:support-v4:27.0.2'
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<activity
android:name="com.egyptianratscrew.android.MainActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.egyptianratscrew.android.AboutActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:screenOrientation="portrait"
Expand Down
22 changes: 0 additions & 22 deletions app/src/main/java/com/egyptianratscrew/android/AboutActivity.java

This file was deleted.

3 changes: 3 additions & 0 deletions app/src/main/res/drawable/home_button.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@android:color/transparent">
</solid>
<stroke
android:width="2dp"
android:color="@color/dark_grey" />
Expand Down
152 changes: 152 additions & 0 deletions app/src/main/res/layout-w600dp/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/game_background"
tools:context="com.egyptianratscrew.android.MainActivity">

<ImageView
android:id="@+id/player_two_card_back"
style="@style/game_card_large"
android:layout_marginTop="-180dp"
android:rotation="180" />

<ImageView
android:id="@+id/player_two_card"
style="@style/game_card_large"
android:layout_marginTop="-180dp"
android:rotation="180" />

<ImageButton
android:id="@+id/p2_slap"
style="@style/game_image_button_large"
android:layout_toEndOf="@id/player_two_card"
android:onClick="playerTwoSlap"
android:rotation="180"
android:src="@drawable/hand_icon"
android:layout_toRightOf="@id/player_two_card" />

<ImageButton
android:id="@+id/p2_play"
style="@style/game_image_button_large"
android:layout_toStartOf="@id/player_two_card"
android:onClick="playerTwoPlay"
android:rotation="180"
android:src="@drawable/play_icon"
android:layout_toLeftOf="@id/player_two_card" />

<TextView
android:id="@+id/num_cards_player_two"
style="@style/num_cards_text_large"
android:layout_marginTop="20dp"
android:rotation="180"
tools:text="7"/>

<ImageView
android:id="@+id/middle_card"
android:layout_width="@dimen/card_width_large"
android:layout_height="@dimen/card_height_large"
android:layout_centerInParent="true"
android:scaleType="fitXY" />

<ImageView
android:id="@+id/middle_icon"
android:layout_width="@dimen/mid_icon_size_large"
android:layout_height="@dimen/mid_icon_size_large"
android:layout_centerInParent="true"
android:scaleType="centerCrop" />

<TextView
android:id="@+id/burn_slap"
style="@style/text_style_slap_large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/lato"
android:gravity="center"
android:textStyle="bold" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="-80dp"
android:orientation="horizontal"
android:rotation="-90"
android:layout_marginLeft="-80dp">

<Button
android:id="@+id/home_button"
style="@style/game_button_large"
android:onClick="homeButton"
android:text="@string/menu_home" />

<Button
android:id="@+id/save_button"
style="@style/game_button_large"
android:onClick="saveButton"
android:text="@string/menu_save" />

<Button
android:id="@+id/reset_button"
style="@style/game_button_large"
android:onClick="resetButton"
android:text="@string/menu_reset" />

</LinearLayout>

<TextView
android:id="@+id/num_cards_middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="50dp"
android:layout_toEndOf="@id/middle_card"
android:fontFamily="@font/lato"
android:rotation="90"
android:textSize="@dimen/font_size_num_cards"
android:textStyle="bold"
android:visibility="gone"
android:layout_toRightOf="@id/middle_card"
android:layout_marginLeft="50dp" />

<ImageView
android:id="@+id/player_one_card_back"
style="@style/game_card_large"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-180dp" />

<ImageView
android:id="@+id/player_one_card"
style="@style/game_card_large"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-180dp" />

<ImageButton
android:id="@+id/p1_slap"
style="@style/game_image_button_large"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@id/player_one_card"
android:onClick="playerOneSlap"
android:src="@drawable/hand_icon"
android:layout_toLeftOf="@id/player_one_card" />

<ImageButton
android:id="@+id/p1_play"
style="@style/game_image_button_large"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@id/player_one_card"
android:onClick="playerOnePlay"
android:src="@drawable/play_icon"
android:layout_toRightOf="@id/player_one_card" />

<TextView
android:id="@+id/num_cards_player_one"
style="@style/num_cards_text_large"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
tools:text="10"/>

</RelativeLayout>
22 changes: 0 additions & 22 deletions app/src/main/res/layout/activity_about.xml

This file was deleted.

66 changes: 46 additions & 20 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/game_background"
android:padding="32dp"
tools:context="com.egyptianratscrew.android.egyptianratscrew.com.egyptianratscrew.android.HomeActivity">
tools:context="com.egyptianratscrew.android.HomeActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-20dp"
android:layout_marginStart="-20dp"
android:layout_marginTop="20dp">
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toTopOf="@+id/title_tv"
app:layout_constraintDimensionRatio="3:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75">

<ImageView
android:id="@+id/play_iv"
android:layout_width="@dimen/home_image_size"
android:layout_height="@dimen/home_image_size"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/play_icon" />

<ImageView
android:id="@+id/slap_iv"
android:layout_width="@dimen/home_image_size"
android:layout_height="@dimen/home_image_size"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/hand_icon" />

<ImageView
android:id="@+id/burn_iv"
android:layout_width="@dimen/home_image_size"
android:layout_height="@dimen/home_image_size"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/burn_icon" />

Expand All @@ -41,15 +51,31 @@
<TextView
android:id="@+id/title_tv"
style="@style/home_text"
android:layout_marginTop="100dp"
android:text="@string/app_name_home_page" />
android:layout_width="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/app_name_home_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.39" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/title_tv"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:orientation="horizontal">
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_tv"
app:layout_constraintVertical_bias="0.20999998">

<Button
style="@style/home_button"
Expand All @@ -68,4 +94,4 @@

</LinearLayout>

</RelativeLayout>
</android.support.constraint.ConstraintLayout>
Loading

0 comments on commit 20584ba

Please sign in to comment.