diff --git a/app/build.gradle b/app/build.gradle index 7a5e3730..28cf2a1b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -51,6 +51,19 @@ android { kotlinCompilerExtensionVersion compose_version kotlinCompilerVersion '1.4.21' } + + packagingOptions { + exclude 'META-INF/DEPENDENCIES' + exclude 'META-INF/LICENSE' + exclude 'META-INF/LICENSE.txt' + exclude 'META-INF/license.txt' + exclude 'META-INF/NOTICE' + exclude 'META-INF/NOTICE.txt' + exclude 'META-INF/notice.txt' + exclude 'META-INF/ASL2.0' + exclude 'META-INF/LGPL2.1' + exclude("META-INF/*.kotlin_module") + } } dependencies { @@ -59,7 +72,6 @@ dependencies { implementation "androidx.core:core-ktx:1.5.0-alpha05" implementation "androidx.palette:palette-ktx:1.0.0" implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.2.1' //Compose implementation "androidx.compose.ui:ui:$compose_version" @@ -69,18 +81,17 @@ dependencies { //Lifecycle implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" - implementation "androidx.lifecycle:lifecycle-extensions-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" //Coroutines - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" + //implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" + //implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" //Room kapt "androidx.room:room-compiler:$room_version" - implementation "androidx.room:room-runtime-ktx:$room_version" + implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" //Okhttp diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ee1bc357..d8ab2498 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,7 +12,7 @@ + android:theme="@style/Theme.ComposeLearn"> diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 00000000..55bbc1fb Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ diff --git a/app/src/main/java/com/example/composelearn/MainActivity.kt b/app/src/main/java/com/example/composelearn/MainActivity.kt index 802d4ca0..d13d1f80 100644 --- a/app/src/main/java/com/example/composelearn/MainActivity.kt +++ b/app/src/main/java/com/example/composelearn/MainActivity.kt @@ -2,15 +2,26 @@ package com.example.composelearn import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.material.* +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Settings import androidx.compose.runtime.Composable +import androidx.compose.runtime.Providers +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.setContent +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import androidx.core.view.WindowCompat import com.example.composelearn.ui.ComposeLearnTheme +import com.example.composelearn.ui.appNameStyle +import dev.chrisbanes.accompanist.insets.ProvideWindowInsets +import dev.chrisbanes.accompanist.insets.statusBarsHeight class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -21,27 +32,67 @@ class MainActivity : AppCompatActivity() { setContent { ComposeLearnTheme { - // A surface container using the 'background' color from the theme - Surface( - color = MaterialTheme.colors.background, - modifier = Modifier.fillMaxSize() - ) { - Statusbar() + ProvideWindowInsets { + HomeScreen() } } } } + + } @Composable -fun Statusbar() { +fun HomeScreen() { + Column { + val appBarColor = MaterialTheme.colors.surface.copy(alpha = 0.87f) + // Draw a scrim over the status bar which matches the app bar + Spacer(Modifier.background(appBarColor).fillMaxWidth().statusBarsHeight()) + + AppBar( + backgroundColor = appBarColor, + modifier = Modifier.fillMaxWidth() + ) + } } +@Composable +fun AppBar( + backgroundColor: Color, + modifier: Modifier = Modifier +) { + TopAppBar( + backgroundColor = backgroundColor, + title = { + Row(verticalAlignment = Alignment.CenterVertically) { + Image( + imageVector = vectorResource(R.drawable.ic_launcher_foreground) + ) + Text( + text = "SpotiFlyer", + style = appNameStyle + ) + } + }, + actions = { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { + IconButton( + onClick = { /* TODO: Open Settings */ } + ) { + Icon(Icons.Filled.Settings, tint = Color.Gray) + } + } + }, + modifier = modifier + ) +} + + @Preview(showBackground = true) @Composable fun DefaultPreview() { ComposeLearnTheme { - Statusbar() + HomeScreen() } } \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Color.kt b/app/src/main/java/com/example/composelearn/ui/Color.kt index 64124434..2673ef67 100644 --- a/app/src/main/java/com/example/composelearn/ui/Color.kt +++ b/app/src/main/java/com/example/composelearn/ui/Color.kt @@ -1,8 +1,35 @@ package com.example.composelearn.ui +import androidx.compose.material.Colors +import androidx.compose.material.darkColors +import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.compositeOver -val purple200 = Color(0xFFBB86FC) -val purple500 = Color(0xFF6200EE) -val purple700 = Color(0xFF3700B3) -val teal200 = Color(0xFF03DAC5) \ No newline at end of file +val colorPrimary = Color(0xFFFC5C7D) +val colorPrimaryDark = Color(0xFFCE1CFF) +val colorAccent = Color(0xFF9AB3FF) +val colorRedError = Color(0xFFFF9494) +val colorSuccessGreen = Color(0xFF59C351) +val darkBackgroundColor = Color(0xFF000000) + +val SpotiFlyerColors = darkColors( + primary = colorPrimary, + onPrimary = Color.Black, + primaryVariant = colorPrimaryDark, + secondary = colorAccent, + onSecondary = Color.Black, + error = colorRedError, + onError = Color.Black, + surface = darkBackgroundColor, + background = darkBackgroundColor +) + +/** + * Return the fully opaque color that results from compositing [onSurface] atop [surface] with the + * given [alpha]. Useful for situations where semi-transparent colors are undesirable. + */ +@Composable +fun Colors.compositedOnSurface(alpha: Float): Color { + return onSurface.copy(alpha = alpha).compositeOver(surface) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Shape.kt b/app/src/main/java/com/example/composelearn/ui/Shape.kt index 84e597a9..fd2dc14e 100644 --- a/app/src/main/java/com/example/composelearn/ui/Shape.kt +++ b/app/src/main/java/com/example/composelearn/ui/Shape.kt @@ -4,8 +4,8 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Shapes import androidx.compose.ui.unit.dp -val shapes = Shapes( - small = RoundedCornerShape(4.dp), - medium = RoundedCornerShape(4.dp), - large = RoundedCornerShape(0.dp) +val SpotiFlyerShapes = Shapes( + small = RoundedCornerShape(percent = 50), + medium = RoundedCornerShape(size = 8.dp), + large = RoundedCornerShape(size = 0.dp) ) \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Theme.kt b/app/src/main/java/com/example/composelearn/ui/Theme.kt index 5c00ce20..c7c4252a 100644 --- a/app/src/main/java/com/example/composelearn/ui/Theme.kt +++ b/app/src/main/java/com/example/composelearn/ui/Theme.kt @@ -1,44 +1,14 @@ package com.example.composelearn.ui -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material.MaterialTheme -import androidx.compose.material.darkColors -import androidx.compose.material.lightColors import androidx.compose.runtime.Composable -private val DarkColorPalette = darkColors( - primary = purple200, - primaryVariant = purple700, - secondary = teal200 -) - -private val LightColorPalette = lightColors( - primary = purple500, - primaryVariant = purple700, - secondary = teal200 - - /* Other default colors to override - background = Color.White, - surface = Color.White, - onPrimary = Color.White, - onSecondary = Color.Black, - onBackground = Color.Black, - onSurface = Color.Black, - */ -) - @Composable -fun ComposeLearnTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) { - val colors = if (darkTheme) { - DarkColorPalette - } else { - LightColorPalette - } - +fun ComposeLearnTheme(content: @Composable() () -> Unit) { MaterialTheme( - colors = colors, - typography = typography, - shapes = shapes, + colors = SpotiFlyerColors, + typography = SpotiFlyerTypography, + shapes = SpotiFlyerShapes, content = content ) } \ No newline at end of file diff --git a/app/src/main/java/com/example/composelearn/ui/Type.kt b/app/src/main/java/com/example/composelearn/ui/Type.kt index 6a5bd381..40651fef 100644 --- a/app/src/main/java/com/example/composelearn/ui/Type.kt +++ b/app/src/main/java/com/example/composelearn/ui/Type.kt @@ -1,28 +1,118 @@ package com.example.composelearn.ui import androidx.compose.material.Typography +import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.font.* import androidx.compose.ui.unit.sp +import com.example.composelearn.R -// Set of Material typography styles to start with -val typography = Typography( - body1 = TextStyle( - fontFamily = FontFamily.Default, +private val Montserrat = fontFamily( + font(R.font.montserrat_light, FontWeight.Light), + font(R.font.montserrat_regular, FontWeight.Normal), + font(R.font.montserrat_medium, FontWeight.Medium), + font(R.font.montserrat_semibold, FontWeight.SemiBold), +) + +val pristineFont = fontFamily( + font(R.font.pristine_script, FontWeight.Bold) +) + +val SpotiFlyerTypography = Typography( + h1 = TextStyle( + fontFamily = Montserrat, + fontSize = 96.sp, + fontWeight = FontWeight.Light, + lineHeight = 117.sp, + letterSpacing = (-1.5).sp + ), + h2 = TextStyle( + fontFamily = Montserrat, + fontSize = 60.sp, + fontWeight = FontWeight.Light, + lineHeight = 73.sp, + letterSpacing = (-0.5).sp + ), + h3 = TextStyle( + fontFamily = Montserrat, + fontSize = 48.sp, fontWeight = FontWeight.Normal, - fontSize = 16.sp + lineHeight = 59.sp + ), + h4 = TextStyle( + fontFamily = Montserrat, + fontSize = 30.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 37.sp + ), + h5 = TextStyle( + fontFamily = Montserrat, + fontSize = 24.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 29.sp + ), + h6 = TextStyle( + fontFamily = Montserrat, + fontSize = 20.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 24.sp + ), + subtitle1 = TextStyle( + fontFamily = Montserrat, + fontSize = 16.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 20.sp, + letterSpacing = 0.5.sp + ), + subtitle2 = TextStyle( + fontFamily = Montserrat, + fontSize = 14.sp, + fontWeight = FontWeight.Medium, + lineHeight = 17.sp, + letterSpacing = 0.1.sp + ), + body1 = TextStyle( + fontFamily = Montserrat, + fontSize = 16.sp, + fontWeight = FontWeight.Medium, + lineHeight = 20.sp, + letterSpacing = 0.15.sp + ), + body2 = TextStyle( + fontFamily = Montserrat, + fontSize = 14.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 20.sp, + letterSpacing = 0.25.sp + ), + button = TextStyle( + fontFamily = Montserrat, + fontSize = 14.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 16.sp, + letterSpacing = 1.25.sp + ), + caption = TextStyle( + fontFamily = Montserrat, + fontSize = 12.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 16.sp, + letterSpacing = 0.sp + ), + overline = TextStyle( + fontFamily = Montserrat, + fontSize = 12.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 16.sp, + letterSpacing = 1.sp ) - /* Other default text styles to override - button = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.W500, - fontSize = 14.sp - ), - caption = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 12.sp - ) - */ -) \ No newline at end of file +) + +val appNameStyle = TextStyle( + fontFamily = pristineFont, + fontSize = 42.sp, + fontWeight = FontWeight.SemiBold, + lineHeight = 42.sp, + letterSpacing = (-0.5).sp, + color = Color.White +) diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 2b068d11..77c0584c 100644 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -4,27 +4,56 @@ android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> - - - - - - - + + + + + + + + - \ No newline at end of file + android:fillColor="#FF000000" + android:pathData="M377,356.7c-68.9,-45.4 -155.6,-56.4 -257.6,-32.7c-20.5,4.8 -13.6,35.8 7.3,31.2C290.7,317 351.6,386 368.2,386C384,386 390.2,365.4 377,356.7z"/> + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9c..00000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/font/montserrat_light.ttf b/app/src/main/res/font/montserrat_light.ttf new file mode 100644 index 00000000..990857de Binary files /dev/null and b/app/src/main/res/font/montserrat_light.ttf differ diff --git a/app/src/main/res/font/montserrat_medium.ttf b/app/src/main/res/font/montserrat_medium.ttf new file mode 100644 index 00000000..6e079f69 Binary files /dev/null and b/app/src/main/res/font/montserrat_medium.ttf differ diff --git a/app/src/main/res/font/montserrat_regular.ttf b/app/src/main/res/font/montserrat_regular.ttf new file mode 100644 index 00000000..8d443d5d Binary files /dev/null and b/app/src/main/res/font/montserrat_regular.ttf differ diff --git a/app/src/main/res/font/montserrat_semibold.ttf b/app/src/main/res/font/montserrat_semibold.ttf new file mode 100644 index 00000000..f8a43f2b Binary files /dev/null and b/app/src/main/res/font/montserrat_semibold.ttf differ diff --git a/app/src/main/res/font/pristine_script.ttf b/app/src/main/res/font/pristine_script.ttf new file mode 100644 index 00000000..e8d3e494 Binary files /dev/null and b/app/src/main/res/font/pristine_script.ttf differ diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cfe..7353dbd1 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index eca70cfe..7353dbd1 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index a571e600..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 61da551c..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c41dd285..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index db5080a7..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 6dba46da..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index da31a871..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 15ac6817..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index b216f2d3..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index f25a4197..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index e96783cc..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml deleted file mode 100644 index 2533f951..00000000 --- a/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127d..32547495 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,10 +1,13 @@ - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF + #FC5C7D + #CE1CFF + #9AB3FF + #FFFFFF + #99FFFFFF + #E6333333 + #000000 + #121212 + #59C351 + #FF9494 \ No newline at end of file diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 00000000..beab31f7 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #000000 + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2d3f8be6..723929bb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - ComposeLearn + SpotiFlyer \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index a5a9d820..04c03af1 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,25 +1,10 @@ - + - - - - -