Skip to content

Commit 12c3951

Browse files
elliptic1claude
andcommitted
Modernize Android project and add CI
- Update Gradle wrapper from 1.12 to 8.7 - Migrate to AndroidX (Fragment, AppCompat, Core) - Replace deprecated APIs (getColor, getFragmentManager) - Update theme from Holo to AppCompat - Add placeholder game assets (sprites and sounds) - Add GitHub Actions workflow for automated builds - Update .gitignore for modern Android development 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b883da2 commit 12c3951

42 files changed

Lines changed: 134 additions & 58 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Android Build
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '17'
23+
distribution: 'temurin'
24+
25+
- name: Setup Gradle
26+
uses: gradle/actions/setup-gradle@v3
27+
28+
- name: Grant execute permission for gradlew
29+
run: chmod +x gradlew
30+
31+
- name: Build Debug APK
32+
run: ./gradlew assembleDebug
33+
34+
- name: Upload APK artifact
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: app-debug
38+
path: app/build/outputs/apk/debug/app-debug.apk
39+
retention-days: 14

.gitignore

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
.gradle
2-
/local.properties
3-
/.idea/workspace.xml
1+
# Gradle
2+
.gradle/
3+
build/
4+
**/build/
5+
6+
# Local configuration
7+
local.properties
8+
9+
# IDE
10+
/.idea/
11+
*.iml
412
.DS_Store
5-
/build
13+
14+
# APK files
15+
*.apk
16+
*.aab

app/build.gradle

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
1-
apply plugin: 'com.android.application'
1+
plugins {
2+
id 'com.android.application'
3+
}
24

35
android {
46
namespace 'com.tbse.nes.bubblebobble'
5-
compileSdkVersion 34
7+
compileSdk 34
68

79
defaultConfig {
810
applicationId "com.tbse.nes.bubblebobble"
9-
minSdkVersion 19
10-
targetSdkVersion 34
11+
minSdk 21
12+
targetSdk 34
1113
versionCode 1
1214
versionName "1.0"
1315
}
1416
buildTypes {
1517
release {
1618
minifyEnabled false
17-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
1820
}
1921
}
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_17
24+
targetCompatibility JavaVersion.VERSION_17
25+
}
2026
}
2127

2228
dependencies {
23-
implementation fileTree(dir: 'libs', include: ['*.jar'])
29+
implementation 'androidx.appcompat:appcompat:1.6.1'
30+
implementation 'androidx.core:core:1.12.0'
31+
implementation 'androidx.fragment:fragment:1.6.2'
32+
33+
// Fix Kotlin stdlib duplicate class issue
34+
constraints {
35+
implementation('org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22') {
36+
because 'kotlin-stdlib-jdk7 is part of kotlin-stdlib in 1.8+'
37+
}
38+
implementation('org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22') {
39+
because 'kotlin-stdlib-jdk8 is part of kotlin-stdlib in 1.8+'
40+
}
41+
}
2442
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest
3-
xmlns:android="http://schemas.android.com/apk/res/android"
4-
package="com.tbse.nes.bubblebobble" >
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
53

64
<application
75
android:allowBackup="true"
8-
android:icon="@drawable/walk01"
6+
android:icon="@drawable/ic_launcher"
97
android:label="@string/app_name"
108
android:theme="@style/AppTheme"
119
android:hardwareAccelerated="true">
1210

1311
<activity
1412
android:name="com.tbse.nes.bubblebobble.ActivityMain"
1513
android:label="@string/app_name"
16-
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
1714
android:screenOrientation="landscape"
1815
android:exported="true" >
1916
<intent-filter>

app/src/main/java/com/tbse/nes/bubblebobble/ActivityMain.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package com.tbse.nes.bubblebobble;
22

3-
import android.app.Activity;
4-
import android.app.Fragment;
53
import android.graphics.Typeface;
64
import android.os.Bundle;
75
import android.util.Log;
86
import android.view.View;
97
import android.widget.FrameLayout;
108

9+
import androidx.fragment.app.Fragment;
10+
import androidx.fragment.app.FragmentActivity;
11+
1112
import com.tbse.nes.bubblebobble.Fragments.GameLevelFragment;
1213
import com.tbse.nes.bubblebobble.Fragments.StartScreenFragment;
1314
import com.tbse.nes.bubblebobble.Levels.Level01;
1415

1516
import java.util.HashMap;
1617

1718

18-
public class ActivityMain extends Activity
19+
public class ActivityMain extends FragmentActivity
1920
{
2021

2122
public static Typeface tf;
@@ -40,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState)
4041

4142
FrameLayout screen_layout = (FrameLayout) findViewById(R.id.mainFrameLayout);
4243

43-
getFragmentManager().beginTransaction().add(screen_layout.getId(), fragments.get(0))
44+
getSupportFragmentManager().beginTransaction().add(screen_layout.getId(), fragments.get(0))
4445
.commit();
4546

4647
int uiOptions = getWindow().getDecorView().getSystemUiVisibility();

app/src/main/java/com/tbse/nes/bubblebobble/Fragments/GameLevelFragment.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.tbse.nes.bubblebobble.Fragments;
22

3-
import android.app.Fragment;
43
import android.content.Context;
54
import android.media.MediaPlayer;
65
import android.os.Bundle;
@@ -10,6 +9,8 @@
109
import android.view.View;
1110
import android.view.ViewGroup;
1211

12+
import androidx.fragment.app.Fragment;
13+
1314
import com.tbse.nes.bubblebobble.DrawSurface;
1415
import com.tbse.nes.bubblebobble.GameThread;
1516
import com.tbse.nes.bubblebobble.R;
@@ -54,11 +55,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
5455

5556
levelView.setOnTouchListener(this);
5657

57-
context = getActivity().getApplicationContext();
58+
context = requireActivity().getApplicationContext();
5859

5960
mGameScreen = (DrawSurface) levelView.findViewById(R.id.svGameScreen);
6061

61-
player = new Player(300, 300, 120, getActivity().getApplicationContext());
62+
player = new Player(300, 300, 120, requireActivity().getApplicationContext());
6263

6364
fruits = new ArrayList<Fruit>();
6465

@@ -72,17 +73,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
7273
container.getWidth()-225,
7374
container.getHeight()-400,
7475
200,
75-
getActivity().getApplicationContext());
76+
requireActivity().getApplicationContext());
7677
bButton = new BButton(
7778
container.getWidth()-500,
7879
container.getHeight()-250,
7980
200,
80-
getActivity().getApplicationContext());
81+
requireActivity().getApplicationContext());
8182
dpad = new Dpad(
8283
15,
8384
container.getHeight()-10-300,
8485
300,
85-
getActivity().getApplicationContext());
86+
requireActivity().getApplicationContext());
8687

