parent
63d6c9b5b9
commit
5882fd8cd6
@ -1,6 +1,49 @@ |
||||
package net.pokeranalytics.android.ui.view.rowrepresentable |
||||
|
||||
import net.pokeranalytics.android.ui.view.DefaultEditDataSource |
||||
import androidx.fragment.app.Fragment |
||||
import net.pokeranalytics.android.R |
||||
import net.pokeranalytics.android.model.realm.TournamentFeature |
||||
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
||||
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetFragment |
||||
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType |
||||
import net.pokeranalytics.android.ui.view.RowRepresentable |
||||
import net.pokeranalytics.android.ui.view.RowRepresentableEditData |
||||
import net.pokeranalytics.android.ui.view.RowViewType |
||||
|
||||
enum class TournamentFeatureRow : RowRepresentable, DefaultEditDataSource |
||||
enum class TournamentFeatureRow : RowRepresentable { |
||||
NAME; |
||||
|
||||
override val resId: Int? |
||||
get() { |
||||
return when (this) { |
||||
NAME -> R.string.name |
||||
} |
||||
} |
||||
|
||||
override val viewType: Int |
||||
get() { |
||||
return when (this) { |
||||
NAME -> RowViewType.TITLE_VALUE.ordinal |
||||
} |
||||
} |
||||
|
||||
override val bottomSheetType: BottomSheetType |
||||
get() { |
||||
return when (this) { |
||||
NAME -> BottomSheetType.EDIT_TEXT |
||||
} |
||||
} |
||||
|
||||
override fun startEditing(dataSource: Any?, parent: Fragment?) { |
||||
if (dataSource == null) return |
||||
if (dataSource !is TournamentFeature) return |
||||
if (parent == null) return |
||||
if (parent !is RowRepresentableDelegate) return |
||||
val data = RowRepresentableEditData() |
||||
when (this) { |
||||
NAME -> data.append(dataSource.name) |
||||
} |
||||
BottomSheetFragment.newCreate(this, parent, data) |
||||
} |
||||
|
||||
} |
||||
|
||||
@ -1,6 +1,49 @@ |
||||
package net.pokeranalytics.android.ui.view.rowrepresentable |
||||
|
||||
import net.pokeranalytics.android.ui.view.DefaultEditDataSource |
||||
import androidx.fragment.app.Fragment |
||||
import net.pokeranalytics.android.R |
||||
import net.pokeranalytics.android.model.realm.TournamentName |
||||
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
||||
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetFragment |
||||
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetType |
||||
import net.pokeranalytics.android.ui.view.RowRepresentable |
||||
import net.pokeranalytics.android.ui.view.RowRepresentableEditData |
||||
import net.pokeranalytics.android.ui.view.RowViewType |
||||
|
||||
enum class TournamentNameRow : RowRepresentable, DefaultEditDataSource |
||||
enum class TournamentNameRow : RowRepresentable { |
||||
NAME; |
||||
|
||||
override val resId: Int? |
||||
get() { |
||||
return when (this) { |
||||
NAME -> R.string.name |
||||
} |
||||
} |
||||
|
||||
override val viewType: Int |
||||
get() { |
||||
return when (this) { |
||||
NAME -> RowViewType.TITLE_VALUE.ordinal |
||||
} |
||||
} |
||||
|
||||
override val bottomSheetType: BottomSheetType |
||||
get() { |
||||
return when (this) { |
||||
NAME -> BottomSheetType.EDIT_TEXT |
||||
} |
||||
} |
||||
|
||||
override fun startEditing(dataSource: Any?, parent: Fragment?) { |
||||
if (dataSource == null) return |
||||
if (dataSource !is TournamentName) return |
||||
if (parent == null) return |
||||
if (parent !is RowRepresentableDelegate) return |
||||
val data = RowRepresentableEditData() |
||||
when (this) { |
||||
NAME -> data.append(dataSource.name) |
||||
} |
||||
BottomSheetFragment.newCreate(this, parent, data) |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue