Skip to content

Commit

Permalink
Merge pull request #27 from musicorum-app/dev
Browse files Browse the repository at this point in the history
upgrade to 1.19.0
  • Loading branch information
MysteryMS authored Oct 1, 2023
2 parents 8ffbf31 + db35206 commit 4a05196
Show file tree
Hide file tree
Showing 36 changed files with 1,106 additions and 283 deletions.
25 changes: 13 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'com.google.dagger.hilt.android'
id 'kotlin-kapt'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.10'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.10'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'dagger.hilt.android.plugin'
Expand All @@ -29,7 +29,6 @@ android {
namespace 'io.musicorum.mobile'
compileSdk 34


signingConfigs {
release {
storeFile file(appKeyStoreFile)
Expand All @@ -39,18 +38,17 @@ android {
}
}


lintOptions {
disable 'MissingTranslation'
disable 'NullSafeMutableLiveData'
}


defaultConfig {
applicationId "io.musicorum.mobile"
minSdk 28
targetSdk 34
versionCode 62
versionName "1.18.2-pre-release"
versionCode 63
versionName "1.19.0-pre-release"
//compileSdkPreview = "UpsideDownCake"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -97,7 +95,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.2'
kotlinCompilerExtensionVersion '1.5.3'
}
packagingOptions {
resources {
Expand All @@ -118,7 +116,7 @@ play {
dependencies {
implementation 'com.github.skydoves:balloon-compose:1.5.2'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation "androidx.paging:paging-compose:3.2.0-rc01"
implementation "androidx.paging:paging-compose:3.3.0-alpha02"
implementation 'com.github.crowdin.mobile-sdk-android:sdk:1.5.7'
implementation platform('androidx.compose:compose-bom:2022.11.00')
implementation 'com.google.android.play:app-update:2.1.0'
Expand All @@ -136,11 +134,10 @@ dependencies {

implementation "com.google.dagger:hilt-android:2.44.2"
implementation 'androidx.core:core-ktx:1.10.0'
kapt "com.google.dagger:hilt-compiler:2.44.2"
kapt "com.google.dagger:hilt-compiler:2.48"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'

// implementation "com.google.accompanist:accompanist-permissions:0.29.0-alpha17"
implementation 'com.google.firebase:firebase-messaging-ktx:23.1.2'
implementation 'com.google.firebase:firebase-messaging-ktx:23.2.1'
implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1"
implementation 'app.rive:rive-android:4.0.0'
implementation "androidx.startup:startup-runtime:1.1.1"
Expand Down Expand Up @@ -171,7 +168,7 @@ dependencies {

implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.1'
implementation 'androidx.activity:activity-compose:1.8.0-rc01'
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation 'androidx.compose.material3:material3:1.2.0-alpha06'
Expand All @@ -189,3 +186,7 @@ dependencies {
kapt {
correctErrorTypes true
}

hilt {
enableAggregatingTask true
}
28 changes: 19 additions & 9 deletions app/src/main/java/io/musicorum/mobile/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.slideInHorizontally
Expand Down Expand Up @@ -86,6 +86,7 @@ import io.musicorum.mobile.views.individual.Album
import io.musicorum.mobile.views.individual.AlbumTracklist
import io.musicorum.mobile.views.individual.Artist
import io.musicorum.mobile.views.individual.PartialAlbum
import io.musicorum.mobile.views.individual.TagScreen
import io.musicorum.mobile.views.individual.Track
import io.musicorum.mobile.views.individual.User
import io.musicorum.mobile.views.login.loginGraph
Expand All @@ -96,7 +97,6 @@ import io.sentry.android.core.SentryAndroid
import io.sentry.compose.withSentryObservableEffect
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.map
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json

val Context.userData: DataStore<Preferences> by preferencesDataStore(name = "userdata")
Expand Down Expand Up @@ -129,11 +129,10 @@ class MainActivity : ComponentActivity() {
super.attachBaseContext(Crowdin.wrapContext(newBase))
}

@OptIn(ExperimentalAnimationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)


val remoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig
val configSettings = remoteConfigSettings {
minimumFetchIntervalInSeconds = 10
Expand Down Expand Up @@ -185,12 +184,12 @@ class MainActivity : ComponentActivity() {
WindowCompat.setDecorFitsSystemWindows(window, true)

firebaseAnalytics = Firebase.analytics
/* window.setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
)
/*window.setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
)*/

WindowCompat.setDecorFitsSystemWindows(window, false)*/
//WindowCompat.setDecorFitsSystemWindows(window, false)

FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
if (task.isSuccessful) {
Expand Down Expand Up @@ -398,6 +397,17 @@ class MainActivity : ComponentActivity() {

composable("settings") { Settings() }
composable("settings/scrobble") { ScrobbleSettings() }

composable(
"tag/{tagName}",
arguments = listOf(
navArgument("tagName") {
type = NavType.StringType
},
)
) {
TagScreen()
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/io/musicorum/mobile/components/ArtistRow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import androidx.compose.foundation.indication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyRow
Expand All @@ -32,12 +32,17 @@ fun ArtistRow(artists: List<Artist>) {
LazyRow(
horizontalArrangement = Arrangement.spacedBy(15.dp),
modifier = Modifier
.padding(start = 20.dp)
.fillMaxWidth()
) {
item {
Spacer(modifier = Modifier.width(5.dp))
}
items(artists) { artist ->
ArtistCard(artist)
}
item {
Spacer(modifier = Modifier.width(5.dp))
}
}
}

Expand Down
32 changes: 20 additions & 12 deletions app/src/main/java/io/musicorum/mobile/components/GradientHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ import io.musicorum.mobile.ui.theme.KindaBlack
val HEADER_HEIGHT = 400.dp

@Composable
fun GradientHeader(backgroundUrl: String?, coverUrl: String?, shape: Shape, placeholderType: PlaceholderType) {
fun GradientHeader(
backgroundUrl: String?,
coverUrl: String?,
shape: Shape,
placeholderType: PlaceholderType,
showCover: Boolean = true
) {
Box(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -52,17 +58,19 @@ fun GradientHeader(backgroundUrl: String?, coverUrl: String?, shape: Shape, plac
)
)
)
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
AsyncImage(
model = defaultImageRequestBuilder(url = coverUrl, placeholderType),
contentDescription = "",
modifier = Modifier
.padding(top = 200.dp)
.shadow(elevation = 20.dp, shape = shape, spotColor = Color.Black)
.clip(shape)
.size(300.dp),
contentScale = ContentScale.Crop
)
if (showCover) {
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
AsyncImage(
model = defaultImageRequestBuilder(url = coverUrl, placeholderType),
contentDescription = "",
modifier = Modifier
.padding(top = 200.dp)
.shadow(elevation = 20.dp, shape = shape, spotColor = Color.Black)
.clip(shape)
.size(300.dp),
contentScale = ContentScale.Crop
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.musicorum.mobile.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
Expand Down Expand Up @@ -32,9 +33,10 @@ fun HorizontalTracksRow(
} else {
LazyRow(
horizontalArrangement = Arrangement.spacedBy(10.dp),
modifier = Modifier
.padding(start = 20.dp)
) {
item {
Spacer(modifier = Modifier.padding(start = 10.dp))
}
if (tracks == null) {
items(4) { _ ->
GenericCardPlaceholder(visible = true)
Expand All @@ -44,6 +46,9 @@ fun HorizontalTracksRow(
TrackCard(track = track, labelType)
}
}
item {
Spacer(modifier = Modifier.padding(start = 10.dp))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,6 @@ private fun InformationSheet(state: MutableState<Boolean>, text: String, palette
Spacer(modifier = Modifier.width(10.dp))
Text(text = "More on Last.fm")
}
Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars))
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/io/musicorum/mobile/components/TagList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.musicorum.mobile.components

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -21,6 +22,8 @@ import androidx.palette.graphics.Palette
import com.google.accompanist.placeholder.PlaceholderHighlight
import com.google.accompanist.placeholder.material.placeholder
import com.google.accompanist.placeholder.shimmer
import io.musicorum.mobile.LocalNavigation
import io.musicorum.mobile.router.Routes
import io.musicorum.mobile.serialization.TagData
import io.musicorum.mobile.ui.theme.SkeletonSecondaryColor
import io.musicorum.mobile.ui.theme.Typography
Expand All @@ -32,6 +35,7 @@ fun TagList(tags: List<TagData>, referencePalette: Palette?, visible: Boolean) {
referencePalette?.getVibrantColor(Color.LightGray.toArgb())?.let { Color(it) }
?: Color.LightGray
val background = darkenColor(borderColor.toArgb(), 0.70f)
val nav = LocalNavigation.current
LazyRow(
Modifier
.fillMaxWidth()
Expand All @@ -44,6 +48,9 @@ fun TagList(tags: List<TagData>, referencePalette: Palette?, visible: Boolean) {
modifier = Modifier
.border(1.dp, borderColor, RoundedCornerShape(100))
.clip(RoundedCornerShape(100))
.clickable {
nav?.navigate(Routes.tag(tag.name))
}
.placeholder(
visible,
highlight = PlaceholderHighlight.shimmer(SkeletonSecondaryColor)
Expand Down
48 changes: 46 additions & 2 deletions app/src/main/java/io/musicorum/mobile/components/TopAlbumsRow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.indication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
Expand All @@ -27,6 +28,8 @@ import coil.compose.AsyncImage
import io.musicorum.mobile.LocalNavigation
import io.musicorum.mobile.coil.PlaceholderType
import io.musicorum.mobile.coil.defaultImageRequestBuilder
import io.musicorum.mobile.ktor.endpoints.TagAlbum
import io.musicorum.mobile.router.Routes
import io.musicorum.mobile.serialization.TopAlbum
import io.musicorum.mobile.ui.theme.Typography
import io.musicorum.mobile.views.individual.PartialAlbum
Expand All @@ -38,12 +41,17 @@ import kotlinx.serialization.json.Json
fun TopAlbumsRow(albums: List<TopAlbum>) {
val nav = LocalNavigation.current!!
LazyRow(
horizontalArrangement = Arrangement.spacedBy(15.dp),
modifier = Modifier.padding(start = 20.dp)
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
item {
Spacer(modifier = Modifier.padding(start = 10.dp))
}
items(albums) { album ->
AlbumCard(album = album, nav)
}
item {
Spacer(modifier = Modifier.padding(start = 10.dp))
}
}
}

Expand Down Expand Up @@ -94,4 +102,40 @@ fun AlbumCard(album: TopAlbum, nav: NavHostController) {
modifier = Modifier.alpha(0.55f)
)
}
}

@Composable
fun AlbumCard(album: TagAlbum) {
val interactionSource = remember { MutableInteractionSource() }
val nav = LocalNavigation.current
val partialAlbum =
Json.encodeToString(PartialAlbum(album.name, album.artist.name))
Column(modifier = Modifier
.clickable(
enabled = true,
indication = null,
interactionSource = interactionSource
) { nav?.navigate(Routes.album(partialAlbum)) }
) {
AsyncImage(
model = defaultImageRequestBuilder(album.images[0].url, PlaceholderType.ALBUM),
contentDescription = null,
modifier = Modifier
.size(120.dp)
.clip(RoundedCornerShape(8.dp))
.indication(interactionSource, LocalIndication.current)
)
Text(
text = album.name,
style = Typography.bodyLarge,
modifier = Modifier.width(120.dp),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
album.artist.name,
style = Typography.bodyMedium,
modifier = Modifier.alpha(0.55f)
)
}
}
Loading

0 comments on commit 4a05196

Please sign in to comment.