Beta bad
This commit is contained in:
@@ -136,7 +136,7 @@ dependencies {
|
||||
implementation("ru.noties.markwon:core:3.1.0")
|
||||
|
||||
implementation("xyz.quaver:documentfilex:0.7.1")
|
||||
implementation("xyz.quaver:subsampledimage:0.0.1-alpha17-SNAPSHOT")
|
||||
implementation("xyz.quaver:subsampledimage:0.0.1-alpha18-SNAPSHOT")
|
||||
|
||||
implementation("com.google.guava:guava:31.0.1-jre")
|
||||
|
||||
|
||||
@@ -280,10 +280,9 @@ val ReaderOptions.Orientation.isReverse: Boolean
|
||||
this == ReaderOptions.Orientation.VERTICAL_UP ||
|
||||
this == ReaderOptions.Orientation.HORIZONTAL_LEFT
|
||||
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun ReaderOptionsSheet(readerOptions: ReaderOptions, onOptionsChange: (ReaderOptions.Builder.() -> Unit) -> Unit) {
|
||||
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.h6, LocalMinimumTouchTargetEnforcement provides false) {
|
||||
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.h6) {
|
||||
Column(Modifier.padding(16.dp, 0.dp)) {
|
||||
val layout = readerOptions.layout
|
||||
val snap = readerOptions.snap
|
||||
@@ -303,20 +302,18 @@ fun ReaderOptionsSheet(readerOptions: ReaderOptions, onOptionsChange: (ReaderOpt
|
||||
ReaderOptions.Layout.DOUBLE_PAGE to DoubleImage,
|
||||
ReaderOptions.Layout.AUTO to Icons.Default.AutoFixHigh
|
||||
).forEach { (option, icon) ->
|
||||
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides true) {
|
||||
IconButton(onClick = {
|
||||
onOptionsChange {
|
||||
setLayout(option)
|
||||
}
|
||||
}) {
|
||||
Icon(
|
||||
icon,
|
||||
contentDescription = null,
|
||||
tint =
|
||||
if (layout == option) MaterialTheme.colors.secondary
|
||||
else LocalContentColor.current
|
||||
)
|
||||
IconButton(onClick = {
|
||||
onOptionsChange {
|
||||
setLayout(option)
|
||||
}
|
||||
}) {
|
||||
Icon(
|
||||
icon,
|
||||
contentDescription = null,
|
||||
tint =
|
||||
if (layout == option) MaterialTheme.colors.secondary
|
||||
else LocalContentColor.current
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.kodein.di.compose.rememberInstance
|
||||
import xyz.quaver.pupil.sources.Source
|
||||
import xyz.quaver.pupil.sources.SourceEntries
|
||||
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun SourceSelectDialog(navController: NavController, currentSource: String? = null, onDismissRequest: () -> Unit = { }) {
|
||||
SourceSelectDialog(currentSource = currentSource, onDismissRequest = onDismissRequest) {
|
||||
@@ -47,46 +46,42 @@ fun SourceSelectDialog(navController: NavController, currentSource: String? = nu
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun SourceSelectDialogItem(source: Source, isSelected: Boolean, onSelected: (Source) -> Unit = { }) {
|
||||
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
||||
Row(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(source.iconResID),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(source.iconResID),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
|
||||
Text(
|
||||
source.name,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Text(
|
||||
source.name,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
|
||||
Icon(
|
||||
Icons.Default.Settings,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.onSurface.copy(alpha = 0.5f)
|
||||
)
|
||||
Icon(
|
||||
Icons.Default.Settings,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.onSurface.copy(alpha = 0.5f)
|
||||
)
|
||||
|
||||
Button(
|
||||
enabled = !isSelected,
|
||||
onClick = {
|
||||
onSelected(source)
|
||||
}
|
||||
) {
|
||||
Text("GO")
|
||||
Button(
|
||||
enabled = !isSelected,
|
||||
onClick = {
|
||||
onSelected(source)
|
||||
}
|
||||
|
||||
) {
|
||||
Text("GO")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun SourceSelectDialog(currentSource: String? = null, onDismissRequest: () -> Unit = { }, onSelected: (Source) -> Unit = { }) {
|
||||
val sourceEntries: SourceEntries by rememberInstance()
|
||||
|
||||
@@ -217,33 +217,31 @@ fun TagGroup(
|
||||
|
||||
val bookmarkedTagsInList = bookmarks intersect tags.toSet()
|
||||
|
||||
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
||||
FlowRow(Modifier.padding(0.dp, 16.dp)) {
|
||||
tags.sortedBy { if (bookmarkedTagsInList.contains(it)) 0 else 1 }
|
||||
.let { (if (isFolded) it.take(10) else it) }.forEach { tag ->
|
||||
TagChip(
|
||||
tag = tag,
|
||||
isFavorite = bookmarkedTagsInList.contains(tag),
|
||||
onFavoriteClick = onBookmarkToggle
|
||||
FlowRow(Modifier.padding(0.dp, 16.dp)) {
|
||||
tags.sortedBy { if (bookmarkedTagsInList.contains(it)) 0 else 1 }
|
||||
.let { (if (isFolded) it.take(10) else it) }.forEach { tag ->
|
||||
TagChip(
|
||||
tag = tag,
|
||||
isFavorite = bookmarkedTagsInList.contains(tag),
|
||||
onFavoriteClick = onBookmarkToggle
|
||||
)
|
||||
}
|
||||
|
||||
if (isFolded && tags.size > 10)
|
||||
Surface(
|
||||
modifier = Modifier.padding(2.dp),
|
||||
color = MaterialTheme.colors.background,
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
elevation = 2.dp,
|
||||
onClick = { isFolded = false }
|
||||
) {
|
||||
Text(
|
||||
"…",
|
||||
modifier = Modifier.padding(16.dp, 8.dp),
|
||||
color = MaterialTheme.colors.onBackground,
|
||||
style = MaterialTheme.typography.body2
|
||||
)
|
||||
}
|
||||
|
||||
if (isFolded && tags.size > 10)
|
||||
Surface(
|
||||
modifier = Modifier.padding(2.dp),
|
||||
color = MaterialTheme.colors.background,
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
elevation = 2.dp,
|
||||
onClick = { isFolded = false }
|
||||
) {
|
||||
Text(
|
||||
"…",
|
||||
modifier = Modifier.padding(16.dp, 8.dp),
|
||||
color = MaterialTheme.colors.onBackground,
|
||||
style = MaterialTheme.typography.body2
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,80 +18,30 @@
|
||||
package xyz.quaver.pupil.sources.manatoki
|
||||
|
||||
import android.app.Application
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.animation.scaleIn
|
||||
import androidx.compose.animation.scaleOut
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.gestures.animateScrollBy
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.PressInteraction
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navigation
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
import com.google.accompanist.insets.LocalWindowInsets
|
||||
import com.google.accompanist.insets.navigationBarsPadding
|
||||
import com.google.accompanist.insets.navigationBarsWithImePadding
|
||||
import com.google.accompanist.insets.rememberInsetsPaddingValues
|
||||
import com.google.accompanist.insets.ui.Scaffold
|
||||
import com.google.accompanist.insets.ui.TopAppBar
|
||||
import io.ktor.client.*
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.kodein.di.DIAware
|
||||
import org.kodein.di.android.closestDI
|
||||
import org.kodein.di.compose.rememberInstance
|
||||
import org.kodein.di.instance
|
||||
import org.kodein.log.LoggerFactory
|
||||
import org.kodein.log.newLogger
|
||||
import xyz.quaver.pupil.R
|
||||
import xyz.quaver.pupil.db.AppDatabase
|
||||
import xyz.quaver.pupil.proto.settingsDataStore
|
||||
import xyz.quaver.pupil.sources.Source
|
||||
import xyz.quaver.pupil.sources.composable.*
|
||||
import xyz.quaver.pupil.sources.manatoki.composable.*
|
||||
import xyz.quaver.pupil.sources.manatoki.viewmodel.*
|
||||
import xyz.quaver.pupil.ui.theme.Orange500
|
||||
import kotlin.math.max
|
||||
import kotlin.math.sign
|
||||
|
||||
import xyz.quaver.pupil.sources.manatoki.composable.Main
|
||||
import xyz.quaver.pupil.sources.manatoki.composable.Reader
|
||||
import xyz.quaver.pupil.sources.manatoki.composable.Recent
|
||||
import xyz.quaver.pupil.sources.manatoki.composable.Search
|
||||
|
||||
@OptIn(
|
||||
ExperimentalMaterialApi::class,
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package xyz.quaver.pupil.sources.manatoki.composable
|
||||
|
||||
import android.util.Log
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
@@ -47,6 +48,7 @@ import com.google.accompanist.insets.rememberInsetsPaddingValues
|
||||
import com.google.accompanist.insets.ui.Scaffold
|
||||
import com.google.accompanist.insets.ui.TopAppBar
|
||||
import io.ktor.client.*
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.kodein.di.compose.rememberInstance
|
||||
import xyz.quaver.pupil.R
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package xyz.quaver.pupil.sources.manatoki.composable
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
@@ -38,6 +39,7 @@ import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.SubcomposeLayout
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.positionInWindow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.toSize
|
||||
import coil.compose.rememberImagePainter
|
||||
@@ -98,6 +100,7 @@ fun MangaListingBottomSheetLayout(
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun MangaListingBottomSheet(
|
||||
mangaListing: MangaListing? = null,
|
||||
@@ -138,16 +141,17 @@ fun MangaListingBottomSheet(
|
||||
) {
|
||||
val painter = rememberImagePainter(mangaListing.thumbnail)
|
||||
|
||||
Image(
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.aspectRatio(
|
||||
with(painter.intrinsicSize) { if (this == Size.Unspecified) 1f else width / height },
|
||||
true
|
||||
),
|
||||
painter = painter,
|
||||
contentDescription = null
|
||||
)
|
||||
Box(Modifier.fillMaxHeight()) {
|
||||
Image(
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.aspectRatio(
|
||||
with(painter.intrinsicSize) { if (this == Size.Unspecified) 1f else width / height }
|
||||
).align(Alignment.Center),
|
||||
painter = painter,
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@@ -205,7 +209,7 @@ fun MangaListingBottomSheet(
|
||||
state = listState,
|
||||
contentPadding = rememberInsetsPaddingValues(LocalWindowInsets.current.navigationBars)
|
||||
) {
|
||||
itemsIndexed(mangaListing.entries, key = { _, entry -> entry.itemID }) { index, entry ->
|
||||
itemsIndexed(mangaListing.entries) { index, entry ->
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
|
||||
@@ -21,8 +21,7 @@ package xyz.quaver.pupil.sources.manatoki.composable
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.scaleIn
|
||||
import androidx.compose.animation.scaleOut
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.gestures.animateScrollBy
|
||||
@@ -43,6 +42,7 @@ import androidx.compose.runtime.livedata.observeAsState
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
@@ -203,13 +203,11 @@ fun Reader(navController: NavController) {
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
AnimatedVisibility(
|
||||
!(model.fullscreen || scrollDirection < 0f),
|
||||
enter = scaleIn(),
|
||||
exit = scaleOut()
|
||||
) {
|
||||
val scale by animateFloatAsState(if (model.fullscreen || scrollDirection < 0f) 0f else 1f)
|
||||
|
||||
if (scale > 0f)
|
||||
FloatingActionButton(
|
||||
modifier = Modifier.navigationBarsPadding(),
|
||||
modifier = Modifier.navigationBarsPadding().scale(scale),
|
||||
onClick = {
|
||||
readerInfo?.let {
|
||||
coroutineScope.launch {
|
||||
@@ -271,7 +269,6 @@ fun Reader(navController: NavController) {
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
) { contentPadding ->
|
||||
ReaderBase(
|
||||
|
||||
@@ -212,25 +212,7 @@ fun Search(navController: NavController) {
|
||||
}.take(20)
|
||||
|
||||
Text("작가")
|
||||
ExposedDropdownMenuBox(expanded = expanded, onExpandedChange = { expanded = !expanded }) {
|
||||
TextField(
|
||||
model.artist,
|
||||
onValueChange = { model.artist = it },
|
||||
trailingIcon = {
|
||||
ExposedDropdownMenuDefaults.TrailingIcon(
|
||||
expanded = expanded
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
ExposedDropdownMenu(expanded, onDismissRequest = { expanded = false }) {
|
||||
suggestedArtists.forEach {
|
||||
DropdownMenuItem(onClick = { model.artist = it; expanded = false }) {
|
||||
Text(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TextField(model.artist, onValueChange = { model.artist = it })
|
||||
|
||||
Text("발행")
|
||||
FlowRow(mainAxisSpacing = 4.dp, crossAxisSpacing = 4.dp) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package xyz.quaver.pupil.sources.manatoki
|
||||
|
||||
import android.os.Parcelable
|
||||
import android.util.Log
|
||||
import androidx.collection.LruCache
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@@ -90,15 +91,13 @@ data class ReaderInfo(
|
||||
@ExperimentalMaterialApi
|
||||
@Composable
|
||||
fun Chip(text: String, selected: Boolean = false, onClick: () -> Unit = { }) {
|
||||
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
||||
Card(
|
||||
onClick = onClick,
|
||||
backgroundColor = if (selected) MaterialTheme.colors.secondary else MaterialTheme.colors.surface,
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
elevation = 4.dp
|
||||
) {
|
||||
Text(text, modifier = Modifier.padding(4.dp))
|
||||
}
|
||||
Card(
|
||||
onClick = onClick,
|
||||
backgroundColor = if (selected) MaterialTheme.colors.secondary else MaterialTheme.colors.surface,
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
elevation = 4.dp
|
||||
) {
|
||||
Text(text, modifier = Modifier.padding(4.dp))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user