From b96e8e5b291e1182aa98c5f72dcffcfb9503581b Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Sun, 8 Dec 2024 00:14:30 +0800 Subject: [PATCH] ui: enlarge history, bookmark font size. fix: #447 --- .../info/plateaukao/einkbro/activity/BrowserActivity.kt | 6 ++++-- .../plateaukao/einkbro/view/compose/BrowseHistoryList.kt | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt b/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt index fb0a8c75..a90ef434 100755 --- a/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt +++ b/app/src/main/java/info/plateaukao/einkbro/activity/BrowserActivity.kt @@ -59,6 +59,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import androidx.core.graphics.Insets import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat @@ -489,8 +491,8 @@ open class BrowserActivity : FragmentActivity(), BrowserController { val externalSearchContainer = binding.activityMainContent.externalSearchActionContainer externalSearchViewModel.searchActions.forEach { action -> val button = TextView(this).apply { - height = ViewUnit.dpToPixel(40).toInt() - textSize = ViewUnit.dpToPixel(10) + height = 40.dp.value.toInt() + textSize = 10.sp.value gravity = Gravity.CENTER background = getDrawable(R.drawable.background_with_border) text = action.title.take(2).uppercase(Locale.getDefault()) diff --git a/app/src/main/java/info/plateaukao/einkbro/view/compose/BrowseHistoryList.kt b/app/src/main/java/info/plateaukao/einkbro/view/compose/BrowseHistoryList.kt index 10768e9d..f54ca625 100644 --- a/app/src/main/java/info/plateaukao/einkbro/view/compose/BrowseHistoryList.kt +++ b/app/src/main/java/info/plateaukao/einkbro/view/compose/BrowseHistoryList.kt @@ -100,8 +100,7 @@ private fun RecordItem( Row( modifier = modifier - .height(60.dp) - .padding(5.dp), + .padding(2.dp), horizontalArrangement = Arrangement.Center ) { if (record.type == RecordType.Bookmark) { @@ -142,14 +141,14 @@ private fun RecordItem( AndroidView( factory = { context -> TextView(context).apply { - textSize = ViewUnit.dpToPixel(6) + textSize = ViewUnit.dpToPixel(11).toFloat() maxLines = 1 ellipsize = TextUtils.TruncateAt.MIDDLE } }, update = { it.text = record.title ?: "Unknown" } ) - Spacer(modifier = Modifier.height(3.dp)) + Spacer(modifier = Modifier.height(1.dp)) Row( modifier = Modifier.fillMaxWidth(), ) { @@ -159,7 +158,7 @@ private fun RecordItem( .align(Alignment.Top), factory = { context -> TextView(context).apply { - textSize = ViewUnit.dpToPixel(5) + textSize = ViewUnit.dpToPixel(8).toFloat() textAlignment = TextView.TEXT_ALIGNMENT_CENTER maxLines = 1 ellipsize = TextUtils.TruncateAt.MIDDLE