Initial commit
This commit is contained in:
17
.claude/agent-memory/java21-android-legacy-builder/MEMORY.md
Normal file
17
.claude/agent-memory/java21-android-legacy-builder/MEMORY.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Memory Index - Helldivers 2 Android App
|
||||
|
||||
## User
|
||||
|
||||
## Feedback
|
||||
|
||||
## Project
|
||||
|
||||
- [Helldivers App Project](helldivers_app_project.md) - Estructura completa app Helldivers 2 para Galaxy S3
|
||||
|
||||
## Reference
|
||||
|
||||
- [Galaxy S3 Build Config](galaxy_s3_build_config.md) - Java 21 + API 18 desugaring setup
|
||||
- [Helldivers 2 Theme Colors](helldivers_theme.md) - Color palette and UI patterns
|
||||
- [SoundManager Pattern](soundmanager_pattern.md) - SoundPool implementation for low-latency audio
|
||||
- [Gradle Build Config](gradle_build_config.md) - Gradle wrapper with Java 21 toolchain
|
||||
- [Landscape Only Mode](landscape_only_mode.md) - Fixed landscape orientation configuration
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: Galaxy S3 Build Configuration
|
||||
description: Java 21 toolchain configuration for Android API 18-21 with desugaring
|
||||
type: reference
|
||||
---
|
||||
|
||||
## Working Configuration for Samsung Galaxy S3
|
||||
|
||||
**Why:** Galaxy S3 has Android 4.3 (API 18) with 1GB RAM. Java 21 features need desugaring.
|
||||
|
||||
**How to apply:**
|
||||
|
||||
### build.gradle (app level)
|
||||
```gradle
|
||||
android {
|
||||
namespace 'com.helldivers.app'
|
||||
compileSdk 28
|
||||
|
||||
defaultConfig {
|
||||
minSdk 18
|
||||
targetSdk 21
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_21
|
||||
targetCompatibility JavaVersion.VERSION_21
|
||||
coreLibraryDesugaringEnabled true
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||
}
|
||||
```
|
||||
|
||||
### AndroidManifest.xml
|
||||
```xml
|
||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="21" />
|
||||
<application android:hardwareAccelerated="false">
|
||||
```
|
||||
|
||||
### Key optimizations for 1GB RAM:
|
||||
- Use Theme.Holo instead of AppCompat
|
||||
- LinearLayout preferred over ConstraintLayout
|
||||
- RGB_565 for bitmaps
|
||||
- Disable hardware acceleration on problematic API 18
|
||||
- Minimize overdraw
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
name: Gradle Build Configuration
|
||||
description: Gradle build files for Java 21 + API 18 with desugaring support
|
||||
type: reference
|
||||
---
|
||||
|
||||
# Gradle Build Configuration
|
||||
|
||||
Migrated from Maven to Gradle due to SDK compatibility issues.
|
||||
|
||||
## Key Files
|
||||
|
||||
### settings.gradle
|
||||
```gradle
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.maven.apache.org/maven2' }
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.maven.apache.org/maven2' }
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Helldivers2App"
|
||||
include ':app'
|
||||
```
|
||||
|
||||
### build.gradle (Root)
|
||||
```gradle
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.maven.apache.org/maven2' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.2.0'
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.android.application' version '8.2.0' apply false
|
||||
}
|
||||
```
|
||||
|
||||
### app/build.gradle
|
||||
```gradle
|
||||
android {
|
||||
namespace 'com.helldivers.app'
|
||||
compileSdk 28
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.helldivers.app"
|
||||
minSdk 18
|
||||
targetSdk 21
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_21
|
||||
targetCompatibility JavaVersion.VERSION_21
|
||||
coreLibraryDesugaringEnabled true
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.android:android:4.1.1.4'
|
||||
implementation 'com.google.zxing:core:3.5.2'
|
||||
implementation 'com.google.zxing:android-core:3.3.0'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||
}
|
||||
```
|
||||
|
||||
## Compile Commands
|
||||
|
||||
```bash
|
||||
# Debug APK
|
||||
.\gradlew clean assembleDebug
|
||||
|
||||
# Install to device
|
||||
.\gradlew installDebug
|
||||
|
||||
# Output: app/build/outputs/apk/debug/app-debug.apk
|
||||
```
|
||||
|
||||
**Why:** Maven had issues with Android SDK path resolution. Gradle wrapper provides more reliable builds across different environments.
|
||||
|
||||
**How to apply:** Use `gradlew.bat` for all builds. Set JAVA_HOME to JDK 21 before running.
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
name: Helldivers App Project
|
||||
description: Estructura completa de app Helldivers 2 para Galaxy S3 (API 18-21)
|
||||
type: project
|
||||
---
|
||||
|
||||
Proyecto Android completo con temática Helldivers 2 creado el 2026-04-14.
|
||||
|
||||
**Estructura creada:**
|
||||
- Java 21 toolchain con desugaring para API 18-21
|
||||
- 3 Activities: MainActivity, ActivityQR, ActivityGame
|
||||
- SoundManager con SoundPool para baja latencia
|
||||
- Tema Helldivers 2: colores neón (amarillo, azul, rojo)
|
||||
- ZXing core para generación QR (sin escaner completo)
|
||||
- Orientación landscape forzada en todas las activities
|
||||
- Optimizado para 720x1280 xhdpi (Galaxy S3)
|
||||
|
||||
**Archivos clave:**
|
||||
- `C:/Users/dangilcal/Documents/Android/Helldivers/app/build.gradle` - Config Java 21 + desugaring
|
||||
- `C:/Users/dangilcal/Documents/Android/Helldivers/app/src/main/AndroidManifest.xml` - Landscape forzado
|
||||
- `C:/Users/dangilcal/Documents/Android/Helldivers/app/src/main/java/com/helldivers/app/` - Código fuente
|
||||
- `C:/Users/dangilcal/Documents/Android/Helldivers/app/src/main/res/` - Recursos
|
||||
|
||||
**Funcionalidades:**
|
||||
1. QR Instagram: genera QR para https://instagram.com/helldivers2
|
||||
2. Minijuego Estratagemas: Simon Says con flechas, puntuación por niveles
|
||||
|
||||
**Para compilar:**
|
||||
```
|
||||
gradlew.bat assembleDebug
|
||||
```
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
name: Helldivers 2 Theme Colors
|
||||
description: Color palette and UI patterns for Helldivers 2 sci-fi military aesthetic
|
||||
type: reference
|
||||
---
|
||||
|
||||
## Helldivers 2 Color Palette
|
||||
|
||||
| Color | Hex Code | Usage |
|
||||
|-------|----------|-------|
|
||||
| Military Orange | #FF6B00 | Primary accent, titles, buttons |
|
||||
| Military Yellow | #FFB800 | Highlights, glow effects |
|
||||
| Neon Cyan | #00D4FF | Active states, info text |
|
||||
| Alert Red | #FF3333 | Errors, exit buttons |
|
||||
| Success Green | #00FF66 | Success states |
|
||||
| Dark Background | #0A0A0F | Main background |
|
||||
| Panel Background | #121417 | Card/panel backgrounds |
|
||||
| Secondary BG | #1B1F25 | Elevated surfaces |
|
||||
|
||||
## Button Styles
|
||||
|
||||
**Standard Button:**
|
||||
- Background: #1B1F25 with orange border
|
||||
- Pressed: Cyan border glow
|
||||
- Min height: 56dp
|
||||
- Border: 2dp
|
||||
- Corner radius: 8dp
|
||||
|
||||
**Accent Buttons:**
|
||||
- Orange: Uses gradient for military feel
|
||||
- Cyan: For primary actions
|
||||
- Red: For destructive actions
|
||||
|
||||
## Typography
|
||||
|
||||
- Titles: 24sp, bold, orange/yellow
|
||||
- Buttons: 16sp, bold, white
|
||||
- Status: 14sp, cyan
|
||||
- Small: 12sp, gray
|
||||
|
||||
## Layout Guidelines (4.8" 720x1280)
|
||||
|
||||
- Touch targets: minimum 48dp
|
||||
- Button spacing: 16dp
|
||||
- Panel padding: 16dp
|
||||
- Screen margins: 16dp
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
name: Landscape Only Mode
|
||||
description: Fixed landscape orientation for all activities - no rotation handling needed
|
||||
type: project
|
||||
---
|
||||
|
||||
# Landscape Only Mode
|
||||
|
||||
App configured to run exclusively in landscape orientation.
|
||||
|
||||
## AndroidManifest.xml Configuration
|
||||
|
||||
```xml
|
||||
<uses-feature android:name="android.hardware.screen.landscape" android:required="true" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|screenSize">
|
||||
</activity>
|
||||
```
|
||||
|
||||
All activities (MainActivity, EstrategemasActivity, QRActivity) have:
|
||||
- `android:screenOrientation="landscape"` - Forces landscape
|
||||
- `android:configChanges="orientation|screenSize"` - Prevents activity recreation
|
||||
|
||||
## Code Changes Required
|
||||
|
||||
### Removed from all Activities:
|
||||
- `onConfigurationChanged()` method - no longer needed
|
||||
- Portrait-specific constants and logic
|
||||
- Layout switching logic (portrait vs landscape)
|
||||
|
||||
### QRActivity Specific:
|
||||
```java
|
||||
// OLD: Size based on orientation
|
||||
int qrSize = (orientation == LANDSCAPE) ? QR_SIZE_LANDSCAPE : QR_SIZE_PORTRAIT;
|
||||
|
||||
// NEW: Fixed landscape size
|
||||
private static final int QR_SIZE = 360; // 180dp x 2 for xhdpi
|
||||
```
|
||||
|
||||
## Layout Structure
|
||||
|
||||
Only `res/layout/` exists - no `layout-land/` subdirectory needed.
|
||||
All layouts are designed specifically for landscape (720x1280 on Galaxy S3).
|
||||
|
||||
## Benefits for Galaxy S3:
|
||||
|
||||
1. **Memory savings** - No duplicate layouts in memory
|
||||
2. **Simpler code** - No orientation change handling
|
||||
3. **Consistent UI** - Always optimized for 4.8" landscape display
|
||||
4. **Better game experience** - Estrategemas minigame designed for wide screen
|
||||
|
||||
**Why:** User requested fixed landscape for consistent Helldivers 2 theme experience. Removes complexity of handling rotation on low-memory devices.
|
||||
|
||||
**How to apply:** When creating new activities, always add `android:screenOrientation="landscape"`. Never implement onConfigurationChanged(). Single layout folder only.
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
name: SoundManager Pattern
|
||||
description: SoundPool implementation for low-latency audio on legacy Android
|
||||
type: reference
|
||||
---
|
||||
|
||||
## SoundPool Implementation for Galaxy S3
|
||||
|
||||
**Why:** MediaPlayer has too much latency for UI sounds. SoundPool is designed for low-latency playback.
|
||||
|
||||
**How to apply:**
|
||||
|
||||
```java
|
||||
public class SoundManager {
|
||||
private static final int MAX_STREAMS = 8;
|
||||
private SoundPool soundPool;
|
||||
private Map<Integer, Integer> soundMap;
|
||||
|
||||
private void initializeSoundPool(Context context) {
|
||||
soundMap = new HashMap<>();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
soundPool = new SoundPool.Builder()
|
||||
.setMaxStreams(MAX_STREAMS)
|
||||
.build();
|
||||
} else {
|
||||
// Legacy constructor for API 18-20
|
||||
soundPool = new SoundPool(MAX_STREAMS, AudioManager.STREAM_MUSIC, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void playButtonClick() {
|
||||
if (loaded && soundPool != null) {
|
||||
Integer soundId = soundMap.get(SOUND_BUTTON);
|
||||
if (soundId != null) {
|
||||
soundPool.play(soundId, 0.7f, 0.7f, 1, 0, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Key points:
|
||||
- Use application context to avoid leaks
|
||||
- Implement as singleton
|
||||
- Release resources in onDestroy
|
||||
- Support both legacy and modern SoundPool APIs
|
||||
- Use short OGG files (under 50KB)
|
||||
Reference in New Issue
Block a user