mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Fixed: The server was not starting automatically after granting notification/storage permissions, whereas it previously started automatically with the XML-based design.
* Fixed: The link was not clickable and was only displaying as plain text in the TextView. * Fixed: The TagView UI was not adjusting properly when all tags were displayed. Fixed: The TagView was not positioned at the bottom and had an unintended bottom margin. * Fixed: The fonts and sizes of the date, article size, and description were not aligned with our current XML design. * Fixed: The ZIM files list was not updating on the UI when selecting/deselecting items. * Removed the `activity_zim_host.xml` file from project since it is unused now.
This commit is contained in:
parent
436a001eb9
commit
6e370a1e74
@ -45,13 +45,12 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.extensions.faviconToPainter
|
||||
import org.kiwix.kiwixmobile.core.ui.theme.KiwixTheme
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.BOOK_DESCRIPTION_LETTER_SPACING
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.BOOK_ICON_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.EIGHT_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FIVE_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FOURTEEN_SP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FOUR_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SIXTEEN_DP
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.TWO_DP
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.KiloByte
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.ArticleCount
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode
|
||||
@ -65,7 +64,6 @@ fun BookItem(
|
||||
onLongClick: ((BookOnDisk) -> Unit)? = null,
|
||||
onMultiSelect: ((BookOnDisk) -> Unit)? = null,
|
||||
selectionMode: SelectionMode = SelectionMode.NORMAL,
|
||||
onCheckedChange: (Boolean) -> Unit = {}
|
||||
) {
|
||||
KiwixTheme {
|
||||
Card(
|
||||
@ -89,7 +87,7 @@ fun BookItem(
|
||||
elevation = CardDefaults.elevatedCardElevation(),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer)
|
||||
) {
|
||||
BookContent(bookOnDisk, selectionMode, onCheckedChange)
|
||||
BookContent(bookOnDisk, selectionMode, onMultiSelect, onClick)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,16 +96,17 @@ fun BookItem(
|
||||
private fun BookContent(
|
||||
bookOnDisk: BookOnDisk,
|
||||
selectionMode: SelectionMode,
|
||||
onCheckedChange: (Boolean) -> Unit
|
||||
onMultiSelect: ((BookOnDisk) -> Unit)?,
|
||||
onClick: ((BookOnDisk) -> Unit)?,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(SIXTEEN_DP)
|
||||
.padding(top = SIXTEEN_DP, start = SIXTEEN_DP)
|
||||
.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (selectionMode == SelectionMode.MULTI) {
|
||||
BookCheckbox(bookOnDisk, onCheckedChange)
|
||||
BookCheckbox(bookOnDisk, selectionMode, onMultiSelect, onClick)
|
||||
}
|
||||
BookIcon(bookOnDisk.book.faviconToPainter())
|
||||
BookDetails(Modifier.weight(1f), bookOnDisk)
|
||||
@ -115,10 +114,20 @@ private fun BookContent(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun BookCheckbox(bookOnDisk: BookOnDisk, onCheckedChange: (Boolean) -> Unit) {
|
||||
private fun BookCheckbox(
|
||||
bookOnDisk: BookOnDisk,
|
||||
selectionMode: SelectionMode,
|
||||
onMultiSelect: ((BookOnDisk) -> Unit)?,
|
||||
onClick: ((BookOnDisk) -> Unit)?
|
||||
) {
|
||||
Checkbox(
|
||||
checked = bookOnDisk.isSelected,
|
||||
onCheckedChange = onCheckedChange
|
||||
onCheckedChange = {
|
||||
when (selectionMode) {
|
||||
SelectionMode.MULTI -> onMultiSelect?.invoke(bookOnDisk)
|
||||
SelectionMode.NORMAL -> onClick?.invoke(bookOnDisk)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@ -138,38 +147,36 @@ private fun BookDetails(modifier: Modifier, bookOnDisk: BookOnDisk) {
|
||||
Column(modifier = modifier.padding(start = SIXTEEN_DP)) {
|
||||
Text(
|
||||
text = bookOnDisk.book.title,
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Spacer(modifier = Modifier.height(TWO_DP))
|
||||
Text(
|
||||
text = bookOnDisk.book.description.orEmpty(),
|
||||
style = MaterialTheme.typography.bodySmall.copy(
|
||||
fontSize = FOURTEEN_SP,
|
||||
letterSpacing = BOOK_DESCRIPTION_LETTER_SPACING
|
||||
),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
color = MaterialTheme.colorScheme.onSecondary
|
||||
)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.padding(top = FOUR_DP)
|
||||
modifier = Modifier.padding(top = FIVE_DP)
|
||||
) {
|
||||
Text(
|
||||
text = bookOnDisk.book.date,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onTertiary
|
||||
)
|
||||
Spacer(modifier = Modifier.width(EIGHT_DP))
|
||||
Text(
|
||||
text = KiloByte(bookOnDisk.book.size).humanReadable,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onTertiary
|
||||
)
|
||||
Spacer(modifier = Modifier.width(EIGHT_DP))
|
||||
Text(
|
||||
text = ArticleCount(bookOnDisk.book.articleCount.orEmpty())
|
||||
.toHumanReadable(LocalContext.current),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onTertiary
|
||||
)
|
||||
}
|
||||
|
@ -19,7 +19,8 @@
|
||||
package org.kiwix.kiwixmobile.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.SuggestionChip
|
||||
import androidx.compose.material3.SuggestionChipDefaults
|
||||
@ -36,9 +37,10 @@ import org.kiwix.kiwixmobile.core.zim_manager.KiwixTag.Companion.YesNoValueTag.P
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.KiwixTag.Companion.YesNoValueTag.VideoTag
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.KiwixTag.TagValue.YES
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
fun TagsView(tags: List<KiwixTag>, modifier: Modifier = Modifier) {
|
||||
Row(
|
||||
FlowRow(
|
||||
modifier = modifier,
|
||||
horizontalArrangement = Arrangement.spacedBy(EIGHT_DP)
|
||||
) {
|
||||
|
@ -71,7 +71,6 @@ import org.kiwix.kiwixmobile.core.utils.files.Log
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.SelectionMode
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem
|
||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
||||
import org.kiwix.kiwixmobile.databinding.ActivityZimHostBinding
|
||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
||||
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService
|
||||
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotService.Companion.ACTION_CHECK_IP_ADDRESS
|
||||
@ -105,7 +104,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
private var ip: String? = null
|
||||
private lateinit var serviceConnection: ServiceConnection
|
||||
private var dialog: Dialog? = null
|
||||
private var activityZimHostBinding: ActivityZimHostBinding? = null
|
||||
private var isHotspotServiceRunning = false
|
||||
private var serverIpText = mutableStateOf("")
|
||||
private var shareIconItem = mutableStateOf(false to {})
|
||||
@ -140,7 +138,7 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
ActivityResultContracts.RequestPermission()
|
||||
) { isGranted ->
|
||||
if (isGranted) {
|
||||
activityZimHostBinding?.startServerButton?.performClick()
|
||||
startServerButtonClick()
|
||||
} else {
|
||||
if (!ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
requireActivity(),
|
||||
@ -164,7 +162,7 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
Map.Entry<String, @kotlin.jvm.JvmSuppressWildcards Boolean>::value
|
||||
)
|
||||
if (isGranted) {
|
||||
activityZimHostBinding?.startServerButton?.performClick()
|
||||
startServerButtonClick()
|
||||
} else {
|
||||
if (!ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
requireActivity(),
|
||||
@ -192,7 +190,7 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
startServerButtonItem = startServerButtonItem.value,
|
||||
selectionMode = SelectionMode.MULTI,
|
||||
onMultiSelect = { select(it) },
|
||||
booksList = booksList.value,
|
||||
booksList = booksList.value
|
||||
) {
|
||||
NavigationIcon(
|
||||
onClick = { activity?.onBackPressedDispatcher?.onBackPressed() }
|
||||
@ -207,17 +205,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
//
|
||||
// bookDelegate =
|
||||
// BookOnDiskDelegate.BookDelegate(sharedPreferenceUtil, multiSelectAction = ::select)
|
||||
// bookDelegate.selectionMode = SelectionMode.MULTI
|
||||
// booksAdapter =
|
||||
// BooksOnDiskAdapter(
|
||||
// bookDelegate,
|
||||
// BookOnDiskDelegate.LanguageDelegate
|
||||
// )
|
||||
//
|
||||
// activityZimHostBinding?.recyclerViewZimHost?.adapter = booksAdapter
|
||||
presenter.attachView(this)
|
||||
|
||||
serviceConnection =
|
||||
@ -324,6 +311,10 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
}
|
||||
it
|
||||
}
|
||||
// Force recomposition by first setting an empty list before assigning the updated list.
|
||||
// This is necessary because modifying an object's property doesn't trigger recomposition,
|
||||
// as Compose still considers the list unchanged.
|
||||
booksList.value = emptyList()
|
||||
booksList.value = tempBooksList
|
||||
saveHostedBooks(tempBooksList)
|
||||
if (ServerUtils.isServerStarted) {
|
||||
@ -380,10 +371,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
|
||||
private fun layoutServerStarted() {
|
||||
serverIpText.value = getString(R.string.server_started_message, ip)
|
||||
// activityZimHostBinding?.serverTextView?.apply {
|
||||
// text = getString(R.string.server_started_message, ip)
|
||||
// movementMethod = LinkMovementMethod.getInstance()
|
||||
// }
|
||||
configureUrlSharingIcon(true)
|
||||
configureQrIcon(true)
|
||||
startServerButtonItem.value =
|
||||
@ -419,10 +406,8 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
activityZimHostBinding?.recyclerViewZimHost?.adapter = null
|
||||
unRegisterHotspotService()
|
||||
presenter.detachView()
|
||||
activityZimHostBinding = null
|
||||
}
|
||||
|
||||
private fun unRegisterHotspotService() {
|
||||
|
@ -18,6 +18,11 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.webserver
|
||||
|
||||
import android.content.Context
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.text.util.Linkify
|
||||
import android.view.Gravity
|
||||
import android.widget.TextView
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@ -31,16 +36,17 @@ import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.core.text.util.LinkifyCompat
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
import org.kiwix.kiwixmobile.core.ui.components.KiwixAppBar
|
||||
import org.kiwix.kiwixmobile.core.ui.components.KiwixButton
|
||||
@ -82,11 +88,18 @@ fun ZimHostScreen(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = SIXTEEN_DP),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
ServerIpText(serverIpText, Modifier.weight(1f))
|
||||
ServerIpText(serverIpText, Modifier.weight(1f), LocalContext.current)
|
||||
ShareIcon(shareIconItem)
|
||||
}
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
BookItemList(booksList, selectionMode, qrImageItem, onClick, onLongClick, onMultiSelect)
|
||||
BookItemList(
|
||||
booksList,
|
||||
selectionMode,
|
||||
qrImageItem,
|
||||
onClick,
|
||||
onLongClick,
|
||||
onMultiSelect
|
||||
)
|
||||
}
|
||||
KiwixButton(
|
||||
startServerButtonItem.first,
|
||||
@ -99,20 +112,28 @@ fun ZimHostScreen(
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
@Composable
|
||||
fun ServerIpText(
|
||||
private fun ServerIpText(
|
||||
serverIpText: String,
|
||||
modifier: Modifier
|
||||
modifier: Modifier,
|
||||
context: Context
|
||||
) {
|
||||
Text(
|
||||
text = serverIpText,
|
||||
modifier = modifier.minimumInteractiveComponentSize(),
|
||||
textAlign = TextAlign.Start,
|
||||
)
|
||||
val serverIpTextView = remember { TextView(context) }
|
||||
AndroidView(factory = { serverIpTextView }, modifier = modifier) { textView ->
|
||||
textView.apply {
|
||||
text = serverIpText
|
||||
textSize = 14F
|
||||
minHeight = context.resources.getDimensionPixelSize(R.dimen.material_minimum_height_and_width)
|
||||
gravity = Gravity.CENTER or Gravity.START
|
||||
LinkifyCompat.addLinks(this, Linkify.WEB_URLS)
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ShareIcon(shareIconItem: Pair<Boolean, () -> Unit>) {
|
||||
private fun ShareIcon(shareIconItem: Pair<Boolean, () -> Unit>) {
|
||||
if (shareIconItem.first) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.ic_share_35dp),
|
||||
@ -128,7 +149,7 @@ fun ShareIcon(shareIconItem: Pair<Boolean, () -> Unit>) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun QRImage(qrImageItem: Pair<Boolean, IconItem>) {
|
||||
private fun QRImage(qrImageItem: Pair<Boolean, IconItem>) {
|
||||
if (qrImageItem.first) {
|
||||
Image(
|
||||
painter = qrImageItem.second.toPainter(),
|
||||
@ -143,7 +164,7 @@ fun QRImage(qrImageItem: Pair<Boolean, IconItem>) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BookItemList(
|
||||
private fun BookItemList(
|
||||
booksList: List<BooksOnDiskListItem>,
|
||||
selectionMode: SelectionMode,
|
||||
qrImageItem: Pair<Boolean, IconItem>,
|
||||
|
@ -1,113 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Kiwix Android
|
||||
~ Copyright (c) 2023 Kiwix <android.kiwix.org>
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.kiwix.kiwixmobile.webserver.ZimHostFragment">
|
||||
|
||||
<include layout="@layout/layout_toolbar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/serverTextView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:autoLink="web"
|
||||
android:gravity="center|start"
|
||||
android:minHeight="@dimen/material_minimum_height_and_width"
|
||||
android:text="@string/server_textview_default_message"
|
||||
app:layout_constraintEnd_toStartOf="@id/shareServerUrlIcon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/shareServerUrlIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:minHeight="@dimen/material_minimum_height_and_width"
|
||||
android:minWidth="@dimen/material_minimum_height_and_width"
|
||||
android:contentDescription="@string/share_host_address"
|
||||
android:src="@drawable/ic_share_35dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/serverTextView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/serverTextView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/startServerButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/serverTextView">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/serverQrCode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/qr_code"
|
||||
android:maxHeight="128dp"
|
||||
android:minHeight="76dp"
|
||||
android:visibility="gone"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerViewZimHost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/menu_wifi_hotspot"
|
||||
android:minHeight="256dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_book" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/startServerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:backgroundTint="@color/startServerGreen"
|
||||
android:text="@string/start_server_label"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -42,6 +42,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import com.tonyodev.fetch2.R.string
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
@ -137,7 +138,7 @@ private fun CrashMessage(
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(messageId),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Normal),
|
||||
textAlign = TextAlign.Center,
|
||||
color = White,
|
||||
modifier = Modifier.padding(start = EIGHT_DP, top = EIGHT_DP, end = EIGHT_DP)
|
||||
|
@ -30,6 +30,7 @@ import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import org.kiwix.kiwixmobile.core.ui.theme.DenimBlue200
|
||||
import org.kiwix.kiwixmobile.core.ui.theme.ErrorActivityBackground
|
||||
import org.kiwix.kiwixmobile.core.ui.theme.White
|
||||
@ -54,7 +55,7 @@ fun CrashCheckBox(checkBoxItem: Pair<Int, MutableState<Boolean>>) {
|
||||
)
|
||||
)
|
||||
Text(
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Normal),
|
||||
text = stringResource(id = checkBoxItem.first),
|
||||
color = White,
|
||||
modifier = Modifier.padding(start = CRASH_CHECKBOX_TOP_PADDING)
|
||||
|
@ -20,6 +20,7 @@ package org.kiwix.kiwixmobile.core.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_BODY_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_HEADLINE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.LARGE_LABEL_TEXT_SIZE
|
||||
@ -28,6 +29,7 @@ import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MEDIUM_BODY_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MEDIUM_HEADLINE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MEDIUM_LABEL_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MEDIUM_TITLE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.MEDIUM_BODY_LETTER_SPACING
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SMALL_BODY_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SMALL_HEADLINE_TEXT_SIZE
|
||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.SMALL_LABEL_TEXT_SIZE
|
||||
@ -47,7 +49,11 @@ val KiwixTypography = Typography(
|
||||
titleMedium = TextStyle(fontSize = MEDIUM_TITLE_TEXT_SIZE),
|
||||
titleSmall = TextStyle(fontSize = SMALL_TITLE_TEXT_SIZE),
|
||||
bodyLarge = TextStyle(fontSize = LARGE_BODY_TEXT_SIZE),
|
||||
bodyMedium = TextStyle(fontSize = MEDIUM_BODY_TEXT_SIZE),
|
||||
bodyMedium = TextStyle(
|
||||
fontSize = MEDIUM_BODY_TEXT_SIZE,
|
||||
fontWeight = FontWeight.Medium,
|
||||
letterSpacing = MEDIUM_BODY_LETTER_SPACING
|
||||
),
|
||||
bodySmall = TextStyle(fontSize = SMALL_BODY_TEXT_SIZE),
|
||||
labelLarge = TextStyle(fontSize = LARGE_LABEL_TEXT_SIZE),
|
||||
labelMedium = TextStyle(fontSize = MEDIUM_LABEL_TEXT_SIZE),
|
||||
|
@ -47,6 +47,7 @@ object ComposeDimens {
|
||||
val TWELVE_DP = 12.dp
|
||||
val TEN_DP = 10.dp
|
||||
val EIGHT_DP = 8.dp
|
||||
val SIX_DP = 6.dp
|
||||
val FIVE_DP = 5.dp
|
||||
val FOUR_DP = 4.dp
|
||||
val TWO_DP = 2.dp
|
||||
@ -79,6 +80,7 @@ object ComposeDimens {
|
||||
val LARGE_LABEL_TEXT_SIZE = 14.sp
|
||||
val MEDIUM_LABEL_TEXT_SIZE = 12.sp
|
||||
val SMALL_LABEL_TEXT_SIZE = 10.sp
|
||||
val MEDIUM_BODY_LETTER_SPACING = 0.00714285714.em
|
||||
|
||||
// AddNoteDialog dimens
|
||||
val MINIMUM_HEIGHT_OF_NOTE_TEXT_FILED = 120.dp
|
||||
@ -93,5 +95,4 @@ object ComposeDimens {
|
||||
|
||||
// BookItem dimes
|
||||
val BOOK_ICON_SIZE = 40.dp
|
||||
val BOOK_DESCRIPTION_LETTER_SPACING = 0.00714285714.em
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user