diff options
author | Allan Wang <me@allanwang.ca> | 2021-10-24 17:45:09 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-10-24 17:45:09 -0700 |
commit | 222709bc15ace77ebf03e5a8e17e0bf026520970 (patch) | |
tree | 802f80dc3e6956b9e8bdf15f4d265f3b863fa58d /sample/src/main/kotlin/ca/allanwang | |
parent | 8c95d32ce4a82ec00590c428d163a3604b7d44ec (diff) | |
download | kau-222709bc15ace77ebf03e5a8e17e0bf026520970.tar.gz kau-222709bc15ace77ebf03e5a8e17e0bf026520970.tar.bz2 kau-222709bc15ace77ebf03e5a8e17e0bf026520970.zip |
Many version bumps
Diffstat (limited to 'sample/src/main/kotlin/ca/allanwang')
6 files changed, 65 insertions, 40 deletions
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<GenericItem>) { - 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<MainActivity>(bundleBuilder = { - withSlideOut(this@AnimActivity) - }) + startActivity<MainActivity>( + 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<AdapterActivity>(bundleBuilder = { - withSceneTransitionAnimation(this@MainActivity) - }) + startActivity<AdapterActivity>( + 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<PermissionCheckbox.ViewHolder>( - R.layout.permission_checkbox, { ViewHolder(it) }) { + R.layout.permission_checkbox, { ViewHolder(it) } +) { override fun bindView(holder: ViewHolder, payloads: List<Any>) { super.bindView(holder, payloads) |