From ff825e3174342ab4d7cbf9e3986a281fa1a634ab Mon Sep 17 00:00:00 2001 From: Sergey Vlasenko Date: Mon, 4 Mar 2024 01:37:54 +0300 Subject: [PATCH 1/6] feature add java 17, gradle 8 support --- android-configs/common-config.gradle | 10 +++++----- api-logansquare/build.gradle | 4 ++++ kotlin-extensions/build.gradle | 4 ++++ lifecycle-rx/build.gradle | 4 ++++ lifecycle-viewcontroller/build.gradle | 4 ++++ lifecycle/build.gradle | 4 ++++ livedata-location/build.gradle | 12 ++++++++++++ logging/build.gradle | 4 ++++ navigation-base/build.gradle | 15 ++++++++++++++- navigation-viewcontroller/build.gradle | 17 +++++++++++++++++ recyclerview-adapters/build.gradle | 4 ++++ recyclerview-calendar/build.gradle | 4 ++++ rx-extensions/build.gradle | 4 ++++ storable/build.gradle | 4 ++++ utils/build.gradle | 4 ++++ views/build.gradle | 3 +++ 16 files changed, 95 insertions(+), 6 deletions(-) diff --git a/android-configs/common-config.gradle b/android-configs/common-config.gradle index 7871c2e..dc73fdd 100644 --- a/android-configs/common-config.gradle +++ b/android-configs/common-config.gradle @@ -1,10 +1,10 @@ apply plugin: 'kotlin-android' rootProject.ext { - compileSdk = 29 + compileSdk = 33 minSdk = 21 - targetSdk = 29 + targetSdk = 33 } android { @@ -16,12 +16,12 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() + jvmTarget = JavaVersion.VERSION_17.toString() } buildFeatures { diff --git a/api-logansquare/build.gradle b/api-logansquare/build.gradle index 46d7270..d81df27 100644 --- a/api-logansquare/build.gradle +++ b/api-logansquare/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.templates.logansquare" +} + dependencies { implementation project(":utils") implementation project(":logging") diff --git a/kotlin-extensions/build.gradle b/kotlin-extensions/build.gradle index afbabac..950e83c 100644 --- a/kotlin-extensions/build.gradle +++ b/kotlin-extensions/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.extensions" +} + dependencies { implementation "androidx.recyclerview:recyclerview" implementation "androidx.fragment:fragment-ktx" diff --git a/lifecycle-rx/build.gradle b/lifecycle-rx/build.gradle index f78e445..ad82b3b 100644 --- a/lifecycle-rx/build.gradle +++ b/lifecycle-rx/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.lifecycle.rx" +} + dependencies { api project(":utils") api project(":logging") diff --git a/lifecycle-viewcontroller/build.gradle b/lifecycle-viewcontroller/build.gradle index e76fa52..7a7b607 100644 --- a/lifecycle-viewcontroller/build.gradle +++ b/lifecycle-viewcontroller/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.lifecycle_viewcontroller" +} + dependencies { implementation project(":lifecycle") implementation project(":navigation-viewcontroller") diff --git a/lifecycle/build.gradle b/lifecycle/build.gradle index ce6fc3e..9e5af83 100644 --- a/lifecycle/build.gradle +++ b/lifecycle/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.lifecycle" +} + dependencies { compileOnly "javax.inject:javax.inject:1" diff --git a/livedata-location/build.gradle b/livedata-location/build.gradle index aca5fc6..9a71da0 100644 --- a/livedata-location/build.gradle +++ b/livedata-location/build.gradle @@ -1,5 +1,17 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.livedata.location" +} + +configurations.configureEach { + resolutionStrategy.eachDependency { + if (requested.name == "agconnect-core") { + useVersion(libs.versions.agconnectCore.get()) + } + } +} + dependencies { api project(":lifecycle") diff --git a/logging/build.gradle b/logging/build.gradle index 57d4392..6e6a1e3 100644 --- a/logging/build.gradle +++ b/logging/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.roboswag.core.log" +} + dependencies { implementation "androidx.annotation:annotation" diff --git a/navigation-base/build.gradle b/navigation-base/build.gradle index ef03f06..957350a 100644 --- a/navigation-base/build.gradle +++ b/navigation-base/build.gradle @@ -3,7 +3,20 @@ apply from: "../android-configs/lib-config.gradle" apply plugin: 'kotlin-kapt' android { - buildFeatures.viewBinding = true + namespace "ru.touchin.roboswag.navigation_base" + + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + buildFeatures { + viewBinding true + buildConfig true + } } dependencies { diff --git a/navigation-viewcontroller/build.gradle b/navigation-viewcontroller/build.gradle index 8734cef..46d5c3f 100644 --- a/navigation-viewcontroller/build.gradle +++ b/navigation-viewcontroller/build.gradle @@ -2,6 +2,23 @@ apply from: "../android-configs/lib-config.gradle" apply plugin: 'kotlin-kapt' +android { + namespace "ru.touchin.roboswag.navigation_viewcontroller" + + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + buildFeatures { + viewBinding true + buildConfig true + } +} + dependencies { implementation project(":utils") implementation project(":logging") diff --git a/recyclerview-adapters/build.gradle b/recyclerview-adapters/build.gradle index f52284b..be8895d 100644 --- a/recyclerview-adapters/build.gradle +++ b/recyclerview-adapters/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.roboswag.recyclerview_adapters" +} + dependencies { implementation project(':kotlin-extensions') diff --git a/recyclerview-calendar/build.gradle b/recyclerview-calendar/build.gradle index 811a091..5afd14d 100644 --- a/recyclerview-calendar/build.gradle +++ b/recyclerview-calendar/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.calendar" +} + dependencies { implementation project(":logging") implementation 'net.danlew:android.joda' diff --git a/rx-extensions/build.gradle b/rx-extensions/build.gradle index 3e4f58f..a2be65b 100644 --- a/rx-extensions/build.gradle +++ b/rx-extensions/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.extensions.rx" +} + dependencies { implementation project(":utils") implementation project(":logging") diff --git a/storable/build.gradle b/storable/build.gradle index 58f4456..55b4d19 100644 --- a/storable/build.gradle +++ b/storable/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.core.observables.storable" +} + dependencies { implementation project(":utils") implementation project(":logging") diff --git a/utils/build.gradle b/utils/build.gradle index 2a490af..48d2989 100644 --- a/utils/build.gradle +++ b/utils/build.gradle @@ -1,5 +1,9 @@ apply from: "../android-configs/lib-config.gradle" +android { + namespace "ru.touchin.roboswag.core.utils" +} + dependencies { implementation project(':kotlin-extensions') implementation "androidx.core:core" diff --git a/views/build.gradle b/views/build.gradle index e76deb5..0b45f54 100644 --- a/views/build.gradle +++ b/views/build.gradle @@ -2,8 +2,11 @@ apply from: "../android-configs/lib-config.gradle" apply plugin: 'kotlin-android' android { + namespace "ru.touchin.roboswag.views" + buildFeatures { viewBinding true + buildConfig true } } -- 2.40.1 From 0be02a0293a46b3651a4d6534e9cfd8a8c577f33 Mon Sep 17 00:00:00 2001 From: Sergey Vlasenko Date: Wed, 6 Mar 2024 15:31:08 +0300 Subject: [PATCH 2/6] fix BaseBottomNavigationController --- .../bottom_navigation_base/BaseBottomNavigationController.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bottom-navigation-base/src/main/java/ru/touchin/roboswag/bottom_navigation_base/BaseBottomNavigationController.kt b/bottom-navigation-base/src/main/java/ru/touchin/roboswag/bottom_navigation_base/BaseBottomNavigationController.kt index d9d0a05..8f831ef 100644 --- a/bottom-navigation-base/src/main/java/ru/touchin/roboswag/bottom_navigation_base/BaseBottomNavigationController.kt +++ b/bottom-navigation-base/src/main/java/ru/touchin/roboswag/bottom_navigation_base/BaseBottomNavigationController.kt @@ -75,7 +75,7 @@ abstract class BaseBottomNavigationController Date: Wed, 27 Dec 2023 20:35:48 +0300 Subject: [PATCH 3/6] Replaced 'fun getLifecycle' with 'val lifecycle' (cherry picked from commit ee44d8aa89b355d16aeddc2805f9f60bfd0a9b69) --- navigation-viewcontroller/build.gradle | 2 +- .../viewcontrollers/ViewController.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/navigation-viewcontroller/build.gradle b/navigation-viewcontroller/build.gradle index 8734cef..1d32242 100644 --- a/navigation-viewcontroller/build.gradle +++ b/navigation-viewcontroller/build.gradle @@ -13,7 +13,7 @@ dependencies { constraints { implementation("androidx.appcompat:appcompat") { version { - require '1.0.2' + require '2.6.0' } } diff --git a/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/viewcontrollers/ViewController.kt b/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/viewcontrollers/ViewController.kt index f205033..ba451c4 100644 --- a/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/viewcontrollers/ViewController.kt +++ b/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/viewcontrollers/ViewController.kt @@ -69,12 +69,13 @@ open class ViewController( val view: View = creationContext.inflater.inflate(layoutRes, creationContext.container, false) + override val lifecycle: Lifecycle + get() = fragment.viewLifecycleOwner.lifecycle + init { lifecycle.addObserver(LifecycleLoggingObserver(this)) } - override fun getLifecycle(): Lifecycle = fragment.viewLifecycleOwner.lifecycle - /** * Look for a child view with the given id. If this view has the given id, return this view. * -- 2.40.1 From 1aa4547ea9e5302f0c53c57b0b348d3b92f97d23 Mon Sep 17 00:00:00 2001 From: KirillKhoroshkov Date: Wed, 27 Dec 2023 21:10:17 +0300 Subject: [PATCH 4/6] Replaced 'fun getLifecycle' with 'val lifecycle' (cherry picked from commit b0c818aadd6c72eda3d1fd7b9963aa1ae021cb80) --- navigation-viewcontroller/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/navigation-viewcontroller/build.gradle b/navigation-viewcontroller/build.gradle index 1d32242..d314980 100644 --- a/navigation-viewcontroller/build.gradle +++ b/navigation-viewcontroller/build.gradle @@ -13,7 +13,7 @@ dependencies { constraints { implementation("androidx.appcompat:appcompat") { version { - require '2.6.0' + require '1.7.0-alpha03' } } -- 2.40.1 From 0b42f2d33f18db1a7407063952a2203f1e4e0fe4 Mon Sep 17 00:00:00 2001 From: KirillKhoroshkov Date: Wed, 27 Dec 2023 21:41:05 +0300 Subject: [PATCH 5/6] Fixed KeyboardResizeableViewController, DelegationListAdapter and LoadingContentView (cherry picked from commit 89d8bfdff5509701c8ddc400490e60c519758d62) --- .../KeyboardResizeableViewController.kt | 49 ++++++++++--------- .../adapters/DelegationListAdapter.kt | 13 +++++ .../views/widget/LoadingContentView.kt | 38 +++++++------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/keyboard_resizeable/KeyboardResizeableViewController.kt b/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/keyboard_resizeable/KeyboardResizeableViewController.kt index bd7f7c8..54d8188 100644 --- a/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/keyboard_resizeable/KeyboardResizeableViewController.kt +++ b/navigation-viewcontroller/src/main/java/ru/touchin/roboswag/navigation_viewcontroller/keyboard_resizeable/KeyboardResizeableViewController.kt @@ -25,9 +25,21 @@ abstract class KeyboardResizeableViewController + onKeyboardShow(diff) + isKeyboardVisible = true + } + private var isKeyboardVisible: Boolean = false - private val keyboardHideListener = OnBackPressedListener { + private val keyboardHidingOnBackPressedListener = OnBackPressedListener { if (isKeyboardVisible) { UiUtils.OfViews.hideSoftInput(activity) true @@ -46,39 +58,31 @@ abstract class KeyboardResizeableViewController - onKeyboardShow(diff) - isKeyboardVisible = true - } - } + if (isHideKeyboardOnBackEnabled) activity.removeOnBackPressedListener(keyboardHidingOnBackPressedListener) } override fun onStop() { super.onStop() activity.keyboardBehaviorDetector?.apply { - keyboardHideListener = null - keyboardShowListener = null + removeOnHideListener(onKeyboardHideListener) + removeOnShowListener(onKeyboardShowListener) } } @@ -86,5 +90,4 @@ abstract class KeyboardResizeableViewController(config: AsyncDifferConfig) : Recy submitList(list) } + /** + * Submits a new list to be diffed, and displayed. + * + * The commit callback can be used to know when the List is committed, but note that it + * may not be executed. If List B is submitted immediately after List A, and is + * committed directly, the callback associated with List A will not be run. + * + * @param newList The new List. + * @param commitCallback Optional runnable that is executed when the List is committed, if + * it is committed. + */ + fun submitList(list: List?, commitCallback: (() -> Unit)?) = differ.submitList(list, commitCallback) + /** * Get the current List - any diffing to present this list has already been computed and * dispatched via the ListUpdateCallback. diff --git a/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt b/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt index 8b43051..3d92f19 100644 --- a/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt +++ b/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt @@ -36,24 +36,26 @@ class LoadingContentView @JvmOverloads constructor( } private fun updateView(state: State) { - if (state == State.ShowContent) { - getChildAt(childCount - 1)?.let { showChild(it.id) } - } else { - when (state) { - is State.Stub -> { - setStubText(state.stubText) - showChild(R.id.text_stub) - } - is State.Loading -> { - showChild(R.id.progress_bar) - } - is State.Error -> { - binding.apply { - errorText.text = state.errorText - errorRepeatButton.setOnRippleClickListener { state.action.invoke() } - errorRepeatButton.text = state.repeatButtonText - showChild(R.id.error_with_repeat) - } + when (state) { + State.ShowContent -> { + getChildAt(childCount - 1)?.let { showChild(it.id) } + } + + is State.Stub -> { + setStubText(state.stubText) + showChild(R.id.text_stub) + } + + State.Loading -> { + showChild(R.id.progress_bar) + } + + is State.Error -> { + binding.apply { + errorText.text = state.errorText + errorRepeatButton.setOnRippleClickListener { state.action.invoke() } + errorRepeatButton.text = state.repeatButtonText + showChild(R.id.error_with_repeat) } else -> Unit } -- 2.40.1 From edbe507262cae69596efcada65f07c73e3224ed4 Mon Sep 17 00:00:00 2001 From: Sergey Vlasenko Date: Wed, 10 Apr 2024 17:39:24 +0300 Subject: [PATCH 6/6] fix pull issues --- .../adapters/DelegationListAdapter.kt | 13 ------------- .../roboswag/views/widget/LoadingContentView.kt | 1 - 2 files changed, 14 deletions(-) diff --git a/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt b/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt index 176a89d..2320911 100644 --- a/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt +++ b/recyclerview-adapters/src/main/java/ru/touchin/roboswag/recyclerview_adapters/adapters/DelegationListAdapter.kt @@ -92,19 +92,6 @@ open class DelegationListAdapter(config: AsyncDifferConfig) : Recy submitList(list) } - /** - * Submits a new list to be diffed, and displayed. - * - * The commit callback can be used to know when the List is committed, but note that it - * may not be executed. If List B is submitted immediately after List A, and is - * committed directly, the callback associated with List A will not be run. - * - * @param newList The new List. - * @param commitCallback Optional runnable that is executed when the List is committed, if - * it is committed. - */ - fun submitList(list: List?, commitCallback: (() -> Unit)?) = differ.submitList(list, commitCallback) - /** * Get the current List - any diffing to present this list has already been computed and * dispatched via the ListUpdateCallback. diff --git a/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt b/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt index 3d92f19..5a6bfae 100644 --- a/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt +++ b/views/src/main/java/ru/touchin/roboswag/views/widget/LoadingContentView.kt @@ -57,7 +57,6 @@ class LoadingContentView @JvmOverloads constructor( errorRepeatButton.text = state.repeatButtonText showChild(R.id.error_with_repeat) } - else -> Unit } } } -- 2.40.1