Skip to content

Commit 95b92cc

Browse files
committed
Gradle commit
- Replaced data binding with View Binding - Updated internal libraries - Updated Android Gradle Plugin to 4.2 - Removed all deprecation warnings
1 parent a1608c4 commit 95b92cc

File tree

9 files changed

+66
-33
lines changed

9 files changed

+66
-33
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 5 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: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 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: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
43

54
android {
65
compileSdkVersion 29
@@ -11,17 +10,25 @@ android {
1110
minSdkVersion 21
1211
targetSdkVersion 29
1312
multiDexEnabled true
14-
versionCode 9
13+
versionCode 10
1514
vectorDrawables.useSupportLibrary = true
16-
versionName "1.2.2"
15+
versionName "1.2.3"
1716
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1817
}
1918

19+
buildFeatures {
20+
viewBinding true
21+
}
22+
2023
buildTypes {
2124
debug {
2225
debuggable true
2326
minifyEnabled true
24-
shrinkResources false
27+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
28+
}
29+
release {
30+
debuggable false
31+
minifyEnabled true
2532
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2633
}
2734
}
@@ -34,7 +41,6 @@ android {
3441

3542
dependencies {
3643
implementation fileTree(dir: 'libs', include: ['*.jar'])
37-
implementation "org.jetbrains.anko:anko-commons:0.10.4"
3844
implementation 'com.google.android.material:material:1.3.0'
3945
implementation 'com.github.bumptech.glide:glide:4.12.0'
4046
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
@@ -45,6 +51,6 @@ dependencies {
4551
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
4652
testImplementation 'junit:junit:4.13'
4753
androidTestImplementation 'androidx.test:runner:1.3.0'
48-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8"
54+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
4955
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
5056
}

app/proguard-rules.pro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
2222
-keep public class * implements com.bumptech.glide.module.GlideModule
23-
-keep public class * extends com.bumptech.glide.module.AppGlideModule
23+
-keep class * extends com.bumptech.glide.module.AppGlideModule {
24+
<init>(...);
25+
}
2426
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
2527
**[] $VALUES;
2628
public *;
2729
}
30+
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
31+
*** rewind();
32+
}
33+
34+
2835
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}

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

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import android.view.ViewGroup
1919
import androidx.core.content.PermissionChecker
2020
import androidx.core.content.PermissionChecker.checkSelfPermission
2121
import androidx.fragment.app.Fragment
22-
import kotlinx.android.synthetic.main.fragment_home.*
22+
import com.bharathvishal.textfilegeneratorbenchmark.databinding.FragmentHomeBinding
2323
import kotlinx.coroutines.*
2424
import java.io.File
2525
import java.io.RandomAccessFile
@@ -37,6 +37,11 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
3737
private var runnerGenerateFiles3: AsyncTaskRunnerGenerate? = null
3838
private var runnerGenerateFiles4: AsyncTaskRunnerGenerate? = null
3939

40+
41+
private var _binding: FragmentHomeBinding? = null
42+
private val binding get() = _binding!!
43+
44+
4045
private var curGeneratedFilesCount: Int = 0
4146
private var filesAlreadyPresent: Int = 0
4247
var totalCount: Int = 10000
@@ -52,7 +57,9 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
5257
container: ViewGroup?,
5358
savedInstanceState: Bundle?
5459
): View? {
55-
return inflater.inflate(R.layout.fragment_home, container, false)
60+
_binding = FragmentHomeBinding.inflate(inflater, container, false)
61+
val view = binding.root
62+
return view
5663
}
5764

5865
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -66,19 +73,19 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
6673
benchMarkProgress?.setCancelable(true)
6774
benchMarkProgress?.setTitle("Generating Text Files")
6875

69-
generate_files_button?.setOnClickListener {
76+
binding.generateFilesButton.setOnClickListener {
7077
if (isStoragePermissionGranted(contextCur!!)) {
7178
curGeneratedFilesCount = 0
7279

7380
totalCount = try {
74-
Integer.parseInt(noOfFilesToGenerateEditText.text.toString())
81+
Integer.parseInt(binding.noOfFilesToGenerateEditText.text.toString())
7582
} catch (e: java.lang.Exception) {
7683
0
7784
}
7885

7986
Log.d(tagTASK, "Current value : $totalCount")
8087

81-
useSingleTaskToGenerate = threadTaskTypeSwitch.isChecked
88+
useSingleTaskToGenerate = binding.threadTaskTypeSwitch.isChecked
8289

8390
if (totalCount in 1..50000) {
8491
//Proceed and launch async task
@@ -88,17 +95,17 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
8895
runnerGenerateFiles1?.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR)
8996
} else {
9097
/*
91-
Algorithm
92-
Say total count of files is 15
93-
num1=3 (totalfilecount/4)
94-
num2=6 (num1 * 2)
95-
num3=9 (num1 * 3)
96-
97-
Tasks start count:
98-
Async Task 1 : 1 to 3 (1 to num1)
99-
Async Task 2 : 4 to 6 (num1+1 to num2)
100-
Async Task 3 : 7 to 9 (num2+1 to num3)
101-
Async Task 4 : 10 to 15 (num3+1 to totalFileCount)*/
98+
Algorithm
99+
Say total count of files is 15
100+
num1=3 (totalfilecount/4)
101+
num2=6 (num1 * 2)
102+
num3=9 (num1 * 3)
103+
104+
Tasks start count:
105+
Async Task 1 : 1 to 3 (1 to num1)
106+
Async Task 2 : 4 to 6 (num1+1 to num2)
107+
Async Task 3 : 7 to 9 (num2+1 to num3)
108+
Async Task 4 : 10 to 15 (num3+1 to totalFileCount)*/
102109

103110
val startNum1 = totalCount / 4
104111
val startNum2 = startNum1 * 2
@@ -160,7 +167,7 @@ class TextFileGeneratorFragment : Fragment(), CoroutineScope by MainScope() {
160167
}
161168

162169

163-
cleanup_files?.setOnClickListener {
170+
binding.cleanupFiles.setOnClickListener {
164171
if (isStoragePermissionGranted(contextCur!!)) {
165172
//Proceed and launch coroutine
166173
contextCur?.let { taskRunnerCleanup(it) }

build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.4.30'
4+
ext.kotlin_version = '1.4.32'
55
repositories {
66
google()
7-
jcenter()
8-
7+
mavenCentral()
98
}
109
dependencies {
11-
classpath 'com.android.tools.build:gradle:4.1.2'
10+
classpath 'com.android.tools.build:gradle:4.2.0'
1211
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1312
// NOTE: Do not place your application dependencies here; they belong
1413
// in the individual module build.gradle files
@@ -18,8 +17,7 @@ buildscript {
1817
allprojects {
1918
repositories {
2019
google()
21-
jcenter()
22-
20+
mavenCentral()
2321
}
2422
}
2523

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

0 commit comments

Comments
 (0)