Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit 5eb5cc1

Browse files
authored
Merge pull request #38 from ricknout/develop
Update Compose to 1.0.0-alpha08
2 parents bb1477b + e0093ab commit 5eb5cc1

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

buildSrc/src/main/java/com/google/android/material/composethemeadapter/dependencies.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ object Versions {
2121
}
2222

2323
object Libs {
24-
const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha15"
24+
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0-alpha01"
2525

2626
const val gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.12.0"
2727

2828
const val mdc = "com.google.android.material:material:1.1.0"
2929

3030
object Kotlin {
31-
const val version = "1.4.10"
31+
const val version = "1.4.20"
3232
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:$version"
3333
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
3434

@@ -47,7 +47,7 @@ object Libs {
4747
val snapshotUrl: String
4848
get() = "https://androidx.dev/snapshots/builds/$snapshot/artifacts/ui/repository/"
4949

50-
private const val version = "1.0.0-alpha07"
50+
private const val version = "1.0.0-alpha08"
5151

5252
const val runtime = "androidx.compose.runtime:runtime:$version"
5353
const val foundation = "androidx.compose.foundation:foundation:${version}"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
distributionBase=GRADLE_USER_HOME
18+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
1819
distributionPath=wrapper/dists
19-
zipStoreBase=GRADLE_USER_HOME
2020
zipStorePath=wrapper/dists
21-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
21+
zipStoreBase=GRADLE_USER_HOME

lib/src/androidTest/java/com/google/android/material/composethemeadapter/MdcThemeTest.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import androidx.compose.foundation.shape.CutCornerShape
2222
import androidx.compose.foundation.shape.RoundedCornerShape
2323
import androidx.compose.material.MaterialTheme
2424
import androidx.compose.ui.geometry.Size
25-
import androidx.compose.ui.platform.ContextAmbient
26-
import androidx.compose.ui.platform.DensityAmbient
25+
import androidx.compose.ui.platform.AmbientContext
26+
import androidx.compose.ui.platform.AmbientDensity
2727
import androidx.compose.ui.res.colorResource
28-
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
28+
import androidx.compose.ui.test.junit4.createAndroidComposeRule
2929
import androidx.compose.ui.text.font.FontFamily
3030
import androidx.compose.ui.text.font.FontWeight
3131
import androidx.compose.ui.text.font.asFontFamily
@@ -36,7 +36,6 @@ import androidx.compose.ui.unit.TextUnit
3636
import androidx.compose.ui.unit.dp
3737
import androidx.compose.ui.unit.em
3838
import androidx.compose.ui.unit.sp
39-
import androidx.test.ext.junit.rules.ActivityScenarioRule
4039
import androidx.test.filters.MediumTest
4140
import com.google.android.material.composethemeadapter.test.R
4241
import org.junit.Assert.assertEquals
@@ -57,10 +56,8 @@ class MdcThemeTest<T : AppCompatActivity>(activityClass: Class<T>) {
5756
fun activities() = listOf(DarkMdcActivity::class.java, LightMdcActivity::class.java)
5857
}
5958

60-
private val activityRule = ActivityScenarioRule(activityClass)
61-
6259
@get:Rule
63-
val composeTestRule = AndroidComposeTestRule(activityRule)
60+
val composeTestRule = createAndroidComposeRule(activityClass)
6461

6562
@Test
6663
fun colors() = composeTestRule.setContent {
@@ -76,7 +73,7 @@ class MdcThemeTest<T : AppCompatActivity>(activityClass: Class<T>) {
7673

7774
// We don't check isSystemInDarkTheme() here since that only checks the system
7875
// dark theme setting: https://issuetracker.google.com/163103826
79-
if (ContextAmbient.current.isInDarkTheme()) {
76+
if (AmbientContext.current.isInDarkTheme()) {
8077
// In dark theme secondaryVariant is ignored and always return secondary
8178
assertEquals(colorResource(R.color.dark_golden_rod), color.secondaryVariant)
8279
} else {
@@ -98,7 +95,7 @@ class MdcThemeTest<T : AppCompatActivity>(activityClass: Class<T>) {
9895
fun shapes() = composeTestRule.setContent {
9996
MdcTheme {
10097
val shapes = MaterialTheme.shapes
101-
val density = DensityAmbient.current
98+
val density = AmbientDensity.current
10299

103100
shapes.small.run {
104101
assertTrue(this is CutCornerShape)
@@ -128,7 +125,7 @@ class MdcThemeTest<T : AppCompatActivity>(activityClass: Class<T>) {
128125
fun type() = composeTestRule.setContent {
129126
MdcTheme {
130127
val typography = MaterialTheme.typography
131-
val density = DensityAmbient.current
128+
val density = AmbientDensity.current
132129

133130
val rubik300 = font(R.font.rubik_300).asFontFamily()
134131
val rubik400 = font(R.font.rubik_400).asFontFamily()

lib/src/main/java/com/google/android/material/composethemeadapter/MdcTheme.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import androidx.compose.material.darkColors
2727
import androidx.compose.material.lightColors
2828
import androidx.compose.runtime.Composable
2929
import androidx.compose.runtime.remember
30-
import androidx.compose.ui.platform.ContextAmbient
30+
import androidx.compose.ui.platform.AmbientContext
3131
import androidx.compose.ui.text.TextStyle
3232
import androidx.compose.ui.unit.Density
3333
import androidx.core.content.res.getResourceIdOrThrow
@@ -55,7 +55,7 @@ import java.lang.reflect.Method
5555
*/
5656
@Composable
5757
fun MdcTheme(
58-
context: Context = ContextAmbient.current,
58+
context: Context = AmbientContext.current,
5959
readColors: Boolean = true,
6060
readTypography: Boolean = true,
6161
readShapes: Boolean = true,

lib/src/main/java/com/google/android/material/composethemeadapter/TypedArrayUtils.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ internal fun textStyleFromTextAppearance(
7474
lineHeight = run {
7575
a.getTextUnitOrNull(R.styleable.ComposeThemeAdapterTextAppearance_lineHeight, density)
7676
?: a.getTextUnitOrNull(R.styleable.ComposeThemeAdapterTextAppearance_android_lineHeight, density)
77-
?: TextUnit.Inherit
77+
?: TextUnit.Unspecified
7878
},
7979
fontFamily = when {
8080
fontFamily != null -> fontFamily.fontFamily
@@ -118,7 +118,7 @@ internal fun textStyleFromTextAppearance(
118118
a.hasValue(R.styleable.ComposeThemeAdapterTextAppearance_android_letterSpacing) -> {
119119
a.getFloat(R.styleable.ComposeThemeAdapterTextAppearance_android_letterSpacing, 0f).em
120120
}
121-
else -> TextUnit.Inherit
121+
else -> TextUnit.Unspecified
122122
}
123123
)
124124
}
@@ -240,7 +240,7 @@ internal data class FontFamilyWithWeight(
240240
internal fun TypedArray.getTextUnit(
241241
index: Int,
242242
density: Density,
243-
fallback: TextUnit = TextUnit.Inherit
243+
fallback: TextUnit = TextUnit.Unspecified
244244
): TextUnit = getTextUnitOrNull(index, density) ?: fallback
245245

246246
/**

sample/src/main/java/com/google/android/material/composethemeadapter/sample/BasicIntegration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fun ComponentsSample() {
9191

9292
FloatingActionButton(
9393
onClick = {},
94-
icon = { Icon(Icons.Default.Favorite) }
94+
content = { Icon(Icons.Default.Favorite) }
9595
)
9696
VerticalSpacer()
9797

0 commit comments

Comments
 (0)