5 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/lyhoangvinh/simple/data/entities/OptionEntity.kt:
--------------------------------------------------------------------------------
1 | package com.lyhoangvinh.simple.data.entities
2 |
3 | data class OptionEntity(
4 | val index: Int,
5 | var isCheck: Boolean? = false,
6 | val name: String
7 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/lyhoangvinh/simple/data/entities/State.kt:
--------------------------------------------------------------------------------
1 | package com.lyhoangvinh.simple.data.entities
2 |
3 | data class State(var status: Status, var message: String?) {
4 | companion object {
5 | fun loading() = State(Status.LOADING, null)
6 | fun success() = State(Status.SUCCESS, null)
7 | fun error(message: String? = null) = State(Status.ERROR, message)
8 | }
9 |
10 | override fun equals(other: Any?): Boolean {
11 | if (this === other) {
12 | return true
13 | }
14 | if (other == null || javaClass != other.javaClass) {
15 | return false
16 | }
17 |
18 | val state = other as State?
19 |
20 | if (status != state?.status) {
21 | return false
22 | }
23 |
24 | return if (message != null) message == state.message else state.message == null
25 | }
26 |
27 | override fun hashCode(): Int {
28 | val result = status.hashCode()
29 | return 31 * result + if (message != null) message!!.hashCode() else 0
30 | }
31 |
32 | override fun toString(): String {
33 | return "status: $status, message: $message"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lyhoangvinh/simple/data/entities/Status.kt:
--------------------------------------------------------------------------------
1 | package com.lyhoangvinh.simple.data.entities
2 |
3 |
4 | /**
5 | * Status of a resource that is provided to the UI.
6 | *
7 | * These are usually created by the Repo classes where they return
8 | * {@code LiveData>} to pass back the latest data to the UI with its fetch status.
9 | */
10 |
11 | enum class Status {
12 | SUCCESS,
13 | ERROR,
14 | LOADING
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/lyhoangvinh/simple/data/entities/VisibilityView.kt:
--------------------------------------------------------------------------------
1 | package com.lyhoangvinh.simple.data.entities
2 |
3 | data class VisibilityView(
4 | var isVisible: Boolean = false
5 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/lyhoangvinh/simple/data/entities/avgle/MergedData.kt:
--------------------------------------------------------------------------------
1 | package com.lyhoangvinh.simple.data.entities.avgle
2 |
3 | import androidx.paging.PagedList
4 | import com.lyhoangvinh.simple.data.entities.DataEmpty
5 | import com.lyhoangvinh.simple.data.entities.State
6 |
7 | sealed class MergedData
8 | data class CategoryData(val categoryItems: PagedList) : MergedData()
9 | data class CollectionBannerData(val collectionBannerItems: List) : MergedData()
10 | data class CollectionBottomData(val collectionBottomItems: PagedList) : MergedData()
11 | data class VideoData(val videoItems: PagedList