parent
f03fc08a8b
commit
31d98eb0a4
|
@ -93,7 +93,7 @@ class AndroidPreferenceProvider private constructor(
|
||||||
.map { getString(key) }
|
.map { getString(key) }
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newStandard(
|
suspend fun newStandard(
|
||||||
context: Context,
|
context: Context,
|
||||||
filename: String
|
filename: String
|
||||||
): PreferenceProvider {
|
): PreferenceProvider {
|
||||||
|
@ -103,7 +103,10 @@ class AndroidPreferenceProvider private constructor(
|
||||||
*/
|
*/
|
||||||
val singleThreadedDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
|
val singleThreadedDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
|
||||||
|
|
||||||
val sharedPreferences = context.getSharedPreferences(filename, Context.MODE_PRIVATE)
|
val sharedPreferences =
|
||||||
|
withContext(singleThreadedDispatcher) {
|
||||||
|
context.getSharedPreferences(filename, Context.MODE_PRIVATE)
|
||||||
|
}
|
||||||
|
|
||||||
return AndroidPreferenceProvider(sharedPreferences, singleThreadedDispatcher)
|
return AndroidPreferenceProvider(sharedPreferences, singleThreadedDispatcher)
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ import co.electriccoin.zcash.ui.design.theme.internal.ButtonColors
|
||||||
import co.electriccoin.zcash.ui.design.theme.internal.DarkTertiaryButtonColors
|
import co.electriccoin.zcash.ui.design.theme.internal.DarkTertiaryButtonColors
|
||||||
import co.electriccoin.zcash.ui.design.theme.internal.LightTertiaryButtonColors
|
import co.electriccoin.zcash.ui.design.theme.internal.LightTertiaryButtonColors
|
||||||
import co.electriccoin.zcash.ui.design.util.StringResource
|
import co.electriccoin.zcash.ui.design.util.StringResource
|
||||||
import co.electriccoin.zcash.ui.design.util.getValue
|
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -270,37 +269,6 @@ fun PrimaryButton(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
@Suppress("LongParameterList", "LongMethod")
|
|
||||||
fun PrimaryButton(
|
|
||||||
state: ButtonState,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
minWidth: Dp = ZcashTheme.dimens.buttonWidth,
|
|
||||||
minHeight: Dp = ZcashTheme.dimens.buttonHeight,
|
|
||||||
buttonColors: ButtonColors = ZcashTheme.colors.primaryButtonColors,
|
|
||||||
textStyle: TextStyle = ZcashTheme.extendedTypography.buttonText,
|
|
||||||
outerPaddingValues: PaddingValues =
|
|
||||||
PaddingValues(
|
|
||||||
horizontal = ZcashTheme.dimens.spacingNone,
|
|
||||||
vertical = ZcashTheme.dimens.spacingSmall
|
|
||||||
),
|
|
||||||
contentPaddingValues: PaddingValues = PaddingValues(all = 17.dp)
|
|
||||||
) {
|
|
||||||
PrimaryButton(
|
|
||||||
onClick = state.onClick,
|
|
||||||
text = state.text.getValue(),
|
|
||||||
enabled = state.isEnabled,
|
|
||||||
showProgressBar = state.isLoading,
|
|
||||||
modifier = modifier,
|
|
||||||
minWidth = minWidth,
|
|
||||||
minHeight = minHeight,
|
|
||||||
buttonColors = buttonColors,
|
|
||||||
textStyle = textStyle,
|
|
||||||
outerPaddingValues = outerPaddingValues,
|
|
||||||
contentPaddingValues = contentPaddingValues,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Suppress("LongParameterList", "LongMethod")
|
@Suppress("LongParameterList", "LongMethod")
|
||||||
fun SecondaryButton(
|
fun SecondaryButton(
|
||||||
|
|
|
@ -158,8 +158,10 @@ data class RadioButtonState(
|
||||||
val onClick: () -> Unit,
|
val onClick: () -> Unit,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Suppress("UnusedPrivateMember")
|
||||||
|
@PreviewScreens
|
||||||
@Composable
|
@Composable
|
||||||
private fun RadioButtonPreview() =
|
private fun RadioButtonPreview() = ZcashTheme {
|
||||||
BlankBgColumn {
|
BlankBgColumn {
|
||||||
var isChecked by remember { mutableStateOf(false) }
|
var isChecked by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
@ -184,8 +186,4 @@ private fun RadioButtonPreview() =
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Suppress("UnusedPrivateMember")
|
|
||||||
@PreviewScreens
|
|
||||||
@Composable
|
|
||||||
private fun RadioButtonPreviewLight() = ZcashTheme { RadioButtonPreview() }
|
|
||||||
|
|
Loading…
Reference in New Issue