Skip to content

Latest commit

 

History

History
140 lines (107 loc) · 3.46 KB

File metadata and controls

140 lines (107 loc) · 3.46 KB

Android Armory

Preferred Libraries

koin_version = '2.1.5'

implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-android-viewmodel:$koin_version"
  • Serialization

Kotlinx Serialization https://github.com/Kotlin/kotlinx.serialization

//Project Level
buildscript {
   ext.kotlin_version = '1.3.70'
   dependencies {
       classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
   }
}
//Module Level
apply plugin: 'kotlinx-serialization'


dependencies {
   implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
   implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.13.0"
}
  • Webservice

Http Logging https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor

Retrofit https://square.github.io/retrofit/

implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
  • Database

Room https://developer.android.com/jetpack/androidx/releases/room

def room_version = "2.2.1"

implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version" 
implementation "androidx.room:room-ktx:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
  • Testing

Mockito https://mockk.io/

testImplementation "io.mockk:mockk:{version}"

Development Guidelines

Layout Files

Component Class Name Layout Name
Activity LoginActivity activity_login.xml
Fragment ProfileFragment fragment_profile.xml
Dialog NoInternetDialog dialog_no_internet.xml
ViewHolder ProductVH item_product.xml

Views(Use ViewBinding)

View ID
TextView @+id/nameTv
EditText @+id/nameEt
ImageView @+id/avatarIv
Button @+id/saveBtn
ImageButton @+id/likeIb

Drawables

Drawable ID
Icon ic_delete
Background bg_rainbow
Logo logo_golf
Selector selector_fave
Shape circle_orange

Settings up different URLs for debug,staging,release builds

    buildTypes {
        debug {
            buildConfigField("String", "BASE_URL", "\"https://\"")
        }
        staging {
            buildConfigField("String", "BASE_URL", "\"https://\"")
        }
        release {
            buildConfigField("String", "BASE_URL", "\"https://\"")
            //....
        }
    }
val baseUrl:String = BuildConfig.BASE_URL

Dynamic resources - <type> <name> <value>

  buildTypes {
        debug {
            resValue ("string", "app_name", "Android Armory Dev")
        }
        staging {
            resValue ("string", "app_name", "Android Armory Staging")
        }
        release {
            resValue ("string", "app_name", "Android Armory")
            //....
        }
    }

R.string.app_name