oday
09/30/2022, 11:38 AMalthaf
10/01/2022, 10:38 AMdata class WishesByCategory(val id: Int, val name: String, val wishes: List<Wish>)
Code below is the from a repository mapper, that maps WishesResponse to the domain model, I'm stuck with the code at 'When' statement, since all the domains models are immutable in my case, i have to make it mutable list explicitly as shown below, however, the follow code doesn't work as each time the loop run it creates fresh list. Final result is that each domain model end up with empty list. Is there a better way to write this code ?
private fun List<WishesRpse>.toWishesByCategory(): List<WishesByCategory> {
val result: ArrayList<WishesByCategory> = ArrayList()
val expWbyC =
WishesByCategory(1, context.getString(R.string.jp_wish_cat_experience), listOf())
val eventWbyC =
WishesByCategory(2, context.getString(R.string.jp_wish_cat_events), listOf())
val serviceWbyC =
WishesByCategory(3, context.getString(R.string.jp_wish_cat_services), listOf())
val moblityWbyC =
WishesByCategory(4, context.getString(R.string.jp_wish_cat_mobility), listOf())
val othersWbyC =
WishesByCategory(5, context.getString(R.string.jp_wish_cat_others), listOf())
forEach {
when (it.id) {
in experience ->
expWbyC.wishes.toMutableList()
in events ->
eventWbyC.wishes.toMutableList()
in service ->
serviceWbyC.wishes.toMutableList()
in mobility ->
moblityWbyC.wishes.toMutableList()
else -> othersWbyC.wishes.toMutableList()
}.add(Wish(it.id, it.name))
}
listOf<WishesByCategory>(
expWbyC,
eventWbyC,
serviceWbyC,
moblityWbyC,
othersWbyC
).forEach {
if (it.wishes.isNotEmpty()) result.add(it)
}
return result
}
Mohamed Ibrahim
10/02/2022, 11:03 AMEric Womer
10/02/2022, 12:56 PMEugene Maksymenko
10/02/2022, 8:43 PMSam
10/03/2022, 3:24 AMOg'abek Tirkashov
10/03/2022, 4:06 AMKatarzyna
10/03/2022, 12:02 PMSky
10/03/2022, 6:26 PMIhoby Christian
10/04/2022, 6:56 AMAhmed Sellami
10/04/2022, 8:50 AMopen class OneTimeObservable {
private var isInitialised = false
var state = false
set(value) {
field = value
isInitialised = true
if (oneTimeObservers.isNotEmpty()) {
notifyOneTimeObservers(value)
}
}
private val oneTimeObservers = mutableMapOf<String, (Boolean) -> Unit>()
fun whenReady(tag: String, listener: (Boolean) -> Unit): Boolean {
return if (!isInitialised) {
oneTimeObservers[tag] = listener
false
} else {
listener(state)
true
}
}
private fun notifyOneTimeObservers(boolean: Boolean) {
oneTimeObservers.forEach {
it.value(boolean)
}
oneTimeObservers.clear()
}
}
open class Observable {
var state = false
set(value) {
field = value
notifyObservers(value)
}
private val observers = mutableMapOf<String, (Boolean) -> Unit>()
fun addObserver(tag: String, observer: (Boolean) -> Unit) {
observers[tag] = observer
}
private fun notifyObservers(boolean: Boolean) {
observers.forEach {
it.value(boolean)
}
}
}
pablisco
10/04/2022, 5:54 PMNaveen
10/06/2022, 5:09 AMJan
10/06/2022, 12:32 PMAhmed Sellami
10/06/2022, 1:25 PMvar playedPodcast = playedPodcasts.find {
it.id == itemToPlay?.id
}
if (playedPodcast == null) {
playedPodcasts.add(PlayedPodcast(itemToPlay?.id, mutableListOf()))
}
playedPodcast = playedPodcasts.find {
it.id == itemToPlay?.id
}!!
ilushakr
10/06/2022, 1:53 PMNiclas Hjalmarsson
10/07/2022, 9:49 AMWindowCompat.setDecorFitsSystemWindows(window, false)
to let me draw behind the systembars.
So all my compose views (that need it ofc) calls Modifier.systemBarPadding()
for statusbar and navbar padding, and it works as expected.
But I’ve found that calling for example an Intent chooser to pick an app to open like an installed email app, makes the systemBarPadding()
return 0 and my layout jumps to underneath the status bar. And it’s all very visible since the dialog from the Intent chooser is not covering the entire screen.
Any tips on how I can make systemBarPadding()
keeping it’s value even after the app is not in the foreground anymore?
Thanks for any help.Naresh
10/07/2022, 10:38 AMKotlinLeaner
10/07/2022, 11:58 AM0x1810
, 0x2A35
. So I am adding value in my btyeArrayof but it giving me error on my side. Please also guide me how can I pass data to scan filters with multiple id.Abdulaziz Mohammed
10/07/2022, 5:29 PMSantiago
10/07/2022, 10:48 PMJava.Lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/engine/okhttp/OkHttp; ---> Java.Lang.ClassNotFoundException: Didn't find class "io.ktor.client.engine.okhttp.OkHttp" on path
I understand I'm missing a dependency on my bindings library / xamarin forms app, but I'm not sure how to proceed.
Did anyone try already to use a KMM library with ktor dependency from Xamarin Forms that experienced this error before?
Thanks.Isaac Akakpo
10/08/2022, 6:06 PMEric Womer
10/09/2022, 2:13 PMEric Womer
10/09/2022, 2:15 PMEric Womer
10/10/2022, 12:31 AMSharansalian Dev
10/10/2022, 5:04 AMAny Android Expert that can help me with this?
https://stackoverflow.com/questions/74010297/create-a-needle-gaugeview-from-ios-swift-to-androidkotlin
Azhar
10/10/2022, 5:57 AMalthaf
10/11/2022, 5:07 AMoverride suspend fun load(params: LoadParams<Int>): LoadResult<Int, Hotel> {
val currentPage = params.key ?: pageSetting.page
hotelSearchRepository.search(
hotelInquiry,
page = currentPage,
itemsPerPage = pageSetting.records
).collect { result ->
>>>>> return@collect result.fold(onSuccess = { hotelInquiryDetails ->
Page(
data = hotelInquiryDetails.hotels,
prevKey = if (currentPage == STARTING_PAGE_INDEX) null else (currentPage - 1),
nextKey = if (hotelInquiryDetails.hotels.isEmpty()) null else (currentPage + pageSetting.records)
)
}, onFailure = {
Error<Int, Hotel>(Exception(it))
})
}
} <<<<< - Error not return statement
Sergio C.
10/11/2022, 8:36 AMCS_047_HARI OM DWIVEDI
10/11/2022, 7:08 PMCS_047_HARI OM DWIVEDI
10/11/2022, 7:08 PM