Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smaller action bars #261

Merged
merged 5 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions app/src/main/java/com/jerboa/ui/components/comment/CommentNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.material.icons.outlined.*
import androidx.compose.material.icons.outlined.Block
import androidx.compose.material.icons.outlined.BookmarkAdd
import androidx.compose.material.icons.outlined.BookmarkAdded
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Description
import androidx.compose.material.icons.outlined.Edit
import androidx.compose.material.icons.outlined.Flag
import androidx.compose.material.icons.outlined.Link
import androidx.compose.material.icons.outlined.MoreVert
import androidx.compose.material.icons.outlined.Restore
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -359,24 +369,27 @@ fun CommentFooterLine(
)
if (showRead) {
ActionBarButton(
icon = Icons.Filled.Check,
icon = if (commentView.comment.read) {
Icons.Outlined.MarkChatRead
} else {
Icons.Outlined.MarkChatUnread
},
onClick = { onMarkAsReadClick(commentView) },
contentColor = if (commentView.comment.read) {
Color.Green
MaterialTheme.colors.primary
} else {
MaterialTheme.colors.onBackground.muted
},
account = account
)
}
ActionBarButton(
icon = if (commentView.saved) { Icons.Default.BookmarkAdded } else {
Icons.Default
.BookmarkAdd
icon = if (commentView.saved) { Icons.Outlined.BookmarkAdded } else {
Icons.Outlined.BookmarkAdd
},
onClick = { onSaveClick(commentView) },
contentColor = if (commentView.saved) {
Color.Yellow
MaterialTheme.colors.primary
} else {
MaterialTheme.colors.onBackground.muted
},
Expand All @@ -385,13 +398,13 @@ fun CommentFooterLine(
// Don't let you respond to your own comment.
if (commentView.creator.id != account?.id) {
ActionBarButton(
icon = Icons.Filled.Reply,
icon = Icons.Outlined.Textsms,
onClick = { onReplyClick(commentView) },
account = account
)
}
ActionBarButton(
icon = Icons.Filled.MoreVert,
icon = Icons.Outlined.MoreVert,
account = account,
onClick = { showMoreOptions = !showMoreOptions }
)
Expand Down Expand Up @@ -447,12 +460,12 @@ fun CommentOptionsDialog(
Column {
IconAndTextDrawerItem(
text = "View Source",
icon = Icons.Default.Description,
icon = Icons.Outlined.Description,
onClick = onViewSourceClick
)
IconAndTextDrawerItem(
text = "Copy Permalink",
icon = Icons.Default.Link,
icon = Icons.Outlined.Link,
onClick = {
val permalink = "${commentView.post.ap_id}/comment/${commentView.comment.id}"
localClipboardManager.setText(AnnotatedString(permalink))
Expand All @@ -463,32 +476,32 @@ fun CommentOptionsDialog(
if (!isCreator) {
IconAndTextDrawerItem(
text = "Report Comment",
icon = Icons.Default.Flag,
icon = Icons.Outlined.Flag,
onClick = onReportClick
)
IconAndTextDrawerItem(
text = "Block ${commentView.creator.name}",
icon = Icons.Default.Block,
icon = Icons.Outlined.Block,
onClick = onBlockCreatorClick
)
}
if (isCreator) {
IconAndTextDrawerItem(
text = "Edit",
icon = Icons.Default.Edit,
icon = Icons.Outlined.Edit,
onClick = onEditCommentClick
)
val deleted = commentView.comment.deleted
if (deleted) {
IconAndTextDrawerItem(
text = "Restore",
icon = Icons.Default.Restore,
icon = Icons.Outlined.Restore,
onClick = onDeleteCommentClick
)
} else {
IconAndTextDrawerItem(
text = "Delete",
icon = Icons.Default.Delete,
icon = Icons.Outlined.Delete,
onClick = onDeleteCommentClick
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Save
import androidx.compose.material.icons.outlined.*
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.Save
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.TextFieldValue
Expand Down Expand Up @@ -46,7 +47,7 @@ fun CommentEditHeader(
)
} else {
Icon(
imageVector = Icons.Default.Save,
imageVector = Icons.Outlined.Save,
contentDescription = "TODO"
)
}
Expand All @@ -59,7 +60,7 @@ fun CommentEditHeader(
}
) {
Icon(
Icons.Filled.Close,
Icons.Outlined.Close,
contentDescription = "Back"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Send
import androidx.compose.material.icons.outlined.*
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.Send
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.TextFieldValue
Expand Down Expand Up @@ -54,7 +55,7 @@ fun CommentReplyHeader(
)
} else {
Icon(
imageVector = Icons.Default.Send,
imageVector = Icons.Outlined.Send,
contentDescription = "TODO"
)
}
Expand All @@ -67,7 +68,7 @@ fun CommentReplyHeader(
}
) {
Icon(
Icons.Filled.Close,
Icons.Outlined.Close,
contentDescription = "Back"
)
}
Expand Down
26 changes: 12 additions & 14 deletions app/src/main/java/com/jerboa/ui/components/common/AppBars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.material.icons.outlined.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -61,7 +61,7 @@ fun SimpleTopAppBar(
navigationIcon = {
IconButton(onClick = { navController.popBackStack() }) {
Icon(
Icons.Filled.ArrowBack,
Icons.Outlined.ArrowBack,
contentDescription = "Back"
)
}
Expand All @@ -87,7 +87,7 @@ fun BottomAppBarAll(
BottomNavigationItem(
icon = {
Icon(
imageVector = Icons.Default.Home,
imageVector = Icons.Outlined.Home,
contentDescription = "TODO"
)
},
Expand All @@ -102,7 +102,7 @@ fun BottomAppBarAll(
BottomNavigationItem(
icon = {
Icon(
imageVector = Icons.Default.List,
imageVector = Icons.Outlined.List,
contentDescription = "TODO"
)
},
Expand All @@ -117,7 +117,7 @@ fun BottomAppBarAll(
icon = {
InboxIconAndBadge(
iconBadgeCount = totalUnreads,
icon = Icons.Default.Email,
icon = Icons.Outlined.Email,
tint = if (screen == "inbox") {
MaterialTheme.colors.primary
} else {
Expand All @@ -135,7 +135,7 @@ fun BottomAppBarAll(
BottomNavigationItem(
icon = {
Icon(
imageVector = Icons.Default.Bookmarks,
imageVector = Icons.Outlined.Bookmarks,
contentDescription = "TODO"
)
},
Expand All @@ -149,7 +149,7 @@ fun BottomAppBarAll(
BottomNavigationItem(
icon = {
Icon(
imageVector = Icons.Default.Person,
imageVector = Icons.Outlined.Person,
contentDescription = "TODO"
)
},
Expand Down Expand Up @@ -204,7 +204,7 @@ fun CommentOrPostNodeHeader(
) {
if (deleted) {
Icon(
imageVector = Icons.Default.Delete,
imageVector = Icons.Outlined.Delete,
contentDescription = "TODO",
tint = MaterialTheme.colors.error
)
Expand Down Expand Up @@ -243,8 +243,7 @@ fun ActionBarButton(
text: String? = null,
contentColor: Color = MaterialTheme.colors.onBackground.muted,
noClick: Boolean = false,
account: Account?,
smallIcon: Boolean = false
account: Account?
) {
val ctx = LocalContext.current
// Button(
Expand All @@ -260,7 +259,6 @@ fun ActionBarButton(
// modifier = Modifier
// .defaultMinSize(minWidth = 1.dp, minHeight = 1.dp)
// )
val iconHeight = if (smallIcon) { ACTION_BAR_ICON_SIZE_SMALLER } else { ACTION_BAR_ICON_SIZE }
val barMod = if (noClick) {
Modifier
} else {
Expand All @@ -279,14 +277,14 @@ fun ActionBarButton(
Icon(
imageVector = icon,
contentDescription = "TODO",
tint = contentColor,
modifier = Modifier.height(iconHeight)
tint = contentColor
)
text?.also {
Spacer(Modifier.size(ButtonDefaults.IconSpacing))
Text(
text = text,
color = contentColor
color = contentColor,
style = MaterialTheme.typography.body2
)
}
}
Expand Down
Loading