Get's rid of the view count.

This commit is contained in:
Vitor Pamplona
2024-06-18 19:33:04 -04:00
parent f28d96d303
commit 5da9e430b0
5 changed files with 61 additions and 72 deletions

View File

@@ -44,8 +44,8 @@ import androidx.compose.material.icons.filled.Link
import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.PushPin import androidx.compose.material.icons.filled.PushPin
import androidx.compose.material.icons.filled.Report import androidx.compose.material.icons.filled.Report
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.outlined.ArrowForwardIos import androidx.compose.material.icons.outlined.ArrowForwardIos
import androidx.compose.material.icons.outlined.BarChart
import androidx.compose.material.icons.outlined.Bolt import androidx.compose.material.icons.outlined.Bolt
import androidx.compose.material.icons.outlined.PlayCircle import androidx.compose.material.icons.outlined.PlayCircle
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@@ -243,6 +243,7 @@ fun ReactionRowIconPreview() {
OutlinedZapIcon(Size20Modifier) OutlinedZapIcon(Size20Modifier)
ZapIcon(Size20Modifier) ZapIcon(Size20Modifier)
ZappedIcon(Size20Modifier) ZappedIcon(Size20Modifier)
ShareIcon(Size20Modifier, Color.Unspecified)
} }
} }
@@ -274,6 +275,19 @@ fun OutlinedZapIcon(
) )
} }
@Composable
fun ShareIcon(
modifier: Modifier,
tint: Color = Color.Unspecified,
) {
Icon(
imageVector = Icons.Default.Share,
modifier = modifier,
contentDescription = stringResource(R.string.share_or_save),
tint = tint,
)
}
@Composable @Composable
fun CashuIcon(modifier: Modifier) { fun CashuIcon(modifier: Modifier) {
Icon( Icon(
@@ -349,19 +363,6 @@ fun CommentIcon(
) )
} }
@Composable
fun ViewCountIcon(
modifier: Modifier,
tint: Color = Color.Unspecified,
) {
Icon(
imageVector = Icons.Outlined.BarChart,
null,
modifier = modifier,
tint = tint,
)
}
@Composable @Composable
fun PollIcon() { fun PollIcon() {
Icon( Icon(

View File

@@ -21,6 +21,7 @@
package com.vitorpamplona.amethyst.ui.note package com.vitorpamplona.amethyst.ui.note
import android.content.Context import android.content.Context
import android.content.Intent
import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.ContentTransform import androidx.compose.animation.ContentTransform
@@ -75,7 +76,6 @@ import androidx.compose.ui.Alignment.Companion.CenterStart
import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
@@ -87,13 +87,11 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Popup import androidx.compose.ui.window.Popup
import androidx.core.content.ContextCompat
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.distinctUntilChanged import androidx.lifecycle.distinctUntilChanged
import androidx.lifecycle.map import androidx.lifecycle.map
import coil.compose.AsyncImage
import coil.request.CachePolicy
import coil.request.ImageRequest
import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.FeatureSetType import com.vitorpamplona.amethyst.model.FeatureSetType
import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.Note
@@ -109,7 +107,6 @@ import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
import com.vitorpamplona.amethyst.ui.theme.DarkerGreen import com.vitorpamplona.amethyst.ui.theme.DarkerGreen
import com.vitorpamplona.amethyst.ui.theme.Font14SP import com.vitorpamplona.amethyst.ui.theme.Font14SP
import com.vitorpamplona.amethyst.ui.theme.HalfDoubleVertSpacer import com.vitorpamplona.amethyst.ui.theme.HalfDoubleVertSpacer
import com.vitorpamplona.amethyst.ui.theme.Height24dpModifier
import com.vitorpamplona.amethyst.ui.theme.ModifierWidth3dp import com.vitorpamplona.amethyst.ui.theme.ModifierWidth3dp
import com.vitorpamplona.amethyst.ui.theme.NoSoTinyBorders import com.vitorpamplona.amethyst.ui.theme.NoSoTinyBorders
import com.vitorpamplona.amethyst.ui.theme.ReactionRowExpandButton import com.vitorpamplona.amethyst.ui.theme.ReactionRowExpandButton
@@ -202,15 +199,51 @@ private fun InnerReactionRow(
ZapReaction(baseNote, MaterialTheme.colorScheme.placeholderText, accountViewModel, nav = nav) ZapReaction(baseNote, MaterialTheme.colorScheme.placeholderText, accountViewModel, nav = nav)
}, },
six = { six = {
// ViewCountReaction( ShareReaction(
// note = baseNote, note = baseNote,
// grayTint = MaterialTheme.colorScheme.placeholderText, grayTint = MaterialTheme.colorScheme.placeholderText,
// viewCountColorFilter = MaterialTheme.colorScheme.placeholderTextColorFilter, )
// )
}, },
) )
} }
@Composable
fun ShareReaction(
note: Note,
grayTint: Color,
barChartModifier: Modifier = Size19Modifier,
) {
val context = LocalContext.current
IconButton(
modifier = barChartModifier,
onClick = {
val sendIntent =
Intent().apply {
action = Intent.ACTION_SEND
type = "text/plain"
putExtra(
Intent.EXTRA_TEXT,
externalLinkForNote(note),
)
putExtra(
Intent.EXTRA_TITLE,
context.getString(R.string.quick_action_share_browser_link),
)
}
val shareIntent =
Intent.createChooser(
sendIntent,
context.getString(R.string.quick_action_share),
)
ContextCompat.startActivity(context, shareIntent, null)
},
) {
ShareIcon(barChartModifier, grayTint)
}
}
@Composable @Composable
private fun GenericInnerReactionRow( private fun GenericInnerReactionRow(
showReactionDetail: Boolean, showReactionDetail: Boolean,
@@ -244,7 +277,7 @@ private fun GenericInnerReactionRow(
Row(verticalAlignment = CenterVertically, modifier = Modifier.weight(1f)) { five() } Row(verticalAlignment = CenterVertically, modifier = Modifier.weight(1f)) { five() }
Row(verticalAlignment = CenterVertically, modifier = Modifier.weight(1f)) { six() } Row(verticalAlignment = CenterVertically, modifier = Modifier) { six() }
} }
} }
@@ -1201,42 +1234,6 @@ fun ObserveZapAmountText(
} }
} }
@Composable
fun ViewCountReaction(
note: Note,
grayTint: Color,
barChartModifier: Modifier = Size19Modifier,
numberSizeModifier: Modifier = Height24dpModifier,
viewCountColorFilter: ColorFilter,
) {
ViewCountIcon(barChartModifier, grayTint)
DrawViewCount(note, numberSizeModifier, viewCountColorFilter)
}
@Composable
private fun DrawViewCount(
note: Note,
iconModifier: Modifier = Modifier,
viewCountColorFilter: ColorFilter,
) {
val context = LocalContext.current
AsyncImage(
model =
remember(note) {
ImageRequest
.Builder(context)
.data("https://counter.amethyst.social/${note.idHex}.svg?label=+&color=00000000")
.diskCachePolicy(CachePolicy.DISABLED)
.memoryCachePolicy(CachePolicy.ENABLED)
.build()
},
contentDescription = context.getString(R.string.view_count),
modifier = iconModifier,
colorFilter = viewCountColorFilter,
)
}
@OptIn(ExperimentalLayoutApi::class) @OptIn(ExperimentalLayoutApi::class)
@Composable @Composable
private fun BoostTypeChoicePopup( private fun BoostTypeChoicePopup(

View File

@@ -73,7 +73,6 @@ import com.vitorpamplona.amethyst.ui.note.NoteAuthorPicture
import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay import com.vitorpamplona.amethyst.ui.note.NoteUsernameDisplay
import com.vitorpamplona.amethyst.ui.note.RenderAllRelayList import com.vitorpamplona.amethyst.ui.note.RenderAllRelayList
import com.vitorpamplona.amethyst.ui.note.ReplyReaction import com.vitorpamplona.amethyst.ui.note.ReplyReaction
import com.vitorpamplona.amethyst.ui.note.ViewCountReaction
import com.vitorpamplona.amethyst.ui.note.ZapReaction import com.vitorpamplona.amethyst.ui.note.ZapReaction
import com.vitorpamplona.amethyst.ui.note.elements.NoteDropDownMenu import com.vitorpamplona.amethyst.ui.note.elements.NoteDropDownMenu
import com.vitorpamplona.amethyst.ui.note.types.FileHeaderDisplay import com.vitorpamplona.amethyst.ui.note.types.FileHeaderDisplay
@@ -92,12 +91,10 @@ import com.vitorpamplona.amethyst.ui.theme.AuthorInfoVideoFeed
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.Size35Modifier import com.vitorpamplona.amethyst.ui.theme.Size35Modifier
import com.vitorpamplona.amethyst.ui.theme.Size35dp import com.vitorpamplona.amethyst.ui.theme.Size35dp
import com.vitorpamplona.amethyst.ui.theme.Size39Modifier
import com.vitorpamplona.amethyst.ui.theme.Size40Modifier import com.vitorpamplona.amethyst.ui.theme.Size40Modifier
import com.vitorpamplona.amethyst.ui.theme.Size40dp import com.vitorpamplona.amethyst.ui.theme.Size40dp
import com.vitorpamplona.amethyst.ui.theme.Size55dp import com.vitorpamplona.amethyst.ui.theme.Size55dp
import com.vitorpamplona.amethyst.ui.theme.VideoReactionColumnPadding import com.vitorpamplona.amethyst.ui.theme.VideoReactionColumnPadding
import com.vitorpamplona.amethyst.ui.theme.onBackgroundColorFilter
import com.vitorpamplona.amethyst.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.theme.placeholderText
import com.vitorpamplona.quartz.events.FileHeaderEvent import com.vitorpamplona.quartz.events.FileHeaderEvent
import com.vitorpamplona.quartz.events.FileStorageHeaderEvent import com.vitorpamplona.quartz.events.FileStorageHeaderEvent
@@ -444,11 +441,5 @@ fun ReactionsColumn(
animationSize = Size35dp, animationSize = Size35dp,
nav = nav, nav = nav,
) )
ViewCountReaction(
note = baseNote,
grayTint = MaterialTheme.colorScheme.onBackground,
barChartModifier = Size39Modifier,
viewCountColorFilter = MaterialTheme.colorScheme.onBackgroundColorFilter,
)
} }
} }

