Skip to content
This repository was archived by the owner on Aug 18, 2021. It is now read-only.

Commit 6a05bbc

Browse files
committed
update: build.gradle
remove: Kotlin-Android-Extension
1 parent c6a2528 commit 6a05bbc

3 files changed

Lines changed: 50 additions & 37 deletions

File tree

app/build.gradle

Lines changed: 9 additions & 3 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
apply plugin: 'kotlin-kapt'
54

65
android {
@@ -16,6 +15,10 @@ android {
1615
sourceCompatibility JavaVersion.VERSION_1_8
1716
targetCompatibility JavaVersion.VERSION_1_8
1817
}
18+
19+
buildFeatures {
20+
viewBinding = true
21+
}
1922

2023
compileSdkVersion 30
2124
buildToolsVersion "30.0.3"
@@ -58,10 +61,13 @@ dependencies {
5861
kapt 'com.github.bumptech.glide:compiler:4.11.0'
5962

6063
// library frogo-recycler-view
61-
implementation 'com.github.amirisback:frogo-recycler-view:3.4.0'
64+
implementation 'com.github.amirisback:frogo-recycler-view:3.5.0'
6265

6366
// library frogo-ui-kit
64-
implementation 'com.github.amirisback:frogo-ui-kit:1.0.4'
67+
implementation 'com.github.amirisback:frogo-ui-kit:1.0.5'
68+
69+
// library frogo-log
70+
implementation 'com.github.amirisback:frogo-log:2.0.0'
6571

6672
testImplementation 'junit:junit:4.13.2'
6773
androidTestImplementation 'androidx.test:runner:1.3.0'

app/src/main/java/com/frogobox/newsapi/MainActivity.kt

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.frogobox.newsapi
22

33
import android.os.Bundle
4+
import android.view.LayoutInflater
45
import android.view.View
56
import android.widget.ImageView
67
import android.widget.TextView
@@ -13,56 +14,61 @@ import com.frogobox.frogonewsapi.data.response.ArticleResponse
1314
import com.frogobox.frogonewsapi.util.NewsConstant.CATEGORY_HEALTH
1415
import com.frogobox.frogonewsapi.util.NewsConstant.COUNTRY_ID
1516
import com.frogobox.frogonewsapi.util.NewsUrl
17+
import com.frogobox.newsapi.databinding.ActivityMainBinding
1618
import com.frogobox.recycler.core.IFrogoViewAdapter
17-
import kotlinx.android.synthetic.main.activity_main.*
1819

1920
class MainActivity : AppCompatActivity() {
2021

22+
private lateinit var binding: ActivityMainBinding
23+
2124
override fun onCreate(savedInstanceState: Bundle?) {
2225
super.onCreate(savedInstanceState)
23-
setContentView(R.layout.activity_main)
26+
binding = ActivityMainBinding.inflate(LayoutInflater.from(this))
27+
setContentView(binding.root)
2428
setupNewsApi()
2529
}
2630

2731
private fun setupNewsApi() {
2832
val consumeNewsApi = ConsumeNewsApi(NewsUrl.NEWS_API_KEY) // Your API_KEY
2933
consumeNewsApi.usingChuckInterceptor(this)
30-
consumeNewsApi.getTopHeadline(
31-
null,
32-
null,
33-
CATEGORY_HEALTH,
34-
COUNTRY_ID,
35-
null,
36-
null,
37-
object : NewsResultCallback<ArticleResponse> {
38-
override fun getResultData(data: ArticleResponse) {
39-
// Your Ui or data
40-
data.articles?.let { setupFrogoRecyclerView(it) }
41-
}
34+
binding.apply {
35+
consumeNewsApi.getTopHeadline(
36+
null,
37+
null,
38+
CATEGORY_HEALTH,
39+
COUNTRY_ID,
40+
null,
41+
null,
42+
object : NewsResultCallback<ArticleResponse> {
43+
override fun getResultData(data: ArticleResponse) {
44+
// Your Ui or data
45+
data.articles?.let { setupFrogoRecyclerView(it) }
46+
}
4247

43-
override fun failedResult(statusCode: Int, errorMessage: String?) {
44-
// Your failed to do
45-
}
48+
override fun failedResult(statusCode: Int, errorMessage: String?) {
49+
// Your failed to do
50+
}
4651

47-
override fun onShowProgress() {
48-
// Your Progress Show
49-
runOnUiThread {
50-
progressView.visibility = View.VISIBLE
52+
override fun onShowProgress() {
53+
// Your Progress Show
54+
runOnUiThread {
55+
progressView.visibility = View.VISIBLE
56+
}
5157
}
52-
}
5358

54-
override fun onHideProgress() {
55-
// Your Progress Hide
56-
runOnUiThread {
57-
progressView.visibility = View.GONE
59+
override fun onHideProgress() {
60+
// Your Progress Hide
61+
runOnUiThread {
62+
progressView.visibility = View.GONE
63+
}
5864
}
59-
}
6065

61-
})
66+
})
67+
}
6268
}
6369

6470
private fun setupFrogoRecyclerView(data: List<Article>) {
65-
frogorecyclerview.injector<Article>()
71+
binding.frogorecyclerview.injector<Article>()
6672
.addData(data)
6773
.addCustomView(R.layout.frogo_rv_list_type_6)
6874
.addEmptyView(null)

frogonewsapi/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
43
apply plugin: 'kotlin-kapt'
54

65
android {
@@ -21,6 +20,10 @@ android {
2120
jvmTarget = JavaVersion.VERSION_1_8.toString()
2221
}
2322

23+
buildFeatures {
24+
viewBinding = true
25+
}
26+
2427
compileSdkVersion 30
2528
buildToolsVersion '30.0.3'
2629

@@ -53,13 +56,11 @@ dependencies {
5356
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
5457
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
5558
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
56-
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
59+
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
5760

5861
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
5962

6063
// Chuck
6164
implementation 'com.readystatesoftware.chuck:library:1.1.0'
6265

63-
64-
65-
}
66+
}

0 commit comments

Comments
 (0)