• Colton Idle

    Colton Idle

    1 year ago
    For anyone that wasn't aware. accompanist coil and glide are deprecated. https://github.com/google/accompanist/releases I moved to coil directly since it added support for compose and the apis seem to be easier to work with, I don't need a weird crop type anymore, and the intermittent image loading failures are all gone. Great job coil team and of course thanks to accompanist team for paving the way.
    Colton Idle
    Shakil Karim
    3 replies
    Copy to Clipboard
  • j

    Jason Inbody

    1 year ago
    Is there anything in compose like SwiftUI observable objects. The observable objects can be used as singletons and there values, when changed can update UI states across the app. Other wise it looks like I have to place callback all over my app. Is there any way over snaking callbacks all over then place?
    j
    n
    +1
    4 replies
    Copy to Clipboard
  • j

    Jason Inbody

    1 year ago
    or maybe even binding variables? In swiftui you could create binding variables you could send down into code and when it changed inside a couple layers down in some functions it would still signal a state change and update the UI state
    j
    1 replies
    Copy to Clipboard
  • Jeff

    Jeff

    1 year ago
    After I click login once (and it fails for example), if I later change the value of email or password, the code in
    onClick
    gets called every time without a click on the button 🤷🏾
    var userEmail by remember { mutableStateOf("") }
    var userPassword by remember { mutableStateOf("") }
    Button(
        text = "Log in",
        onClick = {
            viewModel.login(userEmail, userPassword)
        }
    )
    Jeff
    Alexander Suraphel
    +1
    16 replies
    Copy to Clipboard
  • a

    Abhishek Dewan

    1 year ago
    can someone please help me understand why my bottom navigation composable causes the screen to reset when I moved between the bottom navigation tabs. Code in thread
    a
    i
    8 replies
    Copy to Clipboard
  • a

    AG

    1 year ago
    can someone help me to understand why changing bottomSheetScaffoldState value inside launchedeffect not updating bottom sheet, with coroutinescope.launch everything works right, code in a thread
    a
    m
    5 replies
    Copy to Clipboard
  • g

    Gagandeep

    1 year ago
    Hello All, Facing an error while trying to use compose java.lang.NoSuchMethodError: No static method setContent$default(Landroidx/activity/ComponentActivity;Landroidx/compose/runtime/CompositionContext;Lkotlin/jvm/functions/Function0;ILjava/lang/Object😉V in class Landroidx/activity/compose/ComponentActivityKt; or its super classes (declaration of 'androidx.activity.compose.ComponentActivityKt' appears in /data/app/~~BzN_IRidzKvmf62uFiBXDw==/com.graymatrix.did-sS4KMabqpUrHzNaHQrYCaA==/base.apk) at com.zee5.ComposeActivity.onCreate(ComposeActivity.kt:13) at android.app.Activity.performCreate(Activity.java:8006) at android.app.Activity.performCreate(Activity.java:7990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3584) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:233) at android.app.ActivityThread.main(ActivityThread.java:8010) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978) ******************************************************************************************** build.gradle
    buildFeatures {
        compose = true
        buildConfig = true
        viewBinding = true
    }
    
    compileOptions {
        isCoreLibraryDesugaringEnabled = true
        sourceCompatibility = Versions.java
        targetCompatibility = Versions.java
    }
    
    kotlinOptions {
        jvmTarget = Versions.java.name
    }
    composeOptions {
        kotlinCompilerExtensionVersion = Versions.kotlinCompilerExtension
        kotlinCompilerVersion = Kotlin.version
    }
    kotlin version 1.5.20 compose version 1.0.0-rc02
    g
    l
    +1
    14 replies
    Copy to Clipboard
  • Peter Mandeljc

    Peter Mandeljc

    1 year ago
    are there any bad ideas, that you should not use
    CompositionLocal
    for? Would it be a bad idea, to make a provider for
    ViewModel
    ?
    Peter Mandeljc
    1 replies
    Copy to Clipboard
  • Alexander Suraphel

    Alexander Suraphel

    1 year ago
    LazyColumn(modifier = modifier) {
        for (name in names) {
            Greeting(name = name)
            Divider(color = Color.Black)
        }
    }
    Alexander Suraphel
    Peter Mandeljc
    +1
    23 replies
    Copy to Clipboard
  • Peter Mandeljc

    Peter Mandeljc

    1 year ago
    I'm theory crafting how to approach callback hell in compose. Let's say I have code like below. How would you avoid passing callback down to the child?
    @HiltViewModel
    class WorldViewModel @Inject constructor(): ViewModel() {
        fun hello() {
        }
    }
    
    @Composable
    fun World(vm: WorldViewModel = hiltViewModel()) {
        Continent(onClick = vm::hello)
    }
    
    @Composable
    fun Continent(onClick: () -> Unit) {
        Country(onClick)
    }
    
    @Composable
    fun Country(onClick: () -> Unit) {
        State(onClick)
    }
    
    @Composable
    fun State(onClick: () -> Unit) {
        Button(onClick = onClick) { }
    }
    Peter Mandeljc
    c
    +2
    55 replies
    Copy to Clipboard