https://kotlinlang.org
Join Slack
How to get the screen size when in edge-to-edge mode? I just figured out that LocalContext.current.r...
t

Timo Drick

over 1 year ago
How to get the screen size when in edge-to-edge mode? I just figured out that LocalContext.current.resources.displayMetrics only returns widht and height excluding insets And also: LocalConfiguration.current.screenWidthDp do not include the insets.
t
a
+4
  • 6
  • 40
  • 1140
is there any way to disable paste on a TextField?
m

myanmarking

over 3 years ago
is there any way to disable paste on a TextField?
m
c
o
  • 3
  • 3
  • 1140
What's the best way to generate an .aar file from a multiplatform build.gradle file? My iOS targets ...
s

Sylvain Patenaude

about 5 years ago
What's the best way to generate an .aar file from a multiplatform build.gradle file? My iOS targets generate .framework outputs, but I would now like to wrap my android target jar file in an .aar file. Thanks in advance.
s
k
  • 2
  • 33
  • 1140
Hi Team , Is it possible to use ConstraintLayout in Compose Multiplatofrm , i want to use for ios <@...
s

Shivam Kanodia

about 2 years ago
Hi Team , Is it possible to use ConstraintLayout in Compose Multiplatofrm , i want to use for ios @etolstoy?
s
n
+2
  • 4
  • 5
  • 1138
Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
g

Gaurav Tyagi

over 2 years ago
Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
g
a
  • 2
  • 4
  • 1138
Hey guys, I want to run `debounce` on a flow from within a Composable. I get this warning Flow opera...
s

Shivam Dhuria

about 3 years ago
Hey guys, I want to run
debounce
on a flow from within a Composable. I get this warning Flow operator functions should not be invoked within composition . I am not using Viewmodels so can’t run the flow operator in the VM. Ideally I’d just want to call
debounce
on the
fullNameFlow
and trigger some changes in the composable. What’s the best way to go forward?
//This is inside a Composable
val fullNameFlow = MutableStateFlow("")
fullNameFlow.debounce(3000).mapLatest {
    Log.i(TAG,it)
    //Change Composable State
}

FormTextField(
    onValueChange = {
        fullNameFlow.value = it
    }
)
s
p
z
  • 3
  • 5
  • 1136
I'm really struggling to set up SQL Delight in a Compose Desktop project. This the reference I'm usi...
j

John Aoussou

over 2 years ago
I'm really struggling to set up SQL Delight in a Compose Desktop project. This the reference I'm using but I can't quite follow: https://cashapp.github.io/sqldelight/jvm_sqlite/ , does anyone have another template? Please look in the thread to see what I have attempted.
j
h
+2
  • 4
  • 21
  • 1135
I want to extract the array data from the json response and store the data in my custom data class. ...
t

T

almost 5 years ago
I want to extract the array data from the json response and store the data in my custom data class.
data class NewsData (

    val author: String, val title: String,
    val url: String, val publishedAt: String
)
class NewsViewModel : ViewModel() {

    // The internal MutableLiveData String that stores the most recent response
    private val _response = MutableLiveData<String>()

    // The external immutable LiveData for the response String
    val response: LiveData<String>
        get() = _response

    /**
     * Call getNewsData() on init so we can display status immediately.
     */
    init {
        getNewsData()
    }

    /**
     * Sets the value of the status LiveData to the News API status.
     */
    private fun getNewsData() {

        _response.value = NewsApi.retrofitService.getProperties().enqueue(
            object : Callback<ResponseBody> {
                override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
                    _response.value = "Failure: " + t.message
                    //Log.i("response", t.message)
                }

                override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
                    val root = JSONObject(response.body().toString())
                    val jsonArr = root.getJSONArray("articles")
                    val ob = jsonArr.getJSONObject(0)
                    val name = ob.getString("author")
                    _response.value = name
                }
            }).toString()
    }
}
This is the format of the json response.
t
o
  • 2
  • 19
  • 1134
Is it expected that `WindowInsets.isImeVisible` returns false when the keyboard is showing if the so...
e

eygraber

about 2 years ago
Is it expected that
WindowInsets.isImeVisible
returns false when the keyboard is showing if the softInputMode is set to pan?
e
a
+2
  • 4
  • 44
  • 1134
How to correctly store a list in a mutablestate remember variable? I tried with `val imagesList by r...
p

Pablo

over 1 year ago
How to correctly store a list in a mutablestate remember variable? I tried with
val imagesList by remember *{* _mutableStateListOf_<ImageModel>()*}*
but it gives this error
Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
If I replace
by remember
with
= remember
the error dissapears and I dont understand why. Also, the guides says
by remember
is the correct option so I whould like to understand how to be able to use
by remember
with this list. Another problem I found is that even using
=
instead of
by
, I'm not able to init the variable with a list.
remember *{* _mutableStateListOf_<ImageModel>(ImageModelProvider.imageModelList)*}*
gives this error:
Type mismatch. Required: ImageModel Found:List<ImageModel>
p
e
z
  • 3
  • 8
  • 1132
Previous262728Next

kotlinlang

A modern programming language that makes developers happier.

Powered by