Skip to content

Commit d75a432

Browse files
Merge pull request #7 from ImaginativeShohag/dev
Dev
2 parents bc872ef + 66baf87 commit d75a432

File tree

68 files changed

+1950
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1950
-403
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,19 @@ A simple Android MVVM pattern example and template
2222

2323
## Others
2424

25-
- Build variant (https://developer.android.com/studio/build/build-variants)
25+
- Build variant (https://developer.android.com/studio/build/build-variants)
26+
- Custom Snackbar
27+
- Dark Mode (Initially Implemented)
28+
29+
## Common Binding Adapters
30+
31+
- RecyclerView
32+
- Spinner
33+
- ImageView
34+
- TextView (for Date() to formatted date-time)
35+
36+
## Todo
37+
38+
- Add New Post
39+
- Login
40+
- Registration

app/build.gradle

Lines changed: 60 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
apply plugin: 'com.android.application'
2-
32
apply plugin: 'kotlin-android'
4-
53
apply plugin: 'kotlin-android-extensions'
6-
74
apply plugin: 'kotlin-kapt'
85

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

9+
apply plugin: 'com.google.gms.google-services'
10+
1211
android {
13-
compileSdkVersion 29
14-
buildToolsVersion "29.0.3"
12+
compileSdkVersion 30
13+
buildToolsVersion "30.0.1"
14+
1515
defaultConfig {
1616
applicationId "org.imaginativeworld.simplemvvm"
1717
minSdkVersion 21
18-
targetSdkVersion 29
18+
targetSdkVersion 30
1919
versionCode 1
20-
versionName "1.0"
20+
versionName "1.0.000000" // Major.Minor.YYMMDD
21+
2122
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23+
2224
javaCompileOptions {
2325
annotationProcessorOptions {
2426
arguments = [
@@ -29,6 +31,7 @@ android {
2931
}
3032
}
3133
}
34+
3235
buildTypes {
3336
release {
3437
minifyEnabled true
@@ -41,6 +44,7 @@ android {
4144
versionNameSuffix "-debug"
4245
}
4346
}
47+
4448
// flavorDimensions "feature"
4549
// productFlavors {
4650
// flavorone {
@@ -54,43 +58,49 @@ android {
5458
// versionNameSuffix "-flavortwo"
5559
// }
5660
// }
61+
5762
compileOptions {
5863
sourceCompatibility JavaVersion.VERSION_1_8
5964
targetCompatibility JavaVersion.VERSION_1_8
6065
}
66+
6167
kotlinOptions {
6268
jvmTarget = "1.8"
6369
}
70+
6471
androidExtensions.experimental = true
65-
dataBinding.enabled = true
66-
viewBinding.enabled = true
72+
73+
buildFeatures {
74+
viewBinding = true
75+
dataBinding = true
76+
}
6777
}
6878

6979
dependencies {
7080
implementation fileTree(dir: 'libs', include: ['*.jar'])
71-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72-
implementation 'androidx.appcompat:appcompat:1.1.0'
73-
implementation 'androidx.core:core-ktx:1.2.0'
74-
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
75-
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
76-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
77-
testImplementation 'junit:junit:4.13'
78-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
79-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
81+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
82+
implementation 'androidx.appcompat:appcompat:1.2.0'
83+
implementation 'androidx.core:core-ktx:1.3.2'
84+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
85+
// implementation 'androidx.legacy:legacy-support-v4:1.0.0'
86+
testImplementation 'junit:junit:4.13.1'
87+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
88+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
8089

8190
// Retrofit and Moshi
82-
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
83-
implementation 'com.squareup.retrofit2:converter-moshi:2.8.1'
84-
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.1'
85-
implementation "com.squareup.moshi:moshi-kotlin:1.9.2"
86-
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.2"
91+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
92+
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
93+
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
94+
implementation "com.squareup.moshi:moshi-kotlin:1.9.3"
95+
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.3"
8796

8897
// ViewModel and LiveData
98+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
8999
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
90100
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
91101

92102
// Material Design
93-
implementation 'com.google.android.material:material:1.1.0'
103+
implementation 'com.google.android.material:material:1.2.1'
94104

95105
// Room Persistence Library
96106
implementation "androidx.room:room-runtime:2.2.5"
@@ -100,16 +110,16 @@ dependencies {
100110
implementation "androidx.room:room-ktx:2.2.5"
101111

102112
// Android Navigation Architecture
103-
implementation "androidx.navigation:navigation-fragment-ktx:2.2.2"
104-
implementation "androidx.navigation:navigation-ui-ktx:2.2.2"
113+
implementation "androidx.navigation:navigation-fragment-ktx:2.3.1"
114+
implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
105115

106116
// Kotlin Coroutines
107-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5"
108-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5"
117+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
118+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
109119

110120
// Glide
111121
implementation 'com.github.bumptech.glide:glide:4.11.0'
112-
kapt 'com.github.bumptech.glide:compiler:4.10.0'
122+
kapt 'com.github.bumptech.glide:compiler:4.11.0'
113123

114124
// Paging
115125
implementation "androidx.paging:paging-runtime-ktx:2.1.2"
@@ -118,20 +128,36 @@ dependencies {
118128
implementation 'com.github.ImaginativeShohag:Oops-No-Internet:v1.1.3'
119129

120130
// Permission
121-
implementation 'com.karumi:dexter:6.0.2'
131+
implementation 'com.karumi:dexter:6.2.1'
122132

123133
// Timber
124134
implementation 'com.jakewharton.timber:timber:4.7.1'
125135

126136
// Dagger
127-
implementation 'com.google.dagger:dagger:2.27'
128-
kapt 'com.google.dagger:dagger-compiler:2.26'
137+
implementation 'com.google.dagger:dagger:2.29.1'
138+
kapt 'com.google.dagger:dagger-compiler:2.29.1'
129139

130-
implementation 'com.google.dagger:dagger-android:2.27'
140+
implementation 'com.google.dagger:dagger-android:2.29.1'
131141
// if you use the support libraries
132142
// implementation 'com.google.dagger:dagger-android-support:2.26'
133-
kapt 'com.google.dagger:dagger-android-processor:2.26'
143+
kapt 'com.google.dagger:dagger-android-processor:2.29.1'
134144

135145
// Shimmer
136146
implementation 'com.facebook.shimmer:shimmer:0.5.0'
147+
148+
// Firebase BoM
149+
implementation platform('com.google.firebase:firebase-bom:26.1.0')
150+
151+
// Firebase Libraries
152+
implementation 'com.google.firebase:firebase-analytics-ktx'
153+
implementation 'com.google.firebase:firebase-messaging-ktx'
154+
155+
// Maps
156+
implementation 'com.google.android.gms:play-services-maps:17.0.0'
157+
158+
// Location
159+
implementation 'com.google.android.gms:play-services-location:17.1.0'
160+
161+
//image compressor
162+
implementation 'id.zelory:compressor:3.0.0'
137163
}

app/google-services.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"project_info": {
3+
"project_number": "691300188850",
4+
"firebase_url": "https://iw-learning-projects.firebaseio.com",
5+
"project_id": "iw-learning-projects",
6+
"storage_bucket": "iw-learning-projects.appspot.com"
7+
},
8+
"client": [
9+
{
10+
"client_info": {
11+
"mobilesdk_app_id": "1:691300188850:android:65d4d1ed021f483712ffab",
12+
"android_client_info": {
13+
"package_name": "org.imaginativeworld.simplemvvm"
14+
}
15+
},
16+
"oauth_client": [
17+
{
18+
"client_id": "691300188850-4tl7dgpfpapp6sk9nk7vgq8kvaon885h.apps.googleusercontent.com",
19+
"client_type": 3
20+
}
21+
],
22+
"api_key": [
23+
{
24+
"current_key": "AIzaSyDWE3do0dEgK81GqccXv9z39NKwpJEgqGA"
25+
}
26+
],
27+
"services": {
28+
"appinvite_service": {
29+
"other_platform_oauth_client": [
30+
{
31+
"client_id": "691300188850-4tl7dgpfpapp6sk9nk7vgq8kvaon885h.apps.googleusercontent.com",
32+
"client_type": 3
33+
}
34+
]
35+
}
36+
}
37+
},
38+
{
39+
"client_info": {
40+
"mobilesdk_app_id": "1:691300188850:android:767e863dcd04626412ffab",
41+
"android_client_info": {
42+
"package_name": "org.imaginativeworld.simplemvvm.debug"
43+
}
44+
},
45+
"oauth_client": [
46+
{
47+
"client_id": "691300188850-4tl7dgpfpapp6sk9nk7vgq8kvaon885h.apps.googleusercontent.com",
48+
"client_type": 3
49+
}
50+
],
51+
"api_key": [
52+
{
53+
"current_key": "AIzaSyDWE3do0dEgK81GqccXv9z39NKwpJEgqGA"
54+
}
55+
],
56+
"services": {
57+
"appinvite_service": {
58+
"other_platform_oauth_client": [
59+
{
60+
"client_id": "691300188850-4tl7dgpfpapp6sk9nk7vgq8kvaon885h.apps.googleusercontent.com",
61+
"client_type": 3
62+
}
63+
]
64+
}
65+
}
66+
}
67+
],
68+
"configuration_version": "1"
69+
}

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
<?xml version="1.0" encoding="utf-8"?><!-- bi-smi llāhi r-raḥmāni r-raḥīm -->
1+
<?xml version="1.0" encoding="utf-8"?><!-- Bismillahir Rahmanir Rahim -->
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="org.imaginativeworld.simplemvvm">
55

66
<uses-permission android:name="android.permission.INTERNET" />
77
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
88

9+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10+
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
11+
912
<application
1013
android:name=".MyApplication"
11-
android:allowBackup="true"
14+
android:allowBackup="false"
1215
android:icon="@mipmap/ic_launcher"
1316
android:label="@string/app_name"
1417
android:networkSecurityConfig="@xml/network_security_config"

app/src/main/java/org/imaginativeworld/simplemvvm/adapters/DemoPostListAdapter.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import androidx.recyclerview.widget.RecyclerView
88
import org.imaginativeworld.simplemvvm.databinding.DemoItemPostBinding
99
import org.imaginativeworld.simplemvvm.interfaces.BindableAdapter
1010
import org.imaginativeworld.simplemvvm.interfaces.OnObjectListInteractionListener
11-
import org.imaginativeworld.simplemvvm.models.PostResult
11+
import org.imaginativeworld.simplemvvm.models.DemoPostResult
1212

1313
class DemoPostListAdapter(
14-
private val listener: OnObjectListInteractionListener<PostResult>
15-
) : ListAdapter<PostResult, DemoPostListAdapter.ListViewHolder>(DIFF_CALLBACK),
16-
BindableAdapter<List<PostResult>> {
14+
private val listener: OnObjectListInteractionListener<DemoPostResult>
15+
) : ListAdapter<DemoPostResult, DemoPostListAdapter.ListViewHolder>(DIFF_CALLBACK),
16+
BindableAdapter<List<DemoPostResult>> {
1717

1818
companion object {
1919

20-
private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<PostResult>() {
21-
override fun areItemsTheSame(oldItem: PostResult, newItem: PostResult): Boolean {
20+
private val DIFF_CALLBACK = object : DiffUtil.ItemCallback<DemoPostResult>() {
21+
override fun areItemsTheSame(oldItem: DemoPostResult, newItem: DemoPostResult): Boolean {
2222
return oldItem.id == newItem.id
2323
}
2424

25-
override fun areContentsTheSame(oldItem: PostResult, newItem: PostResult): Boolean {
25+
override fun areContentsTheSame(oldItem: DemoPostResult, newItem: DemoPostResult): Boolean {
2626
return oldItem == newItem
2727
}
2828
}
@@ -38,7 +38,7 @@ class DemoPostListAdapter(
3838
holder.bind(item)
3939
}
4040

41-
override fun setItems(data: List<PostResult>?) {
41+
override fun setItems(data: List<DemoPostResult>?) {
4242
submitList(data) {
4343
data?.apply {
4444
checkEmptiness()
@@ -56,10 +56,10 @@ class DemoPostListAdapter(
5656

5757
class ListViewHolder private constructor(
5858
private val binding: DemoItemPostBinding,
59-
private val listener: OnObjectListInteractionListener<PostResult>
59+
private val listener: OnObjectListInteractionListener<DemoPostResult>
6060
) : RecyclerView.ViewHolder(binding.root) {
6161

62-
fun bind(item: PostResult) {
62+
fun bind(item: DemoPostResult) {
6363
binding.post = item
6464
binding.executePendingBindings()
6565

@@ -76,7 +76,7 @@ class DemoPostListAdapter(
7676
companion object {
7777
fun from(
7878
parent: ViewGroup,
79-
listener: OnObjectListInteractionListener<PostResult>
79+
listener: OnObjectListInteractionListener<DemoPostResult>
8080
): ListViewHolder {
8181
val layoutInflater = LayoutInflater.from(parent.context)
8282
val binding = DemoItemPostBinding.inflate(layoutInflater, parent, false)

0 commit comments

Comments
 (0)