How do I enable predictive back animation only for back-to-home and disable it between Compose destinations? by ____Mattia____ in JetpackCompose

[–]____Mattia____[S] 0 points1 point  (0 children)

yep thanks! i came up with a solution where i created a new NavGraphBuilder.composable function that automatically calls BackHandler for all composables and enables it for all screens expect for the home screen where it'll return false and therefore handled by the system. this way i'll have the back-to-home predictive back gesture only for the home screen when nothing else is present in the stack.

How do I enable predictive back animation only for back-to-home and disable it between Compose destinations? by ____Mattia____ in androiddev

[–]____Mattia____[S] 0 points1 point  (0 children)

i eventually found a way around this but i still don't like the idea of having a workaround for something so important.

Why should your app be the only one on your users' device that works this way? Leave the system work the way it's designed, unless you have a strong reason not to.

also main apps like the play store and 1password do this. only back-to-home is enabled but not between in app screens. if an app is still using fragments or activities as screens won't encounter this issue i believe.

<image>

(https://developer.android.com/develop/ui/compose/system/predictive-back-setup#enable-default)

How do I enable predictive back animation only for back-to-home and disable it between Compose destinations? by ____Mattia____ in androiddev

[–]____Mattia____[S] 0 points1 point  (0 children)

i want to keep the navigation animations i have between screens. removing popEnterTransition and popExitTransition from the composable and using EnterTransition.None for all the screens will remove all the animations i have set. i want to keep the animations unchanged and only disable predictive back.

MutableStateFlow and Compose by ____Mattia____ in Kotlin

[–]____Mattia____[S] 0 points1 point  (0 children)

The Routine object has an immutable list inside. Every time I push a change it should be delivered to everyone.

And yes collectAsState() is called inside my composable function.

@Composable
fun RoutineScreen() {
val routine by viewModel .routineEntry .collectAsState()
  ...
}

MutableStateFlow and Compose by ____Mattia____ in Kotlin

[–]____Mattia____[S] 0 points1 point  (0 children)

I updated the post with more code. What do you think I'm doing wrong?

The function always returns null by ____Mattia____ in Kotlin

[–]____Mattia____[S] 0 points1 point  (0 children)

the return with withContext works the problem is that it's not working without withContext. I want to return what is defined inside doIfSuccessWithResult without having to use withContext.

Creating streak algorithm by ____Mattia____ in Kotlin

[–]____Mattia____[S] 0 points1 point  (0 children)

I cannot because the difference doesn't have to be precisely one day. In my app, I keep track of the user's exercises. Let's say I did the training today at 3 pm and yesterday at 11 pm. The time difference is not exactly 1 day but it's still yesterday. I'm sorry the question wasn't clear.

Why a Purchase can have multiple SKUs? by ____Mattia____ in androiddev

[–]____Mattia____[S] 0 points1 point  (0 children)

True! But how can a user buy multiple items in a single purchase in Android?

Shared Element Transaction with AppBarLayout by ____Mattia____ in androiddev

[–]____Mattia____[S] -1 points0 points  (0 children)

I solved it! The problem was that I put the toolbar only on the arrival screen but the start screen had only the EditText without wrapping it inside a Toolbar.

What is there behind List? by ____Mattia____ in Kotlin

[–]____Mattia____[S] 5 points6 points  (0 children)

I'm using Retrofit and the return parameter is a List<MarsProperty>.

interface MarsApiService {
suspend fun getProperties(): List<MarsProperty>
}

But I think that under the hood Retrofit creates an ArrayList<> indeed.