Skip to content

Commit 5596586

Browse files
Merge pull request #8 from ImaginativeShohag/dev
Dark mode updated, api client bug fixed, credit added. etc.
2 parents d75a432 + fd9bdd9 commit 5596586

Some content is hidden

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

42 files changed

+627
-280
lines changed

.gitignore

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
*.iml
21
.idea
32
.gradle
43
/local.properties
54
.DS_Store
6-
build/
75
/captures
8-
.externalNativeBuild
96

7+
# Source: https://github.com/github/gitignore/blob/master/Android.gitignore
108

119
# Built application files
1210
*.apk
11+
*.aar
1312
*.ap_
1413
*.aab
1514

@@ -23,7 +22,8 @@ build/
2322
bin/
2423
gen/
2524
out/
26-
release/
25+
# Uncomment the following line in case you need and you don't have the release build type files in your app
26+
# release/
2727

2828
# Gradle files
2929
.gradle/
@@ -65,6 +65,7 @@ captures/
6565

6666
# External native build folder generated in Android Studio 2.2 and later
6767
.externalNativeBuild
68+
.cxx/
6869

6970
# Google Services (e.g. APIs or Firebase)
7071
# google-services.json
@@ -89,4 +90,7 @@ lint/intermediates/
8990
lint/generated/
9091
lint/outputs/
9192
lint/tmp/
92-
# lint/reports/
93+
# lint/reports/
94+
95+
# Android Profiling
96+
*.hprof

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ A simple Android MVVM pattern example and template
3838
- Add New Post
3939
- Login
4040
- Registration
41+
- Migrate to Hilt
42+
- Migrate to Paging 3

app/build.gradle

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
3+
apply plugin: 'kotlin-parcelize'
44
apply plugin: 'kotlin-kapt'
55

66
// Navigation Component: Safe Args
@@ -10,7 +10,7 @@ apply plugin: 'com.google.gms.google-services'
1010

1111
android {
1212
compileSdkVersion 30
13-
buildToolsVersion "30.0.1"
13+
buildToolsVersion "30.0.3"
1414

1515
defaultConfig {
1616
applicationId "org.imaginativeworld.simplemvvm"
@@ -68,8 +68,6 @@ android {
6868
jvmTarget = "1.8"
6969
}
7070

71-
androidExtensions.experimental = true
72-
7371
buildFeatures {
7472
viewBinding = true
7573
dataBinding = true
@@ -79,68 +77,67 @@ android {
7977
dependencies {
8078
implementation fileTree(dir: 'libs', include: ['*.jar'])
8179
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'
80+
implementation 'androidx.appcompat:appcompat:1.3.0'
81+
implementation 'androidx.core:core-ktx:1.5.0'
8482
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
85-
// implementation 'androidx.legacy:legacy-support-v4:1.0.0'
86-
testImplementation 'junit:junit:4.13.1'
83+
testImplementation 'junit:junit:4.13.2'
8784
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
8885
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
8986

9087
// Retrofit and Moshi
9188
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
9289
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"
90+
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
91+
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
92+
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0"
9693

9794
// ViewModel and LiveData
98-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
99-
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
100-
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
95+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
96+
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
97+
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.1"
10198

10299
// Material Design
103-
implementation 'com.google.android.material:material:1.2.1'
100+
implementation 'com.google.android.material:material:1.3.0'
104101

105102
// Room Persistence Library
106-
implementation "androidx.room:room-runtime:2.2.5"
107-
kapt "androidx.room:room-compiler:2.2.5"
103+
implementation "androidx.room:room-runtime:2.3.0"
104+
kapt "androidx.room:room-compiler:2.3.0"
108105

109106
// Room: Kotlin Extensions and Coroutines support for Room
110-
implementation "androidx.room:room-ktx:2.2.5"
107+
implementation "androidx.room:room-ktx:2.3.0"
111108

112109
// Android Navigation Architecture
113-
implementation "androidx.navigation:navigation-fragment-ktx:2.3.1"
114-
implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
110+
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
111+
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
115112

116113
// Kotlin Coroutines
117-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
118-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
114+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
115+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"
116+
// Lifecycles only (without ViewModel or LiveData)
117+
// implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
119118

120119
// Glide
121-
implementation 'com.github.bumptech.glide:glide:4.11.0'
122-
kapt 'com.github.bumptech.glide:compiler:4.11.0'
120+
implementation 'com.github.bumptech.glide:glide:4.12.0'
121+
kapt 'com.github.bumptech.glide:compiler:4.12.0'
123122

124123
// Paging
125-
implementation "androidx.paging:paging-runtime-ktx:2.1.2"
124+
implementation "androidx.paging:paging-runtime-ktx:3.0.0"
126125

127126
// No Internet Library
128-
implementation 'com.github.ImaginativeShohag:Oops-No-Internet:v1.1.3'
127+
implementation 'org.imaginativeworld.oopsnointernet:oopsnointernet:2.0.0'
129128

130129
// Permission
131-
implementation 'com.karumi:dexter:6.2.1'
130+
implementation 'com.karumi:dexter:6.2.2'
132131

133132
// Timber
134133
implementation 'com.jakewharton.timber:timber:4.7.1'
135134

136135
// Dagger
137-
implementation 'com.google.dagger:dagger:2.29.1'
138-
kapt 'com.google.dagger:dagger-compiler:2.29.1'
136+
implementation 'com.google.dagger:dagger:2.36'
137+
kapt 'com.google.dagger:dagger-compiler:2.36'
139138

140-
implementation 'com.google.dagger:dagger-android:2.29.1'
141-
// if you use the support libraries
142-
// implementation 'com.google.dagger:dagger-android-support:2.26'
143-
kapt 'com.google.dagger:dagger-android-processor:2.29.1'
139+
implementation 'com.google.dagger:dagger-android:2.36'
140+
kapt 'com.google.dagger:dagger-android-processor:2.36'
144141

145142
// Shimmer
146143
implementation 'com.facebook.shimmer:shimmer:0.5.0'
@@ -153,11 +150,14 @@ dependencies {
153150
implementation 'com.google.firebase:firebase-messaging-ktx'
154151

155152
// Maps
156-
implementation 'com.google.android.gms:play-services-maps:17.0.0'
153+
implementation 'com.google.android.gms:play-services-maps:17.0.1'
157154

158155
// Location
159-
implementation 'com.google.android.gms:play-services-location:17.1.0'
156+
implementation 'com.google.android.gms:play-services-location:18.0.0'
157+
158+
// Image compressor
159+
implementation 'id.zelory:compressor:3.0.1'
160160

161-
//image compressor
162-
implementation 'id.zelory:compressor:3.0.0'
161+
// Image Carousel
162+
implementation "org.imaginativeworld.whynotimagecarousel:whynotimagecarousel:2.0.2"
163163
}

app/src/main/java/org/imaginativeworld/simplemvvm/MyApplication.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Developed by: @ImaginativeShohag
3+
*
4+
* Md. Mahmudul Hasan Shohag
5+
* imaginativeshohag@gmail.com
6+
*
7+
* MVVM Pattern Source: https://github.com/ImaginativeShohag/Simple-MVVM
8+
*/
9+
110
package org.imaginativeworld.simplemvvm
211

312
import android.app.Application
@@ -7,7 +16,6 @@ import org.imaginativeworld.simplemvvm.di.DaggerApplicationGraph
716
import timber.log.Timber
817
import timber.log.Timber.DebugTree
918

10-
1119
class MyApplication : Application() {
1220

1321
val appGraph: ApplicationGraph by lazy {
@@ -24,5 +32,4 @@ class MyApplication : Application() {
2432
Timber.plant(DebugTree())
2533
}
2634
}
27-
28-
}
35+
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class DemoPostPagedListAdapter(
4242
}
4343

4444
override fun setItems(data: PagedList<DemoPostResult>?) {
45-
4645
submitList(data) {
4746
data?.apply {
4847
checkEmptiness()

app/src/main/java/org/imaginativeworld/simplemvvm/components/LocationProviderUtilClient.kt

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Developed by: @ImaginativeShohag
3+
*
4+
* Md. Mahmudul Hasan Shohag
5+
* imaginativeshohag@gmail.com
6+
*
7+
* MVVM Pattern Source: https://github.com/ImaginativeShohag/Simple-MVVM
8+
*/
9+
110
package org.imaginativeworld.simplemvvm.components
211

312
import android.Manifest
@@ -104,7 +113,6 @@ class LocationProviderUtilClient(
104113
enabled = false
105114

106115
stopLocationUpdate()
107-
108116
}
109117

110118
/**
@@ -126,23 +134,19 @@ class LocationProviderUtilClient(
126134
if (exception is ResolvableApiException) {
127135

128136
try {
129-
130137
exception.startResolutionForResult(
131138
activity,
132139
RESOLVE_REQUEST_CODE
133140
)
134-
135141
} catch (sendEx: IntentSender.SendIntentException) {
136142
sendEx.printStackTrace()
137143

138144
// Ignore the error
139145
}
140-
141146
}
142147
}
143148
}
144149

145-
146150
private fun initLocationCallback() {
147151
Timber.d("initLocationCallback")
148152

@@ -157,12 +161,9 @@ class LocationProviderUtilClient(
157161

158162
callback.invoke(currentLocation)
159163
}
160-
161164
}
162-
163165
}
164166

165-
166167
private fun createLocationRequest() {
167168
Timber.d("createLocationRequest")
168169

@@ -172,20 +173,18 @@ class LocationProviderUtilClient(
172173
fastestInterval = locationRequestFastestInterval
173174
priority = locationRequestPriority
174175
}
175-
176176
}
177177

178-
179178
private fun startLocationUpdates() {
180179
Timber.d("startLocationUpdates")
181180

182181
if (ActivityCompat.checkSelfPermission(
183182
activity,
184183
Manifest.permission.ACCESS_FINE_LOCATION
185184
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
186-
activity,
187-
Manifest.permission.ACCESS_COARSE_LOCATION
188-
) != PackageManager.PERMISSION_GRANTED
185+
activity,
186+
Manifest.permission.ACCESS_COARSE_LOCATION
187+
) != PackageManager.PERMISSION_GRANTED
189188
) {
190189
throw SecurityException("You does not have permission to access location.")
191190
}
@@ -197,15 +196,12 @@ class LocationProviderUtilClient(
197196
)
198197

199198
locationUpdatedStarted = true
200-
201199
}
202200

203-
204201
private fun stopLocationUpdate() {
205202
Timber.d("stopLocationUpdate")
206203
fusedLocationClient.removeLocationUpdates(locationCallback)
207204

208205
locationUpdatedStarted = false
209206
}
210-
211-
}
207+
}

0 commit comments

Comments
 (0)