diff --git a/build.gradle b/build.gradle index 5bd3880b6b7c2e0bb919a208dff24f7e3ba565ec..d8b3ce813f3e8a3cc88d96e4f5f8d20d301cd698 100644 --- a/build.gradle +++ b/build.gradle @@ -18,17 +18,17 @@ buildscript { ext { - minSdkVersion = 9 - targetSdkVersion = 25 - compileSdkVersion = 25 - buildToolsVersion = "25.0.3" + minSdkVersion = 14 + targetSdkVersion = 26 + compileSdkVersion = 26 + buildToolsVersion = "26.0.0" androidGradlePluginVersion = "2.3.3" androidMavenGradlePluginVersion = "1.5" gradleBintrayPluginVersion = "1.6" kotlinVersion = "1.1.3" - supportLibVersion = "25.3.1" - espressoVersion = "2.2.2" - testRunnerVersion = "0.5" + supportLibVersion = "26.0.0" + espressoVersion = "3.0.0" + testRunnerVersion = "1.0.0" junitVersion = "4.12" } diff --git a/circle.yml b/circle.yml index 7b2d032adb0add9e4bac6381ee44459ffe7f07f8..866fe6ca754f541125ef4361874cdd041fd2f820 100644 --- a/circle.yml +++ b/circle.yml @@ -6,7 +6,7 @@ machine: dependencies: pre: - - echo y | android update sdk --no-ui --all --filter "android-25,build-tools-25.0.3,tools,platform-tools,extra-android-m2repository" + - echo y | android update sdk --no-ui --all --filter "android-26,build-tools-26.0.0,tools,platform-tools,extra-android-m2repository" cache_directories: - ~/.android override: 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 d2435b2c810889164624b96d06d28a29a36bee94..c56bd3240be9517e0257cca0561f176a9964a2cb 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 @@ -27,7 +27,7 @@ import com.google.android.flexbox.FlexboxLayoutManager */ internal class CatViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - private val imageView = itemView.findViewById(R.id.imageview) as ImageView + private val imageView: ImageView = itemView.findViewById(R.id.imageview) internal fun bindTo(@DrawableRes drawableRes: Int) { imageView.setImageResource(drawableRes) 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 8fefc7ad8126d1faa27008ec004326a741e8b800..fe9b869825e5aab9a840483c22e0348d813703c5 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 @@ -38,7 +38,7 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - val toolbar = findViewById(R.id.toolbar) as Toolbar + val toolbar: Toolbar = findViewById(R.id.toolbar) setSupportActionBar(toolbar) val flexboxLayoutManager = FlexboxLayoutManager(this).apply { @@ -47,7 +47,7 @@ class MainActivity : AppCompatActivity() { alignItems = AlignItems.STRETCH } - val recyclerView = findViewById(R.id.recyclerview) as RecyclerView + val recyclerView: RecyclerView = findViewById(R.id.recyclerview) recyclerView.apply { layoutManager = flexboxLayoutManager adapter = CatAdapter() 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 1b7ee9ecd4fc26f3347d877ad0fa304a20222d49..7ac4894fb7b96483fc34e29cd3c8057f9a99e50f 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 @@ -94,9 +94,8 @@ internal class FlexItemEditFragment : DialogFragment() { dialog.setTitle((viewIndex + 1).toString()) val activity = activity - val orderTextInput = view - .findViewById(R.id.input_layout_order) as TextInputLayout - val orderEdit = view.findViewById(R.id.edit_text_order) as EditText + val orderTextInput: TextInputLayout = view.findViewById(R.id.input_layout_order) + val orderEdit: EditText = view.findViewById(R.id.edit_text_order) orderEdit.setText(flexItem.order.toString()) orderEdit.addTextChangedListener( FlexEditTextWatcher(activity, orderTextInput, IntegerInputValidator(), @@ -106,26 +105,23 @@ internal class FlexItemEditFragment : DialogFragment() { orderEdit.isEnabled = false } - val flexGrowInput = view - .findViewById(R.id.input_layout_flex_grow) as TextInputLayout - val flexGrowEdit = view.findViewById(R.id.edit_text_flex_grow) as EditText + val flexGrowInput: TextInputLayout = view .findViewById(R.id.input_layout_flex_grow) + val flexGrowEdit: EditText = view.findViewById(R.id.edit_text_flex_grow) flexGrowEdit.setText(flexItem.flexGrow.toString()) flexGrowEdit.addTextChangedListener( FlexEditTextWatcher(activity, flexGrowInput, NonNegativeDecimalInputValidator(), R.string.must_be_non_negative_float)) - val flexShrinkInput = view - .findViewById(R.id.input_layout_flex_shrink) as TextInputLayout - val flexShrinkEdit = view.findViewById( - R.id.edit_text_flex_shrink) as EditText + val flexShrinkInput: TextInputLayout = view.findViewById(R.id.input_layout_flex_shrink) + val flexShrinkEdit: EditText = view.findViewById(R.id.edit_text_flex_shrink) flexShrinkEdit.setText(flexItem.flexShrink.toString()) flexShrinkEdit.addTextChangedListener( FlexEditTextWatcher(activity, flexShrinkInput, NonNegativeDecimalInputValidator(), R.string.must_be_non_negative_float)) - val flexBasisPercentInput = view.findViewById(R.id.input_layout_flex_basis_percent) as TextInputLayout - val flexBasisPercentEdit = view.findViewById( - R.id.edit_text_flex_basis_percent) as EditText + val flexBasisPercentInput: TextInputLayout = + view.findViewById(R.id.input_layout_flex_basis_percent) + val flexBasisPercentEdit: EditText = view.findViewById(R.id.edit_text_flex_basis_percent) if (flexItem.flexBasisPercent != FlexboxLayout.LayoutParams.FLEX_BASIS_PERCENT_DEFAULT) { flexBasisPercentEdit .setText(Math.round(flexItem.flexBasisPercent * 100).toString()) @@ -136,52 +132,43 @@ internal class FlexItemEditFragment : DialogFragment() { FlexEditTextWatcher(activity, flexBasisPercentInput, FlexBasisPercentInputValidator(), R.string.must_be_minus_one_or_non_negative_integer)) - val widthInput = view - .findViewById(R.id.input_layout_width) as TextInputLayout - val widthEdit = view.findViewById(R.id.edit_text_width) as EditText + val widthInput: TextInputLayout = view.findViewById(R.id.input_layout_width) + val widthEdit: EditText = view.findViewById(R.id.edit_text_width) widthEdit.setText(activity.pixelToDp(flexItem.width).toString()) widthEdit.addTextChangedListener( FlexEditTextWatcher(activity, widthInput, DimensionInputValidator(), R.string.must_be_minus_one_or_minus_two_or_non_negative_integer)) - val heightInput = view - .findViewById(R.id.input_layout_height) as TextInputLayout - val heightEdit = view.findViewById( - R.id.edit_text_height) as EditText + val heightInput: TextInputLayout = view.findViewById(R.id.input_layout_height) + val heightEdit: EditText= view.findViewById(R.id.edit_text_height) heightEdit.setText(activity.pixelToDp(flexItem.height).toString()) heightEdit.addTextChangedListener( FlexEditTextWatcher(activity, heightInput, DimensionInputValidator(), R.string.must_be_minus_one_or_minus_two_or_non_negative_integer)) - val minWidthInput = view - .findViewById(R.id.input_layout_min_width) as TextInputLayout - val minWidthEdit = view.findViewById(R.id.edit_text_min_width) as EditText + val minWidthInput: TextInputLayout = view.findViewById(R.id.input_layout_min_width) + val minWidthEdit: EditText = view.findViewById(R.id.edit_text_min_width) minWidthEdit.setText(activity.pixelToDp(flexItem.minWidth).toString()) minWidthEdit.addTextChangedListener( FlexEditTextWatcher(activity, minWidthInput, FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)) - val minHeightInput = view - .findViewById(R.id.input_layout_min_height) as TextInputLayout - val minHeightEdit = view.findViewById( - R.id.edit_text_min_height) as EditText + val minHeightInput: TextInputLayout = view.findViewById(R.id.input_layout_min_height) + val minHeightEdit: EditText = view.findViewById(R.id.edit_text_min_height) minHeightEdit.setText(activity.pixelToDp(flexItem.minHeight).toString()) minHeightEdit.addTextChangedListener( FlexEditTextWatcher(activity, minHeightInput, FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)) - val maxWidthInput = view - .findViewById(R.id.input_layout_max_width) as TextInputLayout - val maxWidthEdit = view.findViewById(R.id.edit_text_max_width) as EditText + val maxWidthInput: TextInputLayout = view.findViewById(R.id.input_layout_max_width) + val maxWidthEdit: EditText = view.findViewById(R.id.edit_text_max_width) maxWidthEdit.setText(activity.pixelToDp(flexItem.maxWidth).toString()) maxWidthEdit.addTextChangedListener( FlexEditTextWatcher(activity, maxWidthInput, FixedDimensionInputValidator(), R.string.must_be_non_negative_integer)) - val maxHeightInput = view - .findViewById(R.id.input_layout_max_height) as TextInputLayout - val maxHeightEdit = view.findViewById( - R.id.edit_text_max_height) as EditText + val maxHeightInput: TextInputLayout = view.findViewById(R.id.input_layout_max_height) + val maxHeightEdit: EditText = view.findViewById(R.id.edit_text_max_height) maxHeightEdit.setText(activity.pixelToDp(flexItem.maxHeight).toString()) maxHeightEdit.addTextChangedListener( FlexEditTextWatcher(activity, maxHeightInput, FixedDimensionInputValidator(), @@ -190,8 +177,7 @@ internal class FlexItemEditFragment : DialogFragment() { setNextFocusesOnEnterDown(orderEdit, flexGrowEdit, flexShrinkEdit, flexBasisPercentEdit, widthEdit, heightEdit, minWidthEdit, minHeightEdit, maxWidthEdit, maxHeightEdit) - val alignSelfSpinner = view.findViewById( - R.id.spinner_align_self) as Spinner + val alignSelfSpinner: Spinner = view.findViewById(R.id.spinner_align_self) val arrayAdapter = ArrayAdapter.createFromResource(activity, R.array.array_align_self, R.layout.spinner_item) alignSelfSpinner.adapter = arrayAdapter @@ -213,18 +199,18 @@ internal class FlexItemEditFragment : DialogFragment() { } } - val wrapBeforeCheckBox = view.findViewById(R.id.checkbox_wrap_before) as CheckBox + val wrapBeforeCheckBox: CheckBox = view.findViewById(R.id.checkbox_wrap_before) wrapBeforeCheckBox.isChecked = flexItem.isWrapBefore wrapBeforeCheckBox.setOnCheckedChangeListener { _, isChecked -> flexItemInEdit.isWrapBefore = isChecked } val alignSelfPosition = arrayAdapter .getPosition(alignSelfAsString(flexItem.alignSelf)) alignSelfSpinner.setSelection(alignSelfPosition) - view.findViewById(R.id.button_cancel).setOnClickListener { + view.findViewById