From 222709bc15ace77ebf03e5a8e17e0bf026520970 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 24 Oct 2021 17:45:09 -0700 Subject: Many version bumps --- .../ca/allanwang/kau/sample/KPrefViewTest.kt | 6 +-- .../ca/allanwang/kau/sample/test/BaseTest.kt | 2 +- .../ca/allanwang/kau/sample/test/TestModules.kt | 3 +- sample/src/main/AndroidManifest.xml | 4 +- .../ca/allanwang/kau/sample/AboutActivity.kt | 10 +++-- .../ca/allanwang/kau/sample/AdapterActivity.kt | 3 +- .../kotlin/ca/allanwang/kau/sample/AnimActivity.kt | 32 +++++++++------- .../kotlin/ca/allanwang/kau/sample/MainActivity.kt | 44 ++++++++++++++-------- .../kotlin/ca/allanwang/kau/sample/MediaPicker.kt | 13 ++++--- .../ca/allanwang/kau/sample/PermissionCheckbox.kt | 3 +- sample/src/main/res/xml/kau_changelog.xml | 6 +++ 11 files changed, 79 insertions(+), 47 deletions(-) (limited to 'sample') diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt index fb360b9..b589800 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt @@ -28,9 +28,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule import ca.allanwang.kau.sample.test.BaseTest import dagger.hilt.android.testing.HiltAndroidTest -import javax.inject.Inject -import kotlin.test.assertFalse -import kotlin.test.assertTrue import org.hamcrest.BaseMatcher import org.hamcrest.Description import org.hamcrest.Matcher @@ -41,6 +38,9 @@ import org.junit.Test import org.junit.rules.RuleChain import org.junit.rules.TestRule import org.junit.runner.RunWith +import javax.inject.Inject +import kotlin.test.assertFalse +import kotlin.test.assertTrue /** * Created by Allan Wang on 21/12/2018. diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt index 1cba88f..0c63897 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt @@ -16,8 +16,8 @@ package ca.allanwang.kau.sample.test import dagger.hilt.android.testing.HiltAndroidRule -import kotlin.test.BeforeTest import org.junit.Rule +import kotlin.test.BeforeTest abstract class BaseTest { @Suppress("LeakingThis") diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt index 1615d2f..aef1060 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt @@ -26,7 +26,8 @@ import dagger.hilt.testing.TestInstallIn @Module @TestInstallIn( components = [SingletonComponent::class], - replaces = [PrefFactoryModule::class]) + replaces = [PrefFactoryModule::class] +) object PrefFactoryTestModule { @Provides fun factory(): KPrefFactory = KPrefFactoryInMemory diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index b205c51..aa94481 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ android:theme="@style/AppTheme"> @@ -59,7 +59,7 @@ + android:value="0a09e498a253b98237500fb5f948e5c6" /> \ No newline at end of file diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt index 59f1c92..cb907c6 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt @@ -36,9 +36,11 @@ class AboutActivity : AboutActivityBase(R.string::class.java) { } override fun postInflateMainPage(adapter: FastItemThemedAdapter) { - adapter.add(CardIItem { - title = "About KAU" - descRes = R.string.about_kau - }) + adapter.add( + CardIItem { + title = "About KAU" + descRes = R.string.about_kau + } + ) } } diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt index b166210..cb38f29 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt @@ -59,7 +59,8 @@ class AdapterActivity : ElasticRecyclerActivity() { titleRes = R.string.kau_text_copied button = "Test" buttonClick = { toast("HI") } - }) + } + ) ) setOutsideTapListener { finishAfterTransition() } return true diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt index b3560c5..30fcc45 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt @@ -46,17 +46,21 @@ class AnimActivity : KauBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val adapter = SingleFastAdapter() - setContentView(fullLinearRecycler(adapter).apply { - setBackgroundColor( - pref.bgColor.withAlpha(255) - ) - }) + setContentView( + fullLinearRecycler(adapter).apply { + setBackgroundColor( + pref.bgColor.withAlpha(255) + ) + } + ) - adapter.add(listOf( - PERMISSION_ACCESS_COARSE_LOCATION, - PERMISSION_ACCESS_FINE_LOCATION, - PERMISSION_CAMERA - ).map { PermissionCheckboxModel(it).vh() }) + adapter.add( + listOf( + PERMISSION_ACCESS_COARSE_LOCATION, + PERMISSION_ACCESS_FINE_LOCATION, + PERMISSION_CAMERA + ).map { PermissionCheckboxModel(it).vh() } + ) adapter.addEventHook(PermissionCheckboxViewBinding.clickHook()) kauSwipeOnCreate { edgeFlag = SWIPE_EDGE_LEFT @@ -69,8 +73,10 @@ class AnimActivity : KauBaseActivity() { } override fun onBackPressed() { - startActivity(bundleBuilder = { - withSlideOut(this@AnimActivity) - }) + startActivity( + bundleBuilder = { + withSlideOut(this@AnimActivity) + } + ) } } diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index e6841c8..b47bc48 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -574,10 +574,12 @@ class MainActivity : KPrefActivity() { /** * This is how the setup looks like with all the proper tags */ - checkbox(title = R.string.checkbox_1, getter = pref::check1, setter = { pref.check1 = it }, + checkbox( + title = R.string.checkbox_1, getter = pref::check1, setter = { pref.check1 = it }, builder = { descRes = R.string.desc - }) + } + ) /** * Since we know the order, we may omit the tags @@ -585,7 +587,8 @@ class MainActivity : KPrefActivity() { checkbox( R.string.checkbox_2, pref::check2, - { pref.check2 = it; reloadByTitle(R.string.checkbox_3) }) + { pref.check2 = it; reloadByTitle(R.string.checkbox_3) } + ) /** * Since the builder is the last argument and is a lambda, we may write the setup cleanly like so: @@ -601,19 +604,25 @@ class MainActivity : KPrefActivity() { allowCustom = true } - colorPicker(R.string.accent_color, pref::accentColor, { - pref.accentColor = it - reload() - this@MainActivity.navigationBarColor = it - toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L) - }) { + colorPicker( + R.string.accent_color, pref::accentColor, + { + pref.accentColor = it + reload() + this@MainActivity.navigationBarColor = it + toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L) + } + ) { descRes = R.string.color_no_custom allowCustom = false } - colorPicker(R.string.background_color, pref::bgColor, { - pref.bgColor = it; bgCanvas.ripple(it, duration = 500L) - }) { + colorPicker( + R.string.background_color, pref::bgColor, + { + pref.bgColor = it; bgCanvas.ripple(it, duration = 500L) + } + ) { iicon = GoogleMaterial.Icon.gmd_colorize descRes = R.string.color_custom_alpha allowCustomAlpha = true @@ -663,9 +672,11 @@ class MainActivity : KPrefActivity() { plainText(R.string.adapter_showcase) { onClick = { - startActivity(bundleBuilder = { - withSceneTransitionAnimation(this@MainActivity) - }) + startActivity( + bundleBuilder = { + withSceneTransitionAnimation(this@MainActivity) + } + ) } } @@ -682,7 +693,8 @@ class MainActivity : KPrefActivity() { checkbox( R.string.checkbox_2, pref::check2, - { pref.check2 = it; reloadByTitle(R.string.checkbox_3) }) { + { pref.check2 = it; reloadByTitle(R.string.checkbox_3) } + ) { titleFun = { R.string.checkbox_3 } descRes = R.string.kau_lorem_ipsum } diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt index 0e6b22f..ce45d85 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt @@ -29,13 +29,16 @@ import java.io.File /** * Created by Allan Wang on 2017-07-23. */ -private fun actions(multiple: Boolean) = listOf(object : MediaActionCamera() { +private fun actions(multiple: Boolean) = listOf( + object : MediaActionCamera() { - override fun createFile(context: Context): File = createMediaFile("KAU", ".jpg") + override fun createFile(context: Context): File = createMediaFile("KAU", ".jpg") - override fun createUri(context: Context, file: File): Uri = - FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file) -}, MediaActionGallery(multiple)) + override fun createUri(context: Context, file: File): Uri = + FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file) + }, + MediaActionGallery(multiple) +) class ImagePickerActivity : MediaPickerActivityBase(MediaType.IMAGE, actions(true)) diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt index 7bd2851..a9a67b6 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt @@ -39,7 +39,8 @@ import com.mikepenz.fastadapter.listeners.EventHook * Created by Allan Wang on 2017-07-03. */ class PermissionCheckbox(val permission: String) : KauIItem( - R.layout.permission_checkbox, { ViewHolder(it) }) { + R.layout.permission_checkbox, { ViewHolder(it) } +) { override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 18b8f31..38d8180 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -6,6 +6,12 @@ --> + + + + + + -- cgit v1.2.3 From 1f5079919a5707ad01492450878e574fe65db5c4 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 24 Oct 2021 18:29:46 -0700 Subject: Update changelog --- docs/Changelog.md | 1 + sample/src/main/res/xml/kau_changelog.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'sample') diff --git a/docs/Changelog.md b/docs/Changelog.md index c93a67d..dbff38c 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -4,6 +4,7 @@ * Add support for Bumblebee 2021.1.1 * Remove Koin * Many version bumps +* Update target SDK to 31 ## v6.3.0 * Add support for Arctic Fox 2020.3.1 diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 38d8180..bea7091 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -10,7 +10,7 @@ - + -- cgit v1.2.3