From e398b73f630da70af72934c515873a056d12c8b6 Mon Sep 17 00:00:00 2001 From: Ferdy Rodriguez Date: Mon, 23 Dec 2024 15:46:07 +0100 Subject: [PATCH] chore: [ANDROAPP-6281] changes because of updated design system library (#3941) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manu Muñoz Co-authored-by: Manu Muñoz --- .../org/dhis2/usescases/general/SessionManagerActivity.kt | 7 +++---- .../main/java/org/dhis2/usescases/login/ui/LoginScreen.kt | 7 ++++--- .../java/org/dhis2/usescases/qrScanner/ScanActivity.kt | 2 +- .../org/dhis2/usescases/searchTrackEntity/ui/SearchTEUi.kt | 4 ++-- .../teiDashboard/dialogs/scheduling/SchedulingDialogUi.kt | 3 ++- .../java/org/dhis2/utils/granularsync/SMSSenderHelper.kt | 2 +- .../main/java/org/dhis2/commons/ActivityResultObserver.kt | 2 +- .../dhis2/org/analytics/charts/ui/IndicatorViewHolder.kt | 6 +++--- form/src/main/java/org/dhis2/form/ui/FormView.kt | 2 +- gradle/libs.versions.toml | 6 +++--- .../java/org/dhis2/android/rtsm/ui/base/BaseActivity.kt | 2 +- 11 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/org/dhis2/usescases/general/SessionManagerActivity.kt b/app/src/main/java/org/dhis2/usescases/general/SessionManagerActivity.kt index fecc90d4d5..ff22e095f2 100644 --- a/app/src/main/java/org/dhis2/usescases/general/SessionManagerActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/general/SessionManagerActivity.kt @@ -7,7 +7,6 @@ import android.os.Bundle import android.view.WindowManager import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityOptionsCompat -import androidx.core.content.ContextCompat import androidx.lifecycle.lifecycleScope import io.reactivex.Observable import io.reactivex.subjects.BehaviorSubject @@ -131,7 +130,7 @@ abstract class SessionManagerActivity : AppCompatActivity(), ActivityResultObser override fun onRequestPermissionsResult( requestCode: Int, - permissions: Array, + permissions: Array, grantResults: IntArray, ) { if (activityResultObserver != null) { @@ -190,9 +189,9 @@ abstract class SessionManagerActivity : AppCompatActivity(), ActivityResultObser if (finishAll) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) if (bundle != null) intent.putExtras(bundle) if (transition != null) { - ContextCompat.startActivity(this, intent, transition.toBundle()) + startActivity(intent, transition.toBundle()) } else { - ContextCompat.startActivity(this, intent, null) + startActivity(intent, null) } if (finishCurrent) finish() } diff --git a/app/src/main/java/org/dhis2/usescases/login/ui/LoginScreen.kt b/app/src/main/java/org/dhis2/usescases/login/ui/LoginScreen.kt index d07480b92a..5282d89e54 100644 --- a/app/src/main/java/org/dhis2/usescases/login/ui/LoginScreen.kt +++ b/app/src/main/java/org/dhis2/usescases/login/ui/LoginScreen.kt @@ -30,13 +30,14 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.constraintlayout.compose.ConstraintLayout import org.dhis2.R -import org.hisp.dhis.mobile.ui.designsystem.resource.provideFontResource import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor @@ -118,7 +119,7 @@ fun LoginTopBar( style = TextStyle( fontSize = 16.sp, lineHeight = 24.sp, - fontFamily = provideFontResource("rubik_regular"), + fontFamily = FontFamily(Font(R.font.rubik_regular)), fontWeight = FontWeight.Normal, color = Color.Black, letterSpacing = 0.5.sp, @@ -140,7 +141,7 @@ fun LoginTopBar( style = TextStyle( fontSize = 12.sp, lineHeight = 16.sp, - fontFamily = provideFontResource("rubik_regular"), + fontFamily = FontFamily(Font(R.font.rubik_regular)), fontWeight = FontWeight.Normal, color = SurfaceColor.ContainerHighest, letterSpacing = 0.4.sp, diff --git a/app/src/main/java/org/dhis2/usescases/qrScanner/ScanActivity.kt b/app/src/main/java/org/dhis2/usescases/qrScanner/ScanActivity.kt index e78cbbc67f..a42c5517d5 100644 --- a/app/src/main/java/org/dhis2/usescases/qrScanner/ScanActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/qrScanner/ScanActivity.kt @@ -93,7 +93,7 @@ class ScanActivity : ActivityGlobalAbstract() { override fun onRequestPermissionsResult( requestCode: Int, - permissions: Array, + permissions: Array, grantResults: IntArray, ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/ui/SearchTEUi.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/ui/SearchTEUi.kt index 82d5f798e4..2e8b189115 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/ui/SearchTEUi.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/ui/SearchTEUi.kt @@ -29,7 +29,7 @@ import androidx.compose.material.IconButton import androidx.compose.material.LocalTextStyle import androidx.compose.material.OutlinedButton import androidx.compose.material.Text -import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material3.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -199,7 +199,7 @@ fun SearchButtonWithQuery( .clickable( onClick = onClick, interactionSource = remember { MutableInteractionSource() }, - indication = rememberRipple( + indication = ripple( true, color = SurfaceColor.Primary, ), diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dialogs/scheduling/SchedulingDialogUi.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dialogs/scheduling/SchedulingDialogUi.kt index 4edfd3717e..e9bbffb3f3 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dialogs/scheduling/SchedulingDialogUi.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dialogs/scheduling/SchedulingDialogUi.kt @@ -46,6 +46,7 @@ import org.hisp.dhis.mobile.ui.designsystem.component.RadioButtonData import org.hisp.dhis.mobile.ui.designsystem.resource.provideStringResource import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor +import java.util.Locale @Composable fun SchedulingDialogUi( @@ -64,7 +65,7 @@ fun SchedulingDialogUi( it.value, selected = false, enabled = true, - textInput = provideStringResource(it.value), + textInput = provideStringResource(it.value.lowercase(Locale.getDefault())), ) } var optionSelected by remember { mutableStateOf(yesNoOptions.first()) } diff --git a/app/src/main/java/org/dhis2/utils/granularsync/SMSSenderHelper.kt b/app/src/main/java/org/dhis2/utils/granularsync/SMSSenderHelper.kt index a59b8e4f9e..317bc82715 100644 --- a/app/src/main/java/org/dhis2/utils/granularsync/SMSSenderHelper.kt +++ b/app/src/main/java/org/dhis2/utils/granularsync/SMSSenderHelper.kt @@ -82,7 +82,7 @@ class SMSSenderHelper( .show(fragmentManager, BottomSheetDialogUiModel::class.java.simpleName) } - private fun createSMSIntent(message: String, smsToNumber: String): Intent? { + private fun createSMSIntent(message: String, smsToNumber: String): Intent { val uri = Uri.parse("smsto:$smsToNumber") val intent = Intent(Intent.ACTION_SENDTO).apply { data = uri diff --git a/commons/src/main/java/org/dhis2/commons/ActivityResultObserver.kt b/commons/src/main/java/org/dhis2/commons/ActivityResultObserver.kt index c9aa3fb309..6b78ef370a 100644 --- a/commons/src/main/java/org/dhis2/commons/ActivityResultObserver.kt +++ b/commons/src/main/java/org/dhis2/commons/ActivityResultObserver.kt @@ -6,7 +6,7 @@ interface ActivityResultObserver { fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) fun onRequestPermissionsResult( requestCode: Int, - permissions: Array, + permissions: Array, grantResults: IntArray, ) } diff --git a/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/IndicatorViewHolder.kt b/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/IndicatorViewHolder.kt index 272e71ee5b..37e0c997ba 100644 --- a/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/IndicatorViewHolder.kt +++ b/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/IndicatorViewHolder.kt @@ -7,7 +7,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.size -import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material3.ripple import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -40,7 +40,7 @@ class IndicatorViewHolder( if (programIndicatorModel.programIndicator?.description() != null) { Modifier.clickable( interactionSource = remember { MutableInteractionSource() }, - indication = rememberRipple(), + indication = ripple(), onClick = { showDescription(programIndicatorModel.programIndicator) }, ) } else { @@ -60,7 +60,7 @@ class IndicatorViewHolder( if (programIndicatorModel.programIndicator?.description() != null) { Modifier.clickable( interactionSource = remember { MutableInteractionSource() }, - indication = rememberRipple(), + indication = ripple(), onClick = { showDescription(programIndicatorModel.programIndicator) }, ) } else { diff --git a/form/src/main/java/org/dhis2/form/ui/FormView.kt b/form/src/main/java/org/dhis2/form/ui/FormView.kt index cd7e80ae99..7d03e85799 100644 --- a/form/src/main/java/org/dhis2/form/ui/FormView.kt +++ b/form/src/main/java/org/dhis2/form/ui/FormView.kt @@ -148,7 +148,7 @@ class FormView : Fragment() { override fun onRequestPermissionsResult( requestCode: Int, - permissions: Array, + permissions: Array, grantResults: IntArray, ) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3bf9d733cf..8a742d8d5a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,13 @@ [versions] -sdk = "34" +sdk = "35" minSdk = "21" vCode = "138" vName = "3.1.1" gradle = "8.7.2" -kotlin = '2.0.20' +kotlin = '2.0.21' hilt = '2.47' jacoco = '0.8.10' -designSystem = "0.4.1-20241212.083942-7" +designSystem = "0.4.1-SNAPSHOT" dhis2sdk = "1.11.1-SNAPSHOT" ruleEngine = "3.2.0" expressionParser = "1.1.0" diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/base/BaseActivity.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/base/BaseActivity.kt index a278d1ec97..be03eec03e 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/base/BaseActivity.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/base/BaseActivity.kt @@ -180,7 +180,7 @@ abstract class BaseActivity : AppCompatActivity() { override fun onRequestPermissionsResult( requestCode: Int, - permissions: Array, + permissions: Array, grantResults: IntArray, ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults)