kopia lustrzana https://github.com/vitorpamplona/amethyst
Moves relay modifiers to the app's theme
rodzic
26846fa91a
commit
ecc0f39f7d
|
@ -74,11 +74,11 @@ import com.vitorpamplona.amethyst.ui.theme.HalfStartPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ReactionRowHeightChat
|
import com.vitorpamplona.amethyst.ui.theme.ReactionRowHeightChat
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size30Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size30Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
import com.vitorpamplona.amethyst.ui.theme.Size35dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.WarningColor
|
import com.vitorpamplona.amethyst.ui.theme.WarningColor
|
||||||
import com.vitorpamplona.amethyst.ui.theme.allGoodColor
|
import com.vitorpamplona.amethyst.ui.theme.allGoodColor
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.largeRelayIconModifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import com.vitorpamplona.amethyst.ui.theme.warningColor
|
import com.vitorpamplona.amethyst.ui.theme.warningColor
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -369,7 +369,11 @@ fun ServerConfigClickableLine(
|
||||||
modifier = Modifier.padding(vertical = 5.dp)
|
modifier = Modifier.padding(vertical = 5.dp)
|
||||||
) {
|
) {
|
||||||
Column(Modifier.clickable(onClick = onClick)) {
|
Column(Modifier.clickable(onClick = onClick)) {
|
||||||
RenderRelayIcon(iconUrl = item.briefInfo.favIcon, loadProfilePicture, Size55dp)
|
RenderRelayIcon(
|
||||||
|
iconUrl = item.briefInfo.favIcon,
|
||||||
|
loadProfilePicture,
|
||||||
|
MaterialTheme.colorScheme.largeRelayIconModifier
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = HalfHorzPadding)
|
Spacer(modifier = HalfHorzPadding)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -36,8 +37,8 @@ import com.vitorpamplona.amethyst.ui.note.UserCompose
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size55dp
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
import com.vitorpamplona.amethyst.ui.theme.StdPadding
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.largeRelayIconModifier
|
||||||
|
|
||||||
@OptIn(ExperimentalLayoutApi::class)
|
@OptIn(ExperimentalLayoutApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -83,7 +84,7 @@ fun RelayInformationDialog(
|
||||||
RenderRelayIcon(
|
RenderRelayIcon(
|
||||||
relayBriefInfo.favIcon,
|
relayBriefInfo.favIcon,
|
||||||
automaticallyShowProfilePicture,
|
automaticallyShowProfilePicture,
|
||||||
Size55dp
|
MaterialTheme.colorScheme.largeRelayIconModifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.vitorpamplona.amethyst.ui.note
|
package com.vitorpamplona.amethyst.ui.note
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
@ -9,7 +8,6 @@ import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
import androidx.compose.foundation.layout.FlowRow
|
import androidx.compose.foundation.layout.FlowRow
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ChevronRight
|
import androidx.compose.material.icons.filled.ChevronRight
|
||||||
import androidx.compose.material.ripple.rememberRipple
|
import androidx.compose.material.ripple.rememberRipple
|
||||||
|
@ -25,11 +23,9 @@ import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.unit.Dp
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
|
@ -41,11 +37,11 @@ import com.vitorpamplona.amethyst.ui.actions.RelayInformationDialog
|
||||||
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
import com.vitorpamplona.amethyst.ui.components.RobohashFallbackAsyncImage
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.theme.RelayIconFilter
|
import com.vitorpamplona.amethyst.ui.theme.RelayIconFilter
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size13dp
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size15Modifier
|
import com.vitorpamplona.amethyst.ui.theme.Size15Modifier
|
||||||
import com.vitorpamplona.amethyst.ui.theme.Size15dp
|
import com.vitorpamplona.amethyst.ui.theme.Size15dp
|
||||||
import com.vitorpamplona.amethyst.ui.theme.StdStartPadding
|
import com.vitorpamplona.amethyst.ui.theme.StdStartPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
|
import com.vitorpamplona.amethyst.ui.theme.relayIconModifier
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
public fun RelayBadgesHorizontal(baseNote: Note, accountViewModel: AccountViewModel, nav: (String) -> Unit) {
|
public fun RelayBadgesHorizontal(baseNote: Note, accountViewModel: AccountViewModel, nav: (String) -> Unit) {
|
||||||
|
@ -178,16 +174,11 @@ fun RenderRelay(relay: RelayBriefInfoCache.RelayBriefInfo, accountViewModel: Acc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RenderRelayIcon(iconUrl: String, loadProfilePicture: Boolean, size: Dp = Size13dp) {
|
fun RenderRelayIcon(
|
||||||
val backgroundColor = MaterialTheme.colorScheme.background
|
iconUrl: String,
|
||||||
|
loadProfilePicture: Boolean,
|
||||||
val iconModifier = remember {
|
iconModifier: Modifier = MaterialTheme.colorScheme.relayIconModifier
|
||||||
Modifier
|
) {
|
||||||
.size(size)
|
|
||||||
.clip(shape = CircleShape)
|
|
||||||
.background(backgroundColor)
|
|
||||||
}
|
|
||||||
|
|
||||||
RobohashFallbackAsyncImage(
|
RobohashFallbackAsyncImage(
|
||||||
robot = iconUrl,
|
robot = iconUrl,
|
||||||
model = iconUrl,
|
model = iconUrl,
|
||||||
|
|
|
@ -152,6 +152,26 @@ val LightChannelNotePictureModifier = Modifier
|
||||||
.background(LightColorPalette.background)
|
.background(LightColorPalette.background)
|
||||||
.border(2.dp, LightColorPalette.background, CircleShape)
|
.border(2.dp, LightColorPalette.background, CircleShape)
|
||||||
|
|
||||||
|
val LightRelayIconModifier = Modifier
|
||||||
|
.size(Size13dp)
|
||||||
|
.clip(shape = CircleShape)
|
||||||
|
.background(LightColorPalette.background)
|
||||||
|
|
||||||
|
val DarkRelayIconModifier = Modifier
|
||||||
|
.size(Size13dp)
|
||||||
|
.clip(shape = CircleShape)
|
||||||
|
.background(DarkColorPalette.background)
|
||||||
|
|
||||||
|
val LightLargeRelayIconModifier = Modifier
|
||||||
|
.size(Size55dp)
|
||||||
|
.clip(shape = CircleShape)
|
||||||
|
.background(LightColorPalette.background)
|
||||||
|
|
||||||
|
val DarkLargeRelayIconModifier = Modifier
|
||||||
|
.size(Size55dp)
|
||||||
|
.clip(shape = CircleShape)
|
||||||
|
.background(DarkColorPalette.background)
|
||||||
|
|
||||||
val RichTextDefaults = RichTextStyle().resolveDefaults()
|
val RichTextDefaults = RichTextStyle().resolveDefaults()
|
||||||
|
|
||||||
val MarkDownStyleOnDark = RichTextDefaults.copy(
|
val MarkDownStyleOnDark = RichTextDefaults.copy(
|
||||||
|
@ -294,6 +314,12 @@ val ColorScheme.innerPostModifier: Modifier
|
||||||
val ColorScheme.channelNotePictureModifier: Modifier
|
val ColorScheme.channelNotePictureModifier: Modifier
|
||||||
get() = if (isLight) LightChannelNotePictureModifier else DarkChannelNotePictureModifier
|
get() = if (isLight) LightChannelNotePictureModifier else DarkChannelNotePictureModifier
|
||||||
|
|
||||||
|
val ColorScheme.relayIconModifier: Modifier
|
||||||
|
get() = if (isLight) LightRelayIconModifier else DarkRelayIconModifier
|
||||||
|
|
||||||
|
val ColorScheme.largeRelayIconModifier: Modifier
|
||||||
|
get() = if (isLight) LightRelayIconModifier else DarkRelayIconModifier
|
||||||
|
|
||||||
val ColorScheme.chartStyle: ChartStyle
|
val ColorScheme.chartStyle: ChartStyle
|
||||||
get() {
|
get() {
|
||||||
val defaultColors = if (isLight) DefaultColors.Light else DefaultColors.Dark
|
val defaultColors = if (isLight) DefaultColors.Light else DefaultColors.Dark
|
||||||
|
|
Ładowanie…
Reference in New Issue