Skip to content

Commit 1865c6a

Browse files
authored
Bump up some library versions. (#383)
Also fixes: - Some Kotlin errors in the demo app. - Replace the deprecated compile dependency syntax to api or implementation in the build.gradle files.
1 parent 1874afa commit 1865c6a

File tree

8 files changed

+84
-88
lines changed

8 files changed

+84
-88
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
counter=0 ;
3636
result=1 ;
3737
while [ $result != 0 -a $counter -lt $MAX_RETRY ]; do
38-
gcloud firebase test android run --type instrumentation --app demo-playground/build/outputs/apk/demo-playground-debug.apk --test flexbox/build/outputs/apk/flexbox-debug-androidTest.apk --device-ids hammerhead,sailfish --os-version-ids 19,21,23,24,25,26 --locales en --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s ;
38+
gcloud firebase test android run --type instrumentation --app demo-playground/build/outputs/apk/debug/demo-playground-debug.apk --test flexbox/build/outputs/apk/androidTest/debug/flexbox-debug-androidTest.apk --device-ids hammerhead,sailfish --os-version-ids 19,21,23,24,25,26 --locales en --orientations portrait,landscape --results-bucket ${GCLOUD_TEST_BUCKET_LIBRARY} --timeout 180s ;
3939
result=$? ;
4040
let counter=counter+1 ;
4141
done

build.gradle

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,22 @@
1919
buildscript {
2020
ext {
2121
minSdkVersion = 14
22-
targetSdkVersion = 26
23-
compileSdkVersion = 26
24-
buildToolsVersion = "26.0.0"
25-
androidGradlePluginVersion = "2.3.3"
22+
targetSdkVersion = 27
23+
compileSdkVersion = 27
24+
buildToolsVersion = "27.0.1"
25+
androidGradlePluginVersion = "3.0.1"
2626
androidMavenGradlePluginVersion = "1.5"
2727
gradleBintrayPluginVersion = "1.6"
28-
kotlinVersion = "1.1.3"
29-
supportLibVersion = "26.0.0"
28+
kotlinVersion = "1.1.61"
29+
supportLibVersion = "27.0.1"
3030
espressoVersion = "3.0.0"
3131
testRunnerVersion = "1.0.0"
3232
junitVersion = "4.12"
3333
}
3434

3535
repositories {
3636
jcenter()
37-
maven {
38-
url 'https://maven.google.com'
39-
}
37+
google()
4038
}
4139
dependencies {
4240
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
@@ -51,9 +49,7 @@ buildscript {
5149
allprojects {
5250
repositories {
5351
jcenter()
54-
maven {
55-
url 'https://maven.google.com'
56-
}
52+
google()
5753
}
5854
}
5955

demo-cat-gallery/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ android {
4040
}
4141

4242
dependencies {
43-
compile project(path: ":flexbox")
44-
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
45-
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
46-
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
47-
compile "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
43+
implementation project(path: ":flexbox")
44+
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
45+
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
46+
implementation "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
47+
implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
4848
}

demo-playground/build.gradle

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ android {
4040
}
4141

4242
dependencies {
43-
compile project(":flexbox")
44-
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
45-
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
46-
compile "com.android.support:preference-v7:${rootProject.ext.supportLibVersion}"
47-
compile "com.android.support:preference-v14:${rootProject.ext.supportLibVersion}"
48-
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
49-
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
43+
implementation project(":flexbox")
44+
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
45+
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
46+
implementation "com.android.support:preference-v7:${rootProject.ext.supportLibVersion}"
47+
implementation "com.android.support:preference-v14:${rootProject.ext.supportLibVersion}"
48+
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
49+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
5050

51-
testCompile "junit:junit:${rootProject.ext.junitVersion}"
51+
testImplementation "junit:junit:${rootProject.ext.junitVersion}"
5252

53-
androidTestCompile "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
54-
androidTestCompile "com.android.support.test:runner:${rootProject.ext.testRunnerVersion}"
55-
androidTestCompile "com.android.support.test.espresso:espresso-core:${rootProject.ext.espressoVersion}"
53+
androidTestImplementation "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
54+
androidTestImplementation "com.android.support.test:runner:${rootProject.ext.testRunnerVersion}"
55+
androidTestImplementation "com.android.support.test.espresso:espresso-core:${rootProject.ext.espressoVersion}"
5656
}

demo-playground/src/main/java/com/google/android/flexbox/FlexItemEditFragment.kt

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ import com.google.android.flexbox.validators.*
3838
*/
3939
internal class FlexItemEditFragment : DialogFragment() {
4040

41-
private lateinit var ALIGN_SELF_AUTO: String
41+
private lateinit var alignSelfAuto: String
4242

43-
private lateinit var ALIGN_SELF_FLEX_START: String
43+
private lateinit var alignSelfFlexStart: String
4444

45-
private lateinit var ALIGN_SELF_FLEX_END: String
45+
private lateinit var alignSelfFlexEnd: String
4646

47-
private lateinit var ALIGN_SELF_CENTER: String
47+
private lateinit var alignSelfCenter: String
4848

49-
private lateinit var ALIGN_SELF_BASELINE: String
49+
private lateinit var alignSelfBaseline: String
5050

51-
private lateinit var ALIGN_SELF_STRETCH: String
51+
private lateinit var alignSelfStretch: String
5252

5353
private var viewIndex: Int = 0
5454

@@ -70,19 +70,19 @@ internal class FlexItemEditFragment : DialogFragment() {
7070
} else {
7171
setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Dialog)
7272
}
73-
arguments.let {
73+
arguments?.let {
7474
flexItem = it.getParcelable(FLEX_ITEM_KEY)
7575
viewIndex = it.getInt(VIEW_INDEX_KEY)
7676
}
7777
flexItemInEdit = createNewFlexItem(flexItem)
7878

79-
activity.let {
80-
ALIGN_SELF_AUTO = it.getString(R.string.auto)
81-
ALIGN_SELF_FLEX_START = it.getString(R.string.flex_start)
82-
ALIGN_SELF_FLEX_END = it.getString(R.string.flex_end)
83-
ALIGN_SELF_CENTER = it.getString(R.string.center)
84-
ALIGN_SELF_BASELINE = it.getString(R.string.baseline)
85-
ALIGN_SELF_STRETCH = it.getString(R.string.stretch)
79+
activity?.let {
80+
alignSelfAuto = it.getString(R.string.auto)
81+
alignSelfFlexStart = it.getString(R.string.flex_start)
82+
alignSelfFlexEnd = it.getString(R.string.flex_end)
83+
alignSelfCenter = it.getString(R.string.center)
84+
alignSelfBaseline = it.getString(R.string.baseline)
85+
alignSelfStretch = it.getString(R.string.stretch)
8686
}
8787
}
8888

@@ -91,12 +91,12 @@ internal class FlexItemEditFragment : DialogFragment() {
9191
val view = inflater.inflate(R.layout.fragment_flex_item_edit, container, false)
9292
dialog.setTitle((viewIndex + 1).toString())
9393

94-
val activity = activity
94+
val context = activity ?: return view
9595
val orderTextInput: TextInputLayout = view.findViewById(R.id.input_layout_order)
9696
val orderEdit: EditText = view.findViewById(R.id.edit_text_order)
9797
orderEdit.setText(flexItem.order.toString())
9898
orderEdit.addTextChangedListener(
99-
FlexEditTextWatcher(activity, orderTextInput, IntegerInputValidator(),
99+
FlexEditTextWatcher(context, orderTextInput, IntegerInputValidator(),
100100
R.string.must_be_integer))
101101
if (flexItem is FlexboxLayoutManager.LayoutParams) {
102102
// Order is not enabled in FlexboxLayoutManager
@@ -107,14 +107,14 @@ internal class FlexItemEditFragment : DialogFragment() {
107107
val flexGrowEdit: EditText = view.findViewById(R.id.edit_text_flex_grow)
108108
flexGrowEdit.setText(flexItem.flexGrow.toString())
109109
flexGrowEdit.addTextChangedListener(
110-
FlexEditTextWatcher(activity, flexGrowInput, NonNegativeDecimalInputValidator(),
110+
FlexEditTextWatcher(context, flexGrowInput, NonNegativeDecimalInputValidator(),
111111
R.string.must_be_non_negative_float))
112112

113113
val flexShrinkInput: TextInputLayout = view.findViewById(R.id.input_layout_flex_shrink)
114114
val flexShrinkEdit: EditText = view.findViewById(R.id.edit_text_flex_shrink)
115115
flexShrinkEdit.setText(flexItem.flexShrink.toString())
116116
flexShrinkEdit.addTextChangedListener(
117-
FlexEditTextWatcher(activity, flexShrinkInput, NonNegativeDecimalInputValidator(),
117+
FlexEditTextWatcher(context, flexShrinkInput, NonNegativeDecimalInputValidator(),
118118
R.string.must_be_non_negative_float))
119119

120120
val flexBasisPercentInput: TextInputLayout =
@@ -127,49 +127,49 @@ internal class FlexItemEditFragment : DialogFragment() {
127127
flexBasisPercentEdit.setText(flexItem.flexBasisPercent.toInt().toString())
128128
}
129129
flexBasisPercentEdit.addTextChangedListener(
130-
FlexEditTextWatcher(activity, flexBasisPercentInput, FlexBasisPercentInputValidator(),
130+
FlexEditTextWatcher(context, flexBasisPercentInput, FlexBasisPercentInputValidator(),
131131
R.string.must_be_minus_one_or_non_negative_integer))
132132

133133
val widthInput: TextInputLayout = view.findViewById(R.id.input_layout_width)
134134
val widthEdit: EditText = view.findViewById(R.id.edit_text_width)
135-
widthEdit.setText(activity.pixelToDp(flexItem.width).toString())
135+
widthEdit.setText(context.pixelToDp(flexItem.width).toString())
136136
widthEdit.addTextChangedListener(
137-
FlexEditTextWatcher(activity, widthInput, DimensionInputValidator(),
137+
FlexEditTextWatcher(context, widthInput, DimensionInputValidator(),
138138
R.string.must_be_minus_one_or_minus_two_or_non_negative_integer))
139139

140140
val heightInput: TextInputLayout = view.findViewById(R.id.input_layout_height)
141141
val heightEdit: EditText= view.findViewById(R.id.edit_text_height)
142-
heightEdit.setText(activity.pixelToDp(flexItem.height).toString())
142+
heightEdit.setText(context.pixelToDp(flexItem.height).toString())
143143
heightEdit.addTextChangedListener(
144-
FlexEditTextWatcher(activity, heightInput, DimensionInputValidator(),
144+
FlexEditTextWatcher(context, heightInput, DimensionInputValidator(),
145145
R.string.must_be_minus_one_or_minus_two_or_non_negative_integer))
146146

147147
val minWidthInput: TextInputLayout = view.findViewById(R.id.input_layout_min_width)
148148
val minWidthEdit: EditText = view.findViewById(R.id.edit_text_min_width)
149-
minWidthEdit.setText(activity.pixelToDp(flexItem.minWidth).toString())
149+
minWidthEdit.setText(context.pixelToDp(flexItem.minWidth).toString())
150150
minWidthEdit.addTextChangedListener(
151-
FlexEditTextWatcher(activity, minWidthInput, FixedDimensionInputValidator(),
151+
FlexEditTextWatcher(context, minWidthInput, FixedDimensionInputValidator(),
152152
R.string.must_be_non_negative_integer))
153153

154154
val minHeightInput: TextInputLayout = view.findViewById(R.id.input_layout_min_height)
155155
val minHeightEdit: EditText = view.findViewById(R.id.edit_text_min_height)
156-
minHeightEdit.setText(activity.pixelToDp(flexItem.minHeight).toString())
156+
minHeightEdit.setText(context.pixelToDp(flexItem.minHeight).toString())
157157
minHeightEdit.addTextChangedListener(
158-
FlexEditTextWatcher(activity, minHeightInput, FixedDimensionInputValidator(),
158+
FlexEditTextWatcher(context, minHeightInput, FixedDimensionInputValidator(),
159159
R.string.must_be_non_negative_integer))
160160

161161
val maxWidthInput: TextInputLayout = view.findViewById(R.id.input_layout_max_width)
162162
val maxWidthEdit: EditText = view.findViewById(R.id.edit_text_max_width)
163-
maxWidthEdit.setText(activity.pixelToDp(flexItem.maxWidth).toString())
163+
maxWidthEdit.setText(context.pixelToDp(flexItem.maxWidth).toString())
164164
maxWidthEdit.addTextChangedListener(
165-
FlexEditTextWatcher(activity, maxWidthInput, FixedDimensionInputValidator(),
165+
FlexEditTextWatcher(context, maxWidthInput, FixedDimensionInputValidator(),
166166
R.string.must_be_non_negative_integer))
167167

168168
val maxHeightInput: TextInputLayout = view.findViewById(R.id.input_layout_max_height)
169169
val maxHeightEdit: EditText = view.findViewById(R.id.edit_text_max_height)
170-
maxHeightEdit.setText(activity.pixelToDp(flexItem.maxHeight).toString())
170+
maxHeightEdit.setText(context.pixelToDp(flexItem.maxHeight).toString())
171171
maxHeightEdit.addTextChangedListener(
172-
FlexEditTextWatcher(activity, maxHeightInput, FixedDimensionInputValidator(),
172+
FlexEditTextWatcher(context, maxHeightInput, FixedDimensionInputValidator(),
173173
R.string.must_be_non_negative_integer))
174174

175175
setNextFocusesOnEnterDown(orderEdit, flexGrowEdit, flexShrinkEdit, flexBasisPercentEdit,
@@ -182,12 +182,12 @@ internal class FlexItemEditFragment : DialogFragment() {
182182
alignSelfSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
183183
override fun onItemSelected(parent: AdapterView<*>, ignored: View, position: Int, id: Long) {
184184
flexItemInEdit.alignSelf = when (parent.getItemAtPosition(position).toString()) {
185-
ALIGN_SELF_AUTO -> AlignSelf.AUTO
186-
ALIGN_SELF_FLEX_START -> AlignItems.FLEX_START
187-
ALIGN_SELF_FLEX_END -> AlignItems.FLEX_END
188-
ALIGN_SELF_CENTER -> AlignItems.CENTER
189-
ALIGN_SELF_BASELINE -> AlignItems.BASELINE
190-
ALIGN_SELF_STRETCH -> AlignItems.STRETCH
185+
alignSelfAuto -> AlignSelf.AUTO
186+
alignSelfFlexStart -> AlignItems.FLEX_START
187+
alignSelfFlexEnd -> AlignItems.FLEX_END
188+
alignSelfCenter -> AlignItems.CENTER
189+
alignSelfBaseline -> AlignItems.BASELINE
190+
alignSelfStretch -> AlignItems.STRETCH
191191
else -> return
192192
}
193193
}
@@ -248,9 +248,9 @@ internal class FlexItemEditFragment : DialogFragment() {
248248
if (i + 1 < textViews.size) {
249249
textViews[i + 1].requestFocus()
250250
} else if (i == textViews.size - 1) {
251-
val inputMethodManager = activity
252-
.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
253-
inputMethodManager.hideSoftInputFromWindow(v.windowToken, 0)
251+
val inputMethodManager = activity?.getSystemService(
252+
Context.INPUT_METHOD_SERVICE) as InputMethodManager?
253+
inputMethodManager?.hideSoftInputFromWindow(v.windowToken, 0)
254254
}
255255
}
256256
true
@@ -264,13 +264,13 @@ internal class FlexItemEditFragment : DialogFragment() {
264264

265265
private fun alignSelfAsString(alignSelf: Int): String {
266266
return when (alignSelf) {
267-
AlignSelf.AUTO -> ALIGN_SELF_AUTO
268-
AlignItems.FLEX_START -> ALIGN_SELF_FLEX_START
269-
AlignItems.FLEX_END -> ALIGN_SELF_FLEX_END
270-
AlignItems.CENTER -> ALIGN_SELF_CENTER
271-
AlignItems.BASELINE -> ALIGN_SELF_BASELINE
272-
AlignItems.STRETCH -> ALIGN_SELF_STRETCH
273-
else -> ALIGN_SELF_AUTO
267+
AlignSelf.AUTO -> alignSelfAuto
268+
AlignItems.FLEX_START -> alignSelfFlexStart
269+
AlignItems.FLEX_END -> alignSelfFlexEnd
270+
AlignItems.CENTER -> alignSelfCenter
271+
AlignItems.BASELINE -> alignSelfBaseline
272+
AlignItems.STRETCH -> alignSelfStretch
273+
else -> alignSelfAuto
274274
}
275275
}
276276

@@ -289,7 +289,7 @@ internal class FlexItemEditFragment : DialogFragment() {
289289
textInputLayout.error = ""
290290
} else {
291291
textInputLayout.isErrorEnabled = true
292-
textInputLayout.error = activity.resources.getString(errorMessageId)
292+
textInputLayout.error = activity?.resources?.getString(errorMessageId)
293293
}
294294
}
295295

flexbox/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ android {
4141
}
4242

4343
dependencies {
44-
compile "com.android.support:support-compat:${rootProject.ext.supportLibVersion}"
45-
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
44+
api "com.android.support:support-compat:${rootProject.ext.supportLibVersion}"
45+
api "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
4646

47-
testCompile "junit:junit:${rootProject.ext.junitVersion}"
47+
testImplementation "junit:junit:${rootProject.ext.junitVersion}"
4848

49-
androidTestCompile "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
50-
androidTestCompile "com.android.support.test:runner:${rootProject.ext.testRunnerVersion}"
51-
androidTestCompile "com.android.support.test.espresso:espresso-core:${rootProject.ext.espressoVersion}"
52-
androidTestCompile "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
49+
androidTestImplementation "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
50+
androidTestImplementation "com.android.support.test:runner:${rootProject.ext.testRunnerVersion}"
51+
androidTestImplementation "com.android.support.test.espresso:espresso-core:${rootProject.ext.espressoVersion}"
52+
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
5353
}

flexbox/src/main/java/com/google/android/flexbox/FlexItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.google.android.flexbox;
1818

1919
import android.os.Parcelable;
20-
import android.support.v4.view.ViewCompat;
20+
import android.view.View;
2121

2222
/**
2323
* An interface that has the common behavior as a flex item contained in a flex container.
@@ -39,7 +39,7 @@ interface FlexItem extends Parcelable {
3939
float FLEX_BASIS_PERCENT_DEFAULT = -1f;
4040

4141
/** The maximum size of the max width and max height attributes */
42-
int MAX_SIZE = Integer.MAX_VALUE & ViewCompat.MEASURED_SIZE_MASK;
42+
int MAX_SIZE = Integer.MAX_VALUE & View.MEASURED_SIZE_MASK;
4343

4444
/**
4545
* @return the width attribute of the flex item.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Jun 13 19:10:11 JST 2017
1+
#Mon Nov 27 14:52:10 JST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip

0 commit comments

Comments
 (0)