Skip to content

Commit 71df079

Browse files
Update gradle
1 parent c13c478 commit 71df079

File tree

4 files changed

+6
-56
lines changed

4 files changed

+6
-56
lines changed

Tutorial1-1Basics/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ dependencies {
4242

4343
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
4444
implementation 'androidx.core:core-ktx:1.7.0'
45-
implementation 'androidx.appcompat:appcompat:1.4.0'
46-
implementation 'com.google.android.material:material:1.4.0'
45+
implementation 'androidx.appcompat:appcompat:1.4.1'
46+
implementation 'com.google.android.material:material:1.5.0'
4747

4848
// Lifecycle
4949
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
@@ -63,7 +63,7 @@ dependencies {
6363
// Coil
6464
implementation("io.coil-kt:coil-compose:1.4.0")
6565

66-
def accompanist_version = "0.22.0-rc"
66+
def accompanist_version = "0.24.0-alpha"
6767
// Accompanist
6868
implementation "com.google.accompanist:accompanist-insets:$accompanist_version"
6969
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"

Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/chapter3_layout/Tutorial3_1CustomModifier.kt

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private fun TutorialContent() {
104104
text = "Custom Padding",
105105
modifier = Modifier
106106
.background(Color(0xFF8BC34A))
107-
.customPadding(all = 4.dp)
107+
.paddingNoOffsetNoConstrain(all = 4.dp)
108108
)
109109

110110
StyleableTutorialText(
@@ -252,56 +252,6 @@ fun Modifier.firstBaselineToTop(
252252
}
253253
)
254254

255-
/**
256-
* This modifier is similar to **padding** modifier
257-
*/
258-
/**
259-
* This modifier is similar to **padding** modifier
260-
*/
261-
@Stable
262-
fun Modifier.customPadding(all: Dp) =
263-
this.then(
264-
PaddingModifier(start = all, top = all, end = all, bottom = all, rtlAware = true)
265-
)
266-
267-
// Implementation detail
268-
private class PaddingModifier(
269-
val start: Dp = 0.dp,
270-
val top: Dp = 0.dp,
271-
val end: Dp = 0.dp,
272-
val bottom: Dp = 0.dp,
273-
val rtlAware: Boolean,
274-
) : LayoutModifier {
275-
276-
override fun MeasureScope.measure(
277-
measurable: Measurable,
278-
constraints: Constraints
279-
): MeasureResult {
280-
281-
val horizontal = start.roundToPx() + end.roundToPx()
282-
val vertical = top.roundToPx() + bottom.roundToPx()
283-
284-
val placeable = measurable.measure(constraints.offset(-horizontal, -vertical))
285-
286-
val width = constraints.constrainWidth(placeable.width + horizontal)
287-
val height = constraints.constrainHeight(placeable.height + vertical)
288-
289-
println(
290-
"😁 PaddingModifier() " +
291-
"horizontal: $horizontal, " +
292-
"vertical: $vertical, placeable width: ${placeable.width}"
293-
)
294-
295-
return layout(width, height) {
296-
if (rtlAware) {
297-
placeable.placeRelative(start.roundToPx(), top.roundToPx())
298-
} else {
299-
placeable.place(start.roundToPx(), top.roundToPx())
300-
}
301-
}
302-
}
303-
}
304-
305255
// let's create you own custom stateful modifier with multiple arguments
306256
fun Modifier.composedBackground(width: Dp, height: Dp, index: Int) = composed(
307257
// pass inspector information for debug

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
}
1313
}
1414
dependencies {
15-
classpath 'com.android.tools.build:gradle:7.0.4'
15+
classpath 'com.android.tools.build:gradle:7.1.0'
1616
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
1717

1818
// NOTE: Do not place your application dependencies here; they belong
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Sun Jan 31 16:00:12 TRT 2021
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)