Tag: Sep

Akkurate: New library for validation of your domain models | by Matthias Schenk | Sep, 2023

The next step is to create the required constraints. I start with the constraints for the street property. val addressValidator = Validator<Address> {this.street{isNotEmpty() otherwise {“Street must not be empty.”}constrain {it.matches(“[a-zA-Z\\s]+”.toRegex())} otherwise {“Street must contain only letters.”}}} The value must not be empty and also it…

Why has my background Worker stopped? Exploring Android WorkManger’s StopReason | by Paolo Rotolo | Sep, 2023

Between platform changes, new rules, and Android customizations by OEMs, scheduling long-running background jobs has become a quite challenging task. A practical solution that abstracts most of the underlying problems for developers is WorkManager, which supports both short, immediate jobs (Expedited Work) and long-running workers…

3-step guide to adding emojis — Jetpack Emoji Picker | by Nav Singh | Sep, 2023

class CustomRecentEmojiProvider(context: Context) : RecentEmojiAsyncProvider { private val sharedPreferences by lazy {context.getSharedPreferences(RECENT_EMOJI_LIST_PREF_NAME, Context.MODE_PRIVATE)} private val emoji2Frequency: MutableMap<String, Int> by lazy {sharedPreferences.getString(CUSTOM_EMOJI_FREQ_PREF_KEY, null)?.split(SPLIT_CHAR)?.associate { entry ->entry.split(VALUE_DELIMITER, limit = 2).let { value -> value[0] to value[1].toInt() }}?.toMutableMap() ?: mutableMapOf()} override fun getRecentEmojiListAsync(): ListenableFuture<List<String>> =Futures.immediateFuture(emoji2Frequency.toList().sortedByDescending { it.second }.map…