Implement Android app with improved features: 1. Enhanced swipe controls for smoother movement 2. Improved 3D rotation with visual effects 3. Updated UI to match web app style

This commit is contained in:
Corey 2025-03-26 00:38:43 -04:00
parent 210a518ad5
commit c76cde0f1f
103 changed files with 4180 additions and 357 deletions

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/background" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</vector>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</vector>

View file

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0f142d"
tools:context=".MainActivity">
<TextView
android:id="@+id/gameTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/app_name"
android:textColor="@color/cyan"
android:textSize="32sp"
android:textStyle="bold"
android:shadowColor="#00ffff"
android:shadowRadius="10"
android:shadowDx="0"
android:shadowDy="0"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.tetris3d.views.TetrisGameView
android:id="@+id/tetrisGameView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toTopOf="@+id/controlsHint"
app:layout_constraintDimensionRatio="1:2"
app:layout_constraintEnd_toStartOf="@+id/infoPanel"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gameTitle" />
<TextView
android:id="@+id/controlsHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:gravity="center"
android:text="Swipe left/right to move • Swipe down for soft drop • Swipe up for hard drop • Tap to rotate"
android:textColor="#00ffff"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/infoPanel"
app:layout_constraintStart_toStartOf="parent" />
<androidx.cardview.widget.CardView
android:id="@+id/infoPanel"
android:layout_width="140dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="#202040"
app:cardCornerRadius="12dp"
app:cardElevation="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gameTitle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="12dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/score"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/scoreText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#ff9900"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/lines"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/linesText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#ff9900"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/level"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/levelText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="1"
android:textColor="#ff9900"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Next Piece"
android:textAlignment="center"
android:textColor="#00ffff"
android:textSize="16sp" />
<com.tetris3d.views.NextPieceView
android:id="@+id/nextPieceView"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="8dp" />
<Button
android:id="@+id/startButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:backgroundTint="#ff00dd"
android:textColor="#ffffff"
android:text="@string/start" />
<Button
android:id="@+id/pauseButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:backgroundTint="#00ddff"
android:textColor="#ffffff"
android:text="@string/pause" />
<Button
android:id="@+id/optionsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:backgroundTint="#9900ff"
android:textColor="#ffffff"
android:text="@string/options" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp"
android:background="@color/background">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/game_over"
android:textAlignment="center"
android:textColor="@color/magenta"
android:textSize="28sp"
android:textStyle="bold"
android:layout_marginBottom="24dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/final_score"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="18sp"
android:layout_marginBottom="8dp" />
<TextView
android:id="@+id/textFinalScore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:textAlignment="center"
android:textColor="@color/cyan"
android:textSize="36sp"
android:textStyle="bold"
android:layout_marginBottom="32dp" />
<Button
android:id="@+id/btnPlayAgain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/play_again"
android:textSize="18sp" />
</LinearLayout>

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/options"
android:textAlignment="center"
android:textColor="@color/cyan"
android:textSize="24sp"
android:textStyle="bold"
android:layout_marginBottom="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/enable_3d_effects"
android:textColor="@color/white"
android:textSize="16sp" />
<Switch
android:id="@+id/switch3dEffects"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/enable_spin_animations"
android:textColor="@color/white"
android:textSize="16sp" />
<Switch
android:id="@+id/switchSpinAnimations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/animation_speed"
android:textColor="@color/white"
android:textSize="16sp"
android:layout_marginBottom="8dp" />
<SeekBar
android:id="@+id/seekBarAnimationSpeed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50"
android:layout_marginBottom="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/starting_level"
android:textColor="@color/white"
android:textSize="16sp" />
<NumberPicker
android:id="@+id/numberPickerLevel"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:theme="@style/NumberPickerTheme" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">
<Button
android:id="@+id/btnCloseOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/close"
android:layout_marginEnd="8dp" />
<Button
android:id="@+id/btnApplyOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/apply" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="72dp"
android:height="72dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="0.6666667"
android:scaleY="0.6666667">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="72dp"
android:height="72dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="0.6666667"
android:scaleY="0.6666667">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="0.44444445"
android:scaleY="0.44444445">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="0.44444445"
android:scaleY="0.44444445">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="96dp"
android:height="96dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="0.8888889"
android:scaleY="0.8888889">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="96dp"
android:height="96dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="0.8888889"
android:scaleY="0.8888889">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="144dp"
android:height="144dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="1.3333334"
android:scaleY="1.3333334">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="144dp"
android:height="144dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="1.3333334"
android:scaleY="1.3333334">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="1.7777778"
android:scaleY="1.7777778">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#00FFFF">
<group
android:scaleX="1.7777778"
android:scaleY="1.7777778">
<path
android:fillColor="#000020"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00FFFF"
android:pathData="M24,24h60v60h-60z"/>
<path
android:fillColor="#FF00FF"
android:pathData="M54,24h30v30h-30z"/>
</group>
</vector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="cyan">#FF00FFFF</color>
<color name="cyan_dark">#FF00AAAA</color>
<color name="magenta">#FFFF00FF</color>
<color name="magenta_dark">#FFAA00AA</color>
<color name="background">#FF000020</color>
</resources>

View file

@ -0,0 +1,19 @@
<resources>
<string name="app_name">3D Tetris</string>
<string name="score">Score</string>
<string name="lines">Lines</string>
<string name="level">Level</string>
<string name="pause">Pause</string>
<string name="start">Start</string>
<string name="game_over">Game Over</string>
<string name="final_score">Final Score</string>
<string name="play_again">Play Again</string>
<string name="shadow">Shadow</string>
<string name="options">Options</string>
<string name="enable_3d_effects">3D Effects</string>
<string name="enable_spin_animations">Spin Animations</string>
<string name="animation_speed">Animation Speed</string>
<string name="starting_level">Starting Level</string>
<string name="apply">Apply</string>
<string name="close">Close</string>
</resources>

View file

@ -0,0 +1,18 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.Tetris3D" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/cyan</item>
<item name="colorPrimaryVariant">@color/cyan_dark</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/magenta</item>
<item name="colorSecondaryVariant">@color/magenta_dark</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">@color/black</item>
<item name="android:windowBackground">@color/background</item>
</style>
<style name="NumberPickerTheme">
<item name="android:textColorPrimary">@color/white</item>
<item name="android:colorControlNormal">@color/cyan</item>
<item name="android:textSize">16sp</item>
</style>
</resources>