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 PhoneSubSpecs( | |
| @field:Json(name = "key") | |
| val subTitle: String, | |
| @field:Json(name = "val") | |
| val subSpecs: List<String> | |
| ) |
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
| { | |
| "status": true, | |
| "data": { | |
| "page": 1, | |
| "limit": 10, | |
| "last_page": 4, | |
| "phones": [ | |
| { | |
| "phone_name": "Galaxy Note9", | |
| "phone_name_slug": "galaxy-note9", |
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 PhoneSearchResponse( | |
| @Json(name = "status") | |
| val status: Boolean, | |
| @Json(name = "data") | |
| val data: PhoneSearchDataResponse | |
| ) |
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 PhoneSearchDataResponse( | |
| @field:Json(name = "page") | |
| val page: Int, | |
| @field:Json(name = "limit") | |
| val limit: Int, | |
| @field:Json(name = "last_page") | |
| val lastPage: Int, | |
| @field:Json(name = "phones") | |
| val phones: List<PhoneSearch> | |
| ) |
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 PhoneSearch( | |
| @field:Json(name = "phone_name") | |
| val name: String, | |
| @field:Json(name = "phone_name_slug") | |
| val slug: String, | |
| @field:Json(name = "brand") | |
| val brandName: String, | |
| @field:Json(name = "brand_slug") | |
| val brandSlug: String, | |
| @field:Json(name = "phone_img_url") |
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 { | |
| LOADING, | |
| SUCCESS, | |
| ERROR | |
| } |
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 data: T?, val message: String?) { | |
| companion object { | |
| fun <T> loading(data: T?): Resource<T> { | |
| return Resource(Status.LOADING, data, null) | |
| } | |
| fun <T> success(data: T?): Resource<T> { | |
| return Resource(Status.SUCCESS, data, null) | |
| } |
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
| class ApiHelper @Inject constructor( | |
| private val apiService: ApiService | |
| ) { | |
| suspend fun getBrands(page: Int, limit: Int) = | |
| apiService.getBrands(page, limit) | |
| suspend fun getPhones(brandSlug: String, page: Int, limit: Int) = | |
| apiService.getPhones(brandSlug, page, limit) | |
| suspend fun getPhonesHome(brandSlug: String) = |
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
| class MainRepository @Inject constructor( | |
| private val apiHelper: ApiHelper | |
| ) { | |
| // Do something | |
| } |
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
| <androidx.coordinatorlayout.widget.CoordinatorLayout 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" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| tools:context=".ui.view.activity.MainActivity"> | |
| <androidx.fragment.app.FragmentContainerView | |
| android:id="@+id/navHostFragment" | |
| android:name="androidx.navigation.fragment.NavHostFragment" |