feat: language fragment to jetpack compose

- used minimumInteractiveComponentSize() on the modifier to avoid "Touch target" accessibility issue.
- added compose dimes to previous missed elements.
- added content description for clear icon button in search view.
This commit is contained in:
jaskaran 2025-04-02 14:57:48 +05:30 committed by MohitMaliFtechiz
parent 56e0c1c7b1
commit 852849389e
5 changed files with 9 additions and 6 deletions

View File

@ -36,7 +36,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.unit.dp
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.utils.ComposeDimens
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.LanguageItem
@ -54,7 +53,7 @@ fun LanguageItemRow(
Row(
modifier = modifier
.fillMaxWidth()
.height(64.dp)
.height(ComposeDimens.SIXTY_FOUR_DP)
.semantics {
contentDescription = context.getString(R.string.select_language_content_description)
}
@ -65,7 +64,7 @@ fun LanguageItemRow(
) {
Checkbox(
modifier = Modifier
.padding(16.dp)
.padding(ComposeDimens.SIXTEEN_DP)
.semantics {
testTag = "$LANGUAGE_ITEM_CHECKBOX_TESTING_TAG${language.language}"
},

View File

@ -31,8 +31,8 @@ import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.utils.ComposeDimens
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.HeaderItem
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.LanguageItem
import org.kiwix.kiwixmobile.language.viewmodel.State
@ -79,7 +79,7 @@ fun LanguageList(
modifier = Modifier
.animateItem()
.fillMaxWidth()
.height(64.dp)
.height(ComposeDimens.SIXTY_FOUR_DP)
.semantics {
contentDescription =
context.getString(R.string.select_language_content_description)

View File

@ -23,6 +23,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.minimumInteractiveComponentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.Modifier
@ -58,6 +59,7 @@ fun KiwixSearchView(
TextField(
modifier = modifier
.testTag(testTag)
.minimumInteractiveComponentSize()
.focusRequester(focusRequester),
singleLine = true,
value = value,
@ -81,7 +83,7 @@ fun KiwixSearchView(
Icon(
painter = painterResource(R.drawable.ic_clear_white_24dp),
tint = Color.White,
contentDescription = null
contentDescription = stringResource(R.string.searchview_description_clear)
)
}
}

View File

@ -52,6 +52,7 @@ object ComposeDimens {
val FOUR_DP = 4.dp
val TWO_DP = 2.dp
val SEVENTY_DP = 70.dp
val SIXTY_FOUR_DP = 64.dp
// Font Sizes
val TWENTY_FOUR_SP = 24.sp

View File

@ -405,4 +405,5 @@
<string name="resuming_state">Resuming</string>
<string name="downloading_state">Downloading</string>
<string name="download_failed_state">Failed</string>
<string name="searchview_description_clear">Clear query</string>
</resources>