mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 10:05:15 +00:00
Reorganised cells
This commit is contained in:
parent
8deb21c0c6
commit
4dd84331de
@ -248,6 +248,25 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
||||
|
||||
NetworkConstraint networkConstraint = new NetworkConstraint.Factory(this).create();
|
||||
HTTP.INSTANCE.setConnectedToNetwork(networkConstraint::isMet);
|
||||
|
||||
// add our shortcut debug menu if we are not in a release build
|
||||
if (BuildConfig.BUILD_TYPE != "release") {
|
||||
// add the config settings shortcut
|
||||
/* Intent intent = new Intent(this, ConfigSettingsActivity::class.java);
|
||||
intent.action = Intent.ACTION_VIEW
|
||||
|
||||
val shortcut = ShortcutInfoCompat.Builder(this, "shortcut_config_settings")
|
||||
.setShortLabel("Config Settings")
|
||||
.setLongLabel("Configuration Settings")
|
||||
.setIcon(IconCompat.createWithResource(this, R.drawable.ic_experience_stop))
|
||||
.setIntent(intent)
|
||||
.build()
|
||||
|
||||
ShortcutManagerCompat.pushDynamicShortcut(this, shortcut)
|
||||
|
||||
// Instant apps do not allow this functionality - only the full app
|
||||
configurationSettingsManager.allowDisplayOfDebugMenu(true)*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.conversation.v2
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent.ACTION_UP
|
||||
@ -15,6 +16,7 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@ -58,23 +60,21 @@ import org.thoughtcrime.securesms.ui.Avatar
|
||||
import org.thoughtcrime.securesms.ui.CarouselNextButton
|
||||
import org.thoughtcrime.securesms.ui.CarouselPrevButton
|
||||
import org.thoughtcrime.securesms.ui.Cell
|
||||
import org.thoughtcrime.securesms.ui.CellNoMargin
|
||||
import org.thoughtcrime.securesms.ui.CellWithPaddingAndMargin
|
||||
import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.GetString
|
||||
import org.thoughtcrime.securesms.ui.HorizontalPagerIndicator
|
||||
import org.thoughtcrime.securesms.ui.LargeItemButton
|
||||
import org.thoughtcrime.securesms.ui.TitledText
|
||||
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.TitledText
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.blackAlpha40
|
||||
import org.thoughtcrime.securesms.ui.theme.dangerButtonColors
|
||||
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.bold
|
||||
import org.thoughtcrime.securesms.ui.theme.dangerButtonColors
|
||||
import org.thoughtcrime.securesms.ui.theme.monospace
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -191,7 +191,10 @@ fun CellMetadata(
|
||||
) {
|
||||
state.apply {
|
||||
if (listOfNotNull(sent, received, error, senderInfo).isEmpty()) return
|
||||
CellWithPaddingAndMargin {
|
||||
Cell(
|
||||
margin = PaddingValues(horizontal = LocalDimensions.current.spacing),
|
||||
padding = PaddingValues(all = LocalDimensions.current.spacing)
|
||||
) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)) {
|
||||
TitledText(sent)
|
||||
TitledText(received)
|
||||
@ -215,7 +218,7 @@ fun CellButtons(
|
||||
onResend: (() -> Unit)? = null,
|
||||
onDelete: () -> Unit = {},
|
||||
) {
|
||||
Cell {
|
||||
Cell(margin = PaddingValues(horizontal = LocalDimensions.current.spacing)) {
|
||||
Column {
|
||||
onReply?.let {
|
||||
LargeItemButton(
|
||||
@ -254,8 +257,11 @@ fun Carousel(attachments: List<Attachment>, onClick: (Int) -> Unit) {
|
||||
Row {
|
||||
CarouselPrevButton(pagerState)
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
CellCarousel(pagerState, attachments, onClick)
|
||||
HorizontalPagerIndicator(pagerState)
|
||||
CarouselPager(pagerState, attachments, onClick)
|
||||
HorizontalPagerIndicator(
|
||||
pagerState = pagerState,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.xxsSpacing)
|
||||
)
|
||||
ExpandButton(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
@ -273,12 +279,12 @@ fun Carousel(attachments: List<Attachment>, onClick: (Int) -> Unit) {
|
||||
ExperimentalGlideComposeApi::class
|
||||
)
|
||||
@Composable
|
||||
private fun CellCarousel(
|
||||
private fun CarouselPager(
|
||||
pagerState: PagerState,
|
||||
attachments: List<Attachment>,
|
||||
onClick: (Int) -> Unit
|
||||
) {
|
||||
CellNoMargin {
|
||||
Cell {
|
||||
HorizontalPager(state = pagerState) { i ->
|
||||
GlideImage(
|
||||
contentScale = ContentScale.Crop,
|
||||
@ -317,6 +323,33 @@ fun PreviewMessageDetails(
|
||||
PreviewTheme(colors) {
|
||||
MessageDetails(
|
||||
state = MessageDetailsState(
|
||||
imageAttachments = listOf(
|
||||
Attachment(
|
||||
fileDetails = listOf(
|
||||
TitledText(R.string.message_details_header__file_id, "Screen Shot 2023-07-06 at 11.35.50 am.png")
|
||||
),
|
||||
fileName = "Screen Shot 2023-07-06 at 11.35.50 am.png",
|
||||
uri = Uri.parse(""),
|
||||
hasImage = true
|
||||
),
|
||||
Attachment(
|
||||
fileDetails = listOf(
|
||||
TitledText(R.string.message_details_header__file_id, "Screen Shot 2023-07-06 at 11.35.50 am.png")
|
||||
),
|
||||
fileName = "Screen Shot 2023-07-06 at 11.35.50 am.png",
|
||||
uri = Uri.parse(""),
|
||||
hasImage = true
|
||||
),
|
||||
Attachment(
|
||||
fileDetails = listOf(
|
||||
TitledText(R.string.message_details_header__file_id, "Screen Shot 2023-07-06 at 11.35.50 am.png")
|
||||
),
|
||||
fileName = "Screen Shot 2023-07-06 at 11.35.50 am.png",
|
||||
uri = Uri.parse(""),
|
||||
hasImage = true
|
||||
)
|
||||
|
||||
),
|
||||
nonImageAttachmentFileDetails = listOf(
|
||||
TitledText(R.string.message_details_header__file_id, "Screen Shot 2023-07-06 at 11.35.50 am.png"),
|
||||
TitledText(R.string.message_details_header__file_type, "image/png"),
|
||||
@ -337,7 +370,7 @@ fun PreviewMessageDetails(
|
||||
fun FileDetails(fileDetails: List<TitledText>) {
|
||||
if (fileDetails.isEmpty()) return
|
||||
|
||||
Cell {
|
||||
Cell(margin = PaddingValues(horizontal = LocalDimensions.current.spacing)) {
|
||||
FlowRow(
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.xsSpacing, vertical = LocalDimensions.current.spacing),
|
||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)
|
||||
|
@ -0,0 +1,355 @@
|
||||
package org.thoughtcrime.securesms.debugmenu
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import org.thoughtcrime.securesms.ui.components.AppBarCloseIcon
|
||||
import org.thoughtcrime.securesms.ui.components.AppBarText
|
||||
import org.thoughtcrime.securesms.ui.components.appBarColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DebugMenu(
|
||||
modifier: Modifier = Modifier,
|
||||
onClose: () -> Unit
|
||||
){
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.background(color = LocalColors.current.background)
|
||||
) {
|
||||
// App bar
|
||||
CenterAlignedTopAppBar(
|
||||
modifier = modifier,
|
||||
title = {
|
||||
AppBarText(title = "Debug Menu")
|
||||
},
|
||||
colors = appBarColors(LocalColors.current.background),
|
||||
navigationIcon = {
|
||||
AppBarCloseIcon(onClose = onClose)
|
||||
}
|
||||
)
|
||||
|
||||
// Info pane
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
// .background()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewDebugMenu(){
|
||||
PreviewTheme {
|
||||
DebugMenu(
|
||||
onClose = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
package net.artprocessors.eileen_capstone_ui.debug.settings
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Info
|
||||
import androidx.compose.material3.BottomSheetDefaults
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.jakewharton.processphoenix.ProcessPhoenix
|
||||
import net.artprocessors.debug_ui.common.BaseButton
|
||||
import net.artprocessors.debug_ui.common.BaseDebugTab
|
||||
import net.artprocessors.debug_ui.common.DebugColorBg
|
||||
import net.artprocessors.debug_ui.common.DebugColorFill
|
||||
import net.artprocessors.debug_ui.common.DebugColorPrimary
|
||||
import net.artprocessors.debug_ui.common.DebugColorTextSecondary
|
||||
import net.artprocessors.debug_ui.common.DebugColorTextTertiary
|
||||
import net.artprocessors.debug_ui.common.DebugTextCaption
|
||||
import net.artprocessors.debug_ui.common.DebugTextNormal
|
||||
import net.artprocessors.debug_ui.common.DebugTextTitle
|
||||
import net.artprocessors.debug_ui.common.LabeledDropDown
|
||||
import net.artprocessors.debug_ui.common.ShadowHorizontalSeparator
|
||||
import net.artprocessors.debug_ui.common.l
|
||||
import net.artprocessors.debug_ui.common.m
|
||||
import net.artprocessors.debug_ui.common.s
|
||||
import net.artprocessors.debug_ui.common.xl
|
||||
import net.artprocessors.debug_ui.common.xs
|
||||
import net.artprocessors.debug_ui.common.xxs
|
||||
import net.artprocessors.eileen_capstone_ui.debug.model.AppInfo
|
||||
import net.artprocessors.eileen_capstone_ui.debug.model.DeviceInfo
|
||||
import net.artprocessors.eileen_capstone_ui.debug.model.SettingsCommand
|
||||
import net.artprocessors.eileen_capstone_ui.debug.model.SettingsData
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
internal fun DebugSettingsTabContent(
|
||||
modifier: Modifier = Modifier,
|
||||
title: String,
|
||||
data: SettingsData,
|
||||
sendCommand: (SettingsCommand) -> Unit,
|
||||
onReset: () -> Unit
|
||||
) {
|
||||
var showSheet by remember { mutableStateOf(false) }
|
||||
val modalBottomSheetState = rememberModalBottomSheetState()
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
BaseDebugTab(
|
||||
title = title,
|
||||
appBarEndContent = {
|
||||
IconButton(
|
||||
onClick = { showSheet = true }
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Info,
|
||||
tint = DebugColorPrimary,
|
||||
contentDescription = "Additional info"
|
||||
)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Spacer(modifier = Modifier.height(m()))
|
||||
|
||||
val scrollState = rememberScrollState()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f)
|
||||
.padding(horizontal = s())
|
||||
.verticalScroll(scrollState)
|
||||
) {
|
||||
// Environments
|
||||
LabeledDropDown(
|
||||
selectedText = data.selectedEnv,
|
||||
label = "Environment",
|
||||
values = data.envNames,
|
||||
onValueSelected = {
|
||||
sendCommand(SettingsCommand.SetEnvironment(it))
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(s()))
|
||||
|
||||
// Modes
|
||||
LabeledDropDown(
|
||||
selectedText = data.selectedMode,
|
||||
label = "Mode",
|
||||
values = data.modeNames,
|
||||
onValueSelected = {
|
||||
sendCommand(SettingsCommand.SetMode(it))
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(s()))
|
||||
|
||||
// Site Status
|
||||
LabeledDropDown(
|
||||
selectedText = data.selectedSiteStatus,
|
||||
label = "Site Status (Doesn't require a 'Reset' to take effect)",
|
||||
values = data.siteNames,
|
||||
onValueSelected = {
|
||||
sendCommand(SettingsCommand.SetSiteStatus(it))
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(s()))
|
||||
|
||||
// Positioning
|
||||
LabeledDropDown(
|
||||
selectedText = data.selectedPositioning,
|
||||
label = "Positioning System",
|
||||
values = data.positioning,
|
||||
onValueSelected = {
|
||||
sendCommand(SettingsCommand.SetPositioning(it))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
ShadowHorizontalSeparator()
|
||||
|
||||
Spacer(modifier = Modifier.height(s()))
|
||||
|
||||
|
||||
BaseButton(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = s()),
|
||||
text = "Reset",
|
||||
onClick = {
|
||||
// call the custom reset that can be provided by client of this composable
|
||||
onReset()
|
||||
|
||||
// kill and restart the application
|
||||
ProcessPhoenix.triggerRebirth(context)
|
||||
},
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(xs()))
|
||||
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(horizontal = s()),
|
||||
text = "Hit 'Reset' for these changes to take effect",
|
||||
style = DebugTextCaption,
|
||||
color = DebugColorTextSecondary
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(s()))
|
||||
}
|
||||
|
||||
if (showSheet) {
|
||||
ModalBottomSheet(
|
||||
containerColor = DebugColorBg,
|
||||
onDismissRequest = { showSheet = false },
|
||||
sheetState = modalBottomSheetState,
|
||||
dragHandle = { BottomSheetDefaults.DragHandle(color = DebugColorTextTertiary) },
|
||||
) {
|
||||
AboutAppScreen(appInfo = data.aboutData.appInfo, deviceInfo = data.aboutData.deviceInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AboutAppScreen(appInfo: AppInfo, deviceInfo: DeviceInfo) {
|
||||
val scrollState = rememberScrollState()
|
||||
Column(
|
||||
modifier = Modifier.verticalScroll(scrollState)
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = s()),
|
||||
text = "About the App",
|
||||
textAlign = TextAlign.Center,
|
||||
style = DebugTextTitle
|
||||
)
|
||||
|
||||
HorizontalDivider(color = DebugColorTextTertiary)
|
||||
|
||||
Card(
|
||||
modifier = Modifier.padding(horizontal = m(), vertical = s()),
|
||||
colors = CardDefaults.cardColors(containerColor = DebugColorFill),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(xs())
|
||||
) {
|
||||
val context = LocalContext.current.applicationContext
|
||||
val appContextInfo = context.applicationInfo
|
||||
val appLabelRes = appContextInfo.labelRes
|
||||
with(appInfo) {
|
||||
InfoRow(
|
||||
data = "Name",
|
||||
value = if (appLabelRes == 0) "${appContextInfo.nonLocalizedLabel}" else stringResource(appLabelRes)
|
||||
)
|
||||
InfoRow(data = "ID", value = context.packageName)
|
||||
InfoRow(data = "Variant", value = variant)
|
||||
InfoRow(data = "Version", value = version, isLast = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = Modifier.padding(horizontal = m(), vertical = s()),
|
||||
colors = CardDefaults.cardColors(containerColor = DebugColorFill),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(xs())
|
||||
) {
|
||||
with(deviceInfo) {
|
||||
InfoRow(data = "Language", value = language)
|
||||
InfoRow(data = "Time Zone", value = timezone)
|
||||
InfoRow(data = "OS", value = os)
|
||||
InfoRow(data = "Hardware", value = hardware, isLast = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = l())
|
||||
.padding(bottom = xl()),
|
||||
text = "Powered by Pladia™ · Built by Art Processors\n\n" +
|
||||
"Art Processors acknowledges the Palawa, Wurundjeri and all traditional custodians of the lands on which we work. We acknowledge their long history of story telling and pay our respects to their elders past, present and emerging.",
|
||||
style = DebugTextCaption.copy(color = DebugColorTextSecondary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun InfoRow(data: String, value: String, isLast: Boolean = false) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(xs())
|
||||
.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(xxs()),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(text = data, style = DebugTextNormal)
|
||||
Text(
|
||||
modifier = Modifier.weight(1f),
|
||||
text = value,
|
||||
style = DebugTextCaption.copy(color = DebugColorTextSecondary),
|
||||
textAlign = TextAlign.End
|
||||
)
|
||||
}
|
||||
if (!isLast) HorizontalDivider(color = DebugColorTextTertiary)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun PreviewAboutAppScreen() {
|
||||
Surface(modifier = Modifier.background(color = DebugColorBg)) {
|
||||
AboutAppScreen(
|
||||
appInfo = AppInfo(
|
||||
variant = "BYOD Test",
|
||||
version = "24.2.0 (23111000)"
|
||||
),
|
||||
deviceInfo = DeviceInfo(
|
||||
language = "English [en]",
|
||||
timezone = "Australia/Melbourne",
|
||||
os = "Android 14",
|
||||
hardware = "Pixel 7"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
*/
|
@ -473,10 +473,12 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
@Composable
|
||||
fun Buttons() {
|
||||
Column {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = LocalDimensions.current.spacing)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = LocalDimensions.current.spacing)
|
||||
.padding(top = LocalDimensions.current.xxsSpacing),
|
||||
horizontalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing),
|
||||
) {
|
||||
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.recoverypassword
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
@ -25,19 +26,19 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.CellWithPaddingAndMargin
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.Cell
|
||||
import org.thoughtcrime.securesms.ui.SessionShieldIcon
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.QrImage
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineCopyButton
|
||||
import org.thoughtcrime.securesms.ui.components.border
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.monospace
|
||||
|
||||
@Composable
|
||||
@ -53,6 +54,7 @@ internal fun RecoveryPasswordScreen(
|
||||
.contentDescription(R.string.AccessibilityId_recovery_password)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(bottom = LocalDimensions.current.smallSpacing)
|
||||
.padding(horizontal = LocalDimensions.current.spacing)
|
||||
) {
|
||||
RecoveryPasswordCell(mnemonic, seed, copyMnemonic)
|
||||
HideRecoveryPasswordCell(onHide)
|
||||
@ -69,7 +71,9 @@ private fun RecoveryPasswordCell(
|
||||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
CellWithPaddingAndMargin {
|
||||
Cell(
|
||||
padding = PaddingValues(all = LocalDimensions.current.smallSpacing)
|
||||
){
|
||||
Column {
|
||||
Row {
|
||||
Text(
|
||||
@ -148,7 +152,9 @@ private fun RecoveryPassword(mnemonic: String) {
|
||||
|
||||
@Composable
|
||||
private fun HideRecoveryPasswordCell(onHide: () -> Unit = {}) {
|
||||
CellWithPaddingAndMargin {
|
||||
Cell(
|
||||
padding = PaddingValues(all = LocalDimensions.current.smallSpacing)
|
||||
) {
|
||||
Row {
|
||||
Column(
|
||||
Modifier.weight(1f)
|
||||
|
@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.BoxScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
@ -42,14 +43,17 @@ import kotlin.math.sign
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun BoxScope.HorizontalPagerIndicator(pagerState: PagerState) {
|
||||
if (pagerState.pageCount >= 2) Box(
|
||||
modifier = Modifier
|
||||
.background(color = blackAlpha40, shape = pillShape)
|
||||
.align(Alignment.BottomCenter)
|
||||
.padding(LocalDimensions.current.xxsSpacing)
|
||||
) {
|
||||
Box(modifier = Modifier.padding(LocalDimensions.current.xxsSpacing)) {
|
||||
fun BoxScope.HorizontalPagerIndicator(
|
||||
pagerState: PagerState,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
if (pagerState.pageCount >= 2){
|
||||
Box(
|
||||
modifier = modifier
|
||||
.background(color = blackAlpha40, shape = pillShape)
|
||||
.align(Alignment.BottomCenter)
|
||||
.padding(LocalDimensions.current.xxsSpacing)
|
||||
) {
|
||||
ClickableHorizontalPagerIndicator(
|
||||
pagerState = pagerState,
|
||||
pageCount = pagerState.pageCount
|
||||
|
@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxScope
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@ -105,7 +106,7 @@ fun <T> OptionsCard(card: OptionsCardData<T>, callbacks: Callbacks<T>) {
|
||||
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.xsSpacing))
|
||||
|
||||
CellNoMargin {
|
||||
Cell {
|
||||
LazyColumn(
|
||||
modifier = Modifier.heightIn(max = 5000.dp)
|
||||
) {
|
||||
@ -257,32 +258,22 @@ fun PrewviewItemButton() {
|
||||
|
||||
@Composable
|
||||
fun Cell(
|
||||
padding: Dp = 0.dp,
|
||||
margin: Dp = LocalDimensions.current.spacing,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
CellWithPaddingAndMargin(padding, margin) { content() }
|
||||
}
|
||||
@Composable
|
||||
fun CellNoMargin(content: @Composable () -> Unit) {
|
||||
CellWithPaddingAndMargin(padding = 0.dp, margin = 0.dp) { content() }
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CellWithPaddingAndMargin(
|
||||
padding: Dp = LocalDimensions.current.spacing,
|
||||
margin: Dp = LocalDimensions.current.spacing,
|
||||
padding: PaddingValues = PaddingValues(all = 0.dp),
|
||||
margin: PaddingValues = PaddingValues(all = 0.dp),
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = margin)
|
||||
.background(color = LocalColors.current.backgroundSecondary,
|
||||
shape = MaterialTheme.shapes.small)
|
||||
.padding(margin)
|
||||
.background(
|
||||
color = LocalColors.current.backgroundSecondary,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.wrapContentHeight()
|
||||
.padding(padding)
|
||||
.fillMaxWidth(),
|
||||
) {
|
||||
Box(Modifier.padding(padding)) { content() }
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user