Skip to content

Commit

Permalink
💄 Implement a detailed display interface for Text type pasted items
Browse files Browse the repository at this point in the history
  • Loading branch information
guiyanakuang committed Apr 25, 2024
1 parent c828daa commit 694967e
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.clipevery.ui.clip.detail

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

@Composable
fun ClipDetailView(detailView: @Composable () -> Unit) {
Column(
modifier = Modifier.fillMaxWidth().height(200.dp).padding(10.dp),
) {
detailView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.clipevery.ui.clip.detail

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp
import com.clipevery.clip.item.ClipText

@Composable
fun ClipTextDetailView(clipText: ClipText) {
val text = clipText.text
Text(
text = text,
modifier = Modifier.fillMaxSize(),
overflow = TextOverflow.Ellipsis,
style =
TextStyle(
fontWeight = FontWeight.Normal,
fontFamily = FontFamily.SansSerif,
color = MaterialTheme.colors.onBackground,
fontSize = 14.sp,
),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fun ClipeverySearchWindow(hideWindow: () -> Unit) {
.background(Color.Transparent)
.clip(RoundedCornerShape(10.dp))
.width(800.dp)
.height(600.dp)
.height(480.dp)
.padding(10.dp),
contentAlignment = Alignment.Center,
) {
Expand All @@ -184,7 +184,7 @@ fun ClipeverySearchWindow(hideWindow: () -> Unit) {
Modifier
.shadow(5.dp, RoundedCornerShape(10.dp))
.width(780.dp)
.height(580.dp)
.height(460.dp)
.background(MaterialTheme.colors.background),
contentAlignment = Alignment.Center,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.clipevery.LocalKoinApplication
import com.clipevery.clip.ClipSearchService
import com.clipevery.ui.clip.preview.ClipPreviewItemView
import com.clipevery.ui.clip.preview.ClipSpecificPreviewView
import com.clipevery.clip.item.ClipText
import com.clipevery.ui.clip.detail.ClipDetailView
import com.clipevery.ui.clip.detail.ClipTextDetailView
import com.clipevery.ui.clip.preview.getClipItem

@Composable
fun DetialClipDataView() {
val current = LocalKoinApplication.current
val clipSearchService = current.koin.get<ClipSearchService>()

clipSearchService.currentClipData.value?.let {
ClipPreviewItemView(it) {
ClipSpecificPreviewView(this)
clipSearchService.currentClipData.value?.let { clipData ->
clipData.getClipItem()?.let {
ClipDetailView {
when (it) {
is ClipText -> {
ClipTextDetailView(it)
}
else -> {
}
}
}
}
} ?: run {
Spacer(modifier = Modifier.fillMaxSize())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fun SearchListView(setSelectedIndex: (Int) -> Unit) {

LazyColumn(
state = listState,
modifier = Modifier.width(280.dp).height(520.dp),
modifier = Modifier.width(280.dp).height(400.dp),
) {
itemsIndexed(
clipSearchService.searchResult,
Expand Down

0 comments on commit 694967e

Please sign in to comment.