Skip to content

Commit

Permalink
Merge pull request #30 from musicorum-app/dev
Browse files Browse the repository at this point in the history
update to 1.20
  • Loading branch information
MysteryMS authored Nov 11, 2023
2 parents e153ded + 04895ff commit a5595ef
Show file tree
Hide file tree
Showing 28 changed files with 971 additions and 406 deletions.
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ android {
applicationId "io.musicorum.mobile"
minSdk 28
targetSdk 34
versionCode 64
versionName "1.19.1-pre-release"
versionCode 65
versionName "1.20-pre-release"
//compileSdkPreview = "UpsideDownCake"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -114,6 +114,7 @@ play {
}

dependencies {
implementation 'org.reflections:reflections:0.10.2'
implementation 'com.github.skydoves:balloon-compose:1.5.2'
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation "androidx.paging:paging-compose:3.3.0-alpha02"
Expand Down Expand Up @@ -171,7 +172,7 @@ dependencies {
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'
implementation 'androidx.compose.material3:material3:1.2.0-alpha09'
implementation 'com.google.accompanist:accompanist-placeholder-material:0.26.5-rc'
implementation 'io.coil-kt:coil-compose:2.4.0'
implementation 'androidx.datastore:datastore-preferences:1.0.0'
Expand Down
27 changes: 22 additions & 5 deletions app/src/main/java/io/musicorum/mobile/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import com.google.firebase.remoteconfig.ktx.remoteConfig
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
import dagger.hilt.android.AndroidEntryPoint
import io.musicorum.mobile.ktor.endpoints.UserEndpoint
import io.musicorum.mobile.models.FetchPeriod
import io.musicorum.mobile.repositories.LocalUserRepository
import io.musicorum.mobile.router.BottomNavBar
import io.musicorum.mobile.serialization.User
Expand Down Expand Up @@ -300,6 +301,16 @@ class MainActivity : ComponentActivity() {
)
}
) {
/* WIP val views =
Reflections("io.musicorum.mobile")
.getMethodsAnnotatedWith(Route::class.java)
Log.d("REGISTRY", "${views.size} routes were found.")
views.forEach { method ->
val routeName = method.annotations[0].annotationClass.simpleName
?: return@forEach
composable(route = routeName) { method.invoke(null) }
}*/

loginGraph(navController = navController)

composable("home") { Home() }
Expand All @@ -323,11 +334,17 @@ class MainActivity : ComponentActivity() {
}

composable(
"charts/detail?index={index}",
arguments = listOf(navArgument("index") {
type = NavType.IntType
defaultValue = 1
})
"charts/detail?index={index}&period={period}",
arguments = listOf(
navArgument("index") {
type = NavType.IntType
defaultValue = 1
},
navArgument("period") {
type = NavType.StringType
defaultValue = FetchPeriod.WEEK.value
}
)
) { backStack ->
BaseChartDetail(backStack.arguments?.getInt("index")!!)
}
Expand Down
103 changes: 103 additions & 0 deletions app/src/main/java/io/musicorum/mobile/components/RewindCard.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package io.musicorum.mobile.components

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.Launch
import androidx.compose.material.icons.rounded.ChevronRight
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import io.musicorum.mobile.ui.theme.MostlyRed
import io.musicorum.mobile.ui.theme.Typography

@Composable
fun RewindCard(description: String, onOpen: () -> Unit) {
val expandedState = rememberSaveable {
mutableStateOf(true)
}
val gradient = Brush.horizontalGradient(listOf(MostlyRed, MostlyRed.copy(alpha = .5f)))
val rotationState = rememberSaveable {
mutableFloatStateOf(90f)
}
val rotation = animateFloatAsState(targetValue = rotationState.floatValue)

Box(
modifier = Modifier
.padding(horizontal = 20.dp)
.padding(top = 15.dp)
.clip(RoundedCornerShape(12.dp))
.fillMaxWidth()
.background(gradient)
.padding(horizontal = 14.dp, vertical = 10.dp)

) {
Column {
Row(
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text(text = "Rewind 2023 on the run!", style = Typography.headlineSmall)
IconButton(onClick = {
if (expandedState.value) {
expandedState.value = false
rotationState.floatValue = 0f
} else {
expandedState.value = true
rotationState.floatValue = 90f
}
}) {
Icon(
Icons.Rounded.ChevronRight,
null,
modifier = Modifier.rotate(rotation.value)
)
}
}
AnimatedVisibility(visible = expandedState.value) {
Column {
val tonalColors = ButtonDefaults.filledTonalButtonColors(
containerColor = Color.White.copy(alpha = .4f)
)
Spacer(modifier = Modifier.height(10.dp))
Text(description, style = Typography.bodyLarge)
Spacer(modifier = Modifier.height(10.dp))
FilledTonalButton(
onClick = onOpen,
colors = tonalColors,
modifier = Modifier.height(35.dp)
) {
Icon(Icons.AutoMirrored.Rounded.Launch, null)
Spacer(modifier = Modifier.width(10.dp))
Text(text = "Visit")
}
}
}
}
}
}

This file was deleted.

Loading

0 comments on commit a5595ef

Please sign in to comment.