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

Commit

Permalink
Fix crash on rotation. (google#392)
Browse files Browse the repository at this point in the history
By chanigng the View type as nullable in onItemSelected
  • Loading branch information
thagikura authored Dec 18, 2017
1 parent 5835b17 commit b5ce3f1
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ internal class FlexItemEditFragment : DialogFragment() {
R.array.array_align_self, R.layout.spinner_item)
alignSelfSpinner.adapter = arrayAdapter
alignSelfSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>, ignored: View, position: Int, id: Long) {
override fun onItemSelected(parent: AdapterView<*>, ignored: View?, position: Int,
id: Long) {
flexItemInEdit.alignSelf = when (parent.getItemAtPosition(position).toString()) {
alignSelfAuto -> AlignSelf.AUTO
alignSelfFlexStart -> AlignItems.FLEX_START
Expand All @@ -199,7 +200,8 @@ internal class FlexItemEditFragment : DialogFragment() {

val wrapBeforeCheckBox: CheckBox = view.findViewById(R.id.checkbox_wrap_before)
wrapBeforeCheckBox.isChecked = flexItem.isWrapBefore
wrapBeforeCheckBox.setOnCheckedChangeListener { _, isChecked -> flexItemInEdit.isWrapBefore = isChecked }
wrapBeforeCheckBox.setOnCheckedChangeListener { _, isChecked ->
flexItemInEdit.isWrapBefore = isChecked }
val alignSelfPosition = arrayAdapter
.getPosition(alignSelfAsString(flexItem.alignSelf))
alignSelfSpinner.setSelection(alignSelfPosition)
Expand Down

0 comments on commit b5ce3f1

Please sign in to comment.