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
@AndroidEntryPoint | |
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding | |
private lateinit var navController: NavController | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
binding = ActivityMainBinding.inflate(layoutInflater) | |
setContentView(binding.root) |
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
<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" |
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
<com.google.android.material.bottomappbar.BottomAppBar | |
android:id="@+id/bottomAppBar" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_gravity="bottom" | |
app:fabAlignmentMode="center" | |
app:fabCradleRoundedCornerRadius="20dp" | |
app:fabCradleMargin="8dp" | |
app:contentInsetStart="0dp" | |
app:contentInsetStartWithNavigation="0dp" |
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
<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" |
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 MainRepository @Inject constructor( | |
private val apiHelper: ApiHelper | |
) { | |
// Do something | |
} |
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 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 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 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 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") |