Skip to content

Commit

Permalink
Updated dependency versions. Compiled to run on Android Studio, Bumbl…
Browse files Browse the repository at this point in the history
…ebee 2021.1.1 Canary 3
  • Loading branch information
Johann Blake committed Jul 10, 2021
1 parent d648584 commit 0f54e73
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 19 deletions.
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ android {
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.5.0'
kotlinCompilerVersion '1.5.10'
}
}

dependencies {

def lifecycle_version = "2.4.0-alpha01"
def activity_version = "1.3.0-beta01"
def lifecycle_version = "2.4.0-alpha02"
def activity_version = "1.3.0-rc01"
def retrofit_version = "2.9.0"
def paging_version = "3.0.0"

implementation 'androidx.core:core-ktx:1.6.0-beta02'
implementation 'androidx.appcompat:appcompat:1.4.0-alpha02'
implementation 'com.google.android.material:material:1.4.0-rc01'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
implementation 'com.google.android.material:material:1.4.0'
implementation "androidx.activity:activity-ktx:$activity_version"
implementation "androidx.activity:activity-compose:$activity_version"
implementation "androidx.compose.ui:ui:$compose_version"
Expand All @@ -60,7 +60,7 @@ dependencies {
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha06'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1'
implementation project(':navigation')

Expand All @@ -72,9 +72,9 @@ dependencies {

// Paging
implementation "androidx.paging:paging-runtime:$paging_version"
implementation "androidx.paging:paging-compose:1.0.0-alpha10"
implementation "androidx.paging:paging-compose:1.0.0-alpha11"

// Coil
implementation "io.coil-kt:coil:1.2.1"
implementation "com.google.accompanist:accompanist-coil:0.11.1"
implementation "com.google.accompanist:accompanist-coil:0.13.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import dev.wirespec.navigation.NavigationManager

@ExperimentalMaterialApi
@Composable
fun DummyHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier) {
fun DummyHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier, screenIsClosing: Boolean = false) {

val screenText = navInfo.screenData as String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,30 @@ fun ScreenFactory(isVisible: Boolean, navInfo: NavigationInfo?, modifier: Modifi
closeScreen = false

if (navInfo?.screen == Screens.PetsList) {
PetsListHandler(navInfo = navInfo)
PetsListHandler(navInfo = navInfo, screenIsClosing = closeScreen)
return
}

/**
* IMPORTANT: It is strongly recommended that your screen's handler (PetDetailsHandler, DummyHandler,
* SettingsHandler as used below) contain a parameter that is used to indicate when the screen is closing.
* When animation in Compose is executed, the screen gets recomposed even when the screen is being
* animated to exit. This means that any code in your screen handler will get executed when it closes.
* If there is any code in your handler that should only be executed when the screen is being shown
* (and not when it's removed), you should test to see if the screenIsClosing is set to true and not execute
* the code in your handler.
*/

AnimatedVisibility(
visible = isVisible && !closeScreen,
enter = slideInHorizontally(initialOffsetX = { it }),
exit = slideOutHorizontally(targetOffsetX = { it })
) {
if (navInfo?.screen != null) {
when (navInfo.screen) {
Screens.PetDetails -> PetDetailsHandler(navInfo)
Screens.Dummy -> DummyHandler(navInfo)
Screens.Settings -> SettingsHandler(navInfo)
Screens.PetDetails -> PetDetailsHandler(navInfo, screenIsClosing = closeScreen)
Screens.Dummy -> DummyHandler(navInfo, screenIsClosing = closeScreen)
Screens.Settings -> SettingsHandler(navInfo, screenIsClosing = closeScreen)
}
} else {
Surface(modifier = modifier.fillMaxSize()) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import dev.wirespec.navigation.NavigationManager
@ExperimentalAnimationApi
@ExperimentalMaterialApi
@Composable
fun PetDetailsHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier) {
fun PetDetailsHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier, screenIsClosing: Boolean = false) {

val vm = navInfo.viewmodel as PetDetailsViewModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import kotlin.math.roundToInt

@ExperimentalMaterialApi
@Composable
fun PetsListHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier) {
fun PetsListHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier, screenIsClosing: Boolean = false) {
val vm = navInfo.viewmodel as PetsListViewModel
val vmMain: MainViewModel = viewModel()
val coroutineScope = rememberCoroutineScope()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import dev.wirespec.navigation.NavigationManager

@ExperimentalMaterialApi
@Composable
fun SettingsHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier) {
fun SettingsHandler(navInfo: NavigationInfo, modifier: Modifier = Modifier, screenIsClosing: Boolean = false) {

val vm = navInfo.viewmodel as SettingsViewModel
Settings(
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.0.0-beta08'
compose_version = '1.0.0-rc01'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-alpha02'
classpath 'com.android.tools.build:gradle:7.1.0-alpha03'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}


task clean(type: Delete) {
delete rootProject.buildDir
}

0 comments on commit 0f54e73

Please sign in to comment.