This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:paddingTop="@dimen/dimen_4_dp" | |
android:paddingBottom="@dimen/dimen_4_dp"> |
This file contains hidden or 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
enum class Status { | |
SUCCESS, | |
ERROR, | |
LOADING | |
} |
This file contains hidden or 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
data class Resource<out T>(val status: Status, val actionType: Int, val data: T?, val payload: Bundle?) { | |
companion object { | |
fun <T> success(actionType: Int, data: T? = null, payload: Bundle? = null): Resource<T> { | |
return Resource(Status.SUCCESS,actionType, data, payload) | |
} | |
fun <T> error(actionType: Int, data: T? = null, payload: Bundle? = null): Resource<T> { | |
return Resource(Status.ERROR, actionType, data, payload) | |
} |