aboutsummaryrefslogtreecommitdiff
path: root/sample/src
diff options
context:
space:
mode:
Diffstat (limited to 'sample/src')
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt6
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt2
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt3
-rw-r--r--sample/src/main/AndroidManifest.xml4
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt10
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt3
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt32
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt44
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt13
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt3
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml6
11 files changed, 79 insertions, 47 deletions
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">
<activity
android:name=".MainActivity"
- android:label="@string/app_name"
+ android:exported="true"
android:theme="@style/AppTheme.NoActionBar.Transparent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -59,7 +59,7 @@
</provider>
<meta-data
android:name="com.bugsnag.android.API_KEY"
- android:value="0a09e498a253b98237500fb5f948e5c6"/>
+ android:value="0a09e498a253b98237500fb5f948e5c6" />
</application>
</manifest> \ 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<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)
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 18b8f31..bea7091 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -6,6 +6,12 @@
<item text="" />
-->
+ <version title="v6.4.0" />
+ <item text="Add support for Bumblebee 2021.1.1" />
+ <item text="Remove Koin" />
+ <item text="Many version bumps" />
+ <item text="Update target SDK to 31" />
+
<version title="v6.3.0" />
<item text="Add support for Arctic Fox 2020.3.1" />
<item text="Move to new maven release system" />