mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-05 05:15:37 +00:00
Fix QRs and radio buttons
This commit is contained in:
parent
f97630e38a
commit
6ee2a6e0a9
@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.Divider
|
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.material.primarySurface
|
import androidx.compose.material.primarySurface
|
||||||
@ -20,6 +19,7 @@ import androidx.fragment.app.Fragment
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
|
import org.thoughtcrime.securesms.ui.Divider
|
||||||
import org.thoughtcrime.securesms.ui.ItemButton
|
import org.thoughtcrime.securesms.ui.ItemButton
|
||||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.classicDarkColors
|
import org.thoughtcrime.securesms.ui.classicDarkColors
|
||||||
|
@ -19,7 +19,6 @@ import androidx.compose.foundation.layout.height
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.requiredWidth
|
import androidx.compose.foundation.layout.requiredWidth
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.material.Divider
|
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
@ -94,6 +93,7 @@ import org.thoughtcrime.securesms.permissions.Permissions
|
|||||||
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
||||||
import org.thoughtcrime.securesms.showMuteDialog
|
import org.thoughtcrime.securesms.showMuteDialog
|
||||||
import org.thoughtcrime.securesms.showSessionDialog
|
import org.thoughtcrime.securesms.showSessionDialog
|
||||||
|
import org.thoughtcrime.securesms.ui.Divider
|
||||||
import org.thoughtcrime.securesms.ui.LocalColors
|
import org.thoughtcrime.securesms.ui.LocalColors
|
||||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
@ -444,10 +444,8 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Divider(
|
Divider(modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall))
|
||||||
modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall),
|
|
||||||
color = LocalColors.current.borders
|
|
||||||
)
|
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.conversationsNone),
|
stringResource(R.string.conversationsNone),
|
||||||
style = MaterialTheme.typography.h8,
|
style = MaterialTheme.typography.h8,
|
||||||
|
@ -169,7 +169,7 @@ fun NotificationRadioButton(
|
|||||||
tag?.let { Text(stringResource(it), color = LocalColors.current.primary, style = MaterialTheme.typography.h9) }
|
tag?.let { Text(stringResource(it), color = LocalColors.current.primary, style = MaterialTheme.typography.h9) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RadioButton(selected = selected, modifier = Modifier.align(Alignment.CenterVertically), onClick = onClick)
|
RadioButton(selected = selected, modifier = Modifier.align(Alignment.CenterVertically), onClick = onClick, colors = LocalColors.current.radioButtonColors())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,10 +321,11 @@ fun Modifier.fadingEdges(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Divider() {
|
fun Divider(modifier: Modifier = Modifier, startIndent: Dp = 0.dp) {
|
||||||
androidx.compose.material.Divider(
|
androidx.compose.material.Divider(
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = modifier.padding(horizontal = LocalDimensions.current.marginExtraSmall),
|
||||||
color = LocalColors.current.divider
|
color = LocalColors.current.divider,
|
||||||
|
startIndent = startIndent
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ import org.session.libsession.utilities.AppTextSecurePreferences
|
|||||||
import org.thoughtcrime.securesms.util.ThemeState
|
import org.thoughtcrime.securesms.util.ThemeState
|
||||||
import org.thoughtcrime.securesms.util.themeState
|
import org.thoughtcrime.securesms.util.themeState
|
||||||
|
|
||||||
val LocalLightCell = staticCompositionLocalOf { Color.Black }
|
|
||||||
val LocalOnLightCell = staticCompositionLocalOf { Color.Black }
|
val LocalOnLightCell = staticCompositionLocalOf { Color.Black }
|
||||||
|
|
||||||
val LocalDimensions = staticCompositionLocalOf { Dimensions() }
|
val LocalDimensions = staticCompositionLocalOf { Dimensions() }
|
||||||
@ -72,6 +71,8 @@ data class SessionColors(
|
|||||||
val backgroundBubbleReceived: Color = Color.Unspecified,
|
val backgroundBubbleReceived: Color = Color.Unspecified,
|
||||||
val textBubbleReceived: Color = Color.Unspecified,
|
val textBubbleReceived: Color = Color.Unspecified,
|
||||||
) {
|
) {
|
||||||
|
val backgroundLight get() = if (isLight) backgroundSecondary else Color.White
|
||||||
|
val onBackgroundLight get() = if (isLight) text else background
|
||||||
val button get() = if (isLight) text else primary
|
val button get() = if (isLight) text else primary
|
||||||
val divider get() = text.copy(alpha = TabRowDefaults.DividerOpacity)
|
val divider get() = text.copy(alpha = TabRowDefaults.DividerOpacity)
|
||||||
val backgroundBubbleSent get() = primary
|
val backgroundBubbleSent get() = primary
|
||||||
|
@ -33,7 +33,6 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.ui.LocalColors
|
import org.thoughtcrime.securesms.ui.LocalColors
|
||||||
import org.thoughtcrime.securesms.ui.LocalLightCell
|
|
||||||
import org.thoughtcrime.securesms.ui.LocalOnLightCell
|
import org.thoughtcrime.securesms.ui.LocalOnLightCell
|
||||||
import org.thoughtcrime.securesms.util.QRCodeUtilities
|
import org.thoughtcrime.securesms.util.QRCodeUtilities
|
||||||
|
|
||||||
@ -47,23 +46,25 @@ fun QrImage(
|
|||||||
mutableStateOf(null)
|
mutableStateOf(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val dark = LocalColors.current.onBackgroundLight.value.toInt()
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
LaunchedEffect(string) {
|
LaunchedEffect(string) {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
bitmap = (300..500 step 100).firstNotNullOf {
|
bitmap = (300..500 step 100).firstNotNullOf {
|
||||||
runCatching { QRCodeUtilities.encode(string, it) }.getOrNull()
|
runCatching { QRCodeUtilities.encode(string, it, dark = dark) }.getOrNull()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LocalColors.current.isLight) {
|
if (LocalColors.current.isLight) {
|
||||||
Content(bitmap, icon, modifier = modifier, backgroundColor = MaterialTheme.colors.surface)
|
Content(bitmap, icon, modifier = modifier, backgroundColor = LocalColors.current.backgroundSecondary)
|
||||||
} else {
|
} else {
|
||||||
Card(
|
Card(
|
||||||
backgroundColor = LocalLightCell.current,
|
backgroundColor = Color.White,
|
||||||
elevation = 0.dp,
|
elevation = 0.dp,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
) { Content(bitmap, icon, modifier = Modifier.padding(16.dp), backgroundColor = LocalLightCell.current) }
|
) { Content(bitmap, icon, modifier = Modifier.padding(16.dp), backgroundColor = Color.White) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user