From bfadd2f44898268e74d98ea70aedb16447eb75d8 Mon Sep 17 00:00:00 2001 From: FunkyMuse Date: Mon, 9 Oct 2023 12:05:55 +0200 Subject: [PATCH 1/4] introduce simple scaffold --- .../commons/compose/lists/SimpleLazyListScaffold.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/compose/lists/SimpleLazyListScaffold.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/compose/lists/SimpleLazyListScaffold.kt index 9eb3b6d98..659c1a00b 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/compose/lists/SimpleLazyListScaffold.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/compose/lists/SimpleLazyListScaffold.kt @@ -254,7 +254,7 @@ fun SimpleLazyListScaffold( } @Composable -fun SimpleLazyListScaffold( +fun SimpleScaffold( modifier: Modifier = Modifier, darkStatusBarIcons: Boolean = true, customTopBar: @Composable (scrolledColor: Color, navigationInteractionSource: MutableInteractionSource, scrollBehavior: TopAppBarScrollBehavior, statusBarColor: Int, colorTransitionFraction: Float, contrastColor: Color) -> Unit, From 9b95029ea7379ffe5c868c0e6befda4aaa4aa992 Mon Sep 17 00:00:00 2001 From: FunkyMuse Date: Mon, 9 Oct 2023 12:08:01 +0200 Subject: [PATCH 2/4] introduce simple scaffold --- .../commons/compose/screens/ManageBlockedNumbersScreen.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/compose/screens/ManageBlockedNumbersScreen.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/compose/screens/ManageBlockedNumbersScreen.kt index 4f3ad3ccc..c440b5347 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/compose/screens/ManageBlockedNumbersScreen.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/compose/screens/ManageBlockedNumbersScreen.kt @@ -66,6 +66,7 @@ private const val RESET_IMMEDIATELY = 1L private const val RESET_IDLE = -1L private const val BETWEEN_CLICKS_TIME = 200 //time between a click which is slightly lower than the reset time private const val ON_LONG_CLICK_LABEL = "select" + @Composable internal fun ManageBlockedNumbersScreen( goBack: () -> Unit, @@ -96,7 +97,7 @@ internal fun ManageBlockedNumbersScreen( clearSelection() } - SimpleLazyListScaffold( + SimpleScaffold( darkStatusBarIcons = !isInActionMode, customTopBar = { scrolledColor: Color, navigationInteractionSource: MutableInteractionSource, From c4bc4dab1996779740d948b3e522a9e3cecebaaa Mon Sep 17 00:00:00 2001 From: FunkyMuse Date: Mon, 9 Oct 2023 12:58:57 +0200 Subject: [PATCH 3/4] derive state of for licenses --- .../simplemobiletools/commons/activities/LicenseActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/LicenseActivity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/LicenseActivity.kt index 387e9a090..ab0cbb6e9 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/LicenseActivity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/LicenseActivity.kt @@ -3,6 +3,8 @@ package com.simplemobiletools.commons.activities import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import com.simplemobiletools.commons.R import com.simplemobiletools.commons.compose.extensions.enableEdgeToEdgeSimple @@ -19,7 +21,7 @@ class LicenseActivity : ComponentActivity() { enableEdgeToEdgeSimple() setContent { val licenseMask = remember { intent.getLongExtra(APP_LICENSES, 0) or LICENSE_KOTLIN } - val thirdPartyLicenses = remember { initLicenses().filter { licenseMask and it.id != 0L }.toImmutableList() } + val thirdPartyLicenses by remember { derivedStateOf { initLicenses().filter { licenseMask and it.id != 0L }.toImmutableList() } } AppThemeSurface { LicenseScreen( goBack = ::finish, From 869eb0f1636664b8db053c14f19f765862c50c63 Mon Sep 17 00:00:00 2001 From: FunkyMuse Date: Mon, 9 Oct 2023 12:59:23 +0200 Subject: [PATCH 4/4] refactor: verbosity --- .../commons/activities/ManageBlockedNumbersActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/ManageBlockedNumbersActivity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/ManageBlockedNumbersActivity.kt index c3beee6d2..adb278592 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/ManageBlockedNumbersActivity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/ManageBlockedNumbersActivity.kt @@ -82,12 +82,12 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity() { AddOrEditBlockedNumberAlertDialog( blockedNumber = clickedBlockedNumber, alertDialogState = addBlockedNumberDialogState, - deleteBlockedNumber = { - deleteBlockedNumber(it) + deleteBlockedNumber = { blockedNumber -> + deleteBlockedNumber(blockedNumber) updateBlockedNumbers() }, - addBlockedNumber = { - addBlockedNumber(it) + addBlockedNumber = { blockedNumber -> + addBlockedNumber(blockedNumber) clickedBlockedNumber = null updateBlockedNumbers() }