Skip to content

Commit

Permalink
Merge pull request #9 from ImaginativeShohag/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ImaginativeShohag authored Sep 6, 2021
2 parents 5596586 + 608a8b4 commit ada23a5
Show file tree
Hide file tree
Showing 67 changed files with 1,409 additions and 579 deletions.
44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Simple MVVM

A simple Android MVVM pattern example and template
A simple Android MVVM pattern example and template.

## Android Studio Version

- Android Studio Arctic Fox | 2020.3.1 Patch 2

## Used Components/Libraries

Expand All @@ -16,15 +20,29 @@ A simple Android MVVM pattern example and template
- Timber (https://github.com/JakeWharton/timber)
- Custom Fonts (https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml)
- Shimmer for Android (https://github.com/facebook/shimmer-android)
- Dagger (https://github.com/google/dagger)
- Paging (https://developer.android.com/topic/libraries/architecture/paging)
- Hilt (https://dagger.dev/hilt/)
- Paging 3 (https://developer.android.com/topic/libraries/architecture/paging)
- Dexter (https://github.com/Karumi/Dexter) **(coming soon...)**

## Others

- Build variant (https://developer.android.com/studio/build/build-variants)
- Custom Snackbar
- Dark Mode (Initially Implemented)
- Dark Mode

## Extension Functions (see `utils/extensions`)

- DateTime
- Dialog
- Dimension
- Flow
- General Spinner
- Miscellaneous: show/hide keyboard, download file, open permission settings, open url, send mail
etc.
- Retrofit
- Snackbar
- String
- Toast

## Common Binding Adapters

Expand All @@ -33,10 +51,20 @@ A simple Android MVVM pattern example and template
- ImageView
- TextView (for Date() to formatted date-time)

# Utilities

- `SharedPref`
- `AlarmUtils`
- `LocationProviderUtilClient`
- `Event` Class

## Todo

- Add New Post
- Login
- Registration
- Migrate to Hilt
- Migrate to Paging 3
- Demo Login
- Demo Registration
- OneSignal integration
- Splash (Introduced in Android S)
- Testing
- Example of LocationProviderUtilClient
- AdUtils from Ticket Sheba
132 changes: 83 additions & 49 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'

// Navigation Component: Safe Args
apply plugin: "androidx.navigation.safeargs"

apply plugin: 'com.google.gms.google-services'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'dagger.hilt.android.plugin'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 31
buildToolsVersion "31.0.0"

defaultConfig {
applicationId "org.imaginativeworld.simplemvvm"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0.000000" // Major.Minor.YYMMDD
versionName "1.0.0.000000" // Major.Minor.Patch.YYMMDD
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
annotationProcessorOptions {
arguments = [
arguments += [
"room.schemaLocation" : "$projectDir/schemas".toString(),
"room.incremental" : "true",
"room.expandProjection": "true"
Expand All @@ -33,16 +35,16 @@ android {
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

// flavorDimensions "feature"
Expand All @@ -66,38 +68,60 @@ android {

kotlinOptions {
jvmTarget = "1.8"
useIR = true
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
freeCompilerArgs += "-Xallow-jvm-ir-dependencies"
// Enable experimental coroutines APIs, including Flow
freeCompilerArgs += '-Xopt-in=kotlin.Experimental'
}

buildFeatures {
viewBinding = true
dataBinding = true

// Disable unused AGP features
// buildConfig false
aidl false
renderScript false
resValues false
shaders false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

// Retrofit and Moshi
// Material Design
implementation 'com.google.android.material:material:1.4.0'

// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'

// Moshi
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0"

// Gson
implementation 'com.google.code.gson:gson:2.8.7'

// ViewModel and LiveData
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"

// Material Design
implementation 'com.google.android.material:material:1.3.0'
// Kotlin Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"

// Room Persistence Library
implementation "androidx.room:room-runtime:2.3.0"
Expand All @@ -110,40 +134,28 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"

// Kotlin Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"
// Lifecycles only (without ViewModel or LiveData)
// implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"

// Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
kapt 'com.github.bumptech.glide:compiler:4.12.0'

// Paging
implementation "androidx.paging:paging-runtime-ktx:3.0.0"

// No Internet Library
implementation 'org.imaginativeworld.oopsnointernet:oopsnointernet:2.0.0'
implementation "androidx.paging:paging-runtime-ktx:3.0.1"

// Permission
implementation 'com.karumi:dexter:6.2.2'

// Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.jakewharton.timber:timber:5.0.1'

// Dagger
implementation 'com.google.dagger:dagger:2.36'
kapt 'com.google.dagger:dagger-compiler:2.36'

implementation 'com.google.dagger:dagger-android:2.36'
kapt 'com.google.dagger:dagger-android-processor:2.36'
// Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-compiler:$hilt_version"

// Shimmer
implementation 'com.facebook.shimmer:shimmer:0.5.0'

// Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation platform('com.google.firebase:firebase-bom:28.2.0')

// Firebase Libraries
implementation 'com.google.firebase:firebase-analytics-ktx'
Expand All @@ -158,6 +170,28 @@ dependencies {
// Image compressor
implementation 'id.zelory:compressor:3.0.1'

// No Internet Library
implementation 'org.imaginativeworld.oopsnointernet:oopsnointernet:2.0.0'

// Image Carousel
implementation "org.imaginativeworld.whynotimagecarousel:whynotimagecarousel:2.0.2"

// OneSignal SDK
implementation 'com.onesignal:OneSignal:4.5.1'

// Coil
implementation("io.coil-kt:coil:1.3.2")

// Palette
implementation 'androidx.palette:palette-ktx:1.0.0'
}

// Workaround for OneSignal from:
// https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/37#issuecomment-391983620
googleServices { disableVersionCheck = true }

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
82 changes: 82 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,85 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# ----------------------------------------------------------------
# Help Resources:
# - https://proandroiddev.com/android-default-proguard-rules-guide-20058ba7a486
# ----------------------------------------------------------------

# ----------------------------------------------------------------
# Models
# ----------------------------------------------------------------
# Nothing individual so far...

# ----------------------------------------------------------------
# Moshi
# ----------------------------------------------------------------
# Note: Moshi contains minimally required rules for its own internals to work without need for consumers to embed their own.

# ----------------------------------------------------------------
# Parcelable
# ----------------------------------------------------------------
-keepclassmembers class * implements android.os.Parcelable {
public static final ** CREATOR;
}

# ----------------------------------------------------------------
# Maps
# ----------------------------------------------------------------
# Link: https://developers.google.com/maps/documentation/android-sdk/v3-client-migration
-keep,allowoptimization class com.google.android.libraries.maps.** { *; }

# ----------------------------------------------------------------
# Retrofit
# Source: https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro
# ----------------------------------------------------------------
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# Keep generic signature of Call (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call

# ----------------------------------------------------------------
# OkHttp
# Source: https://square.github.io/okhttp/r8_proguard/
# ----------------------------------------------------------------
# Note: If you use OkHttp as a dependency in an Android project which uses R8 as a default compiler you don’t have to do anything.

# ----------------------------------------------------------------
# okio
# Source: https://square.github.io/okio/#r8-proguard
# ----------------------------------------------------------------
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

Loading

0 comments on commit ada23a5

Please sign in to comment.