Skip to content

Commit bed0d13

Browse files
committed
Development commit
- Upgraded app to Material You theming. App supports Dynamic material theming for devices running Android 12. - Upgraded target SDK to 32. App can now be resized. - Updated Kotlin version. - Updated all internal dependencies.
1 parent 7db8eca commit bed0d13

File tree

14 files changed

+197
-50
lines changed

14 files changed

+197
-50
lines changed

.idea/deploymentTargetDropDown.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
33

44
android {
5-
compileSdkVersion 31
5+
compileSdkVersion 32
66

7-
buildToolsVersion "31.0.0"
7+
buildToolsVersion "32.0.0"
88
defaultConfig {
99
applicationId "com.bharathvishal.textfilegeneratorbenchmark"
10-
minSdkVersion 21
11-
targetSdkVersion 31
10+
minSdkVersion 23
11+
targetSdkVersion 32
1212
multiDexEnabled true
13-
versionCode 25
13+
versionCode 35
1414
vectorDrawables.useSupportLibrary = true
15-
versionName "1.2.9"
15+
versionName "1.3"
1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
}
1818

@@ -41,7 +41,7 @@ android {
4141

4242
dependencies {
4343
implementation fileTree(dir: 'libs', include: ['*.jar'])
44-
implementation 'com.google.android.material:material:1.4.0'
44+
implementation 'com.google.android.material:material:1.6.0-alpha01'
4545
implementation 'com.github.bumptech.glide:glide:4.12.0'
4646
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
4747
implementation 'androidx.cardview:cardview:1.0.0'

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.bharathvishal.textfilegeneratorbenchmark">
55

6-
76
<application
7+
android:name=".MyApplication"
88
android:allowBackup="true"
99
android:icon="@mipmap/ic_launcher"
1010
android:label="@string/app_name"
@@ -14,6 +14,7 @@
1414
android:theme="@style/AppTheme"
1515
tools:ignore="GoogleAppIndexingWarning"
1616
tools:targetApi="q">
17+
1718
<activity
1819
android:name=".MainActivity"
1920
android:exported="true"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.bharathvishal.textfilegeneratorbenchmark
2+
3+
import android.app.Application
4+
import com.google.android.material.color.DynamicColors
5+
6+
class MyApplication : Application() {
7+
override fun onCreate() {
8+
super.onCreate()
9+
10+
//For dynamic theming on Android 12 and above
11+
DynamicColors.applyToActivitiesIfAvailable(this)
12+
}
13+
}

app/src/main/java/com/bharathvishal/textfilegeneratorbenchmark/TextFileGeneratorFragment.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
7878

7979
Log.d(tagTASK, "Current value : $totalCount")
8080

81+
//Cleanup the files generated in a previous benchmark
82+
contextCur?.let { taskRunnerCleanup(it) }
83+
8184
useSingleTaskToGenerate = binding.threadTaskTypeSwitch.isChecked
8285

8386
if (totalCount in 1..50000) {
@@ -306,6 +309,8 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
306309

307310
Log.d(tagTASK, "cur async task being executed OnCancelled : $curAsyncTaskExecuted")
308311

312+
//Cleanup the files generated
313+
contextCur?.let { taskRunnerCleanup(it) }
309314

310315
if (tfilesAlreadyPresent >= totalCount) {
311316
try {
@@ -431,6 +436,7 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
431436
}
432437
}
433438

439+
434440
benchMarkProgress?.setOnCancelListener { dialog ->
435441
Log.d("bench1", "oncancel invoked")
436442
if (isGenerateFilesRunning) {
@@ -457,8 +463,10 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
457463
val internalFile =
458464
File(con?.filesDir!!.path + "/FileBenchmark/")
459465

466+
Log.d("Async1","internal file directory : "+internalFile.path)
467+
460468
//Delete the folder if it exists previously
461-
if (internalFile.exists() && internalFile.path.toString() == "/storage/emulated/0/FileBenchmark")
469+
if (internalFile.exists() && (internalFile.path.toString() == "/storage/emulated/0/FileBenchmark" || internalFile.path.toString().contains("com.bharathvishal.textfilegeneratorbenchmark/files/FileBenchmark")))
462470
Utilities.deleteFiles(internalFile)
463471

464472
//UI Thread

app/src/main/res/layout/activity_main.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66
android:layout_height="match_parent"
77
tools:context="com.bharathvishal.textfilegeneratorbenchmark.MainActivity">
88

9-
10-
<androidx.appcompat.widget.Toolbar
11-
android:id="@+id/toolbarmain"
9+
<com.google.android.material.appbar.AppBarLayout
1210
android:layout_width="match_parent"
13-
android:layout_height="wrap_content"
14-
android:background="?attr/colorPrimary"
15-
android:minHeight="?attr/actionBarSize"
16-
android:theme="@style/ThemeOverlay.AppCompat.Dark"
17-
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
18-
app:titleTextColor="@android:color/white" />
11+
android:id="@+id/appbarmain"
12+
android:layout_height="wrap_content">
13+
14+
<com.google.android.material.appbar.MaterialToolbar
15+
android:id="@+id/toolbarmain"
16+
android:layout_width="match_parent"
17+
android:layout_height="?attr/actionBarSize"
18+
app:title="@string/app_name" />
19+
</com.google.android.material.appbar.AppBarLayout>
1920

2021

2122
<LinearLayout
2223
android:id="@+id/linearlayoutfragmentlayout"
2324
android:layout_width="match_parent"
2425
android:layout_height="match_parent"
25-
android:layout_below="@id/toolbarmain"
26+
android:layout_below="@id/appbarmain"
2627
android:orientation="vertical">
2728

2829
<FrameLayout
2930
android:id="@+id/mainActivityFragmentFramelayout"
3031
android:layout_width="match_parent"
3132
android:layout_height="match_parent" />
32-
3333
</LinearLayout>
3434

3535

app/src/main/res/layout/fragment_home.xml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
android:padding="12dp">
88

99

10-
<androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
10+
<androidx.cardview.widget.CardView
1111
android:layout_width="match_parent"
1212
android:layout_height="match_parent"
1313
android:orientation="vertical"
14-
card_view:cardCornerRadius="4dp"
15-
card_view:cardElevation="4dp"
16-
card_view:cardMaxElevation="5dp"
17-
card_view:cardUseCompatPadding="true">
14+
app:cardCornerRadius="12dp"
15+
app:cardElevation="1dp"
16+
app:cardMaxElevation="1dp"
17+
app:cardUseCompatPadding="true">
1818

1919
<ScrollView
2020
android:layout_width="match_parent"
@@ -148,7 +148,6 @@
148148
android:layout_height="wrap_content"
149149
android:layout_marginTop="10dp">
150150

151-
152151
<TextView
153152
android:layout_width="match_parent"
154153
android:layout_height="wrap_content"
@@ -203,34 +202,30 @@
203202

204203
<com.google.android.material.button.MaterialButton
205204
android:id="@+id/generate_files_button"
206-
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
205+
style="@style/Widget.Material3.Button.OutlinedButton"
207206
android:layout_width="wrap_content"
208207
android:layout_height="wrap_content"
209208
android:layout_gravity="center"
210209
android:layout_marginLeft="10dp"
211210
android:layout_marginRight="10dp"
212211
android:layout_weight="1"
213-
android:background="?android:attr/selectableItemBackground"
214212
android:gravity="center"
215213
android:text="Generate Text Files"
216-
android:textColor="?colorAccent"
217214
android:textSize="14sp"
218215
android:visibility="visible" />
219216

220217

221218
<com.google.android.material.button.MaterialButton
222219
android:id="@+id/cleanup_files"
223-
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
220+
style="@style/Widget.Material3.Button.OutlinedButton"
224221
android:layout_width="wrap_content"
225222
android:layout_height="wrap_content"
226223
android:layout_gravity="center"
227224
android:layout_marginLeft="10dp"
228225
android:layout_marginRight="10dp"
229226
android:layout_weight="1"
230-
android:background="?android:attr/selectableItemBackground"
231227
android:gravity="center"
232228
android:text="Cleanup Generated Files"
233-
android:textColor="?colorAccent"
234229
android:textSize="14sp" />
235230

236231

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<resources>
2+
<style name="AppTheme" parent="Theme.Material3.Dark.NoActionBar">
3+
<item name="colorPrimary">@color/md_theme_dark_primary</item>
4+
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
5+
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
6+
<item name="colorOnPrimaryContainer">@color/md_theme_dark_onPrimaryContainer</item>
7+
<item name="colorSecondary">@color/md_theme_dark_secondary</item>
8+
<item name="colorOnSecondary">@color/md_theme_dark_onSecondary</item>
9+
<item name="colorSecondaryContainer">@color/md_theme_dark_secondaryContainer</item>
10+
<item name="colorOnSecondaryContainer">@color/md_theme_dark_onSecondaryContainer</item>
11+
<item name="colorTertiary">@color/md_theme_dark_tertiary</item>
12+
<item name="colorOnTertiary">@color/md_theme_dark_onTertiary</item>
13+
<item name="colorTertiaryContainer">@color/md_theme_dark_tertiaryContainer</item>
14+
<item name="colorOnTertiaryContainer">@color/md_theme_dark_onTertiaryContainer</item>
15+
<item name="colorError">@color/md_theme_dark_error</item>
16+
<item name="colorErrorContainer">@color/md_theme_dark_errorContainer</item>
17+
<item name="colorOnError">@color/md_theme_dark_onError</item>
18+
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
19+
<item name="android:colorBackground">@color/md_theme_dark_background</item>
20+
<item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
21+
<item name="colorSurface">@color/md_theme_dark_surface</item>
22+
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
23+
<item name="colorSurfaceVariant">@color/md_theme_dark_surfaceVariant</item>
24+
<item name="colorOnSurfaceVariant">@color/md_theme_dark_onSurfaceVariant</item>
25+
<item name="colorOutline">@color/md_theme_dark_outline</item>
26+
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
27+
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
28+
<item name="colorPrimaryInverse">@color/md_theme_dark_primaryInverse</item>
29+
30+
<item name="android:windowLightStatusBar">false</item>
31+
<item name="android:statusBarColor">?colorSurface</item>
32+
</style>
33+
</resources>

app/src/main/res/values/colors.xml

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,56 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<resources>
3-
<color name="colorPrimary">#008577</color>
4-
<color name="colorPrimaryDark">#00574B</color>
5-
<color name="colorAccent">#D81B60</color>
6-
</resources>
2+
<color name="md_theme_light_primary">#196D24</color>
3+
<color name="md_theme_light_onPrimary">#FFFFFF</color>
4+
<color name="md_theme_light_primaryContainer">#A2F69C</color>
5+
<color name="md_theme_light_onPrimaryContainer">#012104</color>
6+
<color name="md_theme_light_secondary">#3C6A00</color>
7+
<color name="md_theme_light_onSecondary">#FFFFFF</color>
8+
<color name="md_theme_light_secondaryContainer">#B9F475</color>
9+
<color name="md_theme_light_onSecondaryContainer">#0E2000</color>
10+
<color name="md_theme_light_tertiary">#266C2B</color>
11+
<color name="md_theme_light_onTertiary">#FFFFFF</color>
12+
<color name="md_theme_light_tertiaryContainer">#AAF5A4</color>
13+
<color name="md_theme_light_onTertiaryContainer">#082009</color>
14+
<color name="md_theme_light_error">#BA1B1B</color>
15+
<color name="md_theme_light_errorContainer">#FFDAD4</color>
16+
<color name="md_theme_light_onError">#FFFFFF</color>
17+
<color name="md_theme_light_onErrorContainer">#410001</color>
18+
<color name="md_theme_light_background">#FCFDF6</color>
19+
<color name="md_theme_light_onBackground">#1A1C19</color>
20+
<color name="md_theme_light_surface">#FCFDF6</color>
21+
<color name="md_theme_light_onSurface">#1A1C19</color>
22+
<color name="md_theme_light_surfaceVariant">#DEE5D8</color>
23+
<color name="md_theme_light_onSurfaceVariant">#424840</color>
24+
<color name="md_theme_light_outline">#73796F</color>
25+
<color name="md_theme_light_inverseOnSurface">#F0F1EB</color>
26+
<color name="md_theme_light_inverseSurface">#2F312D</color>
27+
<color name="md_theme_light_primaryInverse">#86DA82</color>
28+
<color name="md_theme_dark_primary">#86DA82</color>
29+
<color name="md_theme_dark_onPrimary">#003907</color>
30+
<color name="md_theme_dark_primaryContainer">#00530F</color>
31+
<color name="md_theme_dark_onPrimaryContainer">#A2F69C</color>
32+
<color name="md_theme_dark_secondary">#9ED75C</color>
33+
<color name="md_theme_dark_onSecondary">#1C3700</color>
34+
<color name="md_theme_dark_secondaryContainer">#2C5000</color>
35+
<color name="md_theme_dark_onSecondaryContainer">#B9F475</color>
36+
<color name="md_theme_dark_tertiary">#8FD88A</color>
37+
<color name="md_theme_dark_onTertiary">#003907</color>
38+
<color name="md_theme_dark_tertiaryContainer">#045315</color>
39+
<color name="md_theme_dark_onTertiaryContainer">#AAF5A4</color>
40+
<color name="md_theme_dark_error">#FFB4A9</color>
41+
<color name="md_theme_dark_errorContainer">#930006</color>
42+
<color name="md_theme_dark_onError">#680003</color>
43+
<color name="md_theme_dark_onErrorContainer">#FFDAD4</color>
44+
<color name="md_theme_dark_background">#1A1C19</color>
45+
<color name="md_theme_dark_onBackground">#E2E3DD</color>
46+
<color name="md_theme_dark_surface">#1A1C19</color>
47+
<color name="md_theme_dark_onSurface">#E2E3DD</color>
48+
<color name="md_theme_dark_surfaceVariant">#424840</color>
49+
<color name="md_theme_dark_onSurfaceVariant">#C2C8BD</color>
50+
<color name="md_theme_dark_outline">#8C9288</color>
51+
<color name="md_theme_dark_inverseOnSurface">#1A1C19</color>
52+
<color name="md_theme_dark_inverseSurface">#E2E3DD</color>
53+
<color name="md_theme_dark_primaryInverse">#196D24</color>
54+
<color name="seed">#3C8C3F</color>
55+
<color name="error">#BA1B1B</color>
56+
</resources>

0 commit comments

Comments
 (0)