mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Android modules compile!
- Add Tooltip area - Half handle mouse clickables
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.base.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import androidx.compose.ui.unit.DpOffset
|
||||||
|
|
||||||
|
actual interface TooltipPlacement
|
||||||
|
|
||||||
|
actual class CursorPoint actual constructor(
|
||||||
|
offset: DpOffset,
|
||||||
|
alignment: Alignment,
|
||||||
|
windowMargin: Dp
|
||||||
|
): TooltipPlacement
|
||||||
|
|
||||||
|
actual class ComponentRect actual constructor(
|
||||||
|
anchor: Alignment,
|
||||||
|
alignment: Alignment,
|
||||||
|
offset: DpOffset
|
||||||
|
): TooltipPlacement
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
actual fun TooltipArea(
|
||||||
|
tooltip: @Composable () -> Unit,
|
||||||
|
modifier: Modifier,
|
||||||
|
delayMillis: Int,
|
||||||
|
tooltipPlacement: TooltipPlacement,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.library.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
actual fun Modifier.libraryMangaModifier(
|
||||||
|
onClickManga: () -> Unit,
|
||||||
|
onClickRemoveManga: () -> Unit
|
||||||
|
): Modifier = Modifier.clickable(
|
||||||
|
onClick = { onClickManga() }
|
||||||
|
)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.manga.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
actual fun Modifier.chapterItemModifier(
|
||||||
|
onClick: () -> Unit,
|
||||||
|
toggleRead: () -> Unit,
|
||||||
|
toggleBookmarked: () -> Unit,
|
||||||
|
markPreviousAsRead: () -> Unit
|
||||||
|
): Modifier = Modifier.clickable(
|
||||||
|
onClick = { onClick() }
|
||||||
|
)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.sources.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
actual fun Modifier.sourceSideMenuItem(
|
||||||
|
onSourceTabClick: () -> Unit,
|
||||||
|
onSourceCloseTabClick: () -> Unit
|
||||||
|
): Modifier = Modifier.clickable(
|
||||||
|
onClick = {
|
||||||
|
onSourceTabClick()
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.base.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
actual typealias TooltipPlacement = androidx.compose.foundation.TooltipPlacement
|
||||||
|
|
||||||
|
actual typealias CursorPoint = androidx.compose.foundation.TooltipPlacement.CursorPoint
|
||||||
|
|
||||||
|
actual typealias ComponentRect = androidx.compose.foundation.TooltipPlacement.ComponentRect
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
actual fun TooltipArea(
|
||||||
|
tooltip: @Composable () -> Unit,
|
||||||
|
modifier: Modifier,
|
||||||
|
delayMillis: Int,
|
||||||
|
tooltipPlacement: TooltipPlacement,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
androidx.compose.foundation.TooltipArea(
|
||||||
|
tooltip,
|
||||||
|
modifier,
|
||||||
|
delayMillis,
|
||||||
|
tooltipPlacement,
|
||||||
|
content
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.library.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ContextMenuItem
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import ca.gosyer.uicore.components.contextMenuClickable
|
||||||
|
|
||||||
|
actual fun Modifier.libraryMangaModifier(
|
||||||
|
onClickManga: () -> Unit,
|
||||||
|
onClickRemoveManga: () -> Unit
|
||||||
|
): Modifier = Modifier.contextMenuClickable(
|
||||||
|
{
|
||||||
|
listOf(
|
||||||
|
ContextMenuItem("Unfavorite", onClickRemoveManga)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = { onClickManga() }
|
||||||
|
)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.manga.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ContextMenuItem
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import ca.gosyer.uicore.components.contextMenuClickable
|
||||||
|
|
||||||
|
actual fun Modifier.chapterItemModifier(
|
||||||
|
onClick: () -> Unit,
|
||||||
|
toggleRead: () -> Unit,
|
||||||
|
toggleBookmarked: () -> Unit,
|
||||||
|
markPreviousAsRead: () -> Unit
|
||||||
|
): Modifier = Modifier.contextMenuClickable(
|
||||||
|
{
|
||||||
|
listOf(
|
||||||
|
ContextMenuItem("Toggle read") { toggleRead() },
|
||||||
|
ContextMenuItem("Mark previous as read") { markPreviousAsRead() },
|
||||||
|
ContextMenuItem("Toggle bookmarked") { toggleBookmarked() }
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = { onClick() }
|
||||||
|
)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.sources.components
|
||||||
|
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import ca.gosyer.uicore.components.combinedMouseClickable
|
||||||
|
|
||||||
|
actual fun Modifier.sourceSideMenuItem(
|
||||||
|
onSourceTabClick: () -> Unit,
|
||||||
|
onSourceCloseTabClick: () -> Unit
|
||||||
|
): Modifier = Modifier.combinedMouseClickable(
|
||||||
|
onClick = {
|
||||||
|
onSourceTabClick()
|
||||||
|
},
|
||||||
|
onMiddleClick = {
|
||||||
|
onSourceCloseTabClick()
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ca.gosyer.ui.base.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import androidx.compose.ui.unit.DpOffset
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
@ExperimentalFoundationApi
|
||||||
|
expect interface TooltipPlacement
|
||||||
|
|
||||||
|
fun TooltipPlacement.CursorPoint(
|
||||||
|
offset: DpOffset = DpOffset.Zero,
|
||||||
|
alignment: Alignment = Alignment.BottomEnd,
|
||||||
|
windowMargin: Dp = 4.dp
|
||||||
|
) = ca.gosyer.ui.base.components.CursorPoint(offset, alignment, windowMargin)
|
||||||
|
|
||||||
|
@ExperimentalFoundationApi
|
||||||
|
expect class CursorPoint(
|
||||||
|
offset: DpOffset = DpOffset.Zero,
|
||||||
|
alignment: Alignment = Alignment.BottomEnd,
|
||||||
|
windowMargin: Dp = 4.dp
|
||||||
|
): TooltipPlacement
|
||||||
|
|
||||||
|
fun TooltipPlacement.ComponentRect(
|
||||||
|
anchor: Alignment = Alignment.BottomCenter,
|
||||||
|
alignment: Alignment = Alignment.BottomCenter,
|
||||||
|
offset: DpOffset = DpOffset.Zero
|
||||||
|
) = ca.gosyer.ui.base.components.ComponentRect(anchor, alignment, offset)
|
||||||
|
|
||||||
|
@ExperimentalFoundationApi
|
||||||
|
expect class ComponentRect(
|
||||||
|
anchor: Alignment = Alignment.BottomCenter,
|
||||||
|
alignment: Alignment = Alignment.BottomCenter,
|
||||||
|
offset: DpOffset = DpOffset.Zero
|
||||||
|
): TooltipPlacement
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
expect fun TooltipArea(
|
||||||
|
tooltip: @Composable () -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
delayMillis: Int = 500,
|
||||||
|
tooltipPlacement: TooltipPlacement = CursorPoint(
|
||||||
|
offset = DpOffset(0.dp, 16.dp)
|
||||||
|
),
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
)
|
||||||
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
package ca.gosyer.ui.library.components
|
package ca.gosyer.ui.library.components
|
||||||
|
|
||||||
import androidx.compose.foundation.ContextMenuItem
|
|
||||||
import ca.gosyer.ui.base.components.VerticalScrollbar
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
@@ -18,7 +16,6 @@ import androidx.compose.foundation.lazy.GridCells
|
|||||||
import androidx.compose.foundation.lazy.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import ca.gosyer.ui.base.components.rememberScrollbarAdapter
|
|
||||||
import androidx.compose.material.LocalTextStyle
|
import androidx.compose.material.LocalTextStyle
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
@@ -37,10 +34,16 @@ import androidx.compose.ui.text.font.FontFamily
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import ca.gosyer.data.models.Manga
|
import ca.gosyer.data.models.Manga
|
||||||
import ca.gosyer.uicore.components.contextMenuClickable
|
import ca.gosyer.ui.base.components.VerticalScrollbar
|
||||||
|
import ca.gosyer.ui.base.components.rememberScrollbarAdapter
|
||||||
import ca.gosyer.uicore.image.KamelImage
|
import ca.gosyer.uicore.image.KamelImage
|
||||||
import io.kamel.image.lazyPainterResource
|
import io.kamel.image.lazyPainterResource
|
||||||
|
|
||||||
|
expect fun Modifier.libraryMangaModifier(
|
||||||
|
onClickManga: () -> Unit,
|
||||||
|
onClickRemoveManga: () -> Unit
|
||||||
|
): Modifier
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LibraryMangaCompactGrid(
|
fun LibraryMangaCompactGrid(
|
||||||
library: List<Manga>,
|
library: List<Manga>,
|
||||||
@@ -56,17 +59,16 @@ fun LibraryMangaCompactGrid(
|
|||||||
) {
|
) {
|
||||||
items(library) { manga ->
|
items(library) { manga ->
|
||||||
LibraryMangaCompactGridItem(
|
LibraryMangaCompactGridItem(
|
||||||
|
modifier = Modifier.libraryMangaModifier(
|
||||||
|
{ onClickManga(manga.id) },
|
||||||
|
{ onRemoveMangaClicked(manga.id) }
|
||||||
|
),
|
||||||
manga = manga,
|
manga = manga,
|
||||||
unread = manga.unreadCount,
|
unread = manga.unreadCount,
|
||||||
downloaded = manga.downloadCount,
|
downloaded = manga.downloadCount
|
||||||
onClick = { onClickManga(manga.id) }
|
|
||||||
) {
|
|
||||||
listOf(
|
|
||||||
ContextMenuItem("Unfavorite") { onRemoveMangaClicked(manga.id) }
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
VerticalScrollbar(
|
VerticalScrollbar(
|
||||||
rememberScrollbarAdapter(state),
|
rememberScrollbarAdapter(state),
|
||||||
Modifier.align(Alignment.CenterEnd)
|
Modifier.align(Alignment.CenterEnd)
|
||||||
@@ -78,11 +80,10 @@ fun LibraryMangaCompactGrid(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun LibraryMangaCompactGridItem(
|
private fun LibraryMangaCompactGridItem(
|
||||||
|
modifier: Modifier,
|
||||||
manga: Manga,
|
manga: Manga,
|
||||||
unread: Int?,
|
unread: Int?,
|
||||||
downloaded: Int?,
|
downloaded: Int?,
|
||||||
onClick: () -> Unit = {},
|
|
||||||
contextMenuItems: () -> List<ContextMenuItem> = { emptyList() }
|
|
||||||
) {
|
) {
|
||||||
val cover = lazyPainterResource(manga, filterQuality = FilterQuality.Medium)
|
val cover = lazyPainterResource(manga, filterQuality = FilterQuality.Medium)
|
||||||
val fontStyle = LocalTextStyle.current.merge(
|
val fontStyle = LocalTextStyle.current.merge(
|
||||||
@@ -93,11 +94,7 @@ private fun LibraryMangaCompactGridItem(
|
|||||||
modifier = Modifier.padding(4.dp)
|
modifier = Modifier.padding(4.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(3f / 4f)
|
.aspectRatio(3f / 4f)
|
||||||
.clip(MaterialTheme.shapes.medium)
|
.clip(MaterialTheme.shapes.medium) then modifier
|
||||||
.contextMenuClickable(
|
|
||||||
onClick = { onClick() },
|
|
||||||
items = contextMenuItems
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
KamelImage(cover, manga.title, contentScale = ContentScale.Crop)
|
KamelImage(cover, manga.title, contentScale = ContentScale.Crop)
|
||||||
Box(modifier = Modifier.fillMaxSize().then(shadowGradient))
|
Box(modifier = Modifier.fillMaxSize().then(shadowGradient))
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package ca.gosyer.ui.manga.components
|
package ca.gosyer.ui.manga.components
|
||||||
|
|
||||||
import androidx.compose.foundation.ContextMenuItem
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -32,10 +31,16 @@ import androidx.compose.ui.unit.dp
|
|||||||
import ca.gosyer.i18n.MR
|
import ca.gosyer.i18n.MR
|
||||||
import ca.gosyer.ui.base.chapter.ChapterDownloadIcon
|
import ca.gosyer.ui.base.chapter.ChapterDownloadIcon
|
||||||
import ca.gosyer.ui.base.chapter.ChapterDownloadItem
|
import ca.gosyer.ui.base.chapter.ChapterDownloadItem
|
||||||
import ca.gosyer.uicore.components.contextMenuClickable
|
|
||||||
import ca.gosyer.uicore.resources.stringResource
|
import ca.gosyer.uicore.resources.stringResource
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
|
expect fun Modifier.chapterItemModifier(
|
||||||
|
onClick: () -> Unit,
|
||||||
|
toggleRead: () -> Unit,
|
||||||
|
toggleBookmarked: () -> Unit,
|
||||||
|
markPreviousAsRead: () -> Unit
|
||||||
|
): Modifier
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ChapterItem(
|
fun ChapterItem(
|
||||||
chapterDownload: ChapterDownloadItem,
|
chapterDownload: ChapterDownloadItem,
|
||||||
@@ -55,15 +60,11 @@ fun ChapterItem(
|
|||||||
shape = RoundedCornerShape(4.dp)
|
shape = RoundedCornerShape(4.dp)
|
||||||
) {
|
) {
|
||||||
BoxWithConstraints(
|
BoxWithConstraints(
|
||||||
Modifier.contextMenuClickable(
|
Modifier.chapterItemModifier(
|
||||||
{
|
onClick = { onClick(chapter.index) },
|
||||||
listOf(
|
toggleRead = { toggleRead(chapter.index) },
|
||||||
ContextMenuItem("Toggle read") { toggleRead(chapter.index) },
|
toggleBookmarked = { toggleBookmarked(chapter.index) },
|
||||||
ContextMenuItem("Mark previous as read") { markPreviousAsRead(chapter.index) },
|
markPreviousAsRead = { markPreviousAsRead(chapter.index) }
|
||||||
ContextMenuItem("Toggle bookmarked") { toggleBookmarked(chapter.index) }
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onClick = { onClick(chapter.index) }
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
package ca.gosyer.ui.sources.components
|
package ca.gosyer.ui.sources.components
|
||||||
|
|
||||||
import androidx.compose.foundation.TooltipArea
|
|
||||||
import androidx.compose.foundation.TooltipPlacement
|
|
||||||
import ca.gosyer.ui.base.components.VerticalScrollbar
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
@@ -20,7 +17,6 @@ import androidx.compose.foundation.layout.width
|
|||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import ca.gosyer.ui.base.components.rememberScrollbarAdapter
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.Surface
|
import androidx.compose.material.Surface
|
||||||
@@ -38,13 +34,21 @@ import androidx.compose.ui.unit.DpOffset
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ca.gosyer.data.models.Source
|
import ca.gosyer.data.models.Source
|
||||||
import ca.gosyer.i18n.MR
|
import ca.gosyer.i18n.MR
|
||||||
|
import ca.gosyer.ui.base.components.CursorPoint
|
||||||
|
import ca.gosyer.ui.base.components.TooltipArea
|
||||||
|
import ca.gosyer.ui.base.components.VerticalScrollbar
|
||||||
|
import ca.gosyer.ui.base.components.rememberScrollbarAdapter
|
||||||
import ca.gosyer.ui.sources.browse.SourceScreen
|
import ca.gosyer.ui.sources.browse.SourceScreen
|
||||||
import ca.gosyer.ui.sources.home.SourceHomeScreen
|
import ca.gosyer.ui.sources.home.SourceHomeScreen
|
||||||
import ca.gosyer.uicore.components.combinedMouseClickable
|
|
||||||
import ca.gosyer.uicore.image.KamelImage
|
import ca.gosyer.uicore.image.KamelImage
|
||||||
import ca.gosyer.uicore.resources.stringResource
|
import ca.gosyer.uicore.resources.stringResource
|
||||||
import io.kamel.image.lazyPainterResource
|
import io.kamel.image.lazyPainterResource
|
||||||
|
|
||||||
|
expect fun Modifier.sourceSideMenuItem(
|
||||||
|
onSourceTabClick: () -> Unit,
|
||||||
|
onSourceCloseTabClick: () -> Unit
|
||||||
|
): Modifier
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SourcesMenu(
|
fun SourcesMenu(
|
||||||
sourceTabs: List<Source?>,
|
sourceTabs: List<Source?>,
|
||||||
@@ -100,17 +104,17 @@ fun SourcesSideMenu(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(64.dp),
|
modifier = Modifier.size(64.dp),
|
||||||
tooltipPlacement = TooltipPlacement.CursorPoint(
|
tooltipPlacement = CursorPoint(
|
||||||
offset = DpOffset(0.dp, 16.dp)
|
offset = DpOffset(0.dp, 16.dp)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Box(Modifier.fillMaxSize()) {
|
Box(Modifier.fillMaxSize()) {
|
||||||
val modifier = Modifier
|
val modifier = Modifier
|
||||||
.combinedMouseClickable(
|
.sourceSideMenuItem(
|
||||||
onClick = {
|
onSourceTabClick = {
|
||||||
onSourceTabClick(source)
|
onSourceTabClick(source)
|
||||||
},
|
},
|
||||||
onMiddleClick = {
|
onSourceCloseTabClick = {
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
onCloseSourceTabClick(source)
|
onCloseSourceTabClick(source)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
package ca.gosyer.ui.sources.home.components
|
package ca.gosyer.ui.sources.home.components
|
||||||
|
|
||||||
import androidx.compose.foundation.TooltipArea
|
|
||||||
import ca.gosyer.ui.base.components.VerticalScrollbar
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -22,7 +20,6 @@ import androidx.compose.foundation.lazy.LazyListState
|
|||||||
import androidx.compose.foundation.lazy.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import ca.gosyer.ui.base.components.rememberScrollbarAdapter
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Scaffold
|
import androidx.compose.material.Scaffold
|
||||||
@@ -40,6 +37,9 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ca.gosyer.data.models.Source
|
import ca.gosyer.data.models.Source
|
||||||
import ca.gosyer.i18n.MR
|
import ca.gosyer.i18n.MR
|
||||||
|
import ca.gosyer.ui.base.components.TooltipArea
|
||||||
|
import ca.gosyer.ui.base.components.VerticalScrollbar
|
||||||
|
import ca.gosyer.ui.base.components.rememberScrollbarAdapter
|
||||||
import ca.gosyer.ui.base.navigation.ActionItem
|
import ca.gosyer.ui.base.navigation.ActionItem
|
||||||
import ca.gosyer.ui.base.navigation.Toolbar
|
import ca.gosyer.ui.base.navigation.Toolbar
|
||||||
import ca.gosyer.ui.extensions.components.LanguageDialog
|
import ca.gosyer.ui.extensions.components.LanguageDialog
|
||||||
|
|||||||
Reference in New Issue
Block a user