diff --git a/app/src/main/java/org/dhis2/usescases/crash/CrashActivity.kt b/app/src/main/java/org/dhis2/usescases/crash/CrashActivity.kt index 00b07f1b59..93b26678a9 100644 --- a/app/src/main/java/org/dhis2/usescases/crash/CrashActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/crash/CrashActivity.kt @@ -40,12 +40,12 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import cat.ereza.customactivityoncrash.CustomActivityOnCrash import cat.ereza.customactivityoncrash.config.CaocConfig -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.BuildConfig import org.dhis2.R import org.hisp.dhis.mobile.ui.designsystem.component.Button import org.hisp.dhis.mobile.ui.designsystem.component.ButtonStyle import org.hisp.dhis.mobile.ui.designsystem.component.ColorStyle +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import java.text.SimpleDateFormat import java.util.Date import java.util.Locale @@ -61,7 +61,7 @@ class CrashActivity : AppCompatActivity() { return } setContent { - MdcTheme { + DHIS2Theme { Scaffold( floatingActionButton = { CrashGoBackButton { diff --git a/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/dataSetSection/DataSetSectionFragment.kt b/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/dataSetSection/DataSetSectionFragment.kt index 507b06c525..69a1db0003 100644 --- a/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/dataSetSection/DataSetSectionFragment.kt +++ b/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/dataSetSection/DataSetSectionFragment.kt @@ -8,7 +8,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.DatePicker -import androidx.compose.material.MaterialTheme +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -19,7 +19,6 @@ import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.unit.dp -import com.google.android.material.composethemeadapter.MdcTheme import com.google.android.material.timepicker.MaterialTimePicker import com.google.android.material.timepicker.TimeFormat import org.dhis2.R @@ -55,6 +54,7 @@ import org.hisp.dhis.android.core.common.FeatureType import org.hisp.dhis.android.core.common.ValueTypeRenderingType import org.hisp.dhis.android.core.dataelement.DataElement import org.hisp.dhis.android.core.organisationunit.OrganisationUnit +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import java.text.SimpleDateFormat import java.util.Calendar import java.util.Date @@ -106,7 +106,7 @@ class DataSetSectionFragment : FragmentGlobalAbstract(), DataValueContract.View return ComposeView(requireContext()).apply { setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setContent { - MdcTheme { + DHIS2Theme { val localDensity = LocalDensity.current val conf = LocalConfiguration.current val tableConfState by presenterFragment.currentTableConfState().collectAsState() @@ -191,9 +191,9 @@ class DataSetSectionFragment : FragmentGlobalAbstract(), DataValueContract.View TableTheme( tableColors = TableColors( - primary = MaterialTheme.colors.primary, - primaryLight = MaterialTheme.colors.primary.copy(alpha = 0.2f), - disabledSelectedBackground = MaterialTheme.colors.primary.copy( + primary = MaterialTheme.colorScheme.primary, + primaryLight = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f), + disabledSelectedBackground = MaterialTheme.colorScheme.primary.copy( alpha = 0.5f, ), ), diff --git a/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/ui/EventDetailsViewBindings.kt b/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/ui/EventDetailsViewBindings.kt index a740d4c70d..cf0e092ff4 100644 --- a/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/ui/EventDetailsViewBindings.kt +++ b/app/src/main/java/org/dhis2/usescases/eventsWithoutRegistration/eventDetails/ui/EventDetailsViewBindings.kt @@ -6,7 +6,7 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.databinding.BindingAdapter -import com.google.android.material.composethemeadapter.MdcTheme +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme @ExperimentalAnimationApi @BindingAdapter("setReopen") @@ -15,7 +15,7 @@ fun ComposeView.setReopenButton(viewModel: EventDetailsViewModel) { setViewCompositionStrategy( ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed, ) - MdcTheme { + DHIS2Theme { val eventDetail by viewModel.eventDetails.collectAsState() ReopenButton(eventDetail.canReopen) { viewModel.onReopenClick() } } diff --git a/app/src/main/java/org/dhis2/usescases/login/LoginActivity.kt b/app/src/main/java/org/dhis2/usescases/login/LoginActivity.kt index a1570e4382..cbb3c97114 100644 --- a/app/src/main/java/org/dhis2/usescases/login/LoginActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/login/LoginActivity.kt @@ -24,7 +24,6 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.databinding.DataBindingUtil -import com.google.android.material.composethemeadapter.MdcTheme import com.google.gson.Gson import com.google.gson.reflect.TypeToken import okhttp3.HttpUrl.Companion.toHttpUrlOrNull @@ -64,6 +63,7 @@ import org.dhis2.utils.analytics.FORGOT_CODE import org.dhis2.utils.session.PIN_DIALOG_TAG import org.dhis2.utils.session.PinDialog import org.hisp.dhis.android.core.user.openid.IntentWithRequestCode +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import timber.log.Timber import java.io.BufferedReader import java.io.File @@ -202,7 +202,7 @@ class LoginActivity : ActivityGlobalAbstract(), LoginContracts.View { binding.topbar.setContent { val displayMoreActions by presenter.displayMoreActions().observeAsState(true) - MdcTheme { + DHIS2Theme { LoginTopBar( version = buildInfo(), displayMoreActions = displayMoreActions, diff --git a/app/src/main/java/org/dhis2/usescases/login/accounts/AccountsActivity.kt b/app/src/main/java/org/dhis2/usescases/login/accounts/AccountsActivity.kt index cca1514537..4fa24a8447 100644 --- a/app/src/main/java/org/dhis2/usescases/login/accounts/AccountsActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/login/accounts/AccountsActivity.kt @@ -8,13 +8,13 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.runtime.livedata.observeAsState -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.bindings.app import org.dhis2.commons.resources.ColorUtils import org.dhis2.commons.resources.ResourceManager import org.dhis2.usescases.general.ActivityGlobalAbstract import org.dhis2.usescases.login.LoginActivity import org.dhis2.usescases.login.accounts.ui.AccountsScreen +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import timber.log.Timber import java.io.File import java.io.FileOutputStream @@ -63,7 +63,7 @@ class AccountsActivity : ActivityGlobalAbstract() { app().serverComponent()?.plus(AccountsModule())?.inject(this) setContent { - MdcTheme { + DHIS2Theme { val accounts = viewModel.accounts.observeAsState(listOf()) AccountsScreen( accounts = accounts.value, diff --git a/app/src/main/java/org/dhis2/usescases/login/accounts/ui/AccountsScreen.kt b/app/src/main/java/org/dhis2/usescases/login/accounts/ui/AccountsScreen.kt index fabcf741ae..473b4f5411 100644 --- a/app/src/main/java/org/dhis2/usescases/login/accounts/ui/AccountsScreen.kt +++ b/app/src/main/java/org/dhis2/usescases/login/accounts/ui/AccountsScreen.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Button import androidx.compose.material.ButtonDefaults import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -45,60 +44,58 @@ fun AccountsScreen( onAddAccountClicked: () -> Unit, onImportDatabase: () -> Unit, ) { - MaterialTheme { + Column( + Modifier + .fillMaxWidth() + .background(colorResource(id = R.color.colorPrimary)), + ) { + LoginTopBar( + version = LocalContext.current.buildInfo(), + onImportDatabase = onImportDatabase, + ) + Column( - Modifier - .fillMaxWidth() - .background(colorResource(id = R.color.colorPrimary)), + verticalArrangement = Arrangement.SpaceBetween, + modifier = Modifier + .fillMaxHeight() + .clip(RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp)) + .background(Color.White), ) { - LoginTopBar( - version = LocalContext.current.buildInfo(), - onImportDatabase = onImportDatabase, - ) - - Column( - verticalArrangement = Arrangement.SpaceBetween, - modifier = Modifier - .fillMaxHeight() - .clip(RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp)) - .background(Color.White), + LazyColumn( + Modifier + .weight(1f) + .padding(top = 16.dp), ) { - LazyColumn( - Modifier - .weight(1f) - .padding(top = 16.dp), - ) { - items(accounts) { - AccountItem( - Modifier.padding(horizontal = 16.dp, vertical = 8.dp), - it, - onAccountClicked, - ) - } + items(accounts) { + AccountItem( + Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + it, + onAccountClicked, + ) } - Column(Modifier.padding(16.dp)) { - Button( - modifier = Modifier - .fillMaxWidth(), - shape = RoundedCornerShape(8.dp), - colors = ButtonDefaults.buttonColors( - backgroundColor = colorResource(id = R.color.colorPrimary), - contentColor = Color.White, - ), - elevation = ButtonDefaults.elevation( - defaultElevation = 5.dp, - pressedElevation = 15.dp, - disabledElevation = 0.dp, + } + Column(Modifier.padding(16.dp)) { + Button( + modifier = Modifier + .fillMaxWidth(), + shape = RoundedCornerShape(8.dp), + colors = ButtonDefaults.buttonColors( + backgroundColor = colorResource(id = R.color.colorPrimary), + contentColor = Color.White, + ), + elevation = ButtonDefaults.elevation( + defaultElevation = 5.dp, + pressedElevation = 15.dp, + disabledElevation = 0.dp, + ), + onClick = { onAddAccountClicked() }, + ) { + Text( + text = stringResource(R.string.add_accout).toUpperCase(Locale.current), + fontFamily = FontFamily( + Font(R.font.rubik_regular, FontWeight.Medium), ), - onClick = { onAddAccountClicked() }, - ) { - Text( - text = stringResource(R.string.add_accout).toUpperCase(Locale.current), - fontFamily = FontFamily( - Font(R.font.rubik_regular, FontWeight.Medium), - ), - ) - } + ) } } } 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 0e0bf01898..d07480b92a 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 @@ -14,10 +14,10 @@ import androidx.compose.material.DropdownMenu import androidx.compose.material.DropdownMenuItem import androidx.compose.material.Icon import androidx.compose.material.IconButton -import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.MoreVert +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -52,7 +52,7 @@ fun LoginTopBar( modifier = Modifier .fillMaxWidth() .height(80.dp) - .background(MaterialTheme.colors.primary), + .background(MaterialTheme.colorScheme.primary), ) { val (logoLayout, versionLabel) = createRefs() @@ -90,7 +90,7 @@ fun LoginTopBar( Icon( imageVector = Icons.Filled.MoreVert, contentDescription = "More options", - tint = MaterialTheme.colors.onPrimary, + tint = MaterialTheme.colorScheme.onPrimary, ) } @@ -110,7 +110,7 @@ fun LoginTopBar( Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_import_db), contentDescription = "Import database", - tint = MaterialTheme.colors.primary, + tint = MaterialTheme.colorScheme.primary, ) Text( diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchJavaToCompose.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchJavaToCompose.kt index 63bfae26bd..687c32c375 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchJavaToCompose.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchJavaToCompose.kt @@ -7,8 +7,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.LocalConfiguration -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.usescases.searchTrackEntity.ui.WrappedSearchButton +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme @ExperimentalAnimationApi fun ComposeView?.setLandscapeOpenSearchButton( @@ -16,7 +16,7 @@ fun ComposeView?.setLandscapeOpenSearchButton( onClick: () -> Unit, ) { this?.setContent { - MdcTheme { + DHIS2Theme { val screenState by searchTEIViewModel.screenState.observeAsState() val teTypeName by searchTEIViewModel.teTypeName.observeAsState() diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchResultHolder.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchResultHolder.kt index e1395e63e8..84f635b82e 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchResultHolder.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/listView/SearchResultHolder.kt @@ -3,10 +3,10 @@ package org.dhis2.usescases.searchTrackEntity.listView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.core.view.updateLayoutParams import androidx.recyclerview.widget.RecyclerView -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.bindings.dp import org.dhis2.databinding.ResultSearchListBinding import org.dhis2.usescases.searchTrackEntity.ui.SearchResultUi +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme class SearchResultHolder( val binding: ResultSearchListBinding, @@ -27,7 +27,7 @@ class SearchResultHolder( } } }.setContent { - MdcTheme { + DHIS2Theme { SearchResultUi( searchResult = item, onSearchOutsideClick = onSearchOutsideProgram, diff --git a/app/src/main/java/org/dhis2/usescases/troubleshooting/TroubleshootingFragment.kt b/app/src/main/java/org/dhis2/usescases/troubleshooting/TroubleshootingFragment.kt index 43e0405df3..ccadef0b34 100644 --- a/app/src/main/java/org/dhis2/usescases/troubleshooting/TroubleshootingFragment.kt +++ b/app/src/main/java/org/dhis2/usescases/troubleshooting/TroubleshootingFragment.kt @@ -11,11 +11,11 @@ import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.fragment.app.viewModels -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.usescases.general.FragmentGlobalAbstract import org.dhis2.usescases.main.MainActivity import org.dhis2.usescases.main.MainNavigator import org.dhis2.usescases.troubleshooting.ui.TroubleshootingScreen +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import javax.inject.Inject const val OPEN_LANGUAGE_SECTION = "OPEN_LANGUAGE_SECTION" @@ -62,7 +62,7 @@ class TroubleshootingFragment : FragmentGlobalAbstract() { setViewCompositionStrategy( ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed, ) - MdcTheme { + DHIS2Theme { TroubleshootingScreen(troubleshootingViewModel) { refreshScreenLanguageChange() } diff --git a/commons/build.gradle.kts b/commons/build.gradle.kts index 546f96cceb..95de51b8b8 100644 --- a/commons/build.gradle.kts +++ b/commons/build.gradle.kts @@ -99,7 +99,6 @@ dependencies { api(libs.google.gson) api(libs.dagger) kapt(libs.dagger.compiler) - api(libs.google.material.themeadapter) api(libs.barcodeScanner.zxing) api(libs.rx.java) api(libs.rx.android) diff --git a/commons/src/main/java/org/dhis2/commons/bindings/TEICardExtensions.kt b/commons/src/main/java/org/dhis2/commons/bindings/TEICardExtensions.kt index 2d781401f1..e7084c57d0 100644 --- a/commons/src/main/java/org/dhis2/commons/bindings/TEICardExtensions.kt +++ b/commons/src/main/java/org/dhis2/commons/bindings/TEICardExtensions.kt @@ -20,7 +20,6 @@ import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.unit.Dp import androidx.core.content.res.ResourcesCompat import androidx.core.graphics.drawable.DrawableCompat -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.commons.R import org.dhis2.commons.data.EnrollmentIconData import org.dhis2.commons.databinding.ItemFieldValueBinding @@ -33,6 +32,7 @@ import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.EnrollmentStatus import org.hisp.dhis.android.core.program.Program import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import timber.log.Timber import java.util.Date @@ -85,7 +85,7 @@ fun List.getEnrollmentIconsData( fun List.paintAllEnrollmentIcons(parent: ComposeView) { parent.apply { setContent { - MdcTheme { + DHIS2Theme { Row( horizontalArrangement = spacedBy(Dp(4f)), verticalAlignment = Alignment.CenterVertically, diff --git a/compose-table/build.gradle.kts b/compose-table/build.gradle.kts index 0d8159c902..af83802cbc 100644 --- a/compose-table/build.gradle.kts +++ b/compose-table/build.gradle.kts @@ -55,4 +55,5 @@ dependencies { testImplementation(libs.bundles.table.test) androidTestImplementation(libs.bundles.table.androidTest) implementation(libs.dhis2.mobile.designsystem) + implementation(libs.androidx.material3) } diff --git a/compose-table/src/androidTest/java/org/dhis2/composetable/TableRobot.kt b/compose-table/src/androidTest/java/org/dhis2/composetable/TableRobot.kt index 06424d9d2e..ced877d50f 100644 --- a/compose-table/src/androidTest/java/org/dhis2/composetable/TableRobot.kt +++ b/compose-table/src/androidTest/java/org/dhis2/composetable/TableRobot.kt @@ -1,7 +1,7 @@ package org.dhis2.composetable import androidx.annotation.DrawableRes -import androidx.compose.material.MaterialTheme +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -103,7 +103,7 @@ class TableRobot( mutableStateOf(TableSelection.Unselected()) } TableTheme( - tableColors = TableColors().copy(primary = MaterialTheme.colors.primary), + tableColors = TableColors().copy(primary = MaterialTheme.colorScheme.primary), tableConfiguration = TableConfiguration(headerActionsEnabled = false), tableResizeActions = object : TableResizeActions {} ) { @@ -140,7 +140,7 @@ class TableRobot( keyboardHelper.view = LocalView.current var model by remember { mutableStateOf(screenState) } TableTheme( - tableColors = TableColors().copy(primary = MaterialTheme.colors.primary), + tableColors = TableColors().copy(primary = MaterialTheme.colorScheme.primary), tableConfiguration = tableConfiguration, tableResizeActions = object : TableResizeActions {} ) { @@ -187,7 +187,7 @@ class TableRobot( val model by remember { mutableStateOf(screenState) } TableTheme( - tableColors = TableColors().copy(primary = MaterialTheme.colors.primary), + tableColors = TableColors().copy(primary = MaterialTheme.colorScheme.primary), tableConfiguration = TableConfiguration(), tableResizeActions = object : TableResizeActions {} ) { diff --git a/compose-table/src/main/java/org/dhis2/composetable/ui/TableTheme.kt b/compose-table/src/main/java/org/dhis2/composetable/ui/TableTheme.kt index 6e3af046c2..d8a6b758e7 100644 --- a/compose-table/src/main/java/org/dhis2/composetable/ui/TableTheme.kt +++ b/compose-table/src/main/java/org/dhis2/composetable/ui/TableTheme.kt @@ -1,6 +1,6 @@ package org.dhis2.composetable.ui -import androidx.compose.material.MaterialTheme +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import org.dhis2.composetable.actions.DefaultValidator diff --git a/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/mappers/GraphToTable.kt b/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/mappers/GraphToTable.kt index efe1659177..19c7950da7 100644 --- a/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/mappers/GraphToTable.kt +++ b/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/mappers/GraphToTable.kt @@ -4,8 +4,8 @@ import android.content.res.Configuration import android.view.View import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.material.MaterialTheme import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue @@ -24,7 +24,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.google.android.material.composethemeadapter.MdcTheme import dhis2.org.R import dhis2.org.analytics.charts.data.ChartType import dhis2.org.analytics.charts.data.Graph @@ -48,6 +47,7 @@ import org.dhis2.composetable.ui.TableSelection import org.dhis2.composetable.ui.TableTheme import org.dhis2.composetable.ui.compositions.LocalInteraction import org.hisp.dhis.android.core.arch.helpers.DateUtils +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor import kotlin.math.roundToInt @@ -76,7 +76,7 @@ class GraphToTable { dimensionsForLinelisting(localDensity, conf) } - return MdcTheme { + return DHIS2Theme { var dimensions by remember { mutableStateOf( tableDimensions, @@ -123,8 +123,8 @@ class GraphToTable { TableTheme( tableColors = TableColors( - primary = MaterialTheme.colors.primary, - primaryLight = MaterialTheme.colors.primary.copy(alpha = 0.2f), + primary = MaterialTheme.colorScheme.primary, + primaryLight = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f), disabledCellText = TableTheme.colors.cellText, disabledCellBackground = TableTheme.colors.tableBackground, ), diff --git a/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/ChartViewHolder.kt b/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/ChartViewHolder.kt index 19a0a76105..afdc76eb62 100644 --- a/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/ChartViewHolder.kt +++ b/dhis_android_analytics/src/main/java/dhis2/org/analytics/charts/ui/ChartViewHolder.kt @@ -7,11 +7,11 @@ import androidx.databinding.Observable import androidx.recyclerview.widget.RecyclerView import androidx.transition.Slide import androidx.transition.TransitionManager -import com.google.android.material.composethemeadapter.MdcTheme import dhis2.org.analytics.charts.data.ChartType import dhis2.org.analytics.charts.data.toChartBuilder import dhis2.org.databinding.ItemChartBinding import org.hisp.dhis.android.core.common.RelativePeriod +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme class ChartViewHolder( val binding: ItemChartBinding, @@ -74,7 +74,7 @@ class ChartViewHolder( private fun loadComposeChart(chart: ChartModel, visible: Boolean = true) { binding.composeChart.setContent { - MdcTheme { + DHIS2Theme { if (visible) { binding.chartContainer.removeAllViews() chart.graph.toChartBuilder() diff --git a/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialog.kt b/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialog.kt index 39411fe4b3..10b8fe0609 100644 --- a/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialog.kt +++ b/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialog.kt @@ -11,11 +11,11 @@ import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.fragment.app.DialogFragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.form.di.Injector import org.dhis2.form.model.FieldUiModel import org.dhis2.form.model.OptionSetDialogViewModel import org.dhis2.form.model.OptionSetDialogViewModelFactory +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme const val TAG = "OptionSetDialog" @@ -50,7 +50,7 @@ class OptionSetDialog( ViewCompositionStrategy.DisposeOnDetachedFromWindow, ) setContent { - MdcTheme { + DHIS2Theme { OptionSetDialogScreen( viewModel, onCancelClick = { dismiss() }, diff --git a/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialogUi.kt b/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialogUi.kt index 8588dc0986..0733b5fd2a 100644 --- a/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialogUi.kt +++ b/form/src/main/java/org/dhis2/form/ui/dialog/OptionSetDialogUi.kt @@ -22,11 +22,11 @@ import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.Divider import androidx.compose.material.Icon import androidx.compose.material.LocalTextStyle -import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Clear import androidx.compose.material.icons.filled.Search +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState @@ -131,7 +131,7 @@ private fun SearchBar( modifier = Modifier .border( width = 2.dp, - color = MaterialTheme.colors.primary, + color = MaterialTheme.colorScheme.primary, shape = RoundedCornerShape(16.dp), ) .padding(horizontal = 12.dp), @@ -140,7 +140,7 @@ private fun SearchBar( Icon( imageVector = Icons.Filled.Search, contentDescription = "", - tint = MaterialTheme.colors.primary, + tint = MaterialTheme.colorScheme.primary, ) Spacer(modifier = Modifier.size(8.dp)) Box(Modifier.weight(1f)) { @@ -148,7 +148,7 @@ private fun SearchBar( Text( text = stringResource(id = R.string.search), style = LocalTextStyle.current.copy( - color = MaterialTheme.colors.onSurface.copy(alpha = 0.3f), + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f), fontSize = 16.sp, ), ) @@ -162,7 +162,7 @@ private fun SearchBar( Icon( imageVector = Icons.Filled.Clear, contentDescription = "", - tint = MaterialTheme.colors.primary, + tint = MaterialTheme.colorScheme.primary, ) }, ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 089a5d6e6b..b617e8ee68 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,7 +28,6 @@ recyclerview = "1.3.1" compose = "1.5.4" composePaging = "3.3.0" composeLifecycle = "2.8.1" -composeTheme = "1.2.1" composeConstraintLayout = "1.0.1" activityCompose = "1.8.2" viewModelCompose = "2.7.0" @@ -135,7 +134,6 @@ google-auth = { group = "com.google.android.gms", name = "play-services-auth", v google-auth-apiphone = { group = "com.google.android.gms", name = "play-services-auth-api-phone", version = "18.0.1" } google-autoValue = { group = "com.google.auto.value", name = "auto-value", version.ref = "autovalue" } #TODO: this should be removed google-material = { group = "com.google.android.material", name = "material", version.ref = "material" } -google-material-themeadapter = { group = "com.google.android.material", name = "compose-theme-adapter", version.ref = "composeTheme" } google-material3-themeadapter = { group = "com.google.accompanist", name = "accompanist-themeadapter-material3", version.ref = "themeAdapter" } google-gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } network-okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } @@ -208,7 +206,7 @@ deprecated-autoValueParcel = { group = "com.ryanharter.auto.value", name = "auto kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } [bundles] uicomponents-implementation = ["androidx-coreKtx", "androidx-material3", "androidx-material3-window","androidx-material3-adaptative-android", "androidx-material3-adaptative-android", "google-material", "lottie-compose", "dhis2-mobile-designsystem"] -uicomponents-api = ["dhis2-mobile-designsystem", "androidx-compose-constraintlayout", "androidx-compose-preview", "androidx-compose-ui", "google-material-themeadapter", "google-material3-themeadapter"] +uicomponents-api = ["dhis2-mobile-designsystem", "androidx-compose-constraintlayout", "androidx-compose-preview", "androidx-compose-ui", "google-material3-themeadapter"] uicomponents-debugapi = ["androidx-compose-uitooling"] uicomponents-androidtest = ["test-junit-ext"] analytics-implementation = ["androidx-cardview", "androidx-constraintlayout"] diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/HomeActivity.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/HomeActivity.kt index d4e85b7d86..a65dab09ee 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/HomeActivity.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/HomeActivity.kt @@ -18,7 +18,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.res.colorResource -import com.google.android.material.composethemeadapter.MdcTheme import com.journeyapps.barcodescanner.ScanContract import com.journeyapps.barcodescanner.ScanIntentResult import com.journeyapps.barcodescanner.ScanOptions @@ -38,6 +37,7 @@ import org.dhis2.commons.sync.OnSyncNavigationListener import org.dhis2.commons.sync.SyncContext import org.dhis2.commons.sync.SyncDialog import org.dhis2.commons.sync.SyncStatusItem +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme @AndroidEntryPoint class HomeActivity : AppCompatActivity() { @@ -66,7 +66,7 @@ class HomeActivity : AppCompatActivity() { manageStockViewModel.setHelperText(helperText) updateTheme(settingsUiState.selectedTransactionItem.type) manageStockViewModel.setThemeColor(Color(colorResource(themeColor).toArgb())) - MdcTheme { + DHIS2Theme { Surface( modifier = Modifier.fillMaxSize(), color = Color(colorResource(themeColor).toArgb()), diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/BackdropComponent.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/BackdropComponent.kt index 215d3ef1e4..7584fcdc45 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/BackdropComponent.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/BackdropComponent.kt @@ -7,11 +7,11 @@ import androidx.activity.result.ActivityResultLauncher import androidx.compose.material.BackdropScaffold import androidx.compose.material.BackdropValue import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.MaterialTheme import androidx.compose.material.ScaffoldState import androidx.compose.material.SnackbarDuration import androidx.compose.material.SnackbarResult import androidx.compose.material.rememberBackdropScaffoldState +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState @@ -162,11 +162,11 @@ private fun getScrimColor(settingsUiState: SettingsUiState): Color { if (settingsUiState.hasFacilitySelected() && settingsUiState.hasDestinationSelected()) { Color.Unspecified } else { - MaterialTheme.colors.surface.copy(alpha = 0.60f) + MaterialTheme.colorScheme.surface.copy(alpha = 0.60f) } } else { if (!settingsUiState.hasFacilitySelected()) { - MaterialTheme.colors.surface.copy(alpha = 0.60f) + MaterialTheme.colorScheme.surface.copy(alpha = 0.60f) } else { Color.Unspecified } diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/CompletionDialog.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/CompletionDialog.kt index 98173f2edb..d6af638611 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/CompletionDialog.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/CompletionDialog.kt @@ -9,9 +9,9 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CornerSize import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme import androidx.compose.material.Snackbar import androidx.compose.material.Text +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/DropdownComponents.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/DropdownComponents.kt index 71dce8436f..e5121b3a07 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/DropdownComponents.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/DropdownComponents.kt @@ -18,10 +18,10 @@ import androidx.compose.material.DropdownMenu import androidx.compose.material.DropdownMenuItem import androidx.compose.material.Icon import androidx.compose.material.LocalTextStyle -import androidx.compose.material.MaterialTheme import androidx.compose.material.OutlinedTextField import androidx.compose.material.Text import androidx.compose.material.TextFieldDefaults +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/Toolbar.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/Toolbar.kt index df7fd63293..97e79a0401 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/Toolbar.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/home/screens/components/Toolbar.kt @@ -10,12 +10,12 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.BackdropScaffoldState import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme import androidx.compose.material.ScaffoldState import androidx.compose.material.Text import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment @@ -62,7 +62,7 @@ fun Toolbar( text = capitalizeText(title).ifBlank { stringResource(R.string.title_activity_home) }, - style = MaterialTheme.typography.subtitle1, + style = MaterialTheme.typography.titleMedium, maxLines = 1, fontSize = 17.sp, lineHeight = 24.sp, @@ -73,7 +73,7 @@ fun Toolbar( ) { Text( text = from, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, overflow = TextOverflow.Ellipsis, maxLines = 1, fontSize = 12.sp, @@ -153,7 +153,7 @@ fun ColumnScope.ProvideToolBarIcons(to: String?, hasFacilitySelected: Boolean, h ) Text( text = to, - style = MaterialTheme.typography.subtitle2, + style = MaterialTheme.typography.titleSmall, overflow = TextOverflow.Ellipsis, maxLines = 1, fontSize = 12.sp, @@ -193,7 +193,7 @@ fun AnalyticsTopBar( text = capitalizeText(title).ifBlank { stringResource(R.string.title_activity_home) }, - style = MaterialTheme.typography.subtitle1, + style = MaterialTheme.typography.titleMedium, maxLines = 1, fontSize = 17.sp, lineHeight = 24.sp, diff --git a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/managestock/components/ManageStockTable.kt b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/managestock/components/ManageStockTable.kt index a5bdaedb3e..8f134489bd 100644 --- a/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/managestock/components/ManageStockTable.kt +++ b/stock-usecase/src/main/java/org/dhis2/android/rtsm/ui/managestock/components/ManageStockTable.kt @@ -21,7 +21,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.android.rtsm.R import org.dhis2.android.rtsm.ui.home.model.DataEntryStep import org.dhis2.android.rtsm.ui.managestock.ManageStockViewModel @@ -33,6 +32,7 @@ import org.dhis2.composetable.ui.TableConfiguration import org.dhis2.composetable.ui.TableDimensions import org.dhis2.composetable.ui.TableTheme import org.dhis2.composetable.ui.semantics.MAX_CELL_WIDTH_SPACE +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import kotlin.math.roundToInt @Composable @@ -47,7 +47,7 @@ fun ManageStockTable( ), ) - MdcTheme { + DHIS2Theme { if (viewModel.hasData.collectAsState().value) { val localDensity = LocalDensity.current val conf = LocalConfiguration.current diff --git a/ui-components/src/main/java/org/dhis2/ui/MetadataIcon.kt b/ui-components/src/main/java/org/dhis2/ui/MetadataIcon.kt index 0f1e479c6e..f5f44cce73 100644 --- a/ui-components/src/main/java/org/dhis2/ui/MetadataIcon.kt +++ b/ui-components/src/main/java/org/dhis2/ui/MetadataIcon.kt @@ -21,12 +21,12 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.unit.dp -import com.google.android.material.composethemeadapter.MdcTheme import org.dhis2.ui.theme.programColorDark import org.dhis2.ui.theme.programColorLight import org.hisp.dhis.mobile.ui.designsystem.component.ImageCardData import org.hisp.dhis.mobile.ui.designsystem.component.MetadataAvatar import org.hisp.dhis.mobile.ui.designsystem.component.MetadataAvatarSize +import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme @Composable fun MetadataIcon( @@ -79,7 +79,7 @@ fun ComposeView.setUpMetadataIcon( handleComposeDispose() } setContent { - MdcTheme { + DHIS2Theme { MetadataIcon(metadataIconData = metadataIconData) } }