diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt index 639b9cd5..1b74925c 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt @@ -60,6 +60,8 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL */ private var menu: Menu? = null + private var replayerItem: MenuItem? = null + val isEditing: Boolean get() { return this.model.isEdited @@ -117,12 +119,14 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL val hhCopy = getRealm().copyFromRealm(handHistory) this.model.setHandHistory(hhCopy) this.setEditing(false) + this.replayerItem?.isEnabled = true } ?: run { val configurationId = this.arguments?.getString(BundleKey.CONFIGURATION_ID.value) val attached = this.arguments?.getBoolean(BundleKey.ATTACHED.value) ?: false this.model.createNewHandHistory(getRealm(), configurationId, attached) this.setEditing(true) + this.replayerItem?.isEnabled = false } } @@ -207,7 +211,13 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL */ private fun updateMenuUI() { val titleResId = if (this.model.isEdited) R.string.save else R.string.edit - this.menu?.findItem(R.id.edit_save)?.setTitle(titleResId) + + this.menu?.let { menu -> + menu.findItem(R.id.edit_save)?.setTitle(titleResId) + this.replayerItem = menu.findItem(R.id.replayer) + this.replayerItem?.isEnabled = this.model.handHistory.isManaged + Timber.d("this.replayerItem = ${this.replayerItem}") + } } override fun onOptionsItemSelected(item: MenuItem): Boolean { @@ -307,6 +317,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL if (!this.model.isEdited) { this.save() + this.replayerItem?.isEnabled = true } this.handHistoryAdapter.notifyDataSetChanged() @@ -628,15 +639,20 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL valueAnimator.interpolator = AccelerateDecelerateInterpolator() // set interpolator and updateListener to get the animated value valueAnimator.addUpdateListener { - val lp = this.kbTopGuideline.layoutParams as ConstraintLayout.LayoutParams - // get the float value - lp.guideEnd = (it.animatedValue as Float).toInt() - // update layout params - this.kbTopGuideline.layoutParams = lp - - if (lp.guideEnd == end.toInt()) { - endHandler?.invoke() + + this.kbTopGuideline?.let { topGuideline -> + + val lp = this.kbTopGuideline.layoutParams as ConstraintLayout.LayoutParams + // get the float value + lp.guideEnd = (it.animatedValue as Float).toInt() + // update layout params + this.kbTopGuideline.layoutParams = lp + + if (lp.guideEnd == end.toInt()) { + endHandler?.invoke() + } } + } valueAnimator.start() } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fd5066ac..6166e5fa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -803,6 +803,6 @@ Video available! Your video has been generated at the following path Open file with - Your video is currently exported, we\'ll send you a notification when it\'s available. Expect approximately one minute! + We\'ll send you a notification when your video is available. Expect approximately one minute!