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

Commit e48b22c

Browse files
committed
update: build.gradle
1 parent afcf8d3 commit e48b22c

File tree

6 files changed

+85
-63
lines changed

6 files changed

+85
-63
lines changed

app/build.gradle

Lines changed: 21 additions & 12 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 {
@@ -17,13 +16,17 @@ android {
1716
targetCompatibility JavaVersion.VERSION_1_8
1817
}
1918

20-
compileSdkVersion 29
21-
buildToolsVersion "29.0.3"
19+
buildFeatures {
20+
viewBinding = true
21+
}
22+
23+
compileSdkVersion 30
24+
buildToolsVersion "30.0.3"
2225

2326
defaultConfig {
2427
applicationId "com.frogobox.themealsapi"
2528
minSdkVersion 21
26-
targetSdkVersion 29
29+
targetSdkVersion 30
2730
versionCode projectVersionCode
2831
versionName projectVersionName
2932

@@ -42,25 +45,31 @@ android {
4245
dependencies {
4346
implementation fileTree(dir: 'libs', include: ['*.jar'])
4447
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
45-
implementation 'androidx.appcompat:appcompat:1.1.0'
46-
implementation 'androidx.core:core-ktx:1.2.0'
47-
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
48+
implementation 'androidx.appcompat:appcompat:1.2.0'
49+
implementation 'androidx.core:core-ktx:1.3.2'
50+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
4851

4952
// library google
5053
implementation 'com.google.code.gson:gson:2.8.6'
51-
implementation 'com.google.android.material:material:1.1.0'
54+
implementation 'com.google.android.material:material:1.3.0'
5255
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
5356

5457
// Glide
5558
implementation 'com.github.bumptech.glide:glide:4.11.0'
5659
kapt 'com.github.bumptech.glide:compiler:4.11.0'
5760

5861
// library frogo-recycler-view
59-
implementation 'com.github.amirisback:frogo-recycler-view:2.2.4'
62+
implementation 'com.github.amirisback:frogo-recycler-view:3.5.0'
63+
64+
// library frogo-ui-kit
65+
implementation 'com.github.amirisback:frogo-ui-kit:1.0.5'
66+
67+
// library frogo-log
68+
implementation 'com.github.amirisback:frogo-log:2.0.0'
6069

61-
testImplementation 'junit:junit:4.13'
62-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
63-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
70+
testImplementation 'junit:junit:4.13.2'
71+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
72+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
6473

6574
implementation project(':frogothemealdbapi')
6675

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

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
package com.frogobox.themealsapi
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
78
import android.widget.Toast
89
import androidx.appcompat.app.AppCompatActivity
910
import com.bumptech.glide.Glide
11+
import com.frogobox.frogolog.FLog
1012
import com.frogobox.frogothemealdbapi.ConsumeTheMealDbApi
1113
import com.frogobox.frogothemealdbapi.callback.MealResultCallback
1214
import com.frogobox.frogothemealdbapi.data.model.Meal
1315
import com.frogobox.frogothemealdbapi.data.response.MealResponse
14-
import com.frogobox.recycler.boilerplate.viewrclass.FrogoViewAdapterCallback
15-
import kotlinx.android.synthetic.main.activity_main.*
16+
import com.frogobox.recycler.core.IFrogoViewAdapter
17+
import com.frogobox.themealsapi.databinding.ActivityMainBinding
1618

1719
class MainActivity : AppCompatActivity() {
1820

21+
private lateinit var binding: ActivityMainBinding
22+
1923
override fun onCreate(savedInstanceState: Bundle?) {
2024
super.onCreate(savedInstanceState)
21-
setContentView(R.layout.activity_main)
25+
binding = ActivityMainBinding.inflate(LayoutInflater.from(this))
26+
setContentView(binding.root)
2227
setupConsumableMealApi("b")
2328
}
2429

@@ -29,47 +34,52 @@ class MainActivity : AppCompatActivity() {
2934
}
3035

3136
private fun setupConsumableMealApi(firstLetter: String) {
32-
consumeMealApi().listAllMeal(firstLetter, object : MealResultCallback<MealResponse<Meal>> {
33-
override fun getResultData(data: MealResponse<Meal>) {
34-
data.meals?.let { setupFrogoRecyclerView(it) }
35-
}
37+
binding.apply {
38+
consumeMealApi().listAllMeal(
39+
firstLetter,
40+
object : MealResultCallback<MealResponse<Meal>> {
41+
override fun getResultData(data: MealResponse<Meal>) {
42+
data.meals?.let { setupFrogoRecyclerView(it) }
43+
}
3644

37-
override fun failedResult(statusCode: Int, errorMessage: String?) {
38-
Toast.makeText(this@MainActivity, errorMessage, Toast.LENGTH_SHORT).show()
39-
}
45+
override fun failedResult(statusCode: Int, errorMessage: String?) {
46+
Toast.makeText(this@MainActivity, errorMessage, Toast.LENGTH_SHORT).show()
47+
}
4048

41-
override fun onShowProgress() {
42-
// Show Your Progress View
43-
runOnUiThread {
44-
progress_bar.visibility = View.VISIBLE
45-
}
46-
}
49+
override fun onShowProgress() {
50+
// Show Your Progress View
51+
runOnUiThread {
52+
progressBar.visibility = View.VISIBLE
53+
}
54+
}
4755

48-
override fun onHideProgress() {
49-
// Hide Your Progress View
50-
runOnUiThread {
51-
progress_bar.visibility = View.GONE
52-
}
53-
}
54-
})
56+
override fun onHideProgress() {
57+
// Hide Your Progress View
58+
runOnUiThread {
59+
progressBar.visibility = View.GONE
60+
}
61+
}
62+
})
63+
}
5564
}
5665

5766
private fun setupFrogoRecyclerView(data: List<Meal>) {
58-
frogo_rv.injector<Meal>()
67+
binding.frogoRv.injector<Meal>()
5968
.addData(data)
60-
.addCustomView(R.layout.frogo_rv_grid_type_13)
61-
.addCallback(object : FrogoViewAdapterCallback<Meal> {
69+
.addCustomView(R.layout.frogo_rv_grid_type_2)
70+
.addCallback(object : IFrogoViewAdapter<Meal> {
6271
override fun onItemClicked(data: Meal) {
72+
FLog.d(data.strMeal, this@MainActivity)
6373
}
6474

6575
override fun onItemLongClicked(data: Meal) {
6676

6777
}
6878

6979
override fun setupInitComponent(view: View, data: Meal) {
70-
val ivPoster = view.findViewById<ImageView>(R.id.frogo_rv_type_13_iv_poster)
71-
val tvTitle = view.findViewById<TextView>(R.id.frogo_rv_type_13_tv_title)
72-
val tvSubTitle = view.findViewById<TextView>(R.id.frogo_rv_type_13_tv_subtitle)
80+
val ivPoster = view.findViewById<ImageView>(R.id.frogo_rv_grid_type_2_iv_poster)
81+
val tvTitle = view.findViewById<TextView>(R.id.frogo_rv_grid_type_2_tv_title)
82+
val tvSubTitle = view.findViewById<TextView>(R.id.frogo_rv_grid_type_2_tv_subtitle)
7383

7484
Glide.with(view.context).load(data.strMealThumb).into(ivPoster)
7585
tvTitle.text = data.strMeal

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7-
android:background="@color/frogoRvColorWhite"
7+
android:background="@color/frogoColorWhite"
88
tools:context=".MainActivity">
99

10-
<com.frogobox.recycler.FrogoRecyclerView
10+
<com.frogobox.recycler.widget.FrogoRecyclerView
1111
android:id="@+id/frogo_rv"
1212
android:layout_width="0dp"
1313
android:layout_height="0dp"
1414
android:clipToPadding="false"
15-
android:paddingStart="@dimen/frogo_rv_dimen_16dp"
16-
android:paddingTop="@dimen/frogo_rv_dimen_16dp"
15+
android:paddingStart="@dimen/frogo_dimen_16dp"
16+
android:paddingTop="@dimen/frogo_dimen_16dp"
1717
app:layout_constraintBottom_toBottomOf="parent"
1818
app:layout_constraintLeft_toLeftOf="parent"
1919
app:layout_constraintRight_toRightOf="parent"

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +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.3.72'
4+
ext.kotlin_version = '1.5.0'
55
repositories {
66
google()
7-
jcenter()
8-
7+
mavenCentral()
8+
99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.6.3'
11+
classpath 'com.android.tools.build:gradle:4.2.0'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313

1414
// NOTE: Do not place your application dependencies here; they belong
@@ -19,7 +19,7 @@ buildscript {
1919
allprojects {
2020
repositories {
2121
google()
22-
jcenter()
22+
mavenCentral()
2323
maven { url 'https://jitpack.io' }
2424
}
2525
}

frogothemealdbapi/build.gradle

Lines changed: 15 additions & 12 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,12 +20,16 @@ android {
2120
jvmTarget = JavaVersion.VERSION_1_8.toString()
2221
}
2322

24-
compileSdkVersion 29
25-
buildToolsVersion "29.0.3"
23+
buildFeatures {
24+
viewBinding = true
25+
}
26+
27+
compileSdkVersion 30
28+
buildToolsVersion "30.0.3"
2629

2730
defaultConfig {
2831
minSdkVersion 21
29-
targetSdkVersion 29
32+
targetSdkVersion 30
3033
versionCode projectVersionCode
3134
versionName projectVersionName
3235

@@ -46,20 +49,20 @@ android {
4649
dependencies {
4750
implementation fileTree(dir: 'libs', include: ['*.jar'])
4851
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
49-
implementation 'androidx.core:core-ktx:1.2.0'
52+
implementation 'androidx.core:core-ktx:1.3.2'
5053

5154
implementation 'com.google.code.gson:gson:2.8.6'
5255

53-
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
54-
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.0'
55-
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
56-
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
56+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
57+
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
58+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
59+
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
5760

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

6063
implementation 'com.readystatesoftware.chuck:library:1.1.0'
6164

62-
testImplementation 'junit:junit:4.13'
63-
androidTestImplementation 'androidx.test:runner:1.2.0'
64-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
65+
testImplementation 'junit:junit:4.13.2'
66+
androidTestImplementation 'androidx.test:runner:1.3.0'
67+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
6568
}

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-5.6.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

0 commit comments

Comments
 (0)