• Roar Gronmo

    Roar Gronmo

    2 years ago
    In XML it is possible to align neighbouring
    TextView
    on baseline (text baseline
    app:layout_constraintBaseline_toBaselineOf
    ), is/will this be possible in @Compose ?
    Roar Gronmo
    1 replies
    Copy to Clipboard
  • j

    Jon

    2 years ago
    Hi everyone, I did a search but no luck - has anyone integrated a standard MapView with Compose? It seems like it should be easy but I’m just not certain what steps to take. Thanks for any tips/links!
    j
    Adam Powell
    4 replies
    Copy to Clipboard
  • Yang

    Yang

    2 years ago
    Not sure if it's related to the compiler plugin but is there a known issue with the IR compiler where a Java SAM within a suspend function fails to compile? Java interface:
    public interface JavaInterface {
        // this only happens when the method returns void
        void test();
    }
    class MainActivity : AppCompatActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
    
            GlobalScope.launch {
                test()
            }
        }
    }
    
    suspend fun test() {
        withContext(Dispatchers.Default) {
            // sam conversion won't compile
            val listener1 = JavaInterface {
                println("")
            }
    
            // this works
            val listener2 = object : JavaInterface {
                override fun test() {
                    println("")
                }
            }
        }
    }
    Yang
    itnoles
    +1
    4 replies
    Copy to Clipboard
  • m

    msink

    2 years ago
    Did anyone tried to compile
    compose-runtime
    by Kotlin/Native? I did quick and dirty port, and it more or less works
    m
    Andrey Kulikov
    4 replies
    Copy to Clipboard
  • Bryan Lee

    Bryan Lee

    2 years ago
    Anyone see what I'm doing incorrectly? I get the following error here
    val icon = +imageResource(R.drawable.ic_my_location_white_24dp)
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference Something to note: Using setViewContent instead of setContent since I'm using a custom map view
    class MainActivity : AppCompatActivity() {
        val mapContext = MapContext()
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setViewContent {
                AppTheme {
                    MapStack(mapContext = mapContext)
                }
            }
        }
    }
    
    @Composable
    fun MapStack(webMap: WebMap = WebMap(), mapContext: MapContext) {
        Stack {
            MapComponent(mapContext = mapContext, map = webMap.map)
    
            aligned(Alignment.BottomRight){
                val icon = +imageResource(R.drawable.ic_my_location_white_24dp)
                FloatingActionButton(
                            icon = icon,
                            modifier = Spacing(left = 8.dp, top = 8.dp, right = 20.dp, bottom = 48.dp)
                    )
            }
        }
    }
    Bryan Lee
    Timo Drick
    2 replies
    Copy to Clipboard
  • Zsolt

    Zsolt

    2 years ago
    Is my understanding right that back press handling / back stack functionality is not supported, but is on the roadmap at some point? I'm playing around with something related to this and would be curious what's the official standpoint on this. Thanks!
    Zsolt
    wasyl
    2 replies
    Copy to Clipboard
  • Roar Gronmo

    Roar Gronmo

    2 years ago
    When reading Flutter tutorial I see some resemblence to @Compose, is this because of Material pattern which both use or some other type of cooperation...?
    Roar Gronmo
    i
    +2
    6 replies
    Copy to Clipboard
  • Timo Drick

    Timo Drick

    2 years ago
    When i write following class:
    @Model
    Test(var test: String)
    the Compose framework will observe it and recompose the UI when it changes. Can i also observe this class in my custom code outside of a @Composable function?
    Timo Drick
    Adam Powell
    +1
    3 replies
    Copy to Clipboard
  • Bryan Lee

    Bryan Lee

    2 years ago
    Can someone explain to me what this does?
    private fun WebView.setRef(ref: (WebView) -> Unit) {
        ref(this)
    }
    Taken from ui/ui-android-view/src/main/java/androidx/ui/androidview/WebComponent.kt
    Bryan Lee
    Luca Nicoletti
    +2
    7 replies
    Copy to Clipboard
  • Zsolt

    Zsolt

    2 years ago
    Just noticed that changing a var in a @Model annotated class constructor doesn't trigger recomposition, only if the var is declared in the class body.
    Zsolt
    l
    8 replies
    Copy to Clipboard