Merge pull request #1879 from FunkyMuse/master

introduce simple scaffold
This commit is contained in:
Tibor Kaputa 2023-10-09 13:47:57 +02:00 committed by GitHub
commit 330468ce69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View file

@ -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,

View file

@ -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()
}

View file

@ -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,

View file

@ -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,