8788
bubbleShots = new ArrayList<BubbleShot>();
8889

@@ -94,7 +95,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
9495
public void onResume() {
9596
super.onResume();
9697

97-
int uiOptions = getActivity().getWindow().getDecorView().getSystemUiVisibility();
98+
int uiOptions = requireActivity().getWindow().getDecorView().getSystemUiVisibility();
9899

99100
if ( ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions)) {
100101
} else {
@@ -112,7 +113,7 @@ public void onResume() {
112113
uiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
113114
}
114115

115-
getActivity().getWindow().getDecorView().setSystemUiVisibility(uiOptions);
116+
requireActivity().getWindow().getDecorView().setSystemUiVisibility(uiOptions);
116117

117118
}
118119

@@ -122,7 +123,7 @@ public void startGame()
122123
mGameThread.setRunning(true);
123124
mGameThread.start();
124125

125-
music = MediaPlayer.create(getActivity().getApplicationContext(), R.raw.main);
126+
music = MediaPlayer.create(requireActivity().getApplicationContext(), R.raw.main);
126127
music.setLooping(true);
127128
music.start();
128129
}

app/src/main/java/com/tbse/nes/bubblebobble/Fragments/StartScreenFragment.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.tbse.nes.bubblebobble.Fragments;
22

3-
import android.app.Fragment;
43
import android.media.MediaPlayer;
54
import android.os.Bundle;
65
import android.view.LayoutInflater;
@@ -9,6 +8,9 @@
98
import android.view.ViewGroup;
109
import android.widget.TextView;
1110

11+
import androidx.core.content.ContextCompat;
12+
import androidx.fragment.app.Fragment;
13+
1214
import com.tbse.nes.bubblebobble.ActivityMain;
1315
import com.tbse.nes.bubblebobble.R;
1416

@@ -26,7 +28,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
2628
// Inflate the layout for this fragment
2729
View startScreenView = inflater.inflate(R.layout.start_screen_fragment, container, false);
2830

29-
music = MediaPlayer.create(getActivity().getApplicationContext(), R.raw.intro);
31+
music = MediaPlayer.create(requireActivity().getApplicationContext(), R.raw.intro);
3032
music.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
3133
@Override
3234
public void onCompletion(MediaPlayer mp) {
@@ -40,7 +42,7 @@ public void onCompletion(MediaPlayer mp) {
4042

4143
final TextView tv = (TextView) startScreenView.findViewById(R.id.startGameText);
4244
tv.setTypeface(ActivityMain.tf);
43-
tv.setTextColor(getResources().getColor(R.color.white));
45+
tv.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
4446

4547
tv.setOnTouchListener(new View.OnTouchListener() {
4648
@Override
@@ -50,12 +52,12 @@ public boolean onTouch(View v, MotionEvent event) {
5052
music.stop();
5153
}
5254
if (event.getAction() == MotionEvent.ACTION_DOWN) {
53-
tv.setTextColor(getResources().getColor(R.color.red));
55+
tv.setTextColor(ContextCompat.getColor(requireContext(), R.color.red));
5456
}
5557
if (event.getAction() == MotionEvent.ACTION_UP) {
5658

57-
tv.setTextColor(getResources().getColor(R.color.white));
58-
getFragmentManager().beginTransaction().replace(
59+
tv.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
60+
getParentFragmentManager().beginTransaction().replace(
5961
getId(), ActivityMain.fragments.get(1)
6062
).commit();
6163
}
105 Bytes
140 Bytes
140 Bytes

0 commit comments

Comments
 (0)