commit 373cd2f5abe3142c609995a6236e4b96c3500587 Author: Patrick Ulrich Date: Wed Jan 29 11:42:30 2025 -0500 Initial Deployment diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.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/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..0edcd4b --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Good Morning Bitcoin \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..1bfdf85 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..a2d7c21 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..44ca2d9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,41 @@ + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..e1eea1d --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..773fe0f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..18d4e08 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e1d254 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Patrick Ulrich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1d7d9f5 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# GoodMorningBitcoin on Android + +Welcome to the GoodMorningBitcoinAndroid project! This is an Android application that allows you to listen to the Good Morning Bitcoin radio station from GoodMorningBitcoin.com. + +## Features + +- Stream the Good Morning Bitcoin radio station live. +- Play and stop the audio stream. +- Background playback with a notification. + +## Screenshots + +{future use} + +## Getting Started + +To get started with the GoodMorningBitcoinAndroid project, follow these steps: + +1. Clone the repository: + + git clone https://github.com/patrickulrich/GoodMorningBitcoinAndroid.git + +2. Open the project in Android Studio. + +3. Build and run the application on an Android device or emulator. + +You can also check https://github.com/patrickulrich/GoodMorningBitcoin-Android/releases for any releases that are precompiled. + +## Dependencies + +- Kotlin: 1.4.32 +- AndroidX AppCompat: 1.3.1 +- ExoPlayer: 2.15.1 +- Glide: 4.12.0 + +## Contributing + +Contributions to the GoodMorningBitcoinAndroid project are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request. + +## License + +The GoodMorningBitcoinAndroid project is licensed under the [MIT License](https://opensource.org/licenses/MIT). + +## Contact + +- Nostr: [npub1n35s0hnjukw675njzqargeym7l9qzpg2dr6q9924yr798kafwvxsgp63m0](https://primal.net/profile/npub1n35s0hnjukw675njzqargeym7l9qzpg2dr6q9924yr798kafwvxsgp63m0) +- Twitter: [@goodmorningbtc](https://twitter.com/goodmorningbtc) diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..20928a4 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,69 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + namespace 'com.example.goodmorningbitcoin' + compileSdk 33 + + defaultConfig { + applicationId "com.example.goodmorningbitcoin" + minSdk 24 + targetSdk 33 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary true + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + buildFeatures { + compose true + } + composeOptions { + kotlinCompilerExtensionVersion '1.3.2' + } + packagingOptions { + resources { + excludes += '/META-INF/{AL2.0,LGPL2.1}' + } + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' + implementation 'androidx.activity:activity-compose:1.5.1' + implementation platform('androidx.compose:compose-bom:2022.10.00') + implementation 'androidx.compose.ui:ui' + implementation 'androidx.compose.ui:ui-graphics' + implementation 'androidx.compose.ui:ui-tooling-preview' + implementation 'androidx.compose.material3:material3' + implementation 'androidx.media:media:1.4.3' + implementation 'androidx.core:core:1.7.0' + implementation 'com.squareup.okhttp3:okhttp:4.9.1' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00') + androidTestImplementation 'androidx.compose.ui:ui-test-junit4' + debugImplementation 'androidx.compose.ui:ui-tooling' + debugImplementation 'androidx.compose.ui:ui-test-manifest' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/release/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..d17abca Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..47a7467 --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.example.goodmorningbitcoin", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.0", + "outputFile": "app-release.apk" + } + ], + "elementType": "File" +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/goodmorningbitcoin/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/goodmorningbitcoin/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..070c6a9 --- /dev/null +++ b/app/src/androidTest/java/com/example/goodmorningbitcoin/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.goodmorningbitcoin + +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.goodmorningbitcoin", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3cb3fec --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/example/goodmorningbitcoin/MainActivity.kt b/app/src/main/java/com/example/goodmorningbitcoin/MainActivity.kt new file mode 100644 index 0000000..29d99a4 --- /dev/null +++ b/app/src/main/java/com/example/goodmorningbitcoin/MainActivity.kt @@ -0,0 +1,112 @@ +package com.example.goodmorningbitcoin + +import android.app.NotificationChannel +import android.app.NotificationManager +import android.content.Context +import android.content.Intent +import android.os.Build +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Button +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.example.goodmorningbitcoin.ui.theme.GoodMorningBitcoinTheme + +class MainActivity : ComponentActivity() { + private val channelId = "media_playback_channel" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // Create a notification channel (required for Android Oreo and above) + createNotificationChannel() + + setContent { + GoodMorningBitcoinTheme { + // A surface container using the 'background' color from the theme + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier.padding(16.dp) + ) { + Greeting("Android") + + // Remember the state of the media player (playing or stopped) + val isPlaying = remember { mutableStateOf(false) } + + Button( + onClick = { + // Toggle the isPlaying state + isPlaying.value = !isPlaying.value + + val action = if (isPlaying.value) { + MediaPlayerService.ACTION_PLAY + } else { + MediaPlayerService.ACTION_STOP + } + val intent = Intent(this@MainActivity, MediaPlayerService::class.java).apply { + this.action = action + } + startService(intent) + } + ) { + // Choose the correct icon and text based on the isPlaying state + val icon = if (isPlaying.value) R.drawable.ic_stop else R.drawable.ic_play_arrow + val text = if (isPlaying.value) "Stop" else "Play" + + Icon(painter = painterResource(id = icon), contentDescription = text) + Text(text) + } + } + } + } + } + } + + private fun createNotificationChannel() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + val name = getString(R.string.channel_name) + val descriptionText = getString(R.string.channel_description) + val importance = NotificationManager.IMPORTANCE_DEFAULT + val channel = NotificationChannel(channelId, name, importance).apply { + description = descriptionText + } + val notificationManager: NotificationManager = + getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + notificationManager.createNotificationChannel(channel) + } + } +} + +@Composable +fun Greeting(name: String, modifier: Modifier = Modifier) { + Text( + text = "Hello $name!", + modifier = modifier + ) +} + +@Preview(showBackground = true) +@Composable +fun GreetingPreview() { + GoodMorningBitcoinTheme { + Greeting("Android") + } +} diff --git a/app/src/main/java/com/example/goodmorningbitcoin/MediaPlayerService.kt b/app/src/main/java/com/example/goodmorningbitcoin/MediaPlayerService.kt new file mode 100644 index 0000000..94ec10d --- /dev/null +++ b/app/src/main/java/com/example/goodmorningbitcoin/MediaPlayerService.kt @@ -0,0 +1,184 @@ +package com.example.goodmorningbitcoin + +import android.app.Notification +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.app.Service +import android.content.Context +import android.content.Intent +import android.media.MediaPlayer +import android.os.Build +import android.os.IBinder +import android.support.v4.media.session.MediaSessionCompat +import android.support.v4.media.session.PlaybackStateCompat +import androidx.core.app.NotificationCompat +import androidx.core.app.NotificationManagerCompat +import android.util.Log + +class MediaPlayerService : Service() { + private var mediaPlayer: MediaPlayer? = null + private var isPlaying = false + private lateinit var mediaSession: MediaSessionCompat + private val notificationId = 1 + private val channelId = "media_playback_channel" + + companion object { + const val ACTION_PLAY = "com.example.goodmorningbitcoin.ACTION_PLAY" + const val ACTION_STOP = "com.example.goodmorningbitcoin.ACTION_STOP" + } + + override fun onBind(intent: Intent?): IBinder? { + // This service does not support binding, so return null + return null + } + + override fun onCreate() { + super.onCreate() + +// Create a MediaSessionCompat + mediaSession = MediaSessionCompat(this, "MediaSessionTag").apply { + setCallback(mediaSessionCallback) + isActive = true + } + + + // Create a notification channel (required for Android Oreo and above) + createNotificationChannel() + } + + private fun createNotificationChannel() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + val name = "Media Playback" + val descriptionText = "Media playback controls" + val importance = NotificationManager.IMPORTANCE_LOW + val channel = NotificationChannel(channelId, name, importance).apply { + description = descriptionText + } + val notificationManager: NotificationManager = + getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + notificationManager.createNotificationChannel(channel) + } + } + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + when (intent?.action) { + ACTION_PLAY -> startPlaying() + ACTION_STOP -> stopPlaying() + } + return START_NOT_STICKY + } + + private val mediaSessionCallback = object : MediaSessionCompat.Callback() { + override fun onPlay() { + startPlaying() + } + + override fun onPause() { + stopPlaying() + } + } + + private fun startPlaying() { + try { + mediaPlayer = MediaPlayer().apply { + setDataSource("https://radio.goodmorningbitcoin.com/listen/goodmorningbitcoin/radio.mp3") + // Set the OnErrorListener to handle errors during playback + setOnErrorListener { _, what, extra -> + Log.e("MediaPlayerError", "Error occurred during playback, Error code: $what, Extra code: $extra") + // Handle the error as appropriate for your app + true + } + // Set the OnPreparedListener to start playback once prepared + setOnPreparedListener { + start() + } + // Use prepareAsync to prepare the media player asynchronously + prepareAsync() + } + isPlaying = true + updatePlaybackState(PlaybackStateCompat.STATE_PLAYING) + // Show media player notification + showMediaPlayerNotification(PlaybackStateCompat.STATE_PLAYING) + // Start service as a foreground service + startForeground(notificationId, buildNotification(PlaybackStateCompat.STATE_PLAYING)) + } catch (e: Exception) { + Log.e("MediaPlayerError", "Error occurred while starting playback", e) + // Handle the exception as appropriate for your app + } + } + + private fun stopPlaying() { + mediaPlayer?.stop() + mediaPlayer?.release() + mediaPlayer = null + isPlaying = false + updatePlaybackState(PlaybackStateCompat.STATE_PAUSED) + // Update media player notification + showMediaPlayerNotification(PlaybackStateCompat.STATE_PAUSED) + // Stop service as a foreground service + stopForeground(Service.STOP_FOREGROUND_REMOVE) + } + + private fun updatePlaybackState(state: Int) { + val playbackStateBuilder = PlaybackStateCompat.Builder() + .setActions( + PlaybackStateCompat.ACTION_PLAY_PAUSE or + PlaybackStateCompat.ACTION_PLAY or + PlaybackStateCompat.ACTION_PAUSE + ) + .setState(state, PlaybackStateCompat.PLAYBACK_POSITION_UNKNOWN, 0f) + mediaSession.setPlaybackState(playbackStateBuilder.build()) + } + + private fun showMediaPlayerNotification(state: Int) { + val notification = buildNotification(state) + with(NotificationManagerCompat.from(this)) { + notify(notificationId, notification) + } + } + + private fun buildNotification(state: Int): Notification { + val playIntent = Intent(this, MediaPlayerService::class.java).apply { + action = ACTION_PLAY + } + val pauseIntent = Intent(this, MediaPlayerService::class.java).apply { + action = ACTION_STOP + } + val playPendingIntent: PendingIntent = + PendingIntent.getService(this, 0, playIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + val pausePendingIntent: PendingIntent = + PendingIntent.getService(this, 0, pauseIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + + val notificationBuilder = NotificationCompat.Builder(this, channelId) + .setSmallIcon(android.R.drawable.ic_dialog_info) // Use system info icon + .setContentTitle("Good Morning Bitcoin") + .setContentText("Pending Pulling Podcast Name") + .setPriority(NotificationCompat.PRIORITY_LOW) + .setStyle( + androidx.media.app.NotificationCompat.MediaStyle() + .setMediaSession(mediaSession.sessionToken) + .setShowActionsInCompactView(0) + ) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + + if (state == PlaybackStateCompat.STATE_PLAYING) { + notificationBuilder + .addAction( + android.R.drawable.ic_media_pause, + "Pause", + pausePendingIntent + ) // Use system pause icon + } else { + notificationBuilder + .addAction( + android.R.drawable.ic_media_play, + "Play", + playPendingIntent + ) // Use system play icon + } + + return notificationBuilder.build() + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Color.kt b/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Color.kt new file mode 100644 index 0000000..9d9ad5b --- /dev/null +++ b/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.goodmorningbitcoin.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/src/main/java/com/example/goodmorningbitcoin/ui/theme/Theme.kt b/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Theme.kt new file mode 100644 index 0000000..8239b44 --- /dev/null +++ b/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Theme.kt @@ -0,0 +1,70 @@ +package com.example.goodmorningbitcoin.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.runtime.SideEffect +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat + +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 GoodMorningBitcoinTheme( + 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 + } + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val window = (view.context as Activity).window + window.statusBarColor = colorScheme.primary.toArgb() + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme + } + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Type.kt b/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Type.kt new file mode 100644 index 0000000..2f248b6 --- /dev/null +++ b/app/src/main/java/com/example/goodmorningbitcoin/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.goodmorningbitcoin.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/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_masthead.webp b/app/src/main/res/drawable/bg_masthead.webp new file mode 100644 index 0000000..92919d0 Binary files /dev/null and b/app/src/main/res/drawable/bg_masthead.webp differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_play_arrow.xml b/app/src/main/res/drawable/ic_play_arrow.xml new file mode 100644 index 0000000..2217e32 --- /dev/null +++ b/app/src/main/res/drawable/ic_play_arrow.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_stop.xml b/app/src/main/res/drawable/ic_stop.xml new file mode 100644 index 0000000..9266a0e --- /dev/null +++ b/app/src/main/res/drawable/ic_stop.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..597fa42 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,16 @@ + + + +