|
|
|
@ -27,7 +27,6 @@ class ReplayerFragment : RealmFragment() { |
|
|
|
bundle.putSerializable(BundleKey.HAND_HISTORY_ID.value, handHistoryId) |
|
|
|
bundle.putSerializable(BundleKey.HAND_HISTORY_ID.value, handHistoryId) |
|
|
|
fragment.arguments = bundle |
|
|
|
fragment.arguments = bundle |
|
|
|
return fragment |
|
|
|
return fragment |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -36,6 +35,14 @@ class ReplayerFragment : RealmFragment() { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private lateinit var model: ReplayerModel |
|
|
|
private lateinit var model: ReplayerModel |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
|
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.model = activity?.run { |
|
|
|
|
|
|
|
ViewModelProviders.of(this)[ReplayerModel::class.java] |
|
|
|
|
|
|
|
} ?: throw Exception("Invalid Activity") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
super.onCreateView(inflater, container, savedInstanceState) |
|
|
|
super.onCreateView(inflater, container, savedInstanceState) |
|
|
|
@ -48,15 +55,6 @@ class ReplayerFragment : RealmFragment() { |
|
|
|
initUI() |
|
|
|
initUI() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
|
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.model = activity?.run { |
|
|
|
|
|
|
|
ViewModelProviders.of(this)[ReplayerModel::class.java] |
|
|
|
|
|
|
|
} ?: throw Exception("Invalid Activity") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { |
|
|
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { |
|
|
|
super.onCreateOptionsMenu(menu, inflater) |
|
|
|
super.onCreateOptionsMenu(menu, inflater) |
|
|
|
inflater.inflate(R.menu.toolbar_replayer, menu) |
|
|
|
inflater.inflate(R.menu.toolbar_replayer, menu) |
|
|
|
@ -79,17 +77,9 @@ class ReplayerFragment : RealmFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initData() { |
|
|
|
private fun initData() { |
|
|
|
|
|
|
|
|
|
|
|
val id = arguments?.getString(BundleKey.HAND_HISTORY_ID.value) ?: throw PAIllegalStateException("Attempt to start a replayer without hh id") |
|
|
|
val id = arguments?.getString(BundleKey.HAND_HISTORY_ID.value) ?: throw PAIllegalStateException("Attempt to start a replayer without hh id") |
|
|
|
val hh = getRealm().findById<HandHistory>(id) ?: throw PAIllegalStateException("hh with id: $id not found") |
|
|
|
val hh = getRealm().findById<HandHistory>(id) ?: throw PAIllegalStateException("hh with id: $id not found") |
|
|
|
loadHand(hh) |
|
|
|
loadHand(hh) |
|
|
|
|
|
|
|
|
|
|
|
// TODO change |
|
|
|
|
|
|
|
// val hh = getRealm().where(HandHistory::class.java).findFirst()!! |
|
|
|
|
|
|
|
// Timber.d(">>> Load HH with player count = ${hh.numberOfPlayers}") |
|
|
|
|
|
|
|
// this.model.setHandHistory(hh) |
|
|
|
|
|
|
|
// val hhm = ViewModelProviders.of(this)[HandHistoryViewModel::class.java] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initUI() { |
|
|
|
private fun initUI() { |
|
|
|
|