Themeing, text for notebooks

This commit is contained in:
Jackson Harper
2023-05-29 11:11:44 +08:00
parent 048facb7ca
commit 73b71f002c
2 changed files with 34 additions and 21 deletions

View File

@ -10,6 +10,7 @@ import androidx.compose.foundation.*
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.material.TextFieldColors
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.* import androidx.compose.material.icons.filled.*
import androidx.compose.material3.* import androidx.compose.material3.*
@ -21,6 +22,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@ -43,7 +45,7 @@ import app.omnivore.omnivore.ui.library.*
import dev.jeziellago.compose.markdowntext.MarkdownText import dev.jeziellago.compose.markdowntext.MarkdownText
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import app.omnivore.omnivore.persistence.entities.Highlight import app.omnivore.omnivore.persistence.entities.Highlight
import app.omnivore.omnivore.ui.theme.OmnivoreTheme
fun notebookMD(notes: List<Highlight>, highlights: List<Highlight>): String { fun notebookMD(notes: List<Highlight>, highlights: List<Highlight>): String {
@ -179,7 +181,11 @@ fun EditNoteModal(onDismiss: (text: String) -> Unit) {
.padding(paddingValues) .padding(paddingValues)
.focusRequester(focusRequester) .focusRequester(focusRequester)
.fillMaxSize(), .fillMaxSize(),
value = annotation.value, onValueChange = { annotation.value = it } value = annotation.value, onValueChange = { annotation.value = it },
colors = TextFieldDefaults.textFieldColors(
textColor = Color.White
)
) )
} }
} }
@ -364,18 +370,20 @@ fun HighlightsList(item: SavedItemWithLabelsAndHighlights) {
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class) @OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class)
@Composable @Composable
fun BottomSheetUI(content: @Composable () -> Unit) { fun BottomSheetUI(content: @Composable () -> Unit) {
Box( OmnivoreTheme() {
modifier = Modifier Box(
.wrapContentHeight() modifier = Modifier
.fillMaxWidth() .wrapContentHeight()
.clip(RoundedCornerShape(topEnd = 20.dp, topStart = 20.dp)) .fillMaxWidth()
.background(Color.White) .clip(RoundedCornerShape(topEnd = 20.dp, topStart = 20.dp))
.statusBarsPadding() .background(Color.White)
) { .statusBarsPadding()
Scaffold( ) {
) { paddingValues -> Scaffold(
Box(modifier = Modifier.fillMaxSize()) { ) { paddingValues ->
content() Box(modifier = Modifier.fillMaxSize()) {
content()
}
} }
} }
} }

View File

@ -23,6 +23,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -121,13 +122,17 @@ fun AnnotationEditView(
.padding(paddingValues) .padding(paddingValues)
.fillMaxSize() .fillMaxSize()
) { ) {
TextField( TextField(
value = annotation.value, value = annotation.value,
onValueChange = { annotation.value = it }, onValueChange = { annotation.value = it },
modifier = Modifier colors = TextFieldDefaults.textFieldColors(
.focusRequester(focusRequester) textColor = Color.White,
.fillMaxSize() containerColor = Color.Green,
) ),
modifier = Modifier
.focusRequester(focusRequester)
.fillMaxSize()
)
} }
} }
} }