Skip to content

Commit

Permalink
Various Light theme fixes. (#118)
Browse files Browse the repository at this point in the history
- Fix low contrast in light theme. Fixes #116
- Use proper muted text. Fixes #112
- Fix navbar colors. Fixes #111
  • Loading branch information
dessalines authored Mar 9, 2022
1 parent 3d11301 commit ac40b8f
Show file tree
Hide file tree
Showing 26 changed files with 165 additions and 108 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
implementation "com.google.accompanist:accompanist-swiperefresh:$accompanist_version"
implementation "com.google.accompanist:accompanist-flowlayout:$accompanist_version"

implementation 'com.github.jeziellago:compose-markdown:0.2.6'
implementation 'com.github.jeziellago:compose-markdown:0.2.7'

// LiveData
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import com.jerboa.ui.components.common.VoteGeneric
import com.jerboa.ui.components.community.CommunityLink
import com.jerboa.ui.components.home.IconAndTextDrawerItem
import com.jerboa.ui.theme.LARGE_PADDING
import com.jerboa.ui.theme.Muted
import com.jerboa.ui.theme.SMALL_PADDING
import com.jerboa.ui.theme.XXL_PADDING
import com.jerboa.ui.theme.muted

@Composable
fun CommentNodeHeader(
Expand Down Expand Up @@ -254,7 +254,7 @@ fun PostAndCommunityContextHeader(
Row(
verticalAlignment = Alignment.CenterVertically
) {
Text(text = "in ", color = Muted)
Text(text = "in ", color = MaterialTheme.colors.onBackground.muted)
CommunityLink(
community = commentView.community,
onClick = onCommunityClick,
Expand Down Expand Up @@ -351,7 +351,7 @@ fun CommentFooterLine(
contentColor = if (commentView.comment.read) {
Color.Green
} else {
Muted
MaterialTheme.colors.onBackground.muted
},
account = account,
)
Expand All @@ -362,7 +362,7 @@ fun CommentFooterLine(
contentColor = if (commentView.saved) {
Color.Yellow
} else {
Muted
MaterialTheme.colors.onBackground.muted
},
account = account
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.jerboa.ui.components.comment.edit

import android.net.Uri
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.*
Expand All @@ -24,12 +23,17 @@ fun CommentEditHeader(
onSaveClick: () -> Unit,
loading: Boolean,
) {
val backgroundColor = MaterialTheme.colors.primarySurface
val contentColor = contentColorFor(backgroundColor)

TopAppBar(
title = {
Text(
text = "Edit",
)
},
backgroundColor = backgroundColor,
contentColor = contentColor,
elevation = APP_BAR_ELEVATION,
actions = {
IconButton(
Expand Down Expand Up @@ -67,7 +71,6 @@ fun CommentEditHeader(
fun CommentEdit(
content: TextFieldValue,
onContentChange: (TextFieldValue) -> Unit,
onPickedImage: (image: Uri) -> Unit,
account: Account?,
) {
val listState = rememberLazyListState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.text.input.TextFieldValue
import androidx.navigation.NavController
import com.jerboa.api.uploadPictrsImage
import com.jerboa.appendMarkdownImage
import com.jerboa.db.AccountViewModel
import com.jerboa.imageInputStreamFromUri
import com.jerboa.ui.components.common.getCurrentAccount
import com.jerboa.ui.components.inbox.InboxViewModel
import com.jerboa.ui.components.person.PersonProfileViewModel
import com.jerboa.ui.components.post.PostViewModel
import kotlinx.coroutines.launch

@Composable
fun CommentEditActivity(
Expand All @@ -34,7 +30,6 @@ fun CommentEditActivity(

val ctx = LocalContext.current
val account = getCurrentAccount(accountViewModel = accountViewModel)
val scope = rememberCoroutineScope()

var content by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf(TextFieldValue(commentEditViewModel.commentView.value?.comment?.content.orEmpty())) }

Expand Down Expand Up @@ -67,17 +62,6 @@ fun CommentEditActivity(
content = content,
account = account,
onContentChange = { content = it },
onPickedImage = { uri ->
val imageIs = imageInputStreamFromUri(ctx, uri)
scope.launch {
account?.also { acct ->
val url = uploadPictrsImage(acct, imageIs, ctx)
url?.also {
content = TextFieldValue(appendMarkdownImage(content.text, it))
}
}
}
},
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ fun CommentReplyHeader(
onSendClick: () -> Unit,
loading: Boolean,
) {
val backgroundColor = MaterialTheme.colors.primarySurface
val contentColor = contentColorFor(backgroundColor)

TopAppBar(
title = {
Text(
text = "Reply",
)
},
backgroundColor = backgroundColor,
contentColor = contentColor,
actions = {
IconButton(
onClick = onSendClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ fun CommentReplyActivity(

val ctx = LocalContext.current
val account = getCurrentAccount(accountViewModel = accountViewModel)
val scope = rememberCoroutineScope()
var reply by rememberSaveable(stateSaver = TextFieldValue.Saver) {
mutableStateOf(
TextFieldValue
Expand Down
29 changes: 17 additions & 12 deletions app/src/main/java/com/jerboa/ui/components/common/AppBars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ fun SimpleTopAppBar(
text: String,
navController: NavController,
) {
val backgroundColor = MaterialTheme.colors.primarySurface
val contentColor = contentColorFor(backgroundColor)

TopAppBar(
title = {
Text(
text = text,
)
},
elevation = APP_BAR_ELEVATION,
backgroundColor = backgroundColor,
contentColor = contentColor,
navigationIcon = {
IconButton(onClick = { navController.popBackStack() }) {
Icon(
Expand Down Expand Up @@ -81,7 +86,7 @@ fun BottomAppBarAll(
)
},
selectedContentColor = MaterialTheme.colors.primary,
unselectedContentColor = Muted,
unselectedContentColor = MaterialTheme.colors.onBackground.muted,
onClick = {
navController.navigate("home")
},
Expand All @@ -96,7 +101,7 @@ fun BottomAppBarAll(
)
},
selectedContentColor = MaterialTheme.colors.primary,
unselectedContentColor = Muted,
unselectedContentColor = MaterialTheme.colors.onBackground.muted,
onClick = {
navController.navigate("communityList")
},
Expand All @@ -110,12 +115,12 @@ fun BottomAppBarAll(
tint = if (screen == "inbox") {
MaterialTheme.colors.primary
} else {
Muted
MaterialTheme.colors.onBackground.muted
},
)
},
selectedContentColor = MaterialTheme.colors.primary,
unselectedContentColor = Muted,
unselectedContentColor = MaterialTheme.colors.onBackground.muted,
onClick = {
onClickInbox()
},
Expand All @@ -129,7 +134,7 @@ fun BottomAppBarAll(
)
},
selectedContentColor = MaterialTheme.colors.primary,
unselectedContentColor = Muted,
unselectedContentColor = MaterialTheme.colors.onBackground.muted,
onClick = {
onClickSaved()
},
Expand All @@ -143,7 +148,7 @@ fun BottomAppBarAll(
)
},
selectedContentColor = MaterialTheme.colors.primary,
unselectedContentColor = Muted,
unselectedContentColor = MaterialTheme.colors.onBackground.muted,
onClick = onClickProfile,
selected = screen == "profile"
)
Expand Down Expand Up @@ -215,7 +220,7 @@ fun ActionBarButton(
onClick: () -> Unit,
icon: ImageVector,
text: String? = null,
contentColor: Color = Muted,
contentColor: Color = MaterialTheme.colors.onBackground.muted,
noClick: Boolean = false,
account: Account?
) {
Expand Down Expand Up @@ -270,7 +275,7 @@ fun scoreColor(myVote: Int?): Color {
return when (myVote) {
1 -> MaterialTheme.colors.secondary
-1 -> MaterialTheme.colors.error
else -> Muted
else -> MaterialTheme.colors.onBackground.muted
}
}

Expand Down Expand Up @@ -381,7 +386,7 @@ fun Sidebar(
content?.also {
MyMarkdownText(
markdown = it,
color = Muted,
color = MaterialTheme.colors.onBackground.muted,
)
}
}
Expand All @@ -397,17 +402,17 @@ fun CommentsAndPosts(
Row {
Text(
text = "${siFormat(usersActiveMonth)} users / month",
color = Muted,
color = MaterialTheme.colors.onBackground.muted,
)
DotSpacer()
Text(
text = "${siFormat(postCount)} posts",
color = Muted,
color = MaterialTheme.colors.onBackground.muted,
)
DotSpacer()
Text(
text = "${siFormat(commentCount)} comments",
color = Muted,
color = MaterialTheme.colors.onBackground.muted,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedButton
import androidx.compose.material.Text
import androidx.compose.runtime.*
Expand Down Expand Up @@ -160,7 +161,7 @@ fun PickImage(
}) {
Text(
text = "Upload Image",
color = Muted,
color = MaterialTheme.colors.onBackground.muted,
)
}

Expand Down
Loading

0 comments on commit ac40b8f

Please sign in to comment.