This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LiveDataCallAdapter<R>(private val responseType: Type): CallAdapter<R, LiveData<ApiResponse<R>>> { | |
override fun adapt(call: Call<R>): LiveData<ApiResponse<R>> { | |
return object : LiveData<ApiResponse<R>>() { | |
private var isSuccess = false | |
override fun onActive() { | |
super.onActive() | |
if (!isSuccess) enqueue() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: ubuntu:22.04 | |
variables: | |
ANDROID_COMPILE_SDK: "33" | |
ANDROID_BUILD_TOOLS: "33.0.2" | |
EMULATOR_IMAGE: "24" | |
SDK_TOOLS: "9477386" # from https://developer.android.com/studio/#command-tools | |
before_script: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Used as a wrapper for data that is exposed via a LiveData that represents an event. | |
*/ | |
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?