Gabriele Rugani
05/14/2021, 12:40 PMWhat could happen if I would use different libraries with different kotlin version ?
Do you update your project's kotlin language's version only when all the imported libraries are updated ?
alenz316
05/14/2021, 5:37 PME/AndroidRuntime( 3715): Caused by: java.lang.NoClassDefFoundError: kotlin.collections.EmptyList
E/AndroidRuntime( 3715): at kotlin.collections.CollectionsKt__CollectionsKt.emptyList(SourceFile:71)
E/AndroidRuntime( 3715): at kotlin.collections.CollectionsKt.emptyList(SourceFile)
E/AndroidRuntime( 3715): ... 16 more
However, this crash does not happen on newer versions of Android (API 29) or if we have kotlinOptions.useOldBackend = true
, any idea what's the underlying cause in the new IR back-end that would cause it to crash on older versions of Android?Ujjwal Mittal
05/14/2021, 5:47 PMHekanksh Gohel
05/15/2021, 10:35 AMColton Idle
05/16/2021, 4:48 AMprivate val _name = MutableLiveData("")
val name: LiveData<String> = _name
with StateFlow like this
private val _name = MutableStateFlow("")
val name: StateFlow<String> = _name
Is that pretty much it? I do plan on reading/learning more about it, but I'm just trying to get a POC done and just wanted to make sure I'm not breaking any rules here that I don't know about. CheersInk
05/16/2021, 4:16 PM@Composable
fun BankScreen() {
val viewModel: BankViewModel = viewModel()
}
Tried to follow https://insert-koin.io/docs/reference/koin-android/compose/ but Android Studio throws weird erroronirutlA
05/16/2021, 11:09 PMspierce7
05/17/2021, 3:46 AMspnda
05/17/2021, 11:51 AMmelatonina
05/17/2021, 2:32 PMSlackbot
05/17/2021, 2:37 PMInk
05/18/2021, 1:00 PMprivate fun setActiveLabel(textView: TextView) {
binding.apply {
accounts.isSelected = binding.accounts == textView
cards.isSelected = binding.cards == textView
loans.isSelected = binding.loans == textView
funds.isSelected = binding.funds == textView
accounts.isActivated = binding.accounts == textView
cards.isActivated = binding.cards == textView
loans.isActivated = binding.loans == textView
funds.isActivated = binding.funds == textView
}
when (textView) {
binding.accounts -> { binding.accounts.setFocusForAccessibility() }
binding.cards -> { binding.cards.setFocusForAccessibility() }
binding.loans -> { binding.loans.setFocusForAccessibility() }
binding.funds -> { binding.funds.setFocusForAccessibility() }
}
}
Erik
05/18/2021, 2:06 PMstudio .
(e.g. in a repo root) it would open AS in that directory. Running it again would open the existing AS project window.
- ➡️ After, when running studio .
it opens the project in a new AS window every time, even if there already is an open window for the project.
This is an issue, because during the day I run studio .
quite often and I end up with too many windows for the same project!
Do you have this problem too?
Do you know how to fix this?
Is this and AS or JBT issue?Ink
05/18/2021, 3:41 PMNavHostController
as lambda down? I tried:
val appNavController = rememberNavController()
composable("loginScreen") {
LoginScreen(::appNavController)
}
@Composable
fun LoginScreen(navigateToLoginDetails: (details: String) -> Unit) {
....
navigateToLoginDetails(details)
...
}
Ilyes Dhiaeddine Belmiloud
05/18/2021, 7:36 PMInk
05/19/2021, 5:42 AMharis mehmood
05/19/2021, 10:08 AMRyan Simon
05/19/2021, 10:14 PMAbhishek Dewan
05/20/2021, 5:18 AMJoost Klitsie
05/20/2021, 8:33 AMlifecycleScope
and I want to run some job that either runs after a certain time or event (so can get cancelled) what is the best way of doing so?
For example, using:
val job = supervisorJob()
val myScope = lifecycleScope + job
// Somewhere else
job.cancelChildren()
Is not working out, because the myScope
stays alive after the `lifecycleScope`is cancelled
Using
var job: Job? = null
val theWork = lifecycleScope.launch {
// delay, do the work
}
// Somewhere else
job?.cancel()
This would work, but then I always have to keep track of the job. Is it possible to have a lifecycle respecting scope on which I can cancel its children when necessary?Denis Capkovic
05/20/2021, 12:09 PMwm overscan
, to hide navigation controls all-together (you cannot swipe down to bring up notification shade). But this also moves the keyboard, and hides part of it. Our application is always in landscape and is the only one running. Hacky solutions are welcome.ursus
05/20/2021, 6:17 PMAndroid75
05/21/2021, 2:21 AM@Singleton
class RefreshInterceptor @Inject
constructor(
private val savePrefSecurity: SavePrefSecurity
) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
var request = chain?.request()
var response = chain!!.proceed(request)
if (response.code == 401) {
var refresh = savePrefSecurity.getSValue(REFRESH_TOKEN)
if (!refresh.isNullOrBlank()) {
)
GlobalScope.launch {
var refrehResponse = api.refreshToken(sendRefresh)
[....}
// other code...
return@let intercept(chain)
}
}
}
return response
1. how can i avoid GlobalScope ? because refreshToken is a supend function
2. i think that return@let intercept(chain) is inappropriate blockinJesus Cruz Victoria
05/21/2021, 4:25 AMMarco
05/21/2021, 8:10 AMprivate val _uiState: MutableStateFlow<UiState> = MutableStateFlow(State.loading())
val uiState: StateFlow<UiState> = _uiState
init {
viewModelScope.launch {
repository.getData()
.map { resource ->
Log.d("VM", "got $resource")
State.fromResource(resource)
}
.collect { state -> _uiState.value = state }
}
}
or
val uiState = repository.getData()
.map { resource ->
Log.d("VM", "got $resource")
State.fromResource(resource)
}
.stateIn(
scope = viewModelScope,
started = WhileSubscribed(5000),
initialValue = State.loading()
)
And calling them from the activity
val state by viewModel.uiState.collectAsState()
I am also noticing some heavy delay when the api is executed:
I/Choreographer: Skipped 136 frames! The application may be doing too much work on its main thread.
Slackbot
05/21/2021, 1:02 PMErnestas
05/21/2021, 1:57 PMBill
05/22/2021, 9:45 AMstate.list = state.list.map { listItem in
if listItem.id == action.payload.id {
var listItem = listItem
listItem.title = action.payload.newTitle
return listItem
} else {
return listItem
}
}
Christopher Elías
05/23/2021, 4:20 AM2.3.5
to 2.4.0-alpha1
but all my actions are throwing error in the generated class. It its something like this...dhananjaykulkarni19
05/23/2021, 6:50 PM