commit 71db2d1ab963a6facaa1685369cccd3a8f88310e Author: forgejoadmin Date: Tue Aug 18 03:16:42 2026 -0400 Initial commit Co-Authored-By: Claude Sonnet 5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96a49ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Python +.venv/ +.venv_vlm/ +__pycache__/ +*.pyc + +# Android / Gradle +.gradle/ +build/ +/app/local.properties +*.iml +.idea/ +.cxx/ +.externalNativeBuild/ +captures/ + +# OS +.DS_Store +Thumbs.db + +# Env / secrets +.env +.env.* +*.pem +*.key diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/app/app/.gitignore b/app/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/app/build.gradle.kts b/app/app/build.gradle.kts new file mode 100644 index 0000000..6c22a51 --- /dev/null +++ b/app/app/build.gradle.kts @@ -0,0 +1,61 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.compose) +} + +android { + namespace = "com.example.reddex" + compileSdk { + version = release(37) + } + + defaultConfig { + applicationId = "com.example.reddex" + minSdk = 36 + targetSdk = 37 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + optimization { + enable = false + } + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + buildFeatures { + compose = true + } +} + +dependencies { + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.window) + implementation(libs.androidx.camera.core) + implementation(libs.androidx.camera.camera2) + implementation(libs.androidx.camera.lifecycle) + implementation(libs.androidx.camera.view) + implementation(libs.okhttp) + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.junit) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(libs.androidx.junit) + debugImplementation(libs.androidx.compose.ui.test.manifest) + debugImplementation(libs.androidx.compose.ui.tooling) +} \ No newline at end of file diff --git a/app/app/src/androidTest/java/com/example/reddex/ExampleInstrumentedTest.kt b/app/app/src/androidTest/java/com/example/reddex/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..9467505 --- /dev/null +++ b/app/app/src/androidTest/java/com/example/reddex/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.reddex + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.reddex", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/app/src/main/AndroidManifest.xml b/app/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..da8da40 --- /dev/null +++ b/app/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/app/src/main/assets/voices/bulbasaur.wav b/app/app/src/main/assets/voices/bulbasaur.wav new file mode 100644 index 0000000..fd2e398 Binary files /dev/null and b/app/app/src/main/assets/voices/bulbasaur.wav differ diff --git a/app/app/src/main/assets/voices/charizard.wav b/app/app/src/main/assets/voices/charizard.wav new file mode 100644 index 0000000..e717396 Binary files /dev/null and b/app/app/src/main/assets/voices/charizard.wav differ diff --git a/app/app/src/main/assets/voices/eevee.wav b/app/app/src/main/assets/voices/eevee.wav new file mode 100644 index 0000000..90630f6 Binary files /dev/null and b/app/app/src/main/assets/voices/eevee.wav differ diff --git a/app/app/src/main/assets/voices/pikachu.wav b/app/app/src/main/assets/voices/pikachu.wav new file mode 100644 index 0000000..0f99e84 Binary files /dev/null and b/app/app/src/main/assets/voices/pikachu.wav differ diff --git a/app/app/src/main/assets/voices/squirtle.wav b/app/app/src/main/assets/voices/squirtle.wav new file mode 100644 index 0000000..83a7f38 Binary files /dev/null and b/app/app/src/main/assets/voices/squirtle.wav differ diff --git a/app/app/src/main/java/com/example/reddex/Config.kt b/app/app/src/main/java/com/example/reddex/Config.kt new file mode 100644 index 0000000..4168de4 --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/Config.kt @@ -0,0 +1,8 @@ +package com.example.reddex + +/** + * LAN address of the recognition server (see /server in the repo root). + * DHCP can change this -- if recognition stops working, re-check the + * server machine's IP with ipconfig before assuming something else broke. + */ +const val RECOGNITION_SERVER_BASE_URL = "http://192.168.68.53:8420" diff --git a/app/app/src/main/java/com/example/reddex/MainActivity.kt b/app/app/src/main/java/com/example/reddex/MainActivity.kt new file mode 100644 index 0000000..a451742 --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/MainActivity.kt @@ -0,0 +1,358 @@ +package com.example.reddex + +import android.Manifest +import android.content.pm.PackageManager +import android.media.MediaPlayer +import android.util.Log +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.compose.setContent +import androidx.activity.result.contract.ActivityResultContracts +import androidx.activity.enableEdgeToEdge +import androidx.camera.core.CameraSelector +import androidx.camera.core.ImageCapture +import androidx.camera.core.ImageCaptureException +import androidx.camera.core.Preview +import androidx.camera.lifecycle.ProcessCameraProvider +import androidx.camera.view.PreviewView +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Button +import androidx.compose.material3.CircularProgressIndicator +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview as ComposePreview +import androidx.compose.ui.unit.dp +import androidx.core.content.ContextCompat +import com.example.reddex.data.KNOWN_POKEDEX_ENTRIES +import com.example.reddex.data.PokedexEntry +import com.example.reddex.network.RecognitionOutcome +import com.example.reddex.network.RecognitionClient +import com.example.reddex.ui.theme.RedDexTheme +import java.io.File +import java.util.concurrent.Executor +import java.util.concurrent.Executors +import kotlinx.coroutines.launch + +private const val TAG = "Pokedex" + +/** + * Below this width, treat the display as the foldable's small cover + * screen (closed state). Above it, treat it as the unfolded inner + * display (open state). Tuned for the Z Fold 8's cover screen (~5.5", + * narrow) vs inner screen (~7.6", wide) -- this is a simplification of + * full FoldingFeature/posture detection, chosen because we only target + * one known device. Revisit with androidx.window's FoldingFeature APIs + * if broader device support is ever needed. + */ +private const val CLOSED_SCREEN_WIDTH_THRESHOLD_DP = 500 + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + RedDexTheme { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + Box(modifier = Modifier.padding(innerPadding)) { + PokedexApp() + } + } + } + } + } +} + +@Composable +fun PokedexApp() { + val screenWidthDp = LocalConfiguration.current.screenWidthDp + if (screenWidthDp < CLOSED_SCREEN_WIDTH_THRESHOLD_DP) { + ClosedPokedexScreen() + } else { + OpenPokedexScreen() + } +} + +@Composable +fun ClosedPokedexScreen() { + Box( + modifier = Modifier + .fillMaxSize() + .background(Color(0xFFCC0000)), + contentAlignment = Alignment.Center, + ) { + Column(horizontalAlignment = Alignment.CenterHorizontally) { + Box( + modifier = Modifier + .size(72.dp) + .background(Color(0xFF3A6FD8), CircleShape) + .border(4.dp, Color.White, CircleShape), + ) + Text( + text = "POKÉDEX", + color = Color.White, + style = MaterialTheme.typography.headlineSmall, + modifier = Modifier.padding(top = 24.dp), + ) + } + } +} + +private sealed class ScanState { + data object Idle : ScanState() + data object Scanning : ScanState() + data class Recognized(val entry: PokedexEntry) : ScanState() + data class UnknownButDetected(val rawName: String) : ScanState() + data object NotRecognized : ScanState() + data class Error(val message: String) : ScanState() +} + +@Composable +fun OpenPokedexScreen() { + val context = LocalContext.current + var hasCameraPermission by remember { + mutableStateOf( + ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == + PackageManager.PERMISSION_GRANTED + ) + } + val permissionLauncher = rememberLauncherForActivityResult( + ActivityResultContracts.RequestPermission() + ) { granted -> hasCameraPermission = granted } + + LaunchedEffect(Unit) { + if (!hasCameraPermission) permissionLauncher.launch(Manifest.permission.CAMERA) + } + + if (!hasCameraPermission) { + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text("Camera permission is needed to scan Pokémon.") + } + return + } + + var scanState by remember { mutableStateOf(ScanState.Idle) } + var imageCapture by remember { mutableStateOf(null) } + val cameraExecutor = remember { Executors.newSingleThreadExecutor() } + val scope = rememberCoroutineScope() + var mediaPlayer by remember { mutableStateOf(null) } + + DisposableEffect(Unit) { + onDispose { + cameraExecutor.shutdown() + mediaPlayer?.release() + } + } + + Column(modifier = Modifier.fillMaxSize()) { + Box(modifier = Modifier.fillMaxWidth().weight(1f)) { + CameraPreview( + onImageCaptureReady = { imageCapture = it }, + ) + } + Column( + modifier = Modifier + .fillMaxWidth() + .weight(1f) + .verticalScroll(rememberScrollState()) + .padding(16.dp), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Button( + onClick = { + val capture = imageCapture ?: return@Button + scanState = ScanState.Scanning + captureAndIdentify( + context = context, + imageCapture = capture, + executor = cameraExecutor, + scope = scope, + onResult = { outcome -> + scanState = outcomeToState(outcome) + if (scanState is ScanState.Recognized) { + mediaPlayer?.release() + mediaPlayer = playVoice( + context, + (scanState as ScanState.Recognized).entry.voiceAssetPath, + ) + } + }, + ) + }, + enabled = scanState !is ScanState.Scanning, + ) { + Text(if (scanState is ScanState.Scanning) "Scanning..." else "Scan") + } + + Box(modifier = Modifier.height(16.dp)) + ScanResultView(scanState) + } + } +} + +@Composable +private fun ScanResultView(state: ScanState) { + when (state) { + is ScanState.Idle -> Text("Point at a Pokémon and press Scan.") + is ScanState.Scanning -> CircularProgressIndicator() + is ScanState.Recognized -> { + Image( + painter = painterResource(state.entry.imageRes), + contentDescription = state.entry.displayName, + contentScale = ContentScale.Fit, + modifier = Modifier + .fillMaxWidth() + .aspectRatio(1f) + .clip(RoundedCornerShape(8.dp)), + ) + Text( + text = state.entry.displayName, + style = MaterialTheme.typography.headlineMedium, + modifier = Modifier.padding(top = 8.dp), + ) + Text(text = state.entry.dexText, modifier = Modifier.padding(top = 8.dp)) + } + is ScanState.UnknownButDetected -> Text( + "Recognized \"${state.rawName}\", but there's no Pokédex data " + + "for it yet in this app." + ) + is ScanState.NotRecognized -> Text("No Pokémon detected. Try again.") + is ScanState.Error -> Text( + text = "Error: ${state.message}", + color = MaterialTheme.colorScheme.error, + ) + } +} + +private fun outcomeToState(outcome: RecognitionOutcome): ScanState = when (outcome) { + is RecognitionOutcome.Failure -> ScanState.Error(outcome.message) + is RecognitionOutcome.Success -> { + val result = outcome.result + if (!result.recognized || result.species == null) { + ScanState.NotRecognized + } else { + val entry = KNOWN_POKEDEX_ENTRIES[result.species.lowercase()] + if (entry != null) ScanState.Recognized(entry) else ScanState.UnknownButDetected(result.species) + } + } +} + +private fun captureAndIdentify( + context: android.content.Context, + imageCapture: ImageCapture, + executor: Executor, + scope: kotlinx.coroutines.CoroutineScope, + onResult: (RecognitionOutcome) -> Unit, +) { + val photoFile = File(context.cacheDir, "capture_${System.currentTimeMillis()}.jpg") + val outputOptions = ImageCapture.OutputFileOptions.Builder(photoFile).build() + + imageCapture.takePicture( + outputOptions, + executor, + object : ImageCapture.OnImageSavedCallback { + override fun onImageSaved(output: ImageCapture.OutputFileResults) { + scope.launch { + val bytes = photoFile.readBytes() + photoFile.delete() + val outcome = RecognitionClient.identify(bytes) + onResult(outcome) + } + } + + override fun onError(exception: ImageCaptureException) { + Log.e(TAG, "Capture failed", exception) + onResult(RecognitionOutcome.Failure(exception.message ?: "Capture failed")) + } + }, + ) +} + +private fun playVoice(context: android.content.Context, assetPath: String): MediaPlayer? { + return try { + val afd = context.assets.openFd(assetPath) + MediaPlayer().apply { + setDataSource(afd.fileDescriptor, afd.startOffset, afd.length) + afd.close() + prepare() + start() + } + } catch (e: Exception) { + Log.e(TAG, "Voice playback failed for $assetPath", e) + null + } +} + +@Composable +private fun CameraPreview(onImageCaptureReady: (ImageCapture) -> Unit) { + val context = LocalContext.current + val lifecycleOwner = androidx.compose.ui.platform.LocalLifecycleOwner.current + + androidx.compose.ui.viewinterop.AndroidView( + modifier = Modifier.fillMaxSize(), + factory = { ctx -> + val previewView = PreviewView(ctx) + val cameraProviderFuture = ProcessCameraProvider.getInstance(ctx) + cameraProviderFuture.addListener({ + val cameraProvider = cameraProviderFuture.get() + val preview = Preview.Builder().build().also { + it.surfaceProvider = previewView.surfaceProvider + } + val imageCapture = ImageCapture.Builder().build() + val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA + + try { + cameraProvider.unbindAll() + cameraProvider.bindToLifecycle( + lifecycleOwner, + cameraSelector, + preview, + imageCapture, + ) + onImageCaptureReady(imageCapture) + } catch (e: Exception) { + Log.e(TAG, "Camera bind failed", e) + } + }, ContextCompat.getMainExecutor(ctx)) + previewView + }, + ) +} + +@ComposePreview(showBackground = true) +@Composable +fun ClosedPokedexPreview() { + RedDexTheme { ClosedPokedexScreen() } +} diff --git a/app/app/src/main/java/com/example/reddex/data/PokedexEntry.kt b/app/app/src/main/java/com/example/reddex/data/PokedexEntry.kt new file mode 100644 index 0000000..ce4a8df --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/data/PokedexEntry.kt @@ -0,0 +1,65 @@ +package com.example.reddex.data + +import com.example.reddex.R + +data class PokedexEntry( + val speciesKey: String, + val displayName: String, + val dexText: String, + val imageRes: Int, + val voiceAssetPath: String, +) + +/** + * Species this app has art/dex-text/voice for. Only these can be shown + * with full detail even if the recognition server correctly identifies + * something outside this set (see MainActivity's "known but no local + * data" fallback). + */ +val KNOWN_POKEDEX_ENTRIES: Map = listOf( + PokedexEntry( + speciesKey = "bulbasaur", + displayName = "Bulbasaur", + dexText = "The Seed Pokémon. It can be seen napping in bright " + + "sunlight. There is a seed on its back. By soaking up the " + + "sun's rays, the seed grows progressively larger.", + imageRes = R.drawable.dex_bulbasaur, + voiceAssetPath = "voices/bulbasaur.wav", + ), + PokedexEntry( + speciesKey = "charizard", + displayName = "Charizard", + dexText = "The Flame Pokémon. Charizard flies around the sky in " + + "search of powerful opponents. It breathes fire of such " + + "great heat that it melts anything.", + imageRes = R.drawable.dex_charizard, + voiceAssetPath = "voices/charizard.wav", + ), + PokedexEntry( + speciesKey = "pikachu", + displayName = "Pikachu", + dexText = "The Mouse Pokémon. When several of these Pokémon " + + "gather, their electricity could build and cause lightning " + + "storms.", + imageRes = R.drawable.dex_pikachu, + voiceAssetPath = "voices/pikachu.wav", + ), + PokedexEntry( + speciesKey = "eevee", + displayName = "Eevee", + dexText = "The Evolution Pokémon. Its genetic code is irregular. " + + "It may mutate if it is exposed to radiation from element " + + "stones.", + imageRes = R.drawable.dex_eevee, + voiceAssetPath = "voices/eevee.wav", + ), + PokedexEntry( + speciesKey = "squirtle", + displayName = "Squirtle", + dexText = "The Tiny Turtle Pokémon. After birth, its back swells " + + "and hardens into a shell. It powerfully sprays foam from " + + "its mouth.", + imageRes = R.drawable.dex_squirtle, + voiceAssetPath = "voices/squirtle.wav", + ), +).associateBy { it.speciesKey } diff --git a/app/app/src/main/java/com/example/reddex/network/RecognitionClient.kt b/app/app/src/main/java/com/example/reddex/network/RecognitionClient.kt new file mode 100644 index 0000000..6d5577d --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/network/RecognitionClient.kt @@ -0,0 +1,88 @@ +package com.example.reddex.network + +import com.example.reddex.RECOGNITION_SERVER_BASE_URL +import java.io.IOException +import java.util.concurrent.TimeUnit +import kotlinx.coroutines.suspendCancellableCoroutine +import okhttp3.Call +import okhttp3.Callback +import okhttp3.MediaType.Companion.toMediaType +import okhttp3.MultipartBody +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.Response +import org.json.JSONObject +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException + +data class RecognitionResult( + val recognized: Boolean, + val species: String?, + val rawResponse: String, +) + +sealed class RecognitionOutcome { + data class Success(val result: RecognitionResult) : RecognitionOutcome() + data class Failure(val message: String) : RecognitionOutcome() +} + +object RecognitionClient { + private val client = OkHttpClient.Builder() + .connectTimeout(5, TimeUnit.SECONDS) + .writeTimeout(15, TimeUnit.SECONDS) + // model inference can take a few seconds, especially on a cold GPU + .readTimeout(30, TimeUnit.SECONDS) + .build() + + suspend fun identify(jpegBytes: ByteArray): RecognitionOutcome { + val requestBody = MultipartBody.Builder() + .setType(MultipartBody.FORM) + .addFormDataPart( + "file", + "capture.jpg", + jpegBytes.toRequestBody("image/jpeg".toMediaType()), + ) + .build() + + val request = Request.Builder() + .url("$RECOGNITION_SERVER_BASE_URL/identify") + .post(requestBody) + .build() + + return try { + val response = client.newCall(request).await() + response.use { + if (!it.isSuccessful) { + return RecognitionOutcome.Failure("Server error: HTTP ${it.code}") + } + val body = it.body?.string() ?: return RecognitionOutcome.Failure("Empty response") + val json = JSONObject(body) + RecognitionOutcome.Success( + RecognitionResult( + recognized = json.getBoolean("recognized"), + species = if (json.isNull("species")) null else json.getString("species"), + rawResponse = json.optString("raw_response", ""), + ) + ) + } + } catch (e: IOException) { + RecognitionOutcome.Failure("Couldn't reach the recognition server: ${e.message}") + } catch (e: Exception) { + RecognitionOutcome.Failure("Unexpected error: ${e.message}") + } + } + + private suspend fun Call.await(): Response = suspendCancellableCoroutine { cont -> + enqueue(object : Callback { + override fun onResponse(call: Call, response: Response) { + cont.resume(response) + } + + override fun onFailure(call: Call, e: IOException) { + cont.resumeWithException(e) + } + }) + cont.invokeOnCancellation { cancel() } + } +} diff --git a/app/app/src/main/java/com/example/reddex/ui/theme/Color.kt b/app/app/src/main/java/com/example/reddex/ui/theme/Color.kt new file mode 100644 index 0000000..e7ab2d0 --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.reddex.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/app/app/src/main/java/com/example/reddex/ui/theme/Theme.kt b/app/app/src/main/java/com/example/reddex/ui/theme/Theme.kt new file mode 100644 index 0000000..f344898 --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.example.reddex.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun RedDexTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/app/app/src/main/java/com/example/reddex/ui/theme/Type.kt b/app/app/src/main/java/com/example/reddex/ui/theme/Type.kt new file mode 100644 index 0000000..b3dc1f3 --- /dev/null +++ b/app/app/src/main/java/com/example/reddex/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.reddex.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/app/app/src/main/keepRules/rules.keep b/app/app/src/main/keepRules/rules.keep new file mode 100644 index 0000000..d7e081a --- /dev/null +++ b/app/app/src/main/keepRules/rules.keep @@ -0,0 +1,12 @@ +# Add project specific R8 rules here. +# AGP will combine all keep rule files in src/main/keepRules to pass to R8 +# +# For more details, see +# https://d.android.com/r/tools/r8/keep-rules + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} \ No newline at end of file diff --git a/app/app/src/main/res/drawable/dex_bulbasaur.png b/app/app/src/main/res/drawable/dex_bulbasaur.png new file mode 100644 index 0000000..aa8e5d2 Binary files /dev/null and b/app/app/src/main/res/drawable/dex_bulbasaur.png differ diff --git a/app/app/src/main/res/drawable/dex_charizard.png b/app/app/src/main/res/drawable/dex_charizard.png new file mode 100644 index 0000000..205fe6a Binary files /dev/null and b/app/app/src/main/res/drawable/dex_charizard.png differ diff --git a/app/app/src/main/res/drawable/dex_eevee.png b/app/app/src/main/res/drawable/dex_eevee.png new file mode 100644 index 0000000..efb8940 Binary files /dev/null and b/app/app/src/main/res/drawable/dex_eevee.png differ diff --git a/app/app/src/main/res/drawable/dex_pikachu.png b/app/app/src/main/res/drawable/dex_pikachu.png new file mode 100644 index 0000000..2d606dd Binary files /dev/null and b/app/app/src/main/res/drawable/dex_pikachu.png differ diff --git a/app/app/src/main/res/drawable/dex_squirtle.png b/app/app/src/main/res/drawable/dex_squirtle.png new file mode 100644 index 0000000..73f9b93 Binary files /dev/null and b/app/app/src/main/res/drawable/dex_squirtle.png differ diff --git a/app/app/src/main/res/drawable/ic_launcher_background.xml b/app/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/app/src/main/res/mipmap-anydpi/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/app/src/main/res/mipmap-anydpi/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/app/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/app/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/app/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/app/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/app/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/app/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/app/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/app/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/app/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/app/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/app/app/src/main/res/values/colors.xml b/app/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/app/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/app/app/src/main/res/values/strings.xml b/app/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..9638179 --- /dev/null +++ b/app/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Red Dex + \ No newline at end of file diff --git a/app/app/src/main/res/values/themes.xml b/app/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..0d1386b --- /dev/null +++ b/app/app/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +