Feat: Ajout layout initial et ressources UI
- Création de activity_main.xml avec la structure de base (labels score, conteneur grille, boutons). - Création de strings.xml avec les textes initiaux. - Création de colors.xml avec les couleurs de base. - Création des fichiers drawable tile_*.xml pour l'apparence des tuiles (vide, 2 à 2048).
This commit is contained in:
parent
e3c2cc74a3
commit
7eb597650c
12
app/src/main/res/drawable/tile1024.xml
Normal file
12
app/src/main/res/drawable/tile1024.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FCE588" /> <corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile128.xml
Normal file
13
app/src/main/res/drawable/tile128.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#EDCF72" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile16.xml
Normal file
13
app/src/main/res/drawable/tile16.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#F59563" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile2.xml
Normal file
13
app/src/main/res/drawable/tile2.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#EEE4DA" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
12
app/src/main/res/drawable/tile2048.xml
Normal file
12
app/src/main/res/drawable/tile2048.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FFEB84" /> <corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile256.xml
Normal file
13
app/src/main/res/drawable/tile256.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#EDCC61" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile32.xml
Normal file
13
app/src/main/res/drawable/tile32.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#F67C5F" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile4.xml
Normal file
13
app/src/main/res/drawable/tile4.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#EDE0C8" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile512.xml
Normal file
13
app/src/main/res/drawable/tile512.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#EDC850" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile64.xml
Normal file
13
app/src/main/res/drawable/tile64.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#F65E3B" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/tile8.xml
Normal file
13
app/src/main/res/drawable/tile8.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#F2B179" />
|
||||
<corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
12
app/src/main/res/drawable/tile_empty.xml
Normal file
12
app/src/main/res/drawable/tile_empty.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#C9BCAC" /> <corners android:radius="6dp" />
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:top="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp" />
|
||||
|
||||
</shape>
|
@ -2,18 +2,157 @@
|
||||
<androidx.constraintlayout.widget.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/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FCFAEE"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:id="@+id/northPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gameLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="#EDCC5F"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="@string/name_2048"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="48sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gameLabel"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/scoreLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#F75E3E"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="@string/score"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highScoreLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="#F75E3E"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="@string/high_score"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/gameBoardContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="16dp"
|
||||
app:cardBackgroundColor="@android:color/transparent"
|
||||
app:cardCornerRadius="6dp"
|
||||
app:cardElevation="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/restartButton"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/northPanel">
|
||||
|
||||
<androidx.gridlayout.widget.GridLayout
|
||||
android:id="@+id/gameBoard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#A3937D"
|
||||
android:padding="4dp"
|
||||
app:columnCount="4"
|
||||
app:rowCount="4">
|
||||
|
||||
</androidx.gridlayout.widget.GridLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/restartButton"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:backgroundTint="#4A443C"
|
||||
android:text="@string/restart"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toTopOf="@+id/statsButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gameBoardContainer" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/statsButton"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:backgroundTint="#4A443C"
|
||||
android:text="@string/stats"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/menuButton"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/menuButton"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:backgroundTint="#4A443C"
|
||||
android:text="@string/menu"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/statsButton" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -2,4 +2,4 @@
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
<color name="text_tile_low">#776E65</color> </resources>
|
@ -1,3 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">Best 2048</string>
|
||||
<string name="name_2048">2048</string>
|
||||
<string name="score">Score :\n0</string> <string name="high_score">High Score :\n0</string> <string name="restart">Restart</string>
|
||||
<string name="stats">Stats</string>
|
||||
<string name="menu">Menu</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user