• Mehdi Haghgoo

    Mehdi Haghgoo

    2 years ago
    Hi.@romainguy said in a recent

    video

    that Jetpack Compose has to catch up with 15 years of development. Does that mean that Android's classic way of using xml layouts has been in use since 2005? I ask because Android's public first public release seems to be 2008.
    Mehdi Haghgoo
    r
    3 replies
    Copy to Clipboard
  • v

    Vincent tiensi

    2 years ago
    Hiya! Thank you for the codelabs/compose tutorials, they have been super helpful. I was wondering if there’s any tutorials/deeper dive on building custom Modifiers. Modifiers seem pretty core to compose components but besides digging into the source code there doesn’t seem to be much else on it (There was a custom text Modifier.layout in the layout tutorial).
    v
    1 replies
    Copy to Clipboard
  • Sumit Sharma

    Sumit Sharma

    2 years ago
    Hi all, hope you all good, I have a question regarding @Model Annotation in Jetpack library. What does it mean and how can I use it in my JetPack Compose project. Which dependency contains it. Sorry for my bad English. Thanks
    Sumit Sharma
    r
    +1
    7 replies
    Copy to Clipboard
  • Namig Tahmazli

    Namig Tahmazli

    2 years ago
    Hi all. I have a question related to nested scrolling inside draggable and swappable components. I have been investigating Crane App. The BottomUp Slider view contains list. Which causes the list to consume all scroll until it reaches to bottom. Then finally the slider scrolls. I was able to overcome this issue by disabling and enabling LazyColumnFor, but it is not smooth at all. I wonder if there is a better way to handle it?
    Namig Tahmazli
    matvei
    3 replies
    Copy to Clipboard
  • e

    efemoney

    2 years ago
    Is there a modifier to scale a composable? kinda like how scalex and scaley work? I need something temporary (for animations)
    e
    nickbutcher
    +1
    8 replies
    Copy to Clipboard
  • Mehdi Haghgoo

    Mehdi Haghgoo

    2 years ago
    How can I support RTL text in Compose e.g. inside a Text Composable?
    Mehdi Haghgoo
    Zach Klippenstein (he/him) [MOD]
    2 replies
    Copy to Clipboard
  • b

    Brett Best

    2 years ago
    I’m trying to use ViewModel + LiveData, as seen https://developer.android.com/jetpack/compose/interop#viewmodel however the code sample (in thread reply) always shows null
    b
    satyan
    13 replies
    Copy to Clipboard
  • Mehdi Haghgoo

    Mehdi Haghgoo

    2 years ago
    All children of the a compose app's material theme must follow the typography defined in that theme, mustn't they?
    class MainActivity : AppCompatActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContent {
                DraftNotebookTheme {
                    Surface(color = MaterialTheme.colors.background) {
                        MyButton("Android")
                    }
                }
            }
        }
    }
    
    @Composable
    fun MyButton(label: String) {
        Button(onClick = {}) {
            Text(label)
        }
    }
    
    @Preview(showBackground = true)
    @Composable
    fun DefaultPreview() {
        DraftNotebookTheme {
            MyButton("سلام دنیا")
        }
    }
    When doing preview, the text shown on the button does not follow the font family I have set in the theme. Is this a bug?
    Mehdi Haghgoo
    e
    6 replies
    Copy to Clipboard
  • casablancais

    casablancais

    2 years ago
    Hi, based on codelabe on Modifiers ⬇️
    Note : By convention, the modifier is specified as the first optional parameter of a function. This enables you to specify a modifier on a composable without having to name all parameters.
    Is there a reason why the AppTopBar Modifier was not put as the first parameter in the compose material TopAppBar implementation ?
    @Composable
    fun TopAppBar(
        title: @Composable () -> Unit,
        modifier: Modifier = Modifier,
        navigationIcon: @Composable (() -> Unit)? = null,
        actions: @Composable RowScope.() -> Unit = {},
        backgroundColor: Color = MaterialTheme.colors.primarySurface,
        contentColor: Color = contentColorFor(backgroundColor),
        elevation: Dp = TopAppBarElevation
    ) {...}
    casablancais
    m
    2 replies
    Copy to Clipboard
  • Yann Badoual

    Yann Badoual

    2 years ago
    Is this bad practice?
    val (currentSize, setCurrentSize) = remember { mutableStateOf(Size.Zero) }
    val matrix = remember(currentSize) {
        Matrix().apply {
            setRectToRect(
                box,
                RectF(0f, 0f, currentSize.width, currentSize.height),
                Matrix.ScaleToFit.CENTER
            )
        }
    }
    
    remember(matrix) { // heavy work }
    
    Canvas(modifier = Modifier.fillMaxSize()) {
        setCurrentSize(size)
    	
    	// Do some drawing ...
    }
    I didn't find any alternative to retrieve the size and be able to
    remember
    some result with it as a key 🤔
    Yann Badoual
    satyan
    +1
    5 replies
    Copy to Clipboard