Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Add Migration.kt (#114)
Browse files Browse the repository at this point in the history
* Remove jcenter

* Add Migration.kt to migrate from insetter 0.3
  • Loading branch information
osipxd authored Nov 12, 2021
1 parent 85f2f0c commit c5cf221
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 3 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ buildscript {
repositories {
google()
mavenCentral()
jcenter()
}

dependencies {
Expand Down Expand Up @@ -57,7 +56,6 @@ allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

repositories {
jcenter()
mavenCentral()
}

plugins {
Expand Down
14 changes: 14 additions & 0 deletions library/api/library.api
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public final class dev/chrisbanes/insetter/Insetter$Builder {

public final class dev/chrisbanes/insetter/Insetter$Companion {
public final fun builder ()Ldev/chrisbanes/insetter/Insetter$Builder;
public final fun setEdgeToEdgeSystemUiFlags (Landroid/view/View;Z)V
public static synthetic fun setEdgeToEdgeSystemUiFlags$default (Ldev/chrisbanes/insetter/Insetter$Companion;Landroid/view/View;ZILjava/lang/Object;)V
}

public abstract interface annotation class dev/chrisbanes/insetter/Insetter$ConsumeOptions : java/lang/annotation/Annotation {
Expand Down Expand Up @@ -77,6 +79,18 @@ public final class dev/chrisbanes/insetter/InsetterDslKt {
public abstract interface annotation class dev/chrisbanes/insetter/InsetterDslMarker : java/lang/annotation/Annotation {
}

public final class dev/chrisbanes/insetter/MigrationKt {
public static final fun applySystemWindowInsetsToMargin (Landroid/view/View;ZZ)V
public static final fun applySystemWindowInsetsToMargin (Landroid/view/View;ZZZ)V
public static synthetic fun applySystemWindowInsetsToMargin$default (Landroid/view/View;ZZILjava/lang/Object;)V
public static synthetic fun applySystemWindowInsetsToMargin$default (Landroid/view/View;ZZZILjava/lang/Object;)V
public static final fun applySystemWindowInsetsToPadding (Landroid/view/View;ZZ)V
public static final fun applySystemWindowInsetsToPadding (Landroid/view/View;ZZZ)V
public static synthetic fun applySystemWindowInsetsToPadding$default (Landroid/view/View;ZZILjava/lang/Object;)V
public static synthetic fun applySystemWindowInsetsToPadding$default (Landroid/view/View;ZZZILjava/lang/Object;)V
public static final fun noImpl ()Ljava/lang/Void;
}

public abstract interface class dev/chrisbanes/insetter/OnApplyInsetsListener {
public abstract fun onApplyInsets (Landroid/view/View;Landroidx/core/view/WindowInsetsCompat;Ldev/chrisbanes/insetter/ViewState;)V
}
Expand Down
9 changes: 9 additions & 0 deletions library/src/main/java/dev/chrisbanes/insetter/Insetter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,15 @@ class Insetter private constructor(
fun builder(): Builder = Builder()

internal const val TAG = "Insetter"

@Suppress("NOTHING_TO_INLINE", "DeprecatedCallableAddReplaceWith", "unused", "UNUSED_PARAMETER")
@Deprecated(
level = DeprecationLevel.ERROR,
message = "Use WindowCompat.setDecorFitsSystemWindows(window, false) to enable edge to edge mode",
)
inline fun setEdgeToEdgeSystemUiFlags(view: View, enabled: Boolean = true) {
noImpl()
}
}
}

Expand Down
73 changes: 73 additions & 0 deletions library/src/main/java/dev/chrisbanes/insetter/Migration.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress("unused", "UNUSED_PARAMETER", "NOTHING_TO_INLINE")

package dev.chrisbanes.insetter

import android.view.View

@Deprecated(
level = DeprecationLevel.ERROR,
message = "Use applyInsetter instead",
replaceWith = ReplaceWith(
"applyInsetter { type(statusBars = top, navigationBars = bottom) { padding() } }",
"dev.chrisbanes.insetter.applyInsetter"
)
)
inline fun View.applySystemWindowInsetsToPadding(top: Boolean = false, bottom: Boolean = false) {
noImpl()
}

@Deprecated(
level = DeprecationLevel.ERROR,
message = "Use applyInsetter instead",
replaceWith = ReplaceWith(
"applyInsetter { type(statusBars = top, navigationBars = bottom) { padding() }; consume(consume) }",
"dev.chrisbanes.insetter.applyInsetter"
)
)
inline fun View.applySystemWindowInsetsToPadding(top: Boolean = false, bottom: Boolean = false, consume: Boolean) {
noImpl()
}

@Deprecated(
level = DeprecationLevel.ERROR,
message = "Use applyInsetter instead",
replaceWith = ReplaceWith(
"applyInsetter { type(statusBars = top, navigationBars = bottom) { margin() } }",
"dev.chrisbanes.insetter.applyInsetter"
)
)
inline fun View.applySystemWindowInsetsToMargin(top: Boolean = false, bottom: Boolean = false) {
noImpl()
}

@Deprecated(
level = DeprecationLevel.ERROR,
message = "Use applyInsetter instead",
replaceWith = ReplaceWith(
"applyInsetter { type(statusBars = top, navigationBars = bottom) { margin() }; consume(consume) }",
"dev.chrisbanes.insetter.applyInsetter"
)
)
inline fun View.applySystemWindowInsetsToMargin(top: Boolean = false, bottom: Boolean = false, consume: Boolean) {
noImpl()
}

@PublishedApi
internal inline fun noImpl(): Nothing =
throw UnsupportedOperationException("Not implemented, should not be called")

0 comments on commit c5cf221

Please sign in to comment.