|
|
|
|
@ -1,14 +1,21 @@ |
|
|
|
|
package net.pokeranalytics.android.ui.fragment.components |
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.view.LayoutInflater |
|
|
|
|
import android.view.View |
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
|
import kotlinx.android.synthetic.main.bottom_sheet_game.* |
|
|
|
|
import kotlinx.android.synthetic.main.fragment_bottom_sheet.view.* |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.model.realm.Game |
|
|
|
|
import net.pokeranalytics.android.ui.fragment.components.BottomSheetFragment |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.components.DynamicListAdapter |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.components.DynamicRowDelegate |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.components.DynamicRowInterface |
|
|
|
|
|
|
|
|
|
class BottomSheetGameFragment : BottomSheetFragment() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BottomSheetGameFragment : BottomSheetFragment(), DynamicRowDelegate { |
|
|
|
|
|
|
|
|
|
private var game: Game = Game() |
|
|
|
|
|
|
|
|
|
@ -24,6 +31,14 @@ class BottomSheetGameFragment : BottomSheetFragment() { |
|
|
|
|
dismiss() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun adapterRows(): ArrayList<DynamicRowInterface> { |
|
|
|
|
val array = ArrayList<DynamicRowInterface>() |
|
|
|
|
array.add(TitleObject("Game 1")) |
|
|
|
|
array.add(TitleObject("Game 2")) |
|
|
|
|
array.add(TitleObject("Game 3")) |
|
|
|
|
return array |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Init data |
|
|
|
|
*/ |
|
|
|
|
@ -37,6 +52,26 @@ class BottomSheetGameFragment : BottomSheetFragment() { |
|
|
|
|
*/ |
|
|
|
|
private fun initUI() { |
|
|
|
|
LayoutInflater.from(requireContext()).inflate(R.layout.bottom_sheet_game, view?.bottomSheetContainer, true) |
|
|
|
|
|
|
|
|
|
val viewManager = LinearLayoutManager(requireContext()) |
|
|
|
|
val dataAdapter = DynamicListAdapter(this) |
|
|
|
|
|
|
|
|
|
gameNameRecyclerView.apply { |
|
|
|
|
setHasFixedSize(true) |
|
|
|
|
layoutManager = viewManager |
|
|
|
|
adapter = dataAdapter |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inner class TitleObject(var title: String) : DynamicRowInterface { |
|
|
|
|
override fun localizedTitle(context: Context): String { |
|
|
|
|
return title |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override var viewType: Int = 0 |
|
|
|
|
override var bottomSheetType: BottomSheetType = BottomSheetType.NONE |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |