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

Commit

Permalink
Merge pull request #52 from chrisbanes/cb/update-deps
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
chrisbanes authored Apr 27, 2020
2 parents f40a722 + aaf3b7e commit cb07d3c
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 88 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ captures
.idea/caches
.idea/navEditor.xml
.idea/tasks.xml
.idea/tasks.xml
.idea/modules.xml
.idea/compiler.xml
/.idea/jarRepositories.xml
gradle.xml
*.iml

Expand All @@ -24,6 +25,3 @@ gradle.xml
# Do not commit plain-text signing info
release/*.properties
release/*.gpg

# Do not commit firebase config
google-services.json
5 changes: 2 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ buildscript {
}

plugins {
id "com.diffplug.gradle.spotless" version "3.24.3"
id "com.diffplug.gradle.spotless" version "3.28.1"
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
package dev.chrisbanes.insetter.buildsrc

object Versions {
const val ktlint = "0.33.0"
const val ktlint = "0.36.0"
}

object Libs {
// We need to use an old version of AGP since that controls which data-binding version
// we use in dbx. Keeping one stable AGP version behind means we're not forcing people to
// unnecessarily
const val androidGradlePlugin = "com.android.tools.build:gradle:3.4.0"
const val androidGradlePlugin = "com.android.tools.build:gradle:3.5.0"

const val gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.8.0"

Expand All @@ -48,8 +48,8 @@ object Libs {
const val espressoCore = "androidx.test.espresso:espresso-core:3.2.0"
}

const val core = "androidx.core:core:1.2.0-beta01"
const val coreKtx = "androidx.core:core-ktx:1.2.0-beta01"
const val core = "androidx.core:core:1.2.0"
const val coreKtx = "androidx.core:core-ktx:1.2.0"
}

const val constraintLayout = "androidx.constraintlayout:constraintlayout:1.1.3"
Expand Down
108 changes: 43 additions & 65 deletions ktx/src/main/java/dev/chrisbanes/insetter/viewinsetter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ import androidx.annotation.RequiresApi
import androidx.core.view.WindowInsetsCompat

inline fun View.doOnApplyWindowInsets(
crossinline f: (
view: View,
insets: WindowInsetsCompat,
initialState: ViewState
) -> Unit
) {
Insetter.setOnApplyInsetsListener(this) { view, insets, initialState ->
f(view, insets, initialState)
}
crossinline f: (view: View, insets: WindowInsetsCompat, initialState: ViewState) -> Unit
) = Insetter.setOnApplyInsetsListener(this) { view, insets, initialState ->
f(view, insets, initialState)
}

fun View.requestApplyInsetsWhenAttached() {
Expand Down Expand Up @@ -61,20 +55,16 @@ fun View.applySystemWindowInsetsToPadding(
top: Boolean = false,
right: Boolean = false,
bottom: Boolean = false
) {

doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
Insetter.generateEnumSet(left, top, right, bottom),
null,
null,
null
)

}
) = doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
Insetter.generateEnumSet(left, top, right, bottom),
null,
null,
null
)
}

/**
Expand All @@ -90,20 +80,16 @@ fun View.applySystemWindowInsetsToMargin(
top: Boolean = false,
right: Boolean = false,
bottom: Boolean = false
) {

doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
null,
Insetter.generateEnumSet(left, top, right, bottom),
null,
null
)

}
) = doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
null,
Insetter.generateEnumSet(left, top, right, bottom),
null,
null
)
}

/**
Expand All @@ -119,20 +105,16 @@ fun View.applySystemGestureInsetsToPadding(
top: Boolean = false,
right: Boolean = false,
bottom: Boolean = false
) {

doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
null,
null,
Insetter.generateEnumSet(left, top, right, bottom),
null
)

}
) = doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
null,
null,
Insetter.generateEnumSet(left, top, right, bottom),
null
)
}

/**
Expand All @@ -148,18 +130,14 @@ fun View.applySystemGestureInsetsToMargin(
top: Boolean = false,
right: Boolean = false,
bottom: Boolean = false
) {

doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
null,
null,
null,
Insetter.generateEnumSet(left, top, right, bottom)
)

}
) = doOnApplyWindowInsets { view, insets, initialViewState ->
Insetter.applyInsetsToView(
view,
insets,
initialViewState,
null,
null,
null,
Insetter.generateEnumSet(left, top, right, bottom)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.filters.SdkSuppress
import dev.chrisbanes.insetter.Insetter.EDGE_TO_EDGE_FLAGS
import junit.framework.Assert.*
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit

/**
* InsetsTestCase
Expand Down Expand Up @@ -173,4 +176,4 @@ class InsetterTestCase {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ class DataBindingState : BaseObservable() {
notifyPropertyChanged(BR.paddingBottomSystemWindow)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ class InsetterConstraintHelperSample : Activity() {
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import android.os.Bundle
import android.view.View
import android.widget.ListView
import android.widget.SimpleAdapter

import java.text.Collator
import java.util.ArrayList
import java.util.Collections
Expand Down Expand Up @@ -133,4 +132,4 @@ class MainActivity : ListActivity() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ fun View.assertLayoutMargin(left: Int = 0, top: Int = 0, right: Int = 0, bottom:
fun View.assertLayoutMargin(rect: Rect) = assertLayoutMargin(rect.left, rect.top, rect.right, rect.bottom)

@RequiresApi(20)
fun WindowInsets.toWindowInsetsCompat() = WindowInsetsCompat.toWindowInsetsCompat(this)
fun WindowInsets.toWindowInsetsCompat() = WindowInsetsCompat.toWindowInsetsCompat(this)
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ class InsetsConstraintHelperTestCase {
assertPadding(top = systemGestureInsets.top)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ class InsetsConstraintLayoutTestCase {
assertPadding(top = systemGestureInsets.top)
}
}
}
}

0 comments on commit cb07d3c

Please sign in to comment.