Skip to content

Commit 761eb2a

Browse files
Dynamic color added to paged list
1 parent 681e190 commit 761eb2a

36 files changed

+550
-1997
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A simple Android MVVM pattern example and template.
44

55
## Android Studio Version
66

7-
- Android Studio Arctic Fox | 2020.3.1 Beta 5
7+
- Android Studio Arctic Fox | 2020.3.1 RC 1
88

99
## Used Components/Libraries
1010

@@ -30,13 +30,33 @@ A simple Android MVVM pattern example and template.
3030
- Custom Snackbar
3131
- Dark Mode
3232

33+
## Extension Functions (see `utils/extensions`)
34+
35+
- DateTime
36+
- Dialog
37+
- Dimension
38+
- Flow
39+
- General Spinner
40+
- Miscellaneous: show/hide keyboard, download file, open permission settings, open url, send mail
41+
etc.
42+
- Retrofit
43+
- Snackbar
44+
- String
45+
- Toast
46+
3347
## Common Binding Adapters
3448

3549
- RecyclerView
3650
- Spinner
3751
- ImageView
3852
- TextView (for Date() to formatted date-time)
3953

54+
# Utilities
55+
56+
- `SharedPref`
57+
- `AlarmUtils`
58+
- `LocationProviderUtilClient`
59+
4060
## Todo
4161

4262
- Add New Post
@@ -45,7 +65,6 @@ A simple Android MVVM pattern example and template.
4565
- Migrate to Paging 3
4666
- OneSignal integration
4767
- Splash (Introduced in Android S)
48-
- Jetpack Compose Integration
4968
- Testing
5069
- Example of LocationProviderUtilClient
5170
- AdUtils from Ticket Sheba

app/build.gradle

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ plugins {
1010
}
1111

