Improve report creation

dev
Aurelien Hubert 7 years ago
parent 156ff4ce98
commit f70133a00e
  1. 7
      app/src/main/java/net/pokeranalytics/android/ui/adapter/RowRepresentableAdapter.kt
  2. 4
      app/src/main/java/net/pokeranalytics/android/ui/fragment/ReportCreationFragment.kt
  3. 1
      app/src/main/java/net/pokeranalytics/android/ui/fragment/data/EditableDataFragment.kt

@ -55,13 +55,12 @@ class RowRepresentableAdapter(
return return
} }
/* val index = this.dataSource.adapterRows()?.indexOf(row) ?: -1
val index = this.dataSource.indexForRow(row)
if (index >= 0) { if (index >= 0) {
notifyItemChanged(index) notifyItemChanged(index)
} }
*/
notifyDataSetChanged() //notifyDataSetChanged()
} }
/** /**

@ -82,6 +82,7 @@ class ReportCreationFragment : RealmFragment(), RowRepresentableDataSource, RowR
setDisplayHomeAsUpEnabled(true) setDisplayHomeAsUpEnabled(true)
this.optionsAdapter = RowRepresentableAdapter(this, this) this.optionsAdapter = RowRepresentableAdapter(this, this)
this.optionsAdapter.setHasStableIds(true)
val viewManager = LinearLayoutManager(requireContext()) val viewManager = LinearLayoutManager(requireContext())
recyclerView.apply { recyclerView.apply {
@ -179,7 +180,7 @@ class ReportCreationFragment : RealmFragment(), RowRepresentableDataSource, RowR
this.updateUIWithCurrentStep() this.updateUIWithCurrentStep()
} else { } else {
this.next.isEnabled = this.assistant.nextEnabled this.next.isEnabled = this.assistant.nextEnabled
this.optionsAdapter.refreshRow(row) this.optionsAdapter.notifyDataSetChanged()
} }
} }
@ -256,6 +257,7 @@ class Assistant {
return when (this.step) { return when (this.step) {
Step.STAT -> this.stats.contains(row as Stat) Step.STAT -> this.stats.contains(row as Stat)
Step.COMPARATOR -> this.comparators.contains(row as Criteria) Step.COMPARATOR -> this.comparators.contains(row as Criteria)
Step.FILTER -> this.filter == row
else -> false else -> false
} }
} }

@ -89,6 +89,7 @@ open class EditableDataFragment : DataManagerFragment(), RowRepresentableDelegat
val dataSource = getDataSource() val dataSource = getDataSource()
this.rowRepresentableAdapter = RowRepresentableAdapter(getDataSource(), this) this.rowRepresentableAdapter = RowRepresentableAdapter(getDataSource(), this)
this.rowRepresentableAdapter.setHasStableIds(true)
this.recyclerView.adapter = rowRepresentableAdapter this.recyclerView.adapter = rowRepresentableAdapter
// When creating an object, open automatically the keyboard for the first row // When creating an object, open automatically the keyboard for the first row

Loading…
Cancel
Save