Skip to content

Instantly share code, notes, and snippets.

View ajailani4's full-sized avatar

Ahmad Jailani ajailani4

View GitHub Profile
@ajailani4
ajailani4 / build.gradle
Last active April 9, 2021 12:03
Dependency for Spesipon
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.activity:activity-ktx:1.2.2'
implementation 'androidx.fragment:fragment-ktx:1.3.2'
// UI Components
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
@ajailani4
ajailani4 / build.gradle
Created April 9, 2021 10:59
Plugin for Spesipon
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id 'dagger.hilt.android.plugin'
id 'androidx.navigation.safeargs.kotlin'
}
@ajailani4
ajailani4 / build.gradle
Created April 9, 2021 11:01
Enable viewBinding for Spesipon
buildFeatures {
viewBinding true
}
@ajailani4
ajailani4 / build.gradle
Created April 9, 2021 12:07
Config build.gradle (Project) for Spesipon
buildscript {
ext.kotlin_version = "1.4.21"
ext.nav_version = "2.3.4"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@HiltAndroidApp
class App : Application()
<application
android:name=".di.App"
...
... >
@Module
@InstallIn(SingletonComponent::class)
class ApplicationModule {
@Provides
fun provideBaseUrl() = "https://api-mobilespecs.azharimm.tk/"
@Provides
@Singleton
fun provideRetrofit(BASE_URL: String): Retrofit =
Retrofit.Builder()
interface ApiService {
@GET("brands")
suspend fun getBrands(
@Query("page") page: Int,
@Query("limit") limit: Int
): Response<BrandResponse>
@GET("brands/{brandSlug}")
suspend fun getPhones(
@Path("brandSlug") brandSlug: String,
{
"status": true,
"data": {
"page": 1,
"limit": 10,
"last_page": 12,
"brands": [
{
"_id": "5f9918722082abf7d569d671",
"brand_slug": "att",
data class BrandResponse(
@Json(name = "status")
val status: Boolean,
@Json(name = "data")
val data: BrandDataResponse
)