Fix new subtask rotation bug

pull/996/head
Alex Baker 6 years ago
parent 3801c46f31
commit 998f5b51d1

@ -154,8 +154,8 @@ class SubtaskControlSet : TaskEditControlFragment(), SubtaskViewHolder.Callbacks
val subtasks = ArrayList<Task>() val subtasks = ArrayList<Task>()
val children = newSubtaskContainer.childCount val children = newSubtaskContainer.childCount
for (i in 0 until children) { for (i in 0 until children) {
val view = newSubtaskContainer.getChildAt(i) val view = newSubtaskContainer.getChildAt(i) as ViewGroup
val title = view.findViewById<EditText>(R.id.title) val title = view.getChildAt(2) as EditText
val completed: CheckableImageView = view.findViewById(R.id.completeBox) val completed: CheckableImageView = view.findViewById(R.id.completeBox)
val subtask = taskCreator.createWithValues(title.text.toString()) val subtask = taskCreator.createWithValues(title.text.toString())
if (completed.isChecked) { if (completed.isChecked) {
@ -194,8 +194,8 @@ class SubtaskControlSet : TaskEditControlFragment(), SubtaskViewHolder.Callbacks
val view = LayoutInflater.from(activity) val view = LayoutInflater.from(activity)
.inflate(R.layout.editable_subtask_adapter_row_body, newSubtaskContainer, false) as ViewGroup .inflate(R.layout.editable_subtask_adapter_row_body, newSubtaskContainer, false) as ViewGroup
view.findViewById<View>(R.id.clear).setOnClickListener { newSubtaskContainer.removeView(view) } view.findViewById<View>(R.id.clear).setOnClickListener { newSubtaskContainer.removeView(view) }
val editText = view.findViewById<EditText>(R.id.title) val editText = view.getChildAt(2) as EditText
editText.setTextKeepState(task.title) editText.setText(task.title)
editText.setHorizontallyScrolling(false) editText.setHorizontallyScrolling(false)
editText.setLines(1) editText.setLines(1)
editText.maxLines = Int.MAX_VALUE editText.maxLines = Int.MAX_VALUE

@ -20,7 +20,6 @@
android:layout_alignParentEnd="true" /> android:layout_alignParentEnd="true" />
<EditText <EditText
android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toEndOf="@id/completeBox" android:layout_toEndOf="@id/completeBox"

Loading…
Cancel
Save