|
|
|
@ -31,6 +31,8 @@ class SessionFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Bott |
|
|
|
|
|
|
|
|
|
|
|
private lateinit var currentSession: Session |
|
|
|
private lateinit var currentSession: Session |
|
|
|
private lateinit var sessionAdapter: RowRepresentableAdapter |
|
|
|
private lateinit var sessionAdapter: RowRepresentableAdapter |
|
|
|
|
|
|
|
private var sessionMenu: Menu? = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
return inflater.inflate(R.layout.fragment_session, container, false) |
|
|
|
return inflater.inflate(R.layout.fragment_session, container, false) |
|
|
|
@ -43,12 +45,14 @@ class SessionFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Bott |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { |
|
|
|
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { |
|
|
|
inflater?.inflate(R.menu.session_toolbar, menu) |
|
|
|
inflater?.inflate(R.menu.session_toolbar, menu) |
|
|
|
|
|
|
|
this.sessionMenu = menu |
|
|
|
|
|
|
|
updateSessionUI() |
|
|
|
super.onCreateOptionsMenu(menu, inflater) |
|
|
|
super.onCreateOptionsMenu(menu, inflater) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onOptionsItemSelected(item: MenuItem?): Boolean { |
|
|
|
override fun onOptionsItemSelected(item: MenuItem?): Boolean { |
|
|
|
when (item!!.itemId) { |
|
|
|
when (item!!.itemId) { |
|
|
|
R.id.restart -> toast("Restard is clicked!") |
|
|
|
R.id.restart -> toast("Restart is clicked!") |
|
|
|
R.id.delete -> { |
|
|
|
R.id.delete -> { |
|
|
|
currentSession.delete() |
|
|
|
currentSession.delete() |
|
|
|
activity?.finish() |
|
|
|
activity?.finish() |
|
|
|
@ -154,31 +158,31 @@ class SessionFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Bott |
|
|
|
|
|
|
|
|
|
|
|
when (currentSession.getState()) { |
|
|
|
when (currentSession.getState()) { |
|
|
|
SessionState.PENDING -> { |
|
|
|
SessionState.PENDING -> { |
|
|
|
|
|
|
|
sessionMenu?.findItem(R.id.restart)?.isVisible = false |
|
|
|
floatingActionButton.setImageResource(R.drawable.ic_outline_play) |
|
|
|
floatingActionButton.setImageResource(R.drawable.ic_outline_play) |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = false |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = false |
|
|
|
floatingActionButton.animate().scaleX(1f).scaleY(1f).alpha(1f) |
|
|
|
floatingActionButton.animate().scaleX(1f).scaleY(1f).alpha(1f) |
|
|
|
.setInterpolator(OvershootInterpolator()).start() |
|
|
|
.setInterpolator(OvershootInterpolator()).start() |
|
|
|
} |
|
|
|
} |
|
|
|
SessionState.STARTED -> { |
|
|
|
SessionState.STARTED -> { |
|
|
|
|
|
|
|
sessionMenu?.findItem(R.id.restart)?.isVisible = true |
|
|
|
floatingActionButton.setImageResource(R.drawable.ic_outline_pause) |
|
|
|
floatingActionButton.setImageResource(R.drawable.ic_outline_pause) |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = true |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = true |
|
|
|
floatingActionButton.animate().scaleX(1f).scaleY(1f).alpha(1f) |
|
|
|
floatingActionButton.animate().scaleX(1f).scaleY(1f).alpha(1f) |
|
|
|
.setInterpolator(OvershootInterpolator()).start() |
|
|
|
.setInterpolator(OvershootInterpolator()).start() |
|
|
|
} |
|
|
|
} |
|
|
|
SessionState.PAUSED -> { |
|
|
|
SessionState.PAUSED -> { |
|
|
|
|
|
|
|
sessionMenu?.findItem(R.id.restart)?.isVisible = true |
|
|
|
floatingActionButton.setImageResource(R.drawable.ic_outline_play) |
|
|
|
floatingActionButton.setImageResource(R.drawable.ic_outline_play) |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = true |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = true |
|
|
|
floatingActionButton.animate().scaleX(1f).scaleY(1f).alpha(1f) |
|
|
|
floatingActionButton.animate().scaleX(1f).scaleY(1f).alpha(1f) |
|
|
|
.setInterpolator(OvershootInterpolator()).start() |
|
|
|
.setInterpolator(OvershootInterpolator()).start() |
|
|
|
} |
|
|
|
} |
|
|
|
SessionState.FINISHED -> { |
|
|
|
SessionState.FINISHED -> { |
|
|
|
|
|
|
|
sessionMenu?.findItem(R.id.restart)?.isVisible = true |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = false |
|
|
|
bottomAppBar.menu.findItem(R.id.stop).isVisible = false |
|
|
|
floatingActionButton.animate() |
|
|
|
floatingActionButton.animate().scaleX(0f).scaleY(0f).alpha(0f) |
|
|
|
.scaleX(0f) |
|
|
|
.setInterpolator(FastOutSlowInInterpolator()).start() |
|
|
|
.scaleY(0f) |
|
|
|
|
|
|
|
.alpha(0f) |
|
|
|
|
|
|
|
.setInterpolator(FastOutSlowInInterpolator()) |
|
|
|
|
|
|
|
.start() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|