Skip to content

Commit 7401ae5

Browse files
committed
Migrated to M3
Signed-off-by: Arnau Mora Gras <[email protected]>
1 parent 88d028c commit 7401ae5

File tree

5 files changed

+31
-25
lines changed

5 files changed

+31
-25
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ androidx-test-core = { module = "androidx.test:core-ktx", version.ref = "android
2626
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
2727
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-rules" }
2828
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
29-
compose-material = { module = "androidx.compose.material:material" }
29+
compose-material3 = { module = "androidx.compose.material3:material3" }
3030
compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
3131
compose-ui-base = { module = "androidx.compose.ui:ui" }
3232
compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics" }

lib/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ dependencies {
9595
// Jetpack Compose
9696
implementation(libs.androidx.activityCompose)
9797
implementation(platform(libs.compose.bom))
98-
implementation(libs.compose.material)
98+
implementation(libs.compose.material3)
9999
implementation(libs.compose.runtime.livedata)
100100
debugImplementation(libs.compose.ui.tooling)
101101
implementation(libs.compose.ui.toolingPreview)

lib/src/main/java/at/bitfire/cert4android/TrustCertificateActivity.kt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ import androidx.compose.foundation.layout.fillMaxWidth
1919
import androidx.compose.foundation.layout.padding
2020
import androidx.compose.foundation.rememberScrollState
2121
import androidx.compose.foundation.verticalScroll
22-
import androidx.compose.material.Card
23-
import androidx.compose.material.Checkbox
24-
import androidx.compose.material.MaterialTheme
25-
import androidx.compose.material.Scaffold
26-
import androidx.compose.material.SnackbarHost
27-
import androidx.compose.material.SnackbarHostState
28-
import androidx.compose.material.Text
29-
import androidx.compose.material.TextButton
22+
import androidx.compose.material3.Card
23+
import androidx.compose.material3.Checkbox
24+
import androidx.compose.material3.MaterialTheme
25+
import androidx.compose.material3.Scaffold
26+
import androidx.compose.material3.SnackbarHost
27+
import androidx.compose.material3.SnackbarHostState
28+
import androidx.compose.material3.Text
29+
import androidx.compose.material3.TextButton
3030
import androidx.compose.runtime.Composable
3131
import androidx.compose.runtime.LaunchedEffect
3232
import androidx.compose.runtime.getValue
@@ -42,8 +42,6 @@ import androidx.compose.ui.tooling.preview.Preview
4242
import androidx.compose.ui.unit.dp
4343
import androidx.lifecycle.AndroidViewModel
4444
import androidx.lifecycle.viewModelScope
45-
import kotlinx.coroutines.Dispatchers
46-
import kotlinx.coroutines.launch
4745
import java.io.ByteArrayInputStream
4846
import java.security.cert.CertificateFactory
4947
import java.security.cert.CertificateParsingException
@@ -52,6 +50,8 @@ import java.security.spec.MGF1ParameterSpec.SHA1
5250
import java.security.spec.MGF1ParameterSpec.SHA256
5351
import java.text.DateFormat
5452
import java.util.logging.Level
53+
import kotlinx.coroutines.Dispatchers
54+
import kotlinx.coroutines.launch
5555

5656
class TrustCertificateActivity : ComponentActivity() {
5757

@@ -136,7 +136,7 @@ class TrustCertificateActivity : ComponentActivity() {
136136
) {
137137
Text(
138138
text = stringResource(R.string.trust_certificate_unknown_certificate_found),
139-
style = MaterialTheme.typography.body1,
139+
style = MaterialTheme.typography.bodySmall,
140140
modifier = Modifier
141141
.fillMaxWidth()
142142
.padding(bottom = 16.dp)
@@ -149,7 +149,7 @@ class TrustCertificateActivity : ComponentActivity() {
149149

150150
Text(
151151
text = stringResource(R.string.trust_certificate_reset_info),
152-
style = MaterialTheme.typography.body1,
152+
style = MaterialTheme.typography.bodySmall,
153153
modifier = Modifier
154154
.fillMaxWidth()
155155
.padding(top = 16.dp),
@@ -174,7 +174,7 @@ class TrustCertificateActivity : ComponentActivity() {
174174
) {
175175
Text(
176176
text = stringResource(R.string.trust_certificate_x509_certificate_details),
177-
style = MaterialTheme.typography.h5,
177+
style = MaterialTheme.typography.titleMedium,
178178
modifier = Modifier
179179
.fillMaxWidth()
180180
.padding(bottom = 16.dp),
@@ -201,14 +201,14 @@ class TrustCertificateActivity : ComponentActivity() {
201201
if (sha1 != null || sha256 != null) {
202202
Text(
203203
text = stringResource(R.string.trust_certificate_fingerprints).uppercase(),
204-
style = MaterialTheme.typography.body2,
204+
style = MaterialTheme.typography.bodyMedium,
205205
modifier = Modifier.fillMaxWidth(),
206206
)
207207

208208
if (sha1 != null)
209209
Text(
210210
text = sha1,
211-
style = MaterialTheme.typography.body2,
211+
style = MaterialTheme.typography.bodyMedium,
212212
modifier = Modifier
213213
.fillMaxWidth()
214214
.padding(bottom = 16.dp, top = 4.dp),
@@ -217,7 +217,7 @@ class TrustCertificateActivity : ComponentActivity() {
217217
if (sha256 != null)
218218
Text(
219219
text = sha256,
220-
style = MaterialTheme.typography.body2,
220+
style = MaterialTheme.typography.bodyMedium,
221221
modifier = Modifier
222222
.fillMaxWidth()
223223
.padding(bottom = 16.dp, top = 4.dp),
@@ -242,7 +242,7 @@ class TrustCertificateActivity : ComponentActivity() {
242242
}
243243
.weight(1f)
244244
.padding(bottom = 8.dp),
245-
style = MaterialTheme.typography.body2
245+
style = MaterialTheme.typography.bodyMedium
246246
)
247247
}
248248

@@ -274,13 +274,13 @@ class TrustCertificateActivity : ComponentActivity() {
274274
fun InfoPack(@StringRes labelStringRes: Int, text: String) {
275275
Text(
276276
text = stringResource(labelStringRes).uppercase(),
277-
style = MaterialTheme.typography.body2,
277+
style = MaterialTheme.typography.bodyMedium,
278278
modifier = Modifier
279279
.fillMaxWidth(),
280280
)
281281
Text(
282282
text = text,
283-
style = MaterialTheme.typography.body1,
283+
style = MaterialTheme.typography.bodySmall,
284284
modifier = Modifier
285285
.fillMaxWidth()
286286
.padding(bottom = 16.dp),

sample-app/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ dependencies {
5252
implementation(libs.androidx.appcompat)
5353

5454
implementation(libs.androidx.activityCompose)
55-
implementation(libs.compose.material)
55+
implementation(platform(libs.compose.bom))
56+
implementation(libs.compose.material3)
5657
implementation(libs.compose.ui.base)
5758
implementation(libs.compose.ui.graphics)
5859
debugImplementation(libs.compose.ui.toolingPreview)

sample-app/src/main/java/at/bitfire/cert4android/demo/MainActivity.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ import androidx.compose.foundation.layout.Row
1616
import androidx.compose.foundation.layout.padding
1717
import androidx.compose.foundation.rememberScrollState
1818
import androidx.compose.foundation.verticalScroll
19-
import androidx.compose.material.*
19+
import androidx.compose.material3.Button
20+
import androidx.compose.material3.Checkbox
21+
import androidx.compose.material3.MaterialTheme
22+
import androidx.compose.material3.SnackbarHost
23+
import androidx.compose.material3.SnackbarHostState
24+
import androidx.compose.material3.Text
2025
import androidx.compose.runtime.LaunchedEffect
2126
import androidx.compose.runtime.collectAsState
2227
import androidx.compose.runtime.livedata.observeAsState
@@ -30,13 +35,13 @@ import androidx.lifecycle.viewModelScope
3035
import at.bitfire.cert4android.Cert4Android
3136
import at.bitfire.cert4android.CustomCertManager
3237
import at.bitfire.cert4android.CustomCertStore
38+
import java.net.URL
39+
import javax.net.ssl.HttpsURLConnection
3340
import kotlinx.coroutines.Dispatchers
3441
import kotlinx.coroutines.flow.MutableStateFlow
3542
import kotlinx.coroutines.launch
3643
import org.apache.http.conn.ssl.AllowAllHostnameVerifier
3744
import org.apache.http.conn.ssl.StrictHostnameVerifier
38-
import java.net.URL
39-
import javax.net.ssl.HttpsURLConnection
4045

4146
class MainActivity : ComponentActivity() {
4247

0 commit comments

Comments
 (0)