View File

@@ -157,7 +157,7 @@ val VideoReactionColumnPadding = Modifier.padding(bottom = 75.dp)
val DividerThickness = 0.25.dp val DividerThickness = 0.25.dp
val ReactionRowHeight = Modifier.padding(vertical = 7.dp).height(24.dp) val ReactionRowHeight = Modifier.padding(vertical = 7.dp).height(24.dp)
val ReactionRowHeightWithPadding = Modifier.padding(vertical = 7.dp).height(24.dp).padding(start = 10.dp) val ReactionRowHeightWithPadding = Modifier.padding(vertical = 7.dp).height(24.dp).padding(horizontal = 10.dp)
val ReactionRowHeightChat = Modifier.height(25.dp) val ReactionRowHeightChat = Modifier.height(25.dp)
val UserNameRowHeight = Modifier.fillMaxWidth() val UserNameRowHeight = Modifier.fillMaxWidth()
val UserNameMaxRowHeight = Modifier.fillMaxWidth() val UserNameMaxRowHeight = Modifier.fillMaxWidth()

View File

@@ -72,7 +72,7 @@ inline fun ImageVector.Builder.materialOutlinedPath(
fillAlpha = fillAlpha, fillAlpha = fillAlpha,
stroke = SolidColor(Color.Black), stroke = SolidColor(Color.Black),
strokeAlpha = strokeAlpha, strokeAlpha = strokeAlpha,
strokeLineWidth = 1.4f, strokeLineWidth = 1.3f,
strokeLineCap = StrokeCap.Butt, strokeLineCap = StrokeCap.Butt,
strokeLineJoin = StrokeJoin.Bevel, strokeLineJoin = StrokeJoin.Bevel,
strokeLineMiter = 1f, strokeLineMiter = 1f,