1212
android {
13-
compileSdkVersion 30
14-
buildToolsVersion "30.0.3"
13+
compileSdkVersion 31
14+
buildToolsVersion "31.0.0"
1515

1616
defaultConfig {
1717
applicationId "org.imaginativeworld.simplemvvm"
1818
minSdkVersion 21
19-
targetSdkVersion 30
19+
targetSdkVersion 31
2020
versionCode 1
2121
versionName "1.0.0.000000" // Major.Minor.Patch.YYMMDD
2222
vectorDrawables.useSupportLibrary = true
@@ -35,16 +35,16 @@ android {
3535
}
3636

3737
buildTypes {
38-
release {
39-
minifyEnabled true
40-
shrinkResources true
41-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
42-
}
4338
debug {
4439
debuggable true
4540
applicationIdSuffix ".debug"
4641
versionNameSuffix "-debug"
4742
}
43+
release {
44+
minifyEnabled true
45+
shrinkResources true
46+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
47+
}
4848
}
4949

5050
// flavorDimensions "feature"
@@ -78,7 +78,6 @@ android {
7878
buildFeatures {
7979
viewBinding = true
8080
dataBinding = true
81-
compose true
8281

8382
// Disable unused AGP features
8483
// buildConfig false
@@ -87,65 +86,61 @@ android {
8786
resValues false
8887
shaders false
8988
}
90-
91-
composeOptions {
92-
kotlinCompilerExtensionVersion compose_version
93-
}
9489
}
9590

9691
dependencies {
9792
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98-
implementation 'androidx.appcompat:appcompat:1.3.0'
93+
implementation 'androidx.appcompat:appcompat:1.3.1'
9994
implementation 'androidx.core:core-ktx:1.6.0'
100-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
95+
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
10196

10297
testImplementation 'junit:junit:4.13.2'
10398
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
10499
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
105-
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
100+
// androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
106101

107102
// ----------------------------------------------------------------
108103
// Compose
109104
// ----------------------------------------------------------------
110-
implementation "androidx.compose.ui:ui:$compose_version"
111-
implementation "androidx.compose.ui:ui-util:$compose_version"
112-
// Tooling support (Previews, etc.)
113-
implementation "androidx.compose.ui:ui-tooling:1.0.0-beta09" //$compose_version"
114-
// Animation
115-
implementation "androidx.compose.animation:animation:$compose_version"
116-
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
117-
implementation "androidx.compose.foundation:foundation:$compose_version"
118-
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
119-
// Material Design
120-
implementation "androidx.compose.material:material:$compose_version"
121-
// Material design icons
122-
// implementation "androidx.compose.material:material-icons-core:$compose_version"
123-
// implementation "androidx.compose.material:material-icons-extended:$compose_version"
124-
// Integration with observables
125-
implementation "androidx.compose.runtime:runtime:$compose_version"
126-
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
127-
// Compose Navigation Component
128-
implementation "androidx.navigation:navigation-compose:2.4.0-alpha04"
129-
// Constraint Layout
130-
implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha08"
131-
// Integration with activities
132-
implementation 'androidx.activity:activity-compose:1.3.0-rc01'
133-
134-
// Fragments
135-
// implementation "androidx.fragment:fragment-ktx:1.4.0-alpha01"
136-
137-
// Jetpack Compose Integration for ViewModel
138-
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
139-
140-
// Paging
141-
implementation "androidx.paging:paging-compose:1.0.0-alpha11"
142-
143-
// Accompanist
144-
implementation "com.google.accompanist:accompanist-glide:$accompanist_version"
145-
implementation "com.google.accompanist:accompanist-insets:$accompanist_version"
146-
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
147-
implementation "com.google.accompanist:accompanist-flowlayout:$accompanist_version"
148-
implementation "com.google.accompanist:accompanist-pager:$accompanist_version"
105+
// implementation "androidx.compose.ui:ui:$compose_version"
106+
// implementation "androidx.compose.ui:ui-util:$compose_version"
107+
// // Tooling support (Previews, etc.)
108+
// implementation "androidx.compose.ui:ui-tooling:1.0.0-beta09" //$compose_version"
109+
// // Animation
110+
// implementation "androidx.compose.animation:animation:$compose_version"
111+
// // Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
112+
// implementation "androidx.compose.foundation:foundation:$compose_version"
113+
// implementation "androidx.compose.foundation:foundation-layout:$compose_version"
114+
// // Material Design
115+
// implementation "androidx.compose.material:material:$compose_version"
116+
// // Material design icons
117+
// // implementation "androidx.compose.material:material-icons-core:$compose_version"
118+
// // implementation "androidx.compose.material:material-icons-extended:$compose_version"
119+
// // Integration with observables
120+
// implementation "androidx.compose.runtime:runtime:$compose_version"
121+
// implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
122+
// // Compose Navigation Component
123+
// implementation "androidx.navigation:navigation-compose:2.4.0-alpha04"
124+
// // Constraint Layout
125+
// implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha08"
126+
// // Integration with activities
127+
// implementation 'androidx.activity:activity-compose:1.3.0-rc02'
128+
//
129+
// // Fragments
130+
// // implementation "androidx.fragment:fragment-ktx:1.4.0-alpha01"
131+
//
132+
// // Jetpack Compose Integration for ViewModel
133+
// implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
134+
//
135+
// // Paging
136+
// implementation "androidx.paging:paging-compose:1.0.0-alpha11"
137+
//
138+
// // Accompanist
139+
// implementation "com.google.accompanist:accompanist-glide:$accompanist_version"
140+
// implementation "com.google.accompanist:accompanist-insets:$accompanist_version"
141+
// implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
142+
// implementation "com.google.accompanist:accompanist-flowlayout:$accompanist_version"
143+
// implementation "com.google.accompanist:accompanist-pager:$accompanist_version"
149144

150145
// ----------------------------------------------------------------
151146

@@ -161,15 +156,18 @@ dependencies {
161156
implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
162157
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.12.0"
163158

159+
// Gson
160+
implementation 'com.google.code.gson:gson:2.8.7'
161+
164162
// ViewModel and LiveData
165163
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
166164
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
167165
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.1"
168166
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
169167

170168
// Kotlin Coroutines
171-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
172-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"
169+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
170+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"
173171

174172
// Room Persistence Library
175173
implementation "androidx.room:room-runtime:2.3.0"
@@ -187,7 +185,7 @@ dependencies {
187185
kapt 'com.github.bumptech.glide:compiler:4.12.0'
188186

189187
// Paging
190-
implementation "androidx.paging:paging-runtime-ktx:3.0.0"
188+
implementation "androidx.paging:paging-runtime-ktx:3.0.1"
191189

192190
// Permission
193191
implementation 'com.karumi:dexter:6.2.2'
@@ -198,7 +196,7 @@ dependencies {
198196
// Hilt
199197
implementation "com.google.dagger:hilt-android:$hilt_version"
200198
kapt "com.google.dagger:hilt-compiler:$hilt_version"
201-
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
199+
// implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
202200

203201
// Shimmer
204202
implementation 'com.facebook.shimmer:shimmer:0.5.0'
@@ -226,7 +224,13 @@ dependencies {
226224
implementation "org.imaginativeworld.whynotimagecarousel:whynotimagecarousel:2.0.2"
227225

228226
// OneSignal SDK
229-
implementation 'com.onesignal:OneSignal:4.2.0'
227+
implementation 'com.onesignal:OneSignal:4.4.2'
228+
229+
// Coil
230+
implementation("io.coil-kt:coil:1.3.1")
231+
232+
// Palette
233+
implementation 'androidx.palette:palette-ktx:1.0.0'
230234
}
231235

232236
// Workaround for OneSignal from:

app/proguard-rules.pro

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,85 @@
1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
22+
23+
# ----------------------------------------------------------------
24+
# Help Resources:
25+
# - https://proandroiddev.com/android-default-proguard-rules-guide-20058ba7a486
26+
# ----------------------------------------------------------------
27+
28+
# ----------------------------------------------------------------
29+
# Models
30+
# ----------------------------------------------------------------
31+
# Nothing individual so far...
32+
33+
# ----------------------------------------------------------------
34+
# Moshi
35+
# ----------------------------------------------------------------
36+
# Note: Moshi contains minimally required rules for its own internals to work without need for consumers to embed their own.
37+
38+
# ----------------------------------------------------------------
39+
# Parcelable
40+
# ----------------------------------------------------------------
41+
-keepclassmembers class * implements android.os.Parcelable {
42+
public static final ** CREATOR;
43+
}
44+
45+
# ----------------------------------------------------------------
46+
# Maps
47+
# ----------------------------------------------------------------
48+
# Link: https://developers.google.com/maps/documentation/android-sdk/v3-client-migration
49+
-keep,allowoptimization class com.google.android.libraries.maps.** { *; }
50+
51+
# ----------------------------------------------------------------
52+
# Retrofit
53+
# Source: https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro
54+
# ----------------------------------------------------------------
55+
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
56+
# EnclosingMethod is required to use InnerClasses.
57+
-keepattributes Signature, InnerClasses, EnclosingMethod
58+
59+
# Retrofit does reflection on method and parameter annotations.
60+
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
61+
62+
# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
63+
-keepattributes AnnotationDefault
64+
65+
# Retain service method parameters when optimizing.
66+
-keepclassmembers,allowshrinking,allowobfuscation interface * {
67+
@retrofit2.http.* <methods>;
68+
}
69+
70+
# Ignore annotation used for build tooling.
71+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
72+
73+
# Ignore JSR 305 annotations for embedding nullability information.
74+
-dontwarn javax.annotation.**
75+
76+
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
77+
-dontwarn kotlin.Unit
78+
79+
# Top-level functions that can only be used by Kotlin.
80+
-dontwarn retrofit2.KotlinExtensions
81+
-dontwarn retrofit2.KotlinExtensions$*
82+
83+
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
84+
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
85+
-if interface * { @retrofit2.http.* <methods>; }
86+
-keep,allowobfuscation interface <1>
87+
88+
# Keep generic signature of Call (R8 full mode strips signatures from non-kept items).
89+
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
90+
91+
# ----------------------------------------------------------------
92+
# OkHttp
93+
# Source: https://square.github.io/okhttp/r8_proguard/
94+
# ----------------------------------------------------------------
95+
# 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.
96+
97+
# ----------------------------------------------------------------
98+
# okio
99+
# Source: https://square.github.io/okio/#r8-proguard
100+
# ----------------------------------------------------------------
101+
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
102+
-dontwarn org.codehaus.mojo.animal_sniffer.*
103+

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
88

99
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
1011
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
1112

1213
<application
@@ -20,7 +21,9 @@
2021
android:supportsRtl="true"
2122
android:theme="@style/AppTheme"
2223
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
23-
<activity android:name=".ui.activities.main.MainActivity">
24+
<activity
25+
android:name=".ui.activities.main.MainActivity"
26+
android:exported="true">
2427
<intent-filter>
2528
<action android:name="android.intent.action.MAIN" />
2629

0 commit comments

Comments
 (0)