Quanta
11/09/2021, 3:43 PM@Composable
fun Reproduce() {
var currentRoute: String? = null
val expr = currentRoute != null && shouldShowBottomNav(currentRoute)
}
@Composable
fun shouldShowBottomNav(currentRoute: String): Boolean {
return true
}
It only happens when the functions are annotated with @Composable
so probably related to Jetpack compose
I was only able to reproduce the error on the same project though, it does not really happen when I start a new project and try the same.
I have tried: Clean building, invalidating IDE cache, deleting files under ~/.android
and ~/.gradle
to clear those caches but it always gives me same result
Here is the traceback from android studio: https://pastebin.com/i5BkEDBUDheeraj Singh Bhadoria
11/10/2021, 4:41 AMwck
11/10/2021, 5:17 AMorg.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call: remember { mutableStateOf("test") }
Sololo
11/10/2021, 1:35 PMZoltan Demant
11/10/2021, 1:51 PMBad notification posted from package: x Couldn't create icon: StatusBarIcon
on Android 8.1? Im not using any vector-drawables. The icons are all white icons in .png
files.K Merle
11/10/2021, 5:05 PMSergio C.
11/10/2021, 5:16 PMMutableSharedFlow<Unit>(replay = 0)
AmrJyniat
11/11/2021, 7:07 AMmaven { url "<https://jitpack.io>" }
by default, is there any documentation for this change?Hovhannes
11/11/2021, 9:36 AMprivate fun webViewSettings(url: String) {
activityWebBinding.webView.settings.apply {
javaScriptEnabled = true
domStorageEnabled = true
builtInZoomControls = true
displayZoomControls = false
javaScriptCanOpenWindowsAutomatically = true
cacheMode = WebSettings.LOAD_DEFAULT
setAppCachePath(applicationContext.cacheDir.absolutePath)
defaultZoom = WebSettings.ZoomDensity.FAR
loadWithOverviewMode = true
useWideViewPort = true
allowFileAccess = true
allowContentAccess = true
setSupportZoom(true)
layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN
setRenderPriority(WebSettings.RenderPriority.HIGH)
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
setSupportMultipleWindows(true)
}
activityWebBinding.webView.apply {
if (Build.VERSION.SDK_INT >= 22) {
setLayerType(View.LAYER_TYPE_HARDWARE, null)
} else {
setLayerType(View.LAYER_TYPE_SOFTWARE, null)
}
scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
isScrollbarFadingEnabled = true
setBackgroundColor(Color.TRANSPARENT)
loadUrl(url)
}
}
Mahdi Shahpuri
11/13/2021, 9:47 AMPanicMonster
11/14/2021, 6:43 AMfun loadBlogArticles(onSuccess: (List<Blog>) -> Unit, onError: () -> Unit) {
val request = Request.Builder()
.get()
.url(BLOG_ARTICLES_URL)
.build()
executor.execute {
runCatching {
val response: Response = client.newCall(request).execute()
response.body?.string()?.let { json ->
gson.fromJson(json, BlogData::class.java)?.let { blogData ->
return@runCatching blogData.data
}
}
}.onFailure { e: Throwable ->
Log.e("BlogHttpClient", "Error loading blog articles", e)
onError()
}.onSuccess { value: List<Blog>? ->
onSuccess(value ?: emptyList())
}
}
}
Sololo
11/15/2021, 8:31 AMpublic abstract void onResult(@NonNull List<Value> data, int position, int totalCount,
@Nullable Key previousPageKey, @Nullable Key nextPageKey);
what does that ‘totalCount’ mean? use the jetpack’s paging2.Rasmus Hummelmose
11/15/2021, 8:13 PMMehdi Haghgoo
11/15/2021, 9:07 PMoverride fun toString(): String {
return when (this) {
is Success<*> -> "Success[data=$data]"
is Error -> "Error[exception=$exception]"
}
}
This is from the template Login Activity in Android Studio. What is Success<*> and what is "Success[data=$data]"?haris mehmood
11/16/2021, 11:36 AMRajput Art Studio
11/16/2021, 5:50 PMAshu
11/17/2021, 7:01 AMElias Estrada
11/17/2021, 12:27 PMtursunov abdulbois
11/17/2021, 2:20 PM@Singleton
class AuthenticationInterceptor @Inject constructor(profileRepository: ProfileRepository, @ApplicationScope coroutineScope: CoroutineScope) :
Interceptor {
private val tokenFlow: Flow<String?> = profileRepository.getProfileToken()
.stateIn(coroutineScope, SharingStarted.Eagerly, null)
override fun intercept(chain: Interceptor.Chain): Response {
val requestBuilder = chain.request().newBuilder()
val token: String? = runBlocking { // this line should be changed
tokenFlow.firstOrNull()
}
token?.let { requestBuilder.addHeader("Authorization", it) }
return chain.proceed(requestBuilder.build())
}
}
Kamo Spertsyan
11/18/2021, 7:21 AMMarko Novakovic
11/18/2021, 10:15 AMFragment.onCreate
am calling lifecycleScope.launch { ... }
. …
😄 is something I need to verify but espresso test is not waiting for it so it’s not deterministic, sometimes it fails and sometimes it passes.
how can I make espresso test to wait for …
inside launch {}
to finish? is IdlingResources
what am looking for?
ideally I would move all of that into ViewModel
and not deal with it in the Fragment
but currently it’s not up to me 😕Sergio C.
11/18/2021, 11:05 PMval list = mutableListOf<String>("10", "0.1", "0.01", "1")
list.sortBy { // default kotlin in-place sorter
it
}
list.sortByStringValue {
if (it.toDoubleOrNull() == null) {
it
} else {
it.toDouble()
}
}
Nabeel
11/19/2021, 5:03 AMspierce7
11/21/2021, 7:40 PMNot Kotlin
? Who cares? Are we trying to be like stack overflow? People need places to ask questions that they have, and chat communication is far more accessible than posts. This is probably the only chat / slack community that many developers are a part of, especially when it comes to Android.Marko Novakovic
11/22/2021, 12:16 PMSavedStateHandle
and I want to introduce Flow
like this:
class MyViewModel<State>(
private val savedStateHandle: SavedStateHandle,
initialState: State,
) : ViewModel() {
private var _state by mutableStateOf(initialState)
val state: State
get() = _state
init {
viewModelScope.launch {
savedStateHandle.getFlow(STATE, initialState)
.collect { _state = it }
}
}
fun updateState(reducer: State.() -> State) =
savedStateHandle.set(STATE, state.reducer())
companion object {
private const val STATE = "state"
}
}
it crashes my tests but when I do regular get
, set
on savedStateHandle
tests work fine.
both work great when I run in on emulator or real device but every single test crashes.
any help?Vivek Modi
11/22/2021, 2:30 PM0111 user will not allow displaying in edit text. only 111 is allowed
Allow zero at middle
1101 it can allow zero in middle.
TarunY
11/22/2021, 3:19 PMviewModelScope.launch
works perfectly fine when hit for the first time on button click, but does not work for the second time [means when i close my dialog fragment and click back the same button again ]. can you please suggest me how to resolve this issue ??Rubin MINE
11/22/2021, 8:11 PMMarko Novakovic
11/22/2021, 9:44 PMViewModel
init
block am converting SavedInstanceState.getLiveData
to Flow
using asFlow
but when I do that inside init
block my tests are failing because InstantTaskExecutorRule
seems to not take place before init
block. how to go about this?Slackbot
11/23/2021, 7:55 AM