mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 06:42:21 -04:00
Improved the all text colors of LocalFileTransferScreen
to match the XML-based design.
This commit is contained in:
parent
361fbbc0bd
commit
7f0ffa7cc6
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.kiwix.kiwixmobile.localFileTransfer
|
package org.kiwix.kiwixmobile.localFileTransfer
|
||||||
|
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.net.wifi.p2p.WifiP2pDevice
|
import android.net.wifi.p2p.WifiP2pDevice
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
@ -36,6 +37,7 @@ import androidx.compose.material.icons.filled.Search
|
|||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.minimumInteractiveComponentSize
|
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||||
@ -62,6 +64,7 @@ import org.kiwix.kiwixmobile.core.ui.models.ActionMenuItem
|
|||||||
import org.kiwix.kiwixmobile.core.ui.models.IconItem
|
import org.kiwix.kiwixmobile.core.ui.models.IconItem
|
||||||
import org.kiwix.kiwixmobile.core.ui.models.IconItem.Vector
|
import org.kiwix.kiwixmobile.core.ui.models.IconItem.Vector
|
||||||
import org.kiwix.kiwixmobile.core.ui.theme.DodgerBlue
|
import org.kiwix.kiwixmobile.core.ui.theme.DodgerBlue
|
||||||
|
import org.kiwix.kiwixmobile.core.ui.theme.KiwixTheme
|
||||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FIFTEEN_DP
|
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FIFTEEN_DP
|
||||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FILE_FOR_TRANSFER_TEXT_SIZE
|
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FILE_FOR_TRANSFER_TEXT_SIZE
|
||||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FILE_ITEM_ICON_SIZE
|
import org.kiwix.kiwixmobile.core.utils.ComposeDimens.FILE_ITEM_ICON_SIZE
|
||||||
@ -79,13 +82,16 @@ import org.kiwix.kiwixmobile.localFileTransfer.FileItem.FileStatus.SENDING
|
|||||||
import org.kiwix.kiwixmobile.localFileTransfer.FileItem.FileStatus.SENT
|
import org.kiwix.kiwixmobile.localFileTransfer.FileItem.FileStatus.SENT
|
||||||
import org.kiwix.kiwixmobile.localFileTransfer.FileItem.FileStatus.TO_BE_SENT
|
import org.kiwix.kiwixmobile.localFileTransfer.FileItem.FileStatus.TO_BE_SENT
|
||||||
|
|
||||||
@Preview(device = "id:Nexus S")
|
@Preview(
|
||||||
|
uiMode = Configuration.UI_MODE_NIGHT_NO
|
||||||
|
)
|
||||||
|
@Preview(name = "Night Mode", uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||||
@Composable
|
@Composable
|
||||||
fun Preview() {
|
fun Preview() {
|
||||||
LocalFileTransferScreen(
|
LocalFileTransferScreen(
|
||||||
deviceName = "Google Pixel 7a",
|
deviceName = "Device Name",
|
||||||
toolbarTitle = org.kiwix.kiwixmobile.R.string.receive_files_title,
|
toolbarTitle = org.kiwix.kiwixmobile.R.string.receive_files_title,
|
||||||
isPeerSearching = true,
|
isPeerSearching = false,
|
||||||
peerDeviceList = listOf(WifiP2pDevice().apply { deviceName = "Redmi note 9" }),
|
peerDeviceList = listOf(WifiP2pDevice().apply { deviceName = "Redmi note 9" }),
|
||||||
transferFileList = listOf(
|
transferFileList = listOf(
|
||||||
FileItem("DemoFile.zim")
|
FileItem("DemoFile.zim")
|
||||||
@ -119,35 +125,37 @@ fun LocalFileTransferScreen(
|
|||||||
onDeviceItemClick: (WifiP2pDevice) -> Unit,
|
onDeviceItemClick: (WifiP2pDevice) -> Unit,
|
||||||
navigationIcon: @Composable () -> Unit
|
navigationIcon: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
KiwixTheme {
|
||||||
topBar = {
|
Scaffold(
|
||||||
KiwixAppBar(
|
topBar = {
|
||||||
titleId = toolbarTitle,
|
KiwixAppBar(
|
||||||
actionMenuItems = actionMenuItems,
|
titleId = toolbarTitle,
|
||||||
navigationIcon = navigationIcon
|
actionMenuItems = actionMenuItems,
|
||||||
)
|
navigationIcon = navigationIcon
|
||||||
}
|
)
|
||||||
) { padding ->
|
}
|
||||||
Column(
|
) { padding ->
|
||||||
modifier = Modifier
|
Column(
|
||||||
.fillMaxSize()
|
|
||||||
.padding(padding)
|
|
||||||
.background(Color.Transparent)
|
|
||||||
) {
|
|
||||||
YourDeviceHeader(deviceName)
|
|
||||||
HorizontalDivider(
|
|
||||||
color = DodgerBlue,
|
|
||||||
thickness = ONE_DP,
|
|
||||||
modifier = Modifier.padding(horizontal = FIVE_DP)
|
|
||||||
)
|
|
||||||
NearbyDevicesSection(peerDeviceList, isPeerSearching, onDeviceItemClick)
|
|
||||||
HorizontalDivider(
|
|
||||||
color = DodgerBlue,
|
|
||||||
thickness = ONE_DP,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = FIVE_DP)
|
.fillMaxSize()
|
||||||
)
|
.padding(padding)
|
||||||
TransferFilesSection(transferFileList)
|
.background(Color.Transparent)
|
||||||
|
) {
|
||||||
|
YourDeviceHeader(deviceName)
|
||||||
|
HorizontalDivider(
|
||||||
|
color = DodgerBlue,
|
||||||
|
thickness = ONE_DP,
|
||||||
|
modifier = Modifier.padding(horizontal = FIVE_DP)
|
||||||
|
)
|
||||||
|
NearbyDevicesSection(peerDeviceList, isPeerSearching, onDeviceItemClick)
|
||||||
|
HorizontalDivider(
|
||||||
|
color = DodgerBlue,
|
||||||
|
thickness = ONE_DP,
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(horizontal = FIVE_DP)
|
||||||
|
)
|
||||||
|
TransferFilesSection(transferFileList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +179,8 @@ fun NearbyDevicesSection(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = FIVE_DP)
|
.padding(top = FIVE_DP)
|
||||||
.align(Alignment.CenterHorizontally),
|
.align(Alignment.CenterHorizontally),
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
|
|
||||||
when {
|
when {
|
||||||
@ -186,7 +195,8 @@ fun NearbyDevicesSection(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(NO_DEVICE_FOUND_TEXT_PADDING)
|
.padding(NO_DEVICE_FOUND_TEXT_PADDING)
|
||||||
.align(Alignment.CenterHorizontally),
|
.align(Alignment.CenterHorizontally),
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
|
|
||||||
else -> LazyColumn(
|
else -> LazyColumn(
|
||||||
@ -212,7 +222,8 @@ private fun TransferFilesSection(transferFileList: List<FileItem>) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = TEN_DP),
|
.padding(top = TEN_DP),
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
|
|
||||||
LazyColumn(modifier = Modifier.fillMaxSize()) {
|
LazyColumn(modifier = Modifier.fillMaxSize()) {
|
||||||
@ -231,7 +242,8 @@ private fun YourDeviceHeader(deviceName: String) {
|
|||||||
fontStyle = FontStyle.Italic,
|
fontStyle = FontStyle.Italic,
|
||||||
fontSize = YOUR_DEVICE_TEXT_SIZE,
|
fontSize = YOUR_DEVICE_TEXT_SIZE,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(top = FIVE_DP, bottom = ONE_DP)
|
.padding(top = FIVE_DP, bottom = ONE_DP),
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
val contentDescription = stringResource(R.string.device_name)
|
val contentDescription = stringResource(R.string.device_name)
|
||||||
Text(
|
Text(
|
||||||
@ -240,7 +252,8 @@ private fun YourDeviceHeader(deviceName: String) {
|
|||||||
fontSize = PEER_DEVICE_ITEM_TEXT_SIZE,
|
fontSize = PEER_DEVICE_ITEM_TEXT_SIZE,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.minimumInteractiveComponentSize()
|
.minimumInteractiveComponentSize()
|
||||||
.semantics { this.contentDescription = contentDescription }
|
.semantics { this.contentDescription = contentDescription },
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +273,8 @@ fun TransferFileItem(
|
|||||||
fontSize = FILE_ITEM_TEXT_SIZE,
|
fontSize = FILE_ITEM_TEXT_SIZE,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.padding(horizontal = FIVE_DP, vertical = ONE_DP)
|
.padding(horizontal = FIVE_DP, vertical = ONE_DP),
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
|
|
||||||
val modifier = Modifier
|
val modifier = Modifier
|
||||||
@ -309,7 +323,8 @@ fun PeerDeviceItem(
|
|||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(3f)
|
.weight(3f)
|
||||||
.padding(horizontal = FIVE_DP, vertical = ONE_DP)
|
.padding(horizontal = FIVE_DP, vertical = ONE_DP),
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.67f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user