diff --git a/.circleci/config.yml b/.circleci/config.yml
index 377ec31c..7096fbe9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -3,7 +3,7 @@ jobs:
build:
working_directory: ~/code
docker:
- - image: circleci/android:api-27-alpha
+ - image: circleci/android:api-28-alpha
environment:
JVM_OPTS: -Xmx3200m
MAX_RETRY: 4
diff --git a/README.md b/README.md
index f23ede16..217d7016 100644
--- a/README.md
+++ b/README.md
@@ -10,14 +10,14 @@ Add the following dependency to your `build.gradle` file:
```
dependencies {
- implementation 'com.google.android:flexbox:1.0.0'
+ implementation 'com.google.android:flexbox:1.1.0'
}
```
# Usage
-There are two ways of using Flexbox in your layout.
+There are two ways of using Flexbox in your layout.
-## FlexboxLayout
+## FlexboxLayout
The first one is `FlexboxLayout` that extends the `ViewGroup` like `LinearLayout` and `RelativeLayout`.
You can specify the attributes from a layout XML like:
```xml
diff --git a/build.gradle b/build.gradle
index 85805d26..9c897fce 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,16 +19,18 @@
buildscript {
ext {
minSdkVersion = 14
- targetSdkVersion = 27
- compileSdkVersion = 27
- androidGradlePluginVersion = "3.1.3"
+ targetSdkVersion = 28
+ compileSdkVersion = 28
+
+ androidGradlePluginVersion = "3.2.0"
androidMavenGradlePluginVersion = "1.5"
- gradleBintrayPluginVersion = "1.6"
- kotlinVersion = "1.2.30"
- supportLibVersion = "27.1.0"
- espressoVersion = "3.0.0"
- testRunnerVersion = "1.0.0"
+ androidxCoreVersion = "1.0.0"
+ androidxEspressoVersion = "3.1.0-alpha4"
+ androidxTestVersion = "1.1.0-alpha4"
junitVersion = "4.12"
+ gradleBintrayPluginVersion = "1.6"
+ kotlinVersion = "1.2.70"
+ materialVersion = "1.0.0"
}
repositories {
diff --git a/demo-cat-gallery/build.gradle b/demo-cat-gallery/build.gradle
index 52c99f6a..ac44581e 100644
--- a/demo-cat-gallery/build.gradle
+++ b/demo-cat-gallery/build.gradle
@@ -27,7 +27,7 @@ android {
versionCode 1
versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -40,8 +40,8 @@ android {
dependencies {
implementation project(path: ":flexbox")
- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
- implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
- implementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
- implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
+ implementation "androidx.appcompat:appcompat:${rootProject.androidxCoreVersion}"
+ implementation "androidx.recyclerview:recyclerview:${rootProject.androidxCoreVersion}"
+ implementation "com.google.android.material:material:${rootProject.materialVersion}"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.kotlinVersion}"
}
diff --git a/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatAdapter.kt b/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatAdapter.kt
index e8ced670..11b29300 100644
--- a/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatAdapter.kt
+++ b/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatAdapter.kt
@@ -16,9 +16,9 @@
package com.google.android.flexbox.apps.catgallery
-import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
/**
* Adapter class that handles the data set with the {@link RecyclerView.LayoutManager}
diff --git a/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatViewHolder.kt b/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatViewHolder.kt
index c56bd324..17788797 100644
--- a/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatViewHolder.kt
+++ b/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/CatViewHolder.kt
@@ -16,10 +16,10 @@
package com.google.android.flexbox.apps.catgallery
-import android.support.annotation.DrawableRes
-import android.support.v7.widget.RecyclerView
import android.view.View
import android.widget.ImageView
+import androidx.annotation.DrawableRes
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.FlexboxLayoutManager
/**
diff --git a/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/MainActivity.kt b/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/MainActivity.kt
index fe9b8698..bbf1e0b4 100644
--- a/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/MainActivity.kt
+++ b/demo-cat-gallery/src/main/java/com/google/android/flexbox/apps/catgallery/MainActivity.kt
@@ -17,9 +17,9 @@
package com.google.android.flexbox.apps.catgallery
import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.support.v7.widget.RecyclerView
-import android.support.v7.widget.Toolbar
+import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.widget.Toolbar
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.AlignItems
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexWrap
diff --git a/demo-cat-gallery/src/main/res/layout/activity_main.xml b/demo-cat-gallery/src/main/res/layout/activity_main.xml
index bbdbb7dd..e80b3560 100644
--- a/demo-cat-gallery/src/main/res/layout/activity_main.xml
+++ b/demo-cat-gallery/src/main/res/layout/activity_main.xml
@@ -13,7 +13,7 @@ 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.
-->
-
-
-
-
-
-
+
+
-
+
diff --git a/demo-cat-gallery/src/main/res/layout/content_main.xml b/demo-cat-gallery/src/main/res/layout/content_main.xml
index 2e164697..316888f8 100644
--- a/demo-cat-gallery/src/main/res/layout/content_main.xml
+++ b/demo-cat-gallery/src/main/res/layout/content_main.xml
@@ -13,7 +13,7 @@ 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.
-->
-() {
+internal class FlexItemAdapter(private val activity: AppCompatActivity,
+ private val flexContainer: FlexContainer)
+ : RecyclerView.Adapter() {
private val layoutParams = mutableListOf()
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemChangedListenerImplRecyclerView.kt b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemChangedListenerImplRecyclerView.kt
index 773c4755..acedf7d7 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemChangedListenerImplRecyclerView.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemChangedListenerImplRecyclerView.kt
@@ -16,8 +16,8 @@
package com.google.android.flexbox
-import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
/**
* Implementation for the [FlexItemChangedListener].
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemClickListener.kt b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemClickListener.kt
index c1445ea3..6ba866b4 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemClickListener.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemClickListener.kt
@@ -16,8 +16,8 @@
package com.google.android.flexbox
-import android.support.v7.app.AppCompatActivity
import android.view.View
+import androidx.appcompat.app.AppCompatActivity
/**
* Implementation of the [android.view.View.OnClickListener] when a flex item is clicked in
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemEditFragment.kt b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemEditFragment.kt
index 1d513f19..c1e00ba4 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemEditFragment.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemEditFragment.kt
@@ -19,8 +19,6 @@ package com.google.android.flexbox
import android.content.Context
import android.os.Build
import android.os.Bundle
-import android.support.design.widget.TextInputLayout
-import android.support.v4.app.DialogFragment
import android.text.Editable
import android.text.TextWatcher
import android.view.KeyEvent
@@ -30,8 +28,10 @@ import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.*
+import androidx.fragment.app.DialogFragment
import com.google.android.apps.flexbox.R
import com.google.android.flexbox.validators.*
+import com.google.android.material.textfield.TextInputLayout
/**
* DialogFragment that changes the properties for a flex item.
@@ -333,7 +333,7 @@ internal class FlexItemEditFragment : DialogFragment() {
copyFlexItemValues(item, newItem)
return newItem
}
- throw IllegalArgumentException("Unknown FlexItem: " + item)
+ throw IllegalArgumentException("Unknown FlexItem: $item")
}
private fun copyFlexItemValues(from: FlexItem, to: FlexItem) {
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemViewHolder.kt b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemViewHolder.kt
index bc619619..1e9f4a23 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/FlexItemViewHolder.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/FlexItemViewHolder.kt
@@ -16,10 +16,10 @@
package com.google.android.flexbox
-import android.support.v7.widget.RecyclerView
import android.view.Gravity
import android.view.View
import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.apps.flexbox.R
/**
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/FlexboxLayoutFragment.kt b/demo-playground/src/main/java/com/google/android/flexbox/FlexboxLayoutFragment.kt
index 88069e75..af306760 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/FlexboxLayoutFragment.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/FlexboxLayoutFragment.kt
@@ -18,14 +18,14 @@ package com.google.android.flexbox
import android.content.Context
import android.os.Bundle
-import android.support.design.widget.FloatingActionButton
-import android.support.v4.app.Fragment
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
+import androidx.fragment.app.Fragment
import com.google.android.apps.flexbox.R
+import com.google.android.material.floatingactionbutton.FloatingActionButton
import java.util.*
/**
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/FragmentHelper.kt b/demo-playground/src/main/java/com/google/android/flexbox/FragmentHelper.kt
index 4a34c76d..d1b32a50 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/FragmentHelper.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/FragmentHelper.kt
@@ -17,15 +17,15 @@
package com.google.android.flexbox
import android.content.SharedPreferences
-import android.support.design.widget.NavigationView
-import android.support.v7.preference.PreferenceManager
import android.view.Menu
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Spinner
import android.widget.Toast
+import androidx.preference.PreferenceManager
import com.google.android.apps.flexbox.R
+import com.google.android.material.navigation.NavigationView
/**
* Helper class that has the common logic for initializing the Fragment for the play ground demo
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/MainActivity.kt b/demo-playground/src/main/java/com/google/android/flexbox/MainActivity.kt
index 9f99bd2a..7c670edf 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/MainActivity.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/MainActivity.kt
@@ -18,16 +18,16 @@ package com.google.android.flexbox
import android.content.Intent
import android.os.Bundle
-import android.support.design.widget.NavigationView
-import android.support.v4.app.FragmentManager
-import android.support.v4.widget.DrawerLayout
-import android.support.v7.app.ActionBarDrawerToggle
-import android.support.v7.app.AppCompatActivity
-import android.support.v7.widget.Toolbar
import android.view.Menu
import android.view.MenuItem
import android.widget.RadioGroup
+import androidx.appcompat.app.ActionBarDrawerToggle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.widget.Toolbar
+import androidx.drawerlayout.widget.DrawerLayout
+import androidx.fragment.app.FragmentManager
import com.google.android.apps.flexbox.R
+import com.google.android.material.navigation.NavigationView
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/RecyclerViewFragment.kt b/demo-playground/src/main/java/com/google/android/flexbox/RecyclerViewFragment.kt
index e593f69e..474c4857 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/RecyclerViewFragment.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/RecyclerViewFragment.kt
@@ -17,13 +17,13 @@
package com.google.android.flexbox
import android.os.Bundle
-import android.support.design.widget.FloatingActionButton
-import android.support.v4.app.Fragment
-import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.apps.flexbox.R
+import com.google.android.material.floatingactionbutton.FloatingActionButton
/**
* Fragment that contains the [RecyclerView] and the [FlexboxLayoutManager] as its
diff --git a/demo-playground/src/main/java/com/google/android/flexbox/SettingsActivity.kt b/demo-playground/src/main/java/com/google/android/flexbox/SettingsActivity.kt
index 9aadef4b..5abfeea9 100644
--- a/demo-playground/src/main/java/com/google/android/flexbox/SettingsActivity.kt
+++ b/demo-playground/src/main/java/com/google/android/flexbox/SettingsActivity.kt
@@ -17,11 +17,11 @@
package com.google.android.flexbox
import android.os.Bundle
-import android.support.v4.app.FragmentActivity
-import android.support.v7.preference.EditTextPreference
-import android.support.v7.preference.Preference
-import android.support.v7.preference.PreferenceFragmentCompat
import android.widget.Toast
+import androidx.fragment.app.FragmentActivity
+import androidx.preference.EditTextPreference
+import androidx.preference.Preference
+import androidx.preference.PreferenceFragmentCompat
import com.google.android.apps.flexbox.R
import com.google.android.flexbox.validators.DimensionInputValidator
import com.google.android.flexbox.validators.FlexBasisPercentInputValidator
diff --git a/demo-playground/src/main/res/layout/activity_main.xml b/demo-playground/src/main/res/layout/activity_main.xml
index 02a486ca..107331c8 100644
--- a/demo-playground/src/main/res/layout/activity_main.xml
+++ b/demo-playground/src/main/res/layout/activity_main.xml
@@ -13,7 +13,7 @@ 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.
-->
-
-
-
+
diff --git a/demo-playground/src/main/res/layout/app_bar_main.xml b/demo-playground/src/main/res/layout/app_bar_main.xml
index d389bed9..bf77c7d1 100644
--- a/demo-playground/src/main/res/layout/app_bar_main.xml
+++ b/demo-playground/src/main/res/layout/app_bar_main.xml
@@ -13,7 +13,7 @@ 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.
-->
-
-
-
-
+
-
-
-
+
diff --git a/demo-playground/src/main/res/layout/fragment_flex_item_edit.xml b/demo-playground/src/main/res/layout/fragment_flex_item_edit.xml
index fd96c583..c1a98be4 100644
--- a/demo-playground/src/main/res/layout/fragment_flex_item_edit.xml
+++ b/demo-playground/src/main/res/layout/fragment_flex_item_edit.xml
@@ -29,7 +29,7 @@ limitations under the License.
android:paddingStart="@dimen/margin_medium"
app:flexWrap="wrap">
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
diff --git a/flexbox/build.gradle b/flexbox/build.gradle
index d950fcc5..3b62f1a5 100644
--- a/flexbox/build.gradle
+++ b/flexbox/build.gradle
@@ -28,7 +28,7 @@ android {
versionCode 1
versionName "$mavenVersion"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'proguard-rules.txt'
}
@@ -40,15 +40,16 @@ android {
}
dependencies {
- compileOnly "com.android.support:support-compat:${rootProject.ext.supportLibVersion}"
- compileOnly "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
-
- testImplementation "junit:junit:${rootProject.ext.junitVersion}"
-
- androidTestImplementation "com.android.support:support-compat:${rootProject.ext.supportLibVersion}"
- androidTestImplementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
- androidTestImplementation "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
- androidTestImplementation "com.android.support.test:runner:${rootProject.ext.testRunnerVersion}"
- androidTestImplementation "com.android.support.test.espresso:espresso-core:${rootProject.ext.espressoVersion}"
- androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
+ compileOnly "androidx.core:core:${rootProject.androidxCoreVersion}"
+ compileOnly "androidx.recyclerview:recyclerview:${rootProject.androidxCoreVersion}"
+
+ testImplementation "junit:junit:${rootProject.junitVersion}"
+
+ androidTestImplementation "androidx.core:core:${rootProject.androidxCoreVersion}"
+ androidTestImplementation "androidx.recyclerview:recyclerview:${rootProject.androidxCoreVersion}"
+ androidTestImplementation "androidx.annotation:annotation:${rootProject.androidxCoreVersion}"
+ androidTestImplementation "androidx.test:runner:${rootProject.androidxTestVersion}"
+ androidTestImplementation "androidx.test:rules:${rootProject.androidxTestVersion}"
+ androidTestImplementation "androidx.test.espresso:espresso-core:${rootProject.androidxEspressoVersion}"
+ androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.kotlinVersion}"
}
diff --git a/flexbox/constants.gradle b/flexbox/constants.gradle
index c8168849..b4f03e91 100644
--- a/flexbox/constants.gradle
+++ b/flexbox/constants.gradle
@@ -22,7 +22,7 @@ ext {
mavenGroup = 'com.google.android'
mavenArtifactId = 'flexbox'
- mavenVersion = '1.0.0'
+ mavenVersion = '1.1.0'
bintrayOrg = 'google'
}
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/FakeFlexContainer.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/FakeFlexContainer.kt
index cef644ce..e87637e3 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/FakeFlexContainer.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/FakeFlexContainer.kt
@@ -18,7 +18,6 @@ package com.google.android.flexbox
import android.view.View
import android.view.ViewGroup
-import com.google.android.flexbox.FlexContainer.NOT_SET
/**
* Fake implementation of [FlexContainer].
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/FlexboxHelperTest.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/FlexboxHelperTest.kt
index d1a2d924..4b144300 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/FlexboxHelperTest.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/FlexboxHelperTest.kt
@@ -16,14 +16,14 @@
package com.google.android.flexbox
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
import android.view.View
+import androidx.test.rule.ActivityTestRule
+import androidx.test.runner.AndroidJUnit4
import com.google.android.flexbox.test.FlexboxTestActivity
import com.google.android.flexbox.test.IsEqualAllowingError.Companion.isEqualAllowingError
-import junit.framework.Assert.assertEquals
-import junit.framework.Assert.assertNotNull
import org.hamcrest.Matchers.`is`
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNotNull
import org.junit.Assert.assertThat
import org.junit.Before
import org.junit.Rule
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/ConfigChangeActivity.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/ConfigChangeActivity.kt
index 3ede0249..520d557c 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/ConfigChangeActivity.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/ConfigChangeActivity.kt
@@ -30,7 +30,7 @@ class ConfigChangeActivity : Activity() {
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
- Log.d(TAG, "onConfigurationChanged: " + newConfig)
+ Log.d(TAG, "onConfigurationChanged: $newConfig")
}
companion object {
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxAndroidTest.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxAndroidTest.kt
index 7bcfcd78..7e5fef65 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxAndroidTest.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxAndroidTest.kt
@@ -17,31 +17,31 @@
package com.google.android.flexbox.test
import android.content.Context
-import android.support.annotation.LayoutRes
-import android.support.test.InstrumentationRegistry
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.ViewAssertion
-import android.support.test.espresso.assertion.PositionAssertions.*
-import android.support.test.espresso.assertion.ViewAssertions.matches
-import android.support.test.espresso.matcher.ViewMatchers.withId
-import android.support.test.filters.FlakyTest
-import android.support.test.filters.MediumTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import android.support.v4.content.res.ResourcesCompat
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
+import androidx.annotation.LayoutRes
+import androidx.core.content.res.ResourcesCompat
+import androidx.test.InstrumentationRegistry
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.ViewAssertion
+import androidx.test.espresso.assertion.PositionAssertions.*
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.filters.FlakyTest
+import androidx.test.filters.MediumTest
+import androidx.test.rule.ActivityTestRule
+import androidx.test.runner.AndroidJUnit4
import com.google.android.flexbox.*
import com.google.android.flexbox.test.IsEqualAllowingError.Companion.isEqualAllowingError
-import junit.framework.Assert.assertEquals
-import junit.framework.Assert.assertTrue
import org.hamcrest.Description
import org.hamcrest.TypeSafeMatcher
import org.hamcrest.core.Is.`is`
import org.hamcrest.core.IsNot.not
+import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertThat
+import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -4015,7 +4015,7 @@ class FlexboxAndroidTest {
private fun hasWidth(width: Int): ViewAssertion {
return matches(object : TypeSafeMatcher() {
override fun describeTo(description: Description) {
- description.appendText("expected width: " + width)
+ description.appendText("expected width: $width")
}
override fun describeMismatchSafely(item: View, mismatchDescription: Description) {
@@ -4029,7 +4029,7 @@ class FlexboxAndroidTest {
private fun hasHeight(height: Int): ViewAssertion {
return matches(object : TypeSafeMatcher() {
override fun describeTo(description: Description) {
- description.appendText("expected height: " + height)
+ description.appendText("expected height: $height")
}
override fun describeMismatchSafely(item: View, mismatchDescription: Description) {
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerConfigChangeTest.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerConfigChangeTest.kt
index bcbeb9f6..e21a4582 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerConfigChangeTest.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerConfigChangeTest.kt
@@ -19,17 +19,17 @@ package com.google.android.flexbox.test
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.res.Configuration
-import android.support.test.InstrumentationRegistry
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.ViewAction
-import android.support.test.espresso.action.*
-import android.support.test.espresso.matcher.ViewMatchers.withId
-import android.support.test.filters.FlakyTest
-import android.support.test.filters.MediumTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import androidx.test.InstrumentationRegistry
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.ViewAction
+import androidx.test.espresso.action.*
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.filters.FlakyTest
+import androidx.test.filters.MediumTest
+import androidx.test.rule.ActivityTestRule
+import androidx.test.runner.AndroidJUnit4
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexboxLayoutManager
import org.hamcrest.Matchers.`is`
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerTest.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerTest.kt
index 76da7074..f0f85a77 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerTest.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/FlexboxLayoutManagerTest.kt
@@ -19,28 +19,28 @@ package com.google.android.flexbox.test
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.res.Configuration
-import android.support.test.InstrumentationRegistry
-import android.support.test.espresso.Espresso.onView
-import android.support.test.espresso.ViewAction
-import android.support.test.espresso.action.*
-import android.support.test.espresso.matcher.ViewMatchers.withId
-import android.support.test.filters.FlakyTest
-import android.support.test.filters.MediumTest
-import android.support.test.rule.ActivityTestRule
-import android.support.test.runner.AndroidJUnit4
-import android.support.v4.content.res.ResourcesCompat
-import android.support.v7.widget.LinearLayoutManager
-import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import android.widget.TextView
+import androidx.core.content.res.ResourcesCompat
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import androidx.test.InstrumentationRegistry
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.ViewAction
+import androidx.test.espresso.action.*
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.filters.FlakyTest
+import androidx.test.filters.MediumTest
+import androidx.test.rule.ActivityTestRule
+import androidx.test.runner.AndroidJUnit4
import com.google.android.flexbox.*
import com.google.android.flexbox.FlexboxItemDecoration.HORIZONTAL
import com.google.android.flexbox.FlexboxItemDecoration.VERTICAL
import com.google.android.flexbox.test.IsEqualAllowingError.Companion.isEqualAllowingError
-import junit.framework.Assert.assertTrue
import org.hamcrest.Matchers.*
import org.hamcrest.core.IsNot.not
import org.junit.Assert.assertThat
+import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -255,9 +255,9 @@ class FlexboxLayoutManagerTest {
// fill the horizontal remaining space
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(2))
- assertThat(layoutManager.getChildAt(0).width, isEqualAllowingError(activity.dpToPixel(160)))
- assertThat(layoutManager.getChildAt(1).width, isEqualAllowingError(activity.dpToPixel(160)))
- assertThat(layoutManager.getChildAt(2).width, isEqualAllowingError(activity.dpToPixel(320)))
+ assertThat(layoutManager.getChildAt(0)!!.width, isEqualAllowingError(activity.dpToPixel(160)))
+ assertThat(layoutManager.getChildAt(1)!!.width, isEqualAllowingError(activity.dpToPixel(160)))
+ assertThat(layoutManager.getChildAt(2)!!.width, isEqualAllowingError(activity.dpToPixel(320)))
}
@Test
@@ -369,12 +369,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_START))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(150)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(150)))
}
@Test
@@ -403,12 +406,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_END))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(170)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(220)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(220)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(270)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(270)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(320)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(170)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(220)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(220)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(270)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(270)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(320)))
}
@Test
@@ -437,12 +443,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.CENTER))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(85)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(235)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(85)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(235)))
}
@Test
@@ -471,12 +480,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_AROUND))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(28)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(78)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(242)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(292)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(28)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(78)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(242)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(292)))
}
@@ -506,12 +518,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_EVENLY))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(43)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(93)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(228)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(278)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(43)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(93)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(228)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(278)))
}
@Test
@@ -540,12 +555,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_BETWEEN))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(270)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(320)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(270)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(320)))
}
@Test
@@ -576,12 +594,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_START))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(270)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(320)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(220)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(270)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(170)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(220)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(270)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(320)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(220)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(270)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(170)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(220)))
}
@Test
@@ -612,12 +633,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_END))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(150)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(50)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(150)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(50)))
}
@Test
@@ -648,12 +672,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.CENTER))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(235)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(85)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(135)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(235)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(85)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(135)))
}
@Test
@@ -684,12 +711,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_AROUND))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(242)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(292)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(28)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(78)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(242)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(292)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(28)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(78)))
}
@Test
@@ -720,12 +750,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_EVENLY))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(228)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(278)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(43)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(93)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(228)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(278)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(43)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(93)))
}
@Test
@@ -756,12 +789,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_BETWEEN))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).left, isEqualAllowingError(activity.dpToPixel(270)))
- assertThat(layoutManager.getChildAt(0).right, isEqualAllowingError(activity.dpToPixel(320)))
- assertThat(layoutManager.getChildAt(1).left, isEqualAllowingError(activity.dpToPixel(135)))
- assertThat(layoutManager.getChildAt(1).right, isEqualAllowingError(activity.dpToPixel(185)))
- assertThat(layoutManager.getChildAt(2).left, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(2).right, isEqualAllowingError(activity.dpToPixel(50)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.left, isEqualAllowingError(activity.dpToPixel(270)))
+ assertThat(view0.right, isEqualAllowingError(activity.dpToPixel(320)))
+ assertThat(view1.left, isEqualAllowingError(activity.dpToPixel(135)))
+ assertThat(view1.right, isEqualAllowingError(activity.dpToPixel(185)))
+ assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view2.right, isEqualAllowingError(activity.dpToPixel(50)))
}
@Test
@@ -792,12 +828,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_START))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(150)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(150)))
}
@Test
@@ -828,12 +867,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_END))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(90)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(140)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(140)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(190)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(190)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(240)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(90)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(140)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(140)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(190)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(190)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(240)))
}
@Test
@@ -864,12 +906,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.CENTER))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(45)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(195)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(45)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(195)))
}
@Test
@@ -900,12 +945,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_AROUND))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(15)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(65)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(175)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(225)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(15)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(65)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(175)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(225)))
}
@Test
@@ -936,12 +984,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_EVENLY))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(23)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(73)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(167)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(217)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(23)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(73)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(167)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(217)))
}
@Test
@@ -972,12 +1023,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_BETWEEN))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(190)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(240)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(190)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(240)))
}
@Test
@@ -1008,12 +1062,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_START))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(190)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(240)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(140)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(190)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(90)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(140)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(190)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(240)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(140)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(190)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(90)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(140)))
}
@Test
@@ -1044,12 +1101,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.FLEX_END))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(150)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(100)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(50)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(150)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(50)))
}
@Test
@@ -1080,12 +1140,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.CENTER))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(195)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(45)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(95)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(195)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(45)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(95)))
}
@Test
@@ -1116,12 +1179,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_AROUND))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(175)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(225)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(15)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(65)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(175)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(225)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(15)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(65)))
}
@Test
@@ -1152,12 +1218,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_EVENLY))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(167)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(217)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(23)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(73)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(167)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(217)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(23)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(73)))
}
@Test
@@ -1188,12 +1257,15 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.justifyContent, `is`(JustifyContent.SPACE_BETWEEN))
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(190)))
- assertThat(layoutManager.getChildAt(0).bottom, isEqualAllowingError(activity.dpToPixel(240)))
- assertThat(layoutManager.getChildAt(1).top, isEqualAllowingError(activity.dpToPixel(95)))
- assertThat(layoutManager.getChildAt(1).bottom, isEqualAllowingError(activity.dpToPixel(145)))
- assertThat(layoutManager.getChildAt(2).top, isEqualAllowingError(activity.dpToPixel(0)))
- assertThat(layoutManager.getChildAt(2).bottom, isEqualAllowingError(activity.dpToPixel(50)))
+ val view0 = layoutManager.getChildAt(0)!!
+ val view1 = layoutManager.getChildAt(1)!!
+ val view2 = layoutManager.getChildAt(2)!!
+ assertThat(view0.top, isEqualAllowingError(activity.dpToPixel(190)))
+ assertThat(view0.bottom, isEqualAllowingError(activity.dpToPixel(240)))
+ assertThat(view1.top, isEqualAllowingError(activity.dpToPixel(95)))
+ assertThat(view1.bottom, isEqualAllowingError(activity.dpToPixel(145)))
+ assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(0)))
+ assertThat(view2.bottom, isEqualAllowingError(activity.dpToPixel(50)))
}
@Test
@@ -1397,9 +1469,9 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
// Verify all items heights are stretched
- assertThat(layoutManager.getChildAt(0).height, isEqualAllowingError(activity.dpToPixel(80)))
- assertThat(layoutManager.getChildAt(1).height, isEqualAllowingError(activity.dpToPixel(80)))
- assertThat(layoutManager.getChildAt(2).height, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(0)!!.height, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(1)!!.height, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(2)!!.height, isEqualAllowingError(activity.dpToPixel(80)))
}
@Test
@@ -1431,9 +1503,9 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
// Verify all items widths are stretched
- assertThat(layoutManager.getChildAt(0).width, isEqualAllowingError(activity.dpToPixel(80)))
- assertThat(layoutManager.getChildAt(1).width, isEqualAllowingError(activity.dpToPixel(80)))
- assertThat(layoutManager.getChildAt(2).width, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(0)!!.width, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(1)!!.width, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(2)!!.width, isEqualAllowingError(activity.dpToPixel(80)))
}
@Test
@@ -1466,9 +1538,9 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
// Verify the item whose align self is set to stretch is stretched
- assertThat(layoutManager.getChildAt(0).height, isEqualAllowingError(activity.dpToPixel(80)))
- assertThat(layoutManager.getChildAt(1).height, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(2).height, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(0)!!.height, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(1)!!.height, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(layoutManager.getChildAt(2)!!.height, isEqualAllowingError(activity.dpToPixel(80)))
}
@Test
@@ -1501,9 +1573,9 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexItemCount, `is`(3))
assertThat(layoutManager.flexLines.size, `is`(1))
// Verify the item whose align self is set to stretch is stretched
- assertThat(layoutManager.getChildAt(0).width, isEqualAllowingError(activity.dpToPixel(80)))
- assertThat(layoutManager.getChildAt(1).width, isEqualAllowingError(activity.dpToPixel(50)))
- assertThat(layoutManager.getChildAt(2).width, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(0)!!.width, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(layoutManager.getChildAt(1)!!.width, isEqualAllowingError(activity.dpToPixel(50)))
+ assertThat(layoutManager.getChildAt(2)!!.width, isEqualAllowingError(activity.dpToPixel(80)))
}
@Test
@@ -1548,7 +1620,7 @@ class FlexboxLayoutManagerTest {
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
- assertThat(layoutManager.getChildAt(layoutManager.childCount - 1).height,
+ assertThat(layoutManager.getChildAt(layoutManager.childCount - 1)!!.height,
isEqualAllowingError(activity.dpToPixel(80)))
}
@@ -1594,7 +1666,7 @@ class FlexboxLayoutManagerTest {
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
- assertThat(layoutManager.getChildAt(layoutManager.childCount - 1).width,
+ assertThat(layoutManager.getChildAt(layoutManager.childCount - 1)!!.width,
isEqualAllowingError(activity.dpToPixel(70)))
}
@@ -1652,10 +1724,10 @@ class FlexboxLayoutManagerTest {
onView(withId(R.id.recyclerview)).perform(swipe(GeneralLocation.TOP_CENTER,
GeneralLocation.BOTTOM_CENTER))
- assertThat(layoutManager.getChildAt(positionInSecondLine).bottom,
+ assertThat(layoutManager.getChildAt(positionInSecondLine)!!.bottom,
isEqualAllowingError(activity.dpToPixel(210))) // 80 + 130
// Verify that the view in the same line's cross axis position is correct
- assertThat(layoutManager.getChildAt(positionInSecondLine - 1).bottom,
+ assertThat(layoutManager.getChildAt(positionInSecondLine - 1)!!.bottom,
isEqualAllowingError(activity.dpToPixel(160))) // 80 + 80
}
@@ -1709,10 +1781,10 @@ class FlexboxLayoutManagerTest {
onView(withId(R.id.recyclerview)).perform(swipe(GeneralLocation.CENTER_LEFT,
GeneralLocation.CENTER_RIGHT))
- assertThat(layoutManager.getChildAt(positionInSecondLine).right,
+ assertThat(layoutManager.getChildAt(positionInSecondLine)!!.right,
isEqualAllowingError(activity.dpToPixel(210))) // 80 + 130
// Verify that the view in the same line's cross axis position is correct
- assertThat(layoutManager.getChildAt(positionInSecondLine - 1).right,
+ assertThat(layoutManager.getChildAt(positionInSecondLine - 1)!!.right,
isEqualAllowingError(activity.dpToPixel(160))) // 80 + 80
}
@@ -1761,7 +1833,7 @@ class FlexboxLayoutManagerTest {
// 4 comes from the number of flex items - positionInSecondBottomLine
val recyclerView = activity.findViewById(R.id.recyclerview)
val anchorView = layoutManager.getChildAt(layoutManager.childCount - 4)
- assertThat(recyclerView.bottom - anchorView.top,
+ assertThat(recyclerView.bottom - anchorView!!.top,
isEqualAllowingError(activity.dpToPixel(210))) // 80 + 130
}
@@ -1838,7 +1910,7 @@ class FlexboxLayoutManagerTest {
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
assertThat(layoutManager.flexDirection, `is`(FlexDirection.ROW))
// Verify the vertical position (cross size) of the second line is correctly positioned
- assertThat(layoutManager.getChildAt(3).top, isEqualAllowingError(activity.dpToPixel(140)))
+ assertThat(layoutManager.getChildAt(3)!!.top, isEqualAllowingError(activity.dpToPixel(140)))
}
@Test
@@ -1868,7 +1940,7 @@ class FlexboxLayoutManagerTest {
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
assertThat(layoutManager.flexDirection, `is`(FlexDirection.COLUMN))
// Verify the horizontal position (cross size) of the second line is correctly positioned
- assertThat(layoutManager.getChildAt(3).left, isEqualAllowingError(activity.dpToPixel(120)))
+ assertThat(layoutManager.getChildAt(3)!!.left, isEqualAllowingError(activity.dpToPixel(120)))
}
@Test
@@ -1923,7 +1995,7 @@ class FlexboxLayoutManagerTest {
// The top coordinate of the first view should be the height of the second view minus the
// height of the first view (180 - 80)
- assertThat(layoutManager.getChildAt(0).top, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(layoutManager.getChildAt(0)!!.top, isEqualAllowingError(activity.dpToPixel(100)))
}
@Test
@@ -1970,7 +2042,8 @@ class FlexboxLayoutManagerTest {
// The bottom coordinate of the first view in the last line should be the height of the
// second view in the last line minus the height of the first view in the last line
// (180 - 80)
- assertThat(layoutManager.getChildAt(layoutManager.childCount - 2).bottom - layoutManager.getChildAt(layoutManager.childCount - 3).bottom,
+ assertThat(layoutManager.getChildAt(layoutManager.childCount - 2)!!.bottom
+ - layoutManager.getChildAt(layoutManager.childCount - 3)!!.bottom,
isEqualAllowingError(activity.dpToPixel(100)))
}
@@ -2001,7 +2074,7 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexDirection, `is`(FlexDirection.ROW))
val anchorView = layoutManager.getChildAt(0)
- val offset = anchorView.top
+ val offset = anchorView!!.top
assertTrue(offset < 0)
activityRule.runOnUiThread {
@@ -2016,7 +2089,7 @@ class FlexboxLayoutManagerTest {
// Verify that offset position is preserved for the first visible view after the rotation
val anchorAfterRotate = layoutManager.getChildAt(0)
- assertTrue(anchorAfterRotate.top < 0)
+ assertTrue(anchorAfterRotate!!.top < 0)
}
@Test
@@ -2046,7 +2119,7 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexDirection, `is`(FlexDirection.COLUMN))
val anchorView = layoutManager.getChildAt(0)
- val offset = anchorView.left
+ val offset = anchorView!!.left
assertTrue(offset < 0)
activityRule.runOnUiThread {
@@ -2061,7 +2134,7 @@ class FlexboxLayoutManagerTest {
// Verify that offset position is preserved for the first visible view after the rotation
val anchorAfterRotate = layoutManager.getChildAt(0)
- assertTrue(anchorAfterRotate.left < 0)
+ assertTrue(anchorAfterRotate!!.left < 0)
}
@Test
@@ -2094,16 +2167,16 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexDirection, `is`(FlexDirection.ROW))
var view2 = layoutManager.getChildAt(1)
// 90 (view width) + 10 (divider width)
- assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2!!.left, isEqualAllowingError(activity.dpToPixel(100)))
var view3 = layoutManager.getChildAt(2)
// 90 (view width) + 10 (divider width) + 90(view width) + 10 (divider width)
- assertThat(view3.left, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view3!!.left, isEqualAllowingError(activity.dpToPixel(200)))
var view4 = layoutManager.getChildAt(3)
// 100 (view height) + 15 (divider height)
- assertThat(view4.top, isEqualAllowingError(activity.dpToPixel(115)))
+ assertThat(view4!!.top, isEqualAllowingError(activity.dpToPixel(115)))
var view7 = layoutManager.getChildAt(6)
// 100 (view height) + 15 (divider height) + 100 (view height) + 15 (divider height)
- assertThat(view7.top, isEqualAllowingError(activity.dpToPixel(230)))
+ assertThat(view7!!.top, isEqualAllowingError(activity.dpToPixel(230)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2115,16 +2188,16 @@ class FlexboxLayoutManagerTest {
view2 = layoutManager.getChildAt(1)
// 90 (view width)
- assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(90)))
+ assertThat(view2!!.left, isEqualAllowingError(activity.dpToPixel(90)))
view3 = layoutManager.getChildAt(2)
// 90 (view width) + 90(view width)
- assertThat(view3.left, isEqualAllowingError(activity.dpToPixel(180)))
+ assertThat(view3!!.left, isEqualAllowingError(activity.dpToPixel(180)))
view4 = layoutManager.getChildAt(3)
// 100 (view height) + 15 (divider height)
- assertThat(view4.top, isEqualAllowingError(activity.dpToPixel(115)))
+ assertThat(view4!!.top, isEqualAllowingError(activity.dpToPixel(115)))
view7 = layoutManager.getChildAt(6)
// 100 (view height) + 15 (divider height) + 100 (view height) + 15 (divider height)
- assertThat(view7.top, isEqualAllowingError(activity.dpToPixel(230)))
+ assertThat(view7!!.top, isEqualAllowingError(activity.dpToPixel(230)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2136,16 +2209,16 @@ class FlexboxLayoutManagerTest {
view2 = layoutManager.getChildAt(1)
// 90 (view width) + 10 (divider width)
- assertThat(view2.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view2!!.left, isEqualAllowingError(activity.dpToPixel(100)))
view3 = layoutManager.getChildAt(2)
// 90 (view width) + 10 (divider width) + 90(view width) + 10 (divider width)
- assertThat(view3.left, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view3!!.left, isEqualAllowingError(activity.dpToPixel(200)))
view4 = layoutManager.getChildAt(3)
// 100 (view height)
- assertThat(view4.top, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view4!!.top, isEqualAllowingError(activity.dpToPixel(100)))
view7 = layoutManager.getChildAt(6)
// 100 (view height) + 100 (view height)
- assertThat(view7.top, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view7!!.top, isEqualAllowingError(activity.dpToPixel(200)))
}
@Test
@@ -2179,16 +2252,16 @@ class FlexboxLayoutManagerTest {
var view1 = layoutManager.getChildAt(0)
var view2 = layoutManager.getChildAt(1)
// 90 (view width) + 10 (divider width)
- assertThat(view1.right - view2.right, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view1!!.right - view2!!.right, isEqualAllowingError(activity.dpToPixel(100)))
var view3 = layoutManager.getChildAt(2)
// 90 (view width) + 10 (divider width) + 90(view width) + 10 (divider width)
- assertThat(view1.right - view3.right, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view1.right - view3!!.right, isEqualAllowingError(activity.dpToPixel(200)))
var view4 = layoutManager.getChildAt(3)
// 100 (view height) + 15 (divider height)
- assertThat(view4.top, isEqualAllowingError(activity.dpToPixel(115)))
+ assertThat(view4!!.top, isEqualAllowingError(activity.dpToPixel(115)))
var view7 = layoutManager.getChildAt(6)
// 100 (view height) + 15 (divider height) + 100 (view height) + 15 (divider height)
- assertThat(view7.top, isEqualAllowingError(activity.dpToPixel(230)))
+ assertThat(view7!!.top, isEqualAllowingError(activity.dpToPixel(230)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2201,16 +2274,16 @@ class FlexboxLayoutManagerTest {
view1 = layoutManager.getChildAt(0)
view2 = layoutManager.getChildAt(1)
// 90 (view width)
- assertThat(view1.right - view2.right, isEqualAllowingError(activity.dpToPixel(90)))
+ assertThat(view1!!.right - view2!!.right, isEqualAllowingError(activity.dpToPixel(90)))
view3 = layoutManager.getChildAt(2)
// 90 (view width) + 90(view width)
- assertThat(view1.right - view3.right, isEqualAllowingError(activity.dpToPixel(180)))
+ assertThat(view1.right - view3!!.right, isEqualAllowingError(activity.dpToPixel(180)))
view4 = layoutManager.getChildAt(3)
// 100 (view height) + 15 (divider height)
- assertThat(view4.top, isEqualAllowingError(activity.dpToPixel(115)))
+ assertThat(view4!!.top, isEqualAllowingError(activity.dpToPixel(115)))
view7 = layoutManager.getChildAt(6)
// 100 (view height) + 15 (divider height) + 100 (view height) + 15 (divider height)
- assertThat(view7.top, isEqualAllowingError(activity.dpToPixel(230)))
+ assertThat(view7!!.top, isEqualAllowingError(activity.dpToPixel(230)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2223,18 +2296,18 @@ class FlexboxLayoutManagerTest {
view1 = layoutManager.getChildAt(0)
view2 = layoutManager.getChildAt(1)
// 90 (view width) + 10 (divider width)
- assertThat(view1.right - view2.right,
+ assertThat(view1!!.right - view2!!.right,
isEqualAllowingError(activity.dpToPixel(100)))
view3 = layoutManager.getChildAt(2)
// 90 (view width) + 10 (divider width) + 90(view width) + 10 (divider width)
- assertThat(view1.right - view3.right,
+ assertThat(view1.right - view3!!.right,
isEqualAllowingError(activity.dpToPixel(200)))
view4 = layoutManager.getChildAt(3)
// 100 (view height)
- assertThat(view4.top, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view4!!.top, isEqualAllowingError(activity.dpToPixel(100)))
view7 = layoutManager.getChildAt(6)
// 100 (view height) + 100 (view height)
- assertThat(view7.top, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view7!!.top, isEqualAllowingError(activity.dpToPixel(200)))
}
@Test
@@ -2267,16 +2340,16 @@ class FlexboxLayoutManagerTest {
assertThat(layoutManager.flexDirection, `is`(FlexDirection.COLUMN))
var view2 = layoutManager.getChildAt(1)
// 65 (view height) + 15 (divider height)
- assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(view2!!.top, isEqualAllowingError(activity.dpToPixel(80)))
var view3 = layoutManager.getChildAt(2)
// 65 (view height) + 15 (divider height) + 65 (view height) + 15 (divider height)
- assertThat(view3.top, isEqualAllowingError(activity.dpToPixel(160)))
+ assertThat(view3!!.top, isEqualAllowingError(activity.dpToPixel(160)))
var view4 = layoutManager.getChildAt(3)
// 90 (view width) + 10 (divider width)
- assertThat(view4.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view4!!.left, isEqualAllowingError(activity.dpToPixel(100)))
var view7 = layoutManager.getChildAt(6)
// 90 (view width) + 10 (divider width) + 90 (view width) + 10 (divider width)
- assertThat(view7.left, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view7!!.left, isEqualAllowingError(activity.dpToPixel(200)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2288,16 +2361,16 @@ class FlexboxLayoutManagerTest {
view2 = layoutManager.getChildAt(1)
// 65 (view height) + 15 (divider height)
- assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(view2!!.top, isEqualAllowingError(activity.dpToPixel(80)))
view3 = layoutManager.getChildAt(2)
// 65 (view height) + 15 (divider height) + 65 (view height) + 15 (divider height)
- assertThat(view3.top, isEqualAllowingError(activity.dpToPixel(160)))
+ assertThat(view3!!.top, isEqualAllowingError(activity.dpToPixel(160)))
view4 = layoutManager.getChildAt(3)
// 90 (view width)
- assertThat(view4.left, isEqualAllowingError(activity.dpToPixel(90)))
+ assertThat(view4!!.left, isEqualAllowingError(activity.dpToPixel(90)))
view7 = layoutManager.getChildAt(6)
// 90 (view width) + 90 (view width)
- assertThat(view7.left, isEqualAllowingError(activity.dpToPixel(180)))
+ assertThat(view7!!.left, isEqualAllowingError(activity.dpToPixel(180)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2309,16 +2382,16 @@ class FlexboxLayoutManagerTest {
view2 = layoutManager.getChildAt(1)
// 65 (view height)
- assertThat(view2.top, isEqualAllowingError(activity.dpToPixel(65)))
+ assertThat(view2!!.top, isEqualAllowingError(activity.dpToPixel(65)))
view3 = layoutManager.getChildAt(2)
// 65 (view height) + 65 (view height)
- assertThat(view3.top, isEqualAllowingError(activity.dpToPixel(130)))
+ assertThat(view3!!.top, isEqualAllowingError(activity.dpToPixel(130)))
view4 = layoutManager.getChildAt(3)
// 90 (view width) + 10 (divider width)
- assertThat(view4.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view4!!.left, isEqualAllowingError(activity.dpToPixel(100)))
view7 = layoutManager.getChildAt(6)
// 90 (view width) + 10 (divider width) + 90 (view width) + 10 (divider width)
- assertThat(view7.left, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view7!!.left, isEqualAllowingError(activity.dpToPixel(200)))
}
@Test
@@ -2352,16 +2425,16 @@ class FlexboxLayoutManagerTest {
var view1 = layoutManager.getChildAt(0)
var view2 = layoutManager.getChildAt(1)
// 65 (view height) + 15 (divider height)
- assertThat(view1.top - view2.top, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(view1!!.top - view2!!.top, isEqualAllowingError(activity.dpToPixel(80)))
var view3 = layoutManager.getChildAt(2)
// 65 (view height) + 15 (divider height) + 65 (view height) + 15 (divider height)
- assertThat(view1.top - view3.top, isEqualAllowingError(activity.dpToPixel(160)))
+ assertThat(view1.top - view3!!.top, isEqualAllowingError(activity.dpToPixel(160)))
var view4 = layoutManager.getChildAt(3)
// 90 (view width) + 10 (divider width)
- assertThat(view4.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view4!!.left, isEqualAllowingError(activity.dpToPixel(100)))
var view7 = layoutManager.getChildAt(6)
// 90 (view width) + 10 (divider width) + 90 (view width) + 10 (divider width)
- assertThat(view7.left, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view7!!.left, isEqualAllowingError(activity.dpToPixel(200)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2374,16 +2447,16 @@ class FlexboxLayoutManagerTest {
view1 = layoutManager.getChildAt(0)
view2 = layoutManager.getChildAt(1)
// 65 (view height) + 15 (divider height)
- assertThat(view1.top - view2.top, isEqualAllowingError(activity.dpToPixel(80)))
+ assertThat(view1!!.top - view2!!.top, isEqualAllowingError(activity.dpToPixel(80)))
view3 = layoutManager.getChildAt(2)
// 65 (view height) + 15 (divider height) + 65 (view height) + 15 (divider height)
- assertThat(view1.top - view3.top, isEqualAllowingError(activity.dpToPixel(160)))
+ assertThat(view1.top - view3!!.top, isEqualAllowingError(activity.dpToPixel(160)))
view4 = layoutManager.getChildAt(3)
// 90 (view width)
- assertThat(view4.left, isEqualAllowingError(activity.dpToPixel(90)))
+ assertThat(view4!!.left, isEqualAllowingError(activity.dpToPixel(90)))
view7 = layoutManager.getChildAt(6)
// 90 (view width) + 90 (view width)
- assertThat(view7.left, isEqualAllowingError(activity.dpToPixel(180)))
+ assertThat(view7!!.left, isEqualAllowingError(activity.dpToPixel(180)))
activityRule.runOnUiThread {
val recyclerView = activity.findViewById(R.id.recyclerview)
@@ -2396,16 +2469,16 @@ class FlexboxLayoutManagerTest {
view1 = layoutManager.getChildAt(0)
view2 = layoutManager.getChildAt(1)
// 65 (view height)
- assertThat(view1.top - view2.top, isEqualAllowingError(activity.dpToPixel(65)))
+ assertThat(view1!!.top - view2!!.top, isEqualAllowingError(activity.dpToPixel(65)))
view3 = layoutManager.getChildAt(2)
// 65 (view height) + 65 (view height)
- assertThat(view1.top - view3.top, isEqualAllowingError(activity.dpToPixel(130)))
+ assertThat(view1.top - view3!!.top, isEqualAllowingError(activity.dpToPixel(130)))
view4 = layoutManager.getChildAt(3)
// 90 (view width) + 10 (divider width)
- assertThat(view4.left, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(view4!!.left, isEqualAllowingError(activity.dpToPixel(100)))
view7 = layoutManager.getChildAt(6)
// 90 (view width) + 10 (divider width) + 90 (view width) + 10 (divider width)
- assertThat(view7.left, isEqualAllowingError(activity.dpToPixel(200)))
+ assertThat(view7!!.left, isEqualAllowingError(activity.dpToPixel(200)))
}
@Test
@@ -2735,7 +2808,7 @@ class FlexboxLayoutManagerTest {
// https://github.com/google/flexbox-layout/issues/208, the width of the inner
// RecyclerViews were set to 0.
val activity = activityRule.activity
- val outerLayoutManager = LinearLayoutManager(activity)
+ val outerLayoutManager = androidx.recyclerview.widget.LinearLayoutManager(activity)
// Give the inner adapter item count enough so that inner RecyclerView with
// FlexboxLayoutManager wraps its items
@@ -2745,7 +2818,7 @@ class FlexboxLayoutManagerTest {
activityRule.runOnUiThread {
activity.setContentView(R.layout.recyclerview)
val recyclerView = activity.findViewById(R.id.recyclerview)
- outerLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+ outerLayoutManager.orientation = androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL
recyclerView.layoutManager = outerLayoutManager
recyclerView.adapter = adapter
}
@@ -2905,7 +2978,7 @@ class FlexboxLayoutManagerTest {
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
val firstVisible = layoutManager.getChildAt(0)
- assertThat(firstVisible.width, isEqualAllowingError(activity.dpToPixel(40)))
+ assertThat(firstVisible!!.width, isEqualAllowingError(activity.dpToPixel(40)))
assertThat(firstVisible.height, isEqualAllowingError(activity.dpToPixel(75)))
}
@@ -2954,7 +3027,7 @@ class FlexboxLayoutManagerTest {
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
val firstVisible = layoutManager.getChildAt(0)
- assertThat(firstVisible.width, isEqualAllowingError(activity.dpToPixel(100)))
+ assertThat(firstVisible!!.width, isEqualAllowingError(activity.dpToPixel(100)))
assertThat(firstVisible.height, isEqualAllowingError(activity.dpToPixel(120)))
}
@@ -3096,9 +3169,9 @@ class FlexboxLayoutManagerTest {
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
assertThat(layoutManager.flexDirection, `is`(FlexDirection.ROW))
- assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(0)), `is`(0))
- assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(1)), `is`(0))
- assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(2)), `is`(0))
+ assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(0)!!), `is`(0))
+ assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(1)!!), `is`(0))
+ assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(2)!!), `is`(0))
layoutManager.flexLines
.mapNotNull { layoutManager.getChildAt(it.firstIndex) }
.forEach { assertThat(layoutManager.getLeftDecorationWidth(it), `is`(0)) }
@@ -3120,9 +3193,9 @@ class FlexboxLayoutManagerTest {
GeneralLocation.BOTTOM_CENTER))
// Verify even after the scrolling, decoration values are set correctly
- assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(0)), `is`(0))
- assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(1)), `is`(0))
- assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(2)), `is`(0))
+ assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(0)!!), `is`(0))
+ assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(1)!!), `is`(0))
+ assertThat(layoutManager.getTopDecorationHeight(layoutManager.getChildAt(2)!!), `is`(0))
layoutManager.flexLines
.mapNotNull { layoutManager.getChildAt(it.firstIndex) }
.forEach { assertThat(layoutManager.getLeftDecorationWidth(it), `is`(0)) }
@@ -3162,9 +3235,9 @@ class FlexboxLayoutManagerTest {
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
assertThat(layoutManager.flexDirection, `is`(FlexDirection.COLUMN))
- assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(0)), `is`(0))
- assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(1)), `is`(0))
- assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(2)), `is`(0))
+ assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(0)!!), `is`(0))
+ assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(1)!!), `is`(0))
+ assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(2)!!), `is`(0))
layoutManager.flexLines
.mapNotNull { layoutManager.getChildAt(it.firstIndex) }
.forEach { assertThat(layoutManager.getTopDecorationHeight(it), `is`(0)) }
@@ -3186,9 +3259,9 @@ class FlexboxLayoutManagerTest {
GeneralLocation.CENTER_RIGHT))
// Verify even after the scrolling, decoration values are set correctly
- assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(0)), `is`(0))
- assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(1)), `is`(0))
- assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(2)), `is`(0))
+ assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(0)!!), `is`(0))
+ assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(1)!!), `is`(0))
+ assertThat(layoutManager.getLeftDecorationWidth(layoutManager.getChildAt(2)!!), `is`(0))
layoutManager.flexLines
.mapNotNull { layoutManager.getChildAt(it.firstIndex) }
.forEach { assertThat(layoutManager.getTopDecorationHeight(it), `is`(0)) }
@@ -3247,14 +3320,15 @@ class FlexboxLayoutManagerTest {
}
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
- assertThat(layoutManager.getChildAt(0).left, `is`(0))
+ val view = layoutManager.getChildAt(0)!!
+ assertThat(view.left, `is`(0))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.CENTER_RIGHT,
GeneralLocation.CENTER_LEFT))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.CENTER_RIGHT,
GeneralLocation.CENTER_LEFT))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.CENTER_RIGHT,
GeneralLocation.CENTER_LEFT))
- assertThat(layoutManager.getChildAt(0).left, `is`(not(0)))
+ assertThat(view.left, `is`(not(0)))
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
onView(withId(R.id.container)).perform(swipe(GeneralLocation.CENTER_LEFT,
@@ -3265,7 +3339,7 @@ class FlexboxLayoutManagerTest {
GeneralLocation.CENTER_RIGHT))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.CENTER_LEFT,
GeneralLocation.CENTER_RIGHT))
- assertThat(layoutManager.getChildAt(0).left, `is`(0))
+ assertThat(view.left, `is`(0))
}
@Test
@@ -3289,14 +3363,15 @@ class FlexboxLayoutManagerTest {
}
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
- assertThat(layoutManager.getChildAt(0).top, `is`(0))
+ val view = layoutManager.getChildAt(0)!!
+ assertThat(view.top, `is`(0))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.BOTTOM_CENTER,
GeneralLocation.TOP_CENTER))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.BOTTOM_CENTER,
GeneralLocation.TOP_CENTER))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.BOTTOM_CENTER,
GeneralLocation.TOP_CENTER))
- assertThat(layoutManager.getChildAt(0).top, `is`(not(0)))
+ assertThat(view.top, `is`(not(0)))
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
onView(withId(R.id.container)).perform(swipe(GeneralLocation.TOP_CENTER,
@@ -3307,7 +3382,7 @@ class FlexboxLayoutManagerTest {
GeneralLocation.BOTTOM_CENTER))
onView(withId(R.id.container)).perform(swipe(GeneralLocation.TOP_CENTER,
GeneralLocation.BOTTOM_CENTER))
- assertThat(layoutManager.getChildAt(0).top, `is`(0))
+ assertThat(view.top, `is`(0))
}
@Test
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedInnerAdapter.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedInnerAdapter.kt
index 09dcdc96..ea673cb8 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedInnerAdapter.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedInnerAdapter.kt
@@ -16,17 +16,18 @@
package com.google.android.flexbox.test
-import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
/**
* Adapter for the tests for nested RecyclerViews.
* This Adapter is used for the inner RecyclerView.
*/
-internal class NestedInnerAdapter(private val innerPosition: Int, private val itemCount: Int) : RecyclerView.Adapter() {
+internal class NestedInnerAdapter(private val innerPosition: Int, private val itemCount: Int)
+ : RecyclerView.Adapter() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NestedInnerAdapter.InnerViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.viewholder_textview, parent, false)
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedOuterAdapter.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedOuterAdapter.kt
index 09c80af3..72e3cc88 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedOuterAdapter.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/NestedOuterAdapter.kt
@@ -16,11 +16,11 @@
package com.google.android.flexbox.test
-import android.support.annotation.LayoutRes
-import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.annotation.LayoutRes
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexboxLayoutManager
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapter.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapter.kt
index 5a72a4a1..361463ef 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapter.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapter.kt
@@ -16,10 +16,10 @@
package com.google.android.flexbox.test
-import android.support.v7.widget.RecyclerView
import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.FlexboxLayoutManager
/**
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapterMultiViewTypes.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapterMultiViewTypes.kt
index 990254db..aa2cb130 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapterMultiViewTypes.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestAdapterMultiViewTypes.kt
@@ -16,10 +16,10 @@
package com.google.android.flexbox.test
-import android.support.v7.widget.RecyclerView
import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.FlexboxLayoutManager
/**
@@ -74,10 +74,10 @@ internal class TestAdapterMultiViewTypes : RecyclerView.Adapter(
companion object {
- internal val POSITION_MATCH_PARENT = 3
- private val ITEMS = 50
+ internal const val POSITION_MATCH_PARENT = 3
+ private const val ITEMS = 50
- private val VIEW_TYPE_NORMAL = 0
- private val VIEW_TYPE_MATCH_PARENT = 1
+ private const val VIEW_TYPE_NORMAL = 0
+ private const val VIEW_TYPE_MATCH_PARENT = 1
}
}
diff --git a/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestViewHolder.kt b/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestViewHolder.kt
index a052e237..ded6c442 100644
--- a/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestViewHolder.kt
+++ b/flexbox/src/androidTest/java/com/google/android/flexbox/test/TestViewHolder.kt
@@ -16,9 +16,9 @@
package com.google.android.flexbox.test
-import android.support.v7.widget.RecyclerView
import android.view.View
import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
/**
* ViewHolder implementation for a flex item for testing.
diff --git a/flexbox/src/androidTest/res/layout/recyclerview.xml b/flexbox/src/androidTest/res/layout/recyclerview.xml
index 37330bf5..1db3834b 100644
--- a/flexbox/src/androidTest/res/layout/recyclerview.xml
+++ b/flexbox/src/androidTest/res/layout/recyclerview.xml
@@ -15,7 +15,7 @@
-->
-
diff --git a/flexbox/src/androidTest/res/layout/recyclerview_reverse.xml b/flexbox/src/androidTest/res/layout/recyclerview_reverse.xml
index b7c1a2ce..9f5ba827 100644
--- a/flexbox/src/androidTest/res/layout/recyclerview_reverse.xml
+++ b/flexbox/src/androidTest/res/layout/recyclerview_reverse.xml
@@ -14,7 +14,7 @@
~ limitations under the License.
-->
-
-
-
-
diff --git a/flexbox/src/androidTest/res/layout/wrapped_recyclerview_scroll_vertical.xml b/flexbox/src/androidTest/res/layout/wrapped_recyclerview_scroll_vertical.xml
index e3214c08..797fdf28 100644
--- a/flexbox/src/androidTest/res/layout/wrapped_recyclerview_scroll_vertical.xml
+++ b/flexbox/src/androidTest/res/layout/wrapped_recyclerview_scroll_vertical.xml
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320dp"
android:layout_height="240dp">
-
diff --git a/flexbox/src/main/java/com/google/android/flexbox/AlignContent.java b/flexbox/src/main/java/com/google/android/flexbox/AlignContent.java
index 2966a323..ac5e1997 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/AlignContent.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/AlignContent.java
@@ -16,11 +16,11 @@
package com.google.android.flexbox;
-import android.support.annotation.IntDef;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import androidx.annotation.IntDef;
+
/** This attribute controls the alignment of the flex lines in the flex container. */
@IntDef({AlignContent.FLEX_START, AlignContent.FLEX_END, AlignContent.CENTER,
AlignContent.SPACE_BETWEEN, AlignContent.SPACE_AROUND, AlignContent.STRETCH})
diff --git a/flexbox/src/main/java/com/google/android/flexbox/AlignItems.java b/flexbox/src/main/java/com/google/android/flexbox/AlignItems.java
index e93b1a66..8392ed1d 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/AlignItems.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/AlignItems.java
@@ -16,11 +16,11 @@
package com.google.android.flexbox;
-import android.support.annotation.IntDef;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import androidx.annotation.IntDef;
+
/** This attribute controls the alignment along the cross axis. */
@IntDef({AlignItems.FLEX_START, AlignItems.FLEX_END, AlignItems.CENTER,
AlignItems.BASELINE, AlignItems.STRETCH})
diff --git a/flexbox/src/main/java/com/google/android/flexbox/AlignSelf.java b/flexbox/src/main/java/com/google/android/flexbox/AlignSelf.java
index 1f420e34..dff3fdec 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/AlignSelf.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/AlignSelf.java
@@ -16,11 +16,11 @@
package com.google.android.flexbox;
-import android.support.annotation.IntDef;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import androidx.annotation.IntDef;
+
/**
* This attribute controls the alignment along the cross axis.
* The alignment in the same direction can be determined by the {@link AlignItems} attribute in the
diff --git a/flexbox/src/main/java/com/google/android/flexbox/FlexDirection.java b/flexbox/src/main/java/com/google/android/flexbox/FlexDirection.java
index daef7836..a7b94d27 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/FlexDirection.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/FlexDirection.java
@@ -16,11 +16,11 @@
package com.google.android.flexbox;
-import android.support.annotation.IntDef;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import androidx.annotation.IntDef;
+
/**
* The direction children items are placed inside the flex container, it determines the
* direction of the main axis (and the cross axis, perpendicular to the main axis).
diff --git a/flexbox/src/main/java/com/google/android/flexbox/FlexWrap.java b/flexbox/src/main/java/com/google/android/flexbox/FlexWrap.java
index 9e472901..6604f336 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/FlexWrap.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/FlexWrap.java
@@ -16,11 +16,11 @@
package com.google.android.flexbox;
-import android.support.annotation.IntDef;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import androidx.annotation.IntDef;
+
/**
* This attribute controls whether the flex container is single-line or multi-line, and the
* direction of the cross axis.
diff --git a/flexbox/src/main/java/com/google/android/flexbox/FlexboxHelper.java b/flexbox/src/main/java/com/google/android/flexbox/FlexboxHelper.java
index f9996b5b..3fcbfbcb 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/FlexboxHelper.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/FlexboxHelper.java
@@ -16,15 +16,11 @@
package com.google.android.flexbox;
-import static android.support.v7.widget.RecyclerView.NO_POSITION;
-
import static com.google.android.flexbox.FlexContainer.NOT_SET;
import static com.google.android.flexbox.FlexItem.FLEX_BASIS_PERCENT_DEFAULT;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
-import android.support.v4.view.MarginLayoutParamsCompat;
+import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
+
import android.util.SparseIntArray;
import android.view.View;
import android.view.ViewGroup;
@@ -34,6 +30,11 @@
import java.util.Collections;
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
+import androidx.core.view.MarginLayoutParamsCompat;
+
/**
* Offers various calculations for Flexbox to use the common logic between the classes such as
* {@link FlexboxLayout} and {@link FlexboxLayoutManager}.
diff --git a/flexbox/src/main/java/com/google/android/flexbox/FlexboxItemDecoration.java b/flexbox/src/main/java/com/google/android/flexbox/FlexboxItemDecoration.java
index 17eaaeb1..4965b261 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/FlexboxItemDecoration.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/FlexboxItemDecoration.java
@@ -16,18 +16,19 @@
package com.google.android.flexbox;
-import static android.support.v7.widget.RecyclerView.NO_POSITION;
+import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.support.v7.widget.RecyclerView;
import android.view.View;
import java.util.List;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* {@link RecyclerView.ItemDecoration} implementation that can be used as item decorations between
* view holders within the {@link FlexboxLayoutManager}.
diff --git a/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java b/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
index 2850afa6..269e8cdc 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayout.java
@@ -22,9 +22,6 @@
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.IntDef;
-import android.support.annotation.Nullable;
-import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.View;
@@ -37,6 +34,10 @@
import java.util.ArrayList;
import java.util.List;
+import androidx.annotation.IntDef;
+import androidx.annotation.Nullable;
+import androidx.core.view.ViewCompat;
+
/**
* A layout that arranges its children in a way its attributes can be specified like the
* CSS Flexible Box Layout Module.
diff --git a/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayoutManager.java b/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayoutManager.java
index f599e165..13405bc4 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayoutManager.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/FlexboxLayoutManager.java
@@ -16,20 +16,14 @@
package com.google.android.flexbox;
-import static android.support.v7.widget.LinearLayoutManager.INVALID_OFFSET;
-import static android.support.v7.widget.RecyclerView.NO_POSITION;
+import static androidx.recyclerview.widget.LinearLayoutManager.INVALID_OFFSET;
+import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.NonNull;
-import android.support.v4.view.ViewCompat;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.LinearSmoothScroller;
-import android.support.v7.widget.OrientationHelper;
-import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
@@ -39,6 +33,13 @@
import java.util.ArrayList;
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.core.view.ViewCompat;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.LinearSmoothScroller;
+import androidx.recyclerview.widget.OrientationHelper;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* LayoutManager for the {@link RecyclerView}. This class is intended to be used within a
* {@link RecyclerView} and offers the same capabilities of measure/layout its children
@@ -1982,7 +1983,7 @@ private int handleScrollingMainAxis(int delta) {
int parentLength = isMainAxisHorizontal ? mParent.getWidth() : mParent.getHeight();
int mainAxisLength = isMainAxisHorizontal ? getWidth() : getHeight();
- boolean layoutRtl = getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL;
+ boolean layoutRtl = getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL;
if (layoutRtl) {
int absDelta = Math.abs(delta);
if (delta < 0) {
@@ -2312,7 +2313,7 @@ private int computeScrollRange(RecyclerView.State state) {
}
/**
- * Copied from {@link android.support.v7.widget.RecyclerView.LayoutManager#shouldMeasureChild
+ * Copied from {@link RecyclerView.LayoutManager#shouldMeasureChild
* (View,
* int, int, RecyclerView.LayoutParams)}}
*/
@@ -2326,7 +2327,7 @@ private boolean shouldMeasureChild(View child, int widthSpec, int heightSpec,
/**
* Copied from
- * {@link android.support.v7.widget.RecyclerView.LayoutManager#isMeasurementUpToDate(int, int,
+ * {@link RecyclerView.LayoutManager#isMeasurementUpToDate(int, int,
* int)}
*/
private static boolean isMeasurementUpToDate(int childSize, int spec, int dimension) {
@@ -2513,7 +2514,7 @@ private View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyV
/**
* @param position the index of the view
* @return the index of the {@link FlexLine}, which includes the view whose index is passed as
- * the position argument.
+ * the position argument.
*/
int getPositionToFlexLineIndex(int position) {
assert mFlexboxHelper.mIndexToFlexLine != null;
diff --git a/flexbox/src/main/java/com/google/android/flexbox/JustifyContent.java b/flexbox/src/main/java/com/google/android/flexbox/JustifyContent.java
index d8ba58ff..4df9fd34 100644
--- a/flexbox/src/main/java/com/google/android/flexbox/JustifyContent.java
+++ b/flexbox/src/main/java/com/google/android/flexbox/JustifyContent.java
@@ -16,11 +16,11 @@
package com.google.android.flexbox;
-import android.support.annotation.IntDef;
-
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import androidx.annotation.IntDef;
+
/** This attribute controls the alignment along the main axis. */
@IntDef({JustifyContent.FLEX_START, JustifyContent.FLEX_END, JustifyContent.CENTER,
JustifyContent.SPACE_BETWEEN, JustifyContent.SPACE_AROUND})
diff --git a/gradle.properties b/gradle.properties
index 6c206c0b..1f0a9edb 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -33,3 +33,5 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+android.enableJetifier=true
+android.useAndroidX=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 05ef575b..f6b961fd 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 7f356077..39898483 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Jul 19 22:58:08 JST 2018
+#Mon Sep 24 09:09:16 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
diff --git a/gradlew b/gradlew
index 9d82f789..cccdd3d5 100755
--- a/gradlew
+++ b/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
##############################################################################
##
@@ -6,20 +6,38 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
+ NONSTOP* )
+ nonstop=true
+ ;;
esac
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index aec99730..e95643d6 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line