fix: 阅读菜单书源名称点击事件
This commit is contained in:
1 file changed
+57
-10
@@ -52,7 +52,11 @@ import androidx.compose.foundation.verticalScroll
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
||||||
|
import androidx.compose.material.icons.automirrored.filled.Login
|
||||||
|
import androidx.compose.material.icons.filled.Block
|
||||||
|
import androidx.compose.material.icons.filled.Edit
|
||||||
import androidx.compose.material.icons.filled.MoreVert
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
|
import androidx.compose.material.icons.filled.Payment
|
||||||
import androidx.compose.material.icons.filled.Refresh
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
import androidx.compose.material.icons.filled.SwapHoriz
|
import androidx.compose.material.icons.filled.SwapHoriz
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -139,6 +143,7 @@ import io.legado.app.ui.widget.components.AppSlider
|
|||||||
import io.legado.app.ui.widget.components.bookmark.BookmarkEditContent
|
import io.legado.app.ui.widget.components.bookmark.BookmarkEditContent
|
||||||
import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
||||||
import io.legado.app.ui.widget.components.divider.PillDivider
|
import io.legado.app.ui.widget.components.divider.PillDivider
|
||||||
|
import io.legado.app.ui.widget.components.menuItem.MenuItemIcon
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
||||||
import io.legado.app.ui.widget.components.text.AppText
|
import io.legado.app.ui.widget.components.text.AppText
|
||||||
@@ -842,7 +847,7 @@ private fun MenuTitleBar(
|
|||||||
.padding(horizontal = 16.dp, vertical = 4.dp),
|
.padding(horizontal = 16.dp, vertical = 4.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Text(
|
AppText(
|
||||||
text = state.chapterName,
|
text = state.chapterName,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
style = labelStyle,
|
style = labelStyle,
|
||||||
@@ -852,15 +857,57 @@ private fun MenuTitleBar(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!state.isLocalBook && state.bookSource != null) {
|
if (!state.isLocalBook && state.bookSource != null) {
|
||||||
Text(
|
var sourceMenuExpanded by remember { mutableStateOf(false) }
|
||||||
text = state.bookSource.bookSourceName,
|
Box {
|
||||||
modifier = Modifier
|
AppText(
|
||||||
.clickable { onIntent(ReadBookIntent.OpenSourceEdit) }
|
text = state.bookSource.bookSourceName,
|
||||||
.padding(start = 8.dp),
|
modifier = Modifier
|
||||||
style = labelStyle,
|
.clickable { sourceMenuExpanded = true }
|
||||||
color = titleTextColor,
|
.padding(start = 8.dp),
|
||||||
maxLines = 1,
|
style = labelStyle,
|
||||||
)
|
color = titleTextColor,
|
||||||
|
maxLines = 1,
|
||||||
|
)
|
||||||
|
RoundDropdownMenu(
|
||||||
|
expanded = sourceMenuExpanded,
|
||||||
|
onDismissRequest = { sourceMenuExpanded = false },
|
||||||
|
) {
|
||||||
|
if (!state.bookSource.loginUrl.isNullOrBlank()) {
|
||||||
|
RoundDropdownMenuItem(
|
||||||
|
leadingIcon = { MenuItemIcon(Icons.AutoMirrored.Filled.Login) },
|
||||||
|
text = stringResource(R.string.login),
|
||||||
|
onClick = {
|
||||||
|
sourceMenuExpanded = false
|
||||||
|
onIntent(ReadBookIntent.ShowLogin)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
RoundDropdownMenuItem(
|
||||||
|
leadingIcon = { MenuItemIcon(Icons.Default.Payment) },
|
||||||
|
text = stringResource(R.string.chapter_pay),
|
||||||
|
onClick = {
|
||||||
|
sourceMenuExpanded = false
|
||||||
|
onIntent(ReadBookIntent.PayAction)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
RoundDropdownMenuItem(
|
||||||
|
leadingIcon = { MenuItemIcon(Icons.Default.Edit) },
|
||||||
|
text = stringResource(R.string.edit_source),
|
||||||
|
onClick = {
|
||||||
|
sourceMenuExpanded = false
|
||||||
|
onIntent(ReadBookIntent.OpenSourceEdit)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
RoundDropdownMenuItem(
|
||||||
|
leadingIcon = { MenuItemIcon(Icons.Default.Block) },
|
||||||
|
text = stringResource(R.string.disable_source),
|
||||||
|
onClick = {
|
||||||
|
sourceMenuExpanded = false
|
||||||
|
onIntent(ReadBookIntent.DisableSource)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user