mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 14:52:13 -04:00
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:
parent
56e0c1c7b1
commit
852849389e
@ -36,7 +36,6 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.semantics.contentDescription
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.semantics.testTag
|
import androidx.compose.ui.semantics.testTag
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import org.kiwix.kiwixmobile.core.R
|
import org.kiwix.kiwixmobile.core.R
|
||||||
import org.kiwix.kiwixmobile.core.utils.ComposeDimens
|
import org.kiwix.kiwixmobile.core.utils.ComposeDimens
|
||||||
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.LanguageItem
|
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.LanguageItem
|
||||||
@ -54,7 +53,7 @@ fun LanguageItemRow(
|
|||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(64.dp)
|
.height(ComposeDimens.SIXTY_FOUR_DP)
|
||||||
.semantics {
|
.semantics {
|
||||||
contentDescription = context.getString(R.string.select_language_content_description)
|
contentDescription = context.getString(R.string.select_language_content_description)
|
||||||
}
|
}
|
||||||
@ -65,7 +64,7 @@ fun LanguageItemRow(
|
|||||||
) {
|
) {
|
||||||
Checkbox(
|
Checkbox(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(16.dp)
|
.padding(ComposeDimens.SIXTEEN_DP)
|
||||||
.semantics {
|
.semantics {
|
||||||
testTag = "$LANGUAGE_ITEM_CHECKBOX_TESTING_TAG${language.language}"
|
testTag = "$LANGUAGE_ITEM_CHECKBOX_TESTING_TAG${language.language}"
|
||||||
},
|
},
|
||||||
|
@ -31,8 +31,8 @@ import androidx.compose.runtime.snapshotFlow
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.semantics.contentDescription
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import org.kiwix.kiwixmobile.core.R
|
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.HeaderItem
|
||||||
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.LanguageItem
|
import org.kiwix.kiwixmobile.language.composables.LanguageListItem.LanguageItem
|
||||||
import org.kiwix.kiwixmobile.language.viewmodel.State
|
import org.kiwix.kiwixmobile.language.viewmodel.State
|
||||||
@ -79,7 +79,7 @@ fun LanguageList(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.animateItem()
|
.animateItem()
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(64.dp)
|
.height(ComposeDimens.SIXTY_FOUR_DP)
|
||||||
.semantics {
|
.semantics {
|
||||||
contentDescription =
|
contentDescription =
|
||||||
context.getString(R.string.select_language_content_description)
|
context.getString(R.string.select_language_content_description)
|
||||||
|
@ -23,6 +23,7 @@ import androidx.compose.material3.IconButton
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextField
|
import androidx.compose.material3.TextField
|
||||||
import androidx.compose.material3.TextFieldDefaults
|
import androidx.compose.material3.TextFieldDefaults
|
||||||
|
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.SideEffect
|
import androidx.compose.runtime.SideEffect
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -58,6 +59,7 @@ fun KiwixSearchView(
|
|||||||
TextField(
|
TextField(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.testTag(testTag)
|
.testTag(testTag)
|
||||||
|
.minimumInteractiveComponentSize()
|
||||||
.focusRequester(focusRequester),
|
.focusRequester(focusRequester),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
value = value,
|
value = value,
|
||||||
@ -81,7 +83,7 @@ fun KiwixSearchView(
|
|||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_clear_white_24dp),
|
painter = painterResource(R.drawable.ic_clear_white_24dp),
|
||||||
tint = Color.White,
|
tint = Color.White,
|
||||||
contentDescription = null
|
contentDescription = stringResource(R.string.searchview_description_clear)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ object ComposeDimens {
|
|||||||
val FOUR_DP = 4.dp
|
val FOUR_DP = 4.dp
|
||||||
val TWO_DP = 2.dp
|
val TWO_DP = 2.dp
|
||||||
val SEVENTY_DP = 70.dp
|
val SEVENTY_DP = 70.dp
|
||||||
|
val SIXTY_FOUR_DP = 64.dp
|
||||||
|
|
||||||
// Font Sizes
|
// Font Sizes
|
||||||
val TWENTY_FOUR_SP = 24.sp
|
val TWENTY_FOUR_SP = 24.sp
|
||||||
|
@ -405,4 +405,5 @@
|
|||||||
<string name="resuming_state">Resuming</string>
|
<string name="resuming_state">Resuming</string>
|
||||||
<string name="downloading_state">Downloading</string>
|
<string name="downloading_state">Downloading</string>
|
||||||
<string name="download_failed_state">Failed</string>
|
<string name="download_failed_state">Failed</string>
|
||||||
|
<string name="searchview_description_clear">Clear query</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user