• ubu

    ubu

    2 years ago
    Hi guys, what would be the best presentation pattern for implementing a rich text editor on Android? What do you think?
    ubu
    Anastasia Finogenova
    +2
    7 replies
    Copy to Clipboard
  • s

    sanmi

    2 years ago
    How do you handle dagger scoping using single activity Achi. Let's say I'd like to share a viewmodel amongst my reg fragments. How do I do it without creating another activity?
    s
    tjohnn
    +1
    9 replies
    Copy to Clipboard
  • Jason

    Jason

    2 years ago
    I were applying MVVM to my project and there is no problem so far, but I just confuse is there any problem with MVVM or what problem that MVVM can not resolve…
    Jason
    t
    +4
    15 replies
    Copy to Clipboard
  • Brendan Weinstein

    Brendan Weinstein

    2 years ago
    I recommend https://twitter.com/VasiliyZukanov/status/1206211507551375360?s=19 for some useful framing on design pattern trade-offs. One concept I like from CoRedux (https://github.com/freeletics/CoRedux) is you can use the design to enforce a log of all state changes. This is useful for sending breadcrumbs on crash reports. I have been playing around with implementing a similar pattern using coroutine flows. If we expand the discussion to what are some of the best ways to write an application, I am jealous that react/redux devs can replay state and hot reload.
    Brendan Weinstein
    rkeazor
    3 replies
    Copy to Clipboard
  • a

    Adam Hurwitz

    2 years ago
    What do Android devs think of the Unidirectional Data Flow + LiveData pattern in Kotlin? In version 2.0 I improved the view events, effects, and cleaned up the ViewModel with Kotlin Coroutines. 👩‍💻🏻 https://proandroiddev.com/udf2-0-5052c3e1c62a?
    a
    Daniel Beleza
    2 replies
    Copy to Clipboard
  • u

    ursus

    2 years ago
    to allow for parallel compilation of core, but have features depends on whole core still?
    u
    g
    10 replies
    Copy to Clipboard
  • Jérôme Gully

    Jérôme Gully

    2 years ago
    Hello, I follow this codelabs (https://codelabs.developers.google.com/codelabs/kotlin-android-training-coroutines-and-room/#3) and at any moment it's explained why we must write a custom ViewModelFactory. In my project I used
    ViewModel by viewModels()
    to avoid boilerplate code, so I'm a bit confused about it.
    Jérôme Gully
    1 replies
    Copy to Clipboard
  • Daniel

    Daniel

    2 years ago
    Thoughts on the SharedPreferences component needed: Would you prefer a single class where all shared preferences are located (see example below) or would you have several classes which handle a subset of preferences? Or even several shared preferences? Currently thinking about the pros and cons of each and I am leaning to a single class. Since there I am sure that there are never duplicate keys (because they are not scattered over several classes) and I can immedeately say what the application saves in the preferences.
    class Preferences(private val sharedPreferences: SharedPreferences) {
        private companion object {
            private const val GENERATED_LEVEL_INFO_SEEN_KEY =
                    "generatedLevelInfoSeenKey"
    
           // ...
        }
    
        var generatedLevelInfoSeen by BooleanPreference(
                GENERATED_LEVEL_INFO_SEEN_KEY, false)
    
        // ...
    
        private inner class BooleanPreference(
                private val key: String,
                private val default: Boolean) {
    
            operator fun getValue(thisRef: Preferences, property: KProperty<*>) =
                    sharedPreferences.getBoolean(key, default)
    
            operator fun setValue(thisRef: Preferences, property: KProperty<*>, value: Boolean) =
                    sharedPreferences.edit { putBoolean(key, value) }
        }
    }
    Daniel
    Pablichjenkov
    +1
    3 replies
    Copy to Clipboard
  • Hitanshu Dhawan

    Hitanshu Dhawan

    2 years ago
    Hey guys, I am using LiveData coroutines KTX extension for my project.https://developer.android.com/topic/libraries/architecture/coroutines#livedata The code is something like this.
    ViewModel/Repository
    fun getData() = liveData {
        val a = getFromDB()
        emit(a)
        val b = getFromNetwork()
        emit(b)
    }
    View
    viewModel.getData().observe(this, Observer{
        // do ui stuff
    })
    This works perfectly fine. But the problem is now I want to add Swipe to Refresh feature, and want that the entire
    liveData {}
    block to run again. How do I trigger a refresh call to the
    getData()
    LiveData? One solution which is mentioned here (https://stackoverflow.com/a/58689791) is to introduce another
    MediatorLiveData
    and remove and re-add the
    liveData {}
    block on refresh. But I don't want to add 2 LiveDatas and it also seems like a hack. Any good and elegant solution for this guys? Thanks.
    Hitanshu Dhawan
    v
    3 replies
    Copy to Clipboard
  • u

    ursus

    2 years ago
    Is name Repository established forever? I always read it as a Dao basically. I'd call is Manager. Should I just get used to it?
    u
    s
    +3
    24 replies
    Copy to Clipboard