Skip to content

Commit d50d33a

Browse files
updated: dependencies through common file
1 parent f103ff5 commit d50d33a

File tree

6 files changed

+38
-29
lines changed

6 files changed

+38
-29
lines changed

DiffUtil/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
*.iml
22
.gradle
33
/local.properties
4-
/.idea/workspace.xml
5-
/.idea/libraries
4+
.idea
65
.DS_Store
76
/build
87
/captures

DiffUtil/.idea/misc.xml

+10-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DiffUtil/app/build.gradle

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ apply plugin: 'kotlin-android'
55
apply plugin: 'kotlin-android-extensions'
66

77
android {
8-
compileSdkVersion 26
8+
compileSdkVersion compileSdkVer
99
defaultConfig {
1010
applicationId "com.developers.diffutil"
11-
minSdkVersion 19
12-
targetSdkVersion 26
11+
minSdkVersion minSdkVer
12+
targetSdkVersion targetSdkVer
1313
versionCode 1
1414
versionName "1.0"
1515
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,11 +24,11 @@ android {
2424

2525
dependencies {
2626
implementation fileTree(dir: 'libs', include: ['*.jar'])
27-
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
28-
implementation 'com.android.support:appcompat-v7:26.1.0'
29-
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
30-
testImplementation 'junit:junit:4.12'
31-
implementation 'com.android.support:recyclerview-v7:26.1.0'
32-
androidTestImplementation 'com.android.support.test:runner:1.0.1'
33-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
27+
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28+
implementation "com.android.support:appcompat-v7:$buildToolsVer"
29+
implementation "com.android.support.constraint:constraint-layout:$constraintLayoutVersion"
30+
implementation "com.android.support:recyclerview-v7:$supportVer"
31+
testImplementation "junit:junit:$junitVer"
32+
androidTestImplementation "com.android.support.test:runner:$androidTestRunnerVer"
33+
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoCoreVersion"
3434
}

DiffUtil/app/src/main/java/com/developers/diffutil/ContactsAdapter.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import java.util.logging.Logger
1414
* Created by Amanjeet Singh on 17/1/18.
1515
*/
1616
class ContactsAdapter(val context: Context,
17-
val personList: MutableList<Person>) :
17+
private val personList: MutableList<Person>) :
1818
RecyclerView.Adapter<ContactsAdapter.MyViewHolder>() {
1919

2020

@@ -26,29 +26,29 @@ class ContactsAdapter(val context: Context,
2626
return personList.size
2727
}
2828

29-
override fun onBindViewHolder(holder: MyViewHolder?, position: Int) {
30-
holder?.bindItems(personList[position])
29+
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
30+
holder.bindItems(personList[position])
3131
}
3232

33-
override fun onBindViewHolder(holder: MyViewHolder?, position: Int, payloads: MutableList<Any>?) {
34-
if (payloads?.isEmpty()!!) {
33+
override fun onBindViewHolder(holder: MyViewHolder, position: Int, payloads: MutableList<Any>) {
34+
if (payloads.isEmpty()) {
3535
super.onBindViewHolder(holder, position, payloads)
3636
} else {
3737
val bundle = payloads[0] as Bundle
3838
for (key in bundle.keySet()) {
3939
if (key == "name") {
40-
holder?.itemView?.name_text_view?.text = personList[position].name
40+
holder.itemView.name_text_view.text = personList[position].name
4141
}
4242
if (key == "status") {
4343
log.info("Changes are ready to show")
44-
holder?.itemView?.status_text_view?.text = personList[position].status
44+
holder.itemView.status_text_view.text = personList[position].status
4545
}
4646
}
4747

4848
}
4949
}
5050

51-
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): MyViewHolder {
51+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
5252
val view = LayoutInflater.from(context).inflate(R.layout.item_view,
5353
parent, false)
5454
return MyViewHolder(view)

DiffUtil/build.gradle

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
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.2.10'
4+
apply from: '../dependencies.gradle'
5+
56
repositories {
67
google()
78
jcenter()
89
}
910
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.0.1'
11+
classpath "com.android.tools.build:gradle:$androidPluginVer"
1112
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1213

1314
// NOTE: Do not place your application dependencies here; they belong
@@ -22,6 +23,10 @@ allprojects {
2223
}
2324
}
2425

26+
subprojects {
27+
apply from: '../../dependencies.gradle'
28+
}
29+
2530
task clean(type: Delete) {
2631
delete rootProject.buildDir
2732
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Jan 15 20:24:28 IST 2018
1+
#Sat Jan 12 17:04:47 IST 2019
22
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-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 commit comments

Comments
 (0)