Skip to content

Commit

Permalink
Update to compose 1.5.0-beta03 to fix crashes when animationDurationS…
Browse files Browse the repository at this point in the history
…cale is disabled (#930)

* Revert SwipeBackComments feature

* Upgrade to compose 1.5.0-beta03 and fix depreciations

* Smoll change

* Fix formatting

* Trigger woodpecker

* Updates slight changes

---------

Co-authored-by: Kevin Phoenix <[email protected]>
  • Loading branch information
MV-GH and twizmwazin authored Jul 2, 2023
1 parent 8e1b3c0 commit 2aa5161
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
27 changes: 15 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ android {
}

dependencies {
val composeVersion = "1.5.0-beta03"

implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.github.alorma:compose-settings-ui-m3:0.27.0")

Expand All @@ -103,11 +105,12 @@ dependencies {
implementation("io.noties.markwon:linkify:4.6.2")

// Accompanist
implementation("com.google.accompanist:accompanist-pager:0.30.1")
implementation("com.google.accompanist:accompanist-pager-indicators:0.30.1")
implementation("com.google.accompanist:accompanist-flowlayout:0.30.1")
implementation("com.google.accompanist:accompanist-permissions:0.30.1")
implementation("com.google.accompanist:accompanist-navigation-animation:0.30.1")
val accompanistVersion = "0.31.4-beta"
implementation("com.google.accompanist:accompanist-pager:$accompanistVersion")
implementation("com.google.accompanist:accompanist-pager-indicators:$accompanistVersion")
implementation("com.google.accompanist:accompanist-flowlayout:$accompanistVersion")
implementation("com.google.accompanist:accompanist-permissions:$accompanistVersion")
implementation("com.google.accompanist:accompanist-navigation-animation:$accompanistVersion")

// LiveData
implementation("androidx.compose.runtime:runtime-livedata:1.4.3")
Expand Down Expand Up @@ -136,24 +139,24 @@ dependencies {
// Unfortunately, ui tooling, and the markdown thing, still brings in the other material2 dependencies
implementation("androidx.compose.material3:material3:1.1.1")
implementation("androidx.compose.material3:material3-window-size-class:1.1.1")
implementation("androidx.compose.material:material-icons-extended:1.4.3")
implementation("androidx.compose.material:material-icons-extended:$composeVersion")
implementation("org.ocpsoft.prettytime:prettytime:5.0.6.Final")
implementation("io.coil-kt:coil-compose:2.4.0")
implementation("androidx.navigation:navigation-compose:2.5.3")
implementation("androidx.navigation:navigation-compose:2.7.0-beta01")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1")
testImplementation("androidx.arch.core:core-testing:2.2.0")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")

implementation("androidx.compose.ui:ui:1.4.3")
implementation("androidx.compose.ui:ui-tooling-preview:1.4.3")
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.ui:ui-tooling-preview:$composeVersion")
implementation("androidx.activity:activity-compose:1.7.2")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.4.3")
debugImplementation("androidx.compose.ui:ui-tooling:1.4.3")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.4.3")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeVersion")
debugImplementation("androidx.compose.ui:ui-tooling:$composeVersion")
debugImplementation("androidx.compose.ui:ui-test-manifest:$composeVersion")
implementation("net.engawapg.lib:zoomable:1.4.3")
implementation("androidx.browser:browser:1.5.0")

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/jerboa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import androidx.navigation.navDeepLink
import androidx.navigation.navigation
import arrow.core.Either
import com.google.accompanist.navigation.animation.AnimatedNavHost
import com.google.accompanist.navigation.animation.composable
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
import com.jerboa.api.API
import com.jerboa.api.ApiState
import com.jerboa.api.MINIMUM_API_VERSION
Expand Down Expand Up @@ -124,7 +124,7 @@ class MainActivity : AppCompatActivity() {
JerboaTheme(
appSettings = appSettings,
) {
val navController = rememberAnimatedNavController()
val navController = rememberNavController()
val serverVersionOutdatedViewed = remember { mutableStateOf(false) }

MarkdownHelper.init(
Expand All @@ -148,7 +148,7 @@ class MainActivity : AppCompatActivity() {
else -> {}
}

AnimatedNavHost(
NavHost(
route = Route.Graph.ROOT,
navController = navController,
startDestination = Route.HOME,
Expand Down
15 changes: 11 additions & 4 deletions app/src/main/java/com/jerboa/ui/components/inbox/InboxActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fun InboxTabs(
val transferCommentReplyDepsViaRoot = navController.rootChannel<CommentReplyDeps>()

val tabTitles = InboxTab.values().map { getLocalizedStringForInboxTab(ctx, it) }
val pagerState = rememberPagerState()
val pagerState = rememberPagerState { tabTitles.size }

Column(
modifier = Modifier.padding(padding),
Expand Down Expand Up @@ -224,7 +224,6 @@ fun InboxTabs(
},
)
HorizontalPager(
pageCount = tabTitles.size,
state = pagerState,
verticalAlignment = Alignment.Top,
modifier = Modifier.fillMaxSize(),
Expand Down Expand Up @@ -455,7 +454,11 @@ fun InboxTabs(
}
},
)
Box(modifier = Modifier.pullRefresh(refreshState).fillMaxSize()) {
Box(
modifier = Modifier
.pullRefresh(refreshState)
.fillMaxSize(),
) {
PullRefreshIndicator(loading, refreshState, Modifier.align(Alignment.TopCenter))
when (val mentionsRes = inboxViewModel.mentionsRes) {
ApiState.Empty -> ApiEmptyText()
Expand Down Expand Up @@ -621,7 +624,11 @@ fun InboxTabs(
}
},
)
Box(modifier = Modifier.pullRefresh(refreshState).fillMaxSize()) {
Box(
modifier = Modifier
.pullRefresh(refreshState)
.fillMaxSize(),
) {
PullRefreshIndicator(loading, refreshState, Modifier.align(Alignment.TopCenter))
when (val messagesRes = inboxViewModel.messagesRes) {
ApiState.Empty -> ApiEmptyText()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ fun UserTabs(
} else {
UserTab.values().map { getLocalizedStringForUserTab(ctx, it) }
}
val pagerState = rememberPagerState()
val pagerState = rememberPagerState { tabTitles.size }

val loading = personProfileViewModel.personDetailsRes == ApiState.Loading

Expand Down Expand Up @@ -315,7 +315,6 @@ fun UserTabs(
}
}
HorizontalPager(
pageCount = tabTitles.size,
state = pagerState,
verticalAlignment = Alignment.Top,
modifier = Modifier.fillMaxSize(),
Expand Down

0 comments on commit 2aa5161

Please sign in to comment.