Fixing crash when sharing before saving a new hand

bs
Laurent 5 years ago
parent a11af4b08e
commit 53dd61086c
  1. 10
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/editor/EditorFragment.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerFragment.kt
  3. 1
      app/src/main/res/values/strings.xml

@ -24,6 +24,7 @@ import net.pokeranalytics.android.model.realm.handhistory.HandHistory
import net.pokeranalytics.android.ui.activity.components.RequestCode
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate
import net.pokeranalytics.android.ui.extensions.px
import net.pokeranalytics.android.ui.extensions.showAlertDialog
import net.pokeranalytics.android.ui.fragment.components.BaseFragment
import net.pokeranalytics.android.ui.fragment.components.RealmFragment
import net.pokeranalytics.android.ui.fragment.components.bottomsheet.BottomSheetFragment
@ -179,7 +180,7 @@ class EditorFragment : RealmFragment(), RowRepresentableDelegate, KeyboardListen
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
menu.clear()
this.menu = menu
inflater.inflate(R.menu.toolbar_hand_history, menu)
inflater.inflate(R.menu.toolbar_hh_editor, menu)
updateMenuUI()
super.onCreateOptionsMenu(menu, inflater)
}
@ -237,7 +238,12 @@ class EditorFragment : RealmFragment(), RowRepresentableDelegate, KeyboardListen
}
private fun exportHand() {
(this.activity as HandHistoryActivity).exportHand(this.model.handHistory)
if (!this.model.isEdited) {
(this.activity as HandHistoryActivity).exportHand(this.model.handHistory)
} else {
this.showAlertDialog(R.string.please_save_hand_history)
}
}
/***

@ -60,7 +60,7 @@ class ReplayerFragment : RealmFragment() {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.toolbar_replayer, menu)
inflater.inflate(R.menu.toolbar_hh_replayer, menu)
}
override fun onPause() {

@ -805,5 +805,6 @@
<string name="open_file_with">Open file with</string>
<string name="video_export_started">We\'ll send you a notification when your file is available. Expect approximately one minute!</string>
<string name="show_villain_cards">Show villain cards</string>
<string name="please_save_hand_history">Please save before sharing</string>
</resources>

Loading…
Cancel
Save