diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt index 18cd5bd7..098622aa 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt @@ -231,7 +231,7 @@ open class HandHistory : RealmObject(), RowRepresentable, Identifiable, Filterab this.smallBlind?.let { sb -> this.bigBlind?.let { bb -> - firstLineComponents.add("$sb/$bb") + firstLineComponents.add("${sb.formatted()}/${bb.formatted()}") } } if (this.ante > 0.0) { @@ -288,7 +288,7 @@ open class HandHistory : RealmObject(), RowRepresentable, Identifiable, Filterab private fun localizedPlayerSetup(playerSetup: PlayerSetup, positions: LinkedHashSet, context: Context): String { val playerItems = mutableListOf(positions.elementAt(playerSetup.position).value) - playerItems.add("[${this.cards.formatted(context)}]") + playerItems.add("[${playerSetup.cards.formatted(context)}]") playerSetup.stack?.let { stack -> playerItems.add("- $stack") } 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 36580cfd..613e959e 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 @@ -2,6 +2,7 @@ package net.pokeranalytics.android.ui.modules.handhistory import android.animation.ValueAnimator import android.app.AlertDialog +import android.content.Intent import android.os.Bundle import android.view.* import android.view.animation.AccelerateDecelerateInterpolator @@ -210,7 +211,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL R.id.delete -> deleteHand() R.id.back -> showPreviousHand() R.id.forward -> showNextHand() - R.id.export -> exportHand() + R.id.share -> exportHand() } return true } @@ -582,8 +583,14 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL private fun textExport() { - val s = this.model.handHistory.localizedString(this.requireContext()) - Timber.d("hand = $s") + val hhString = this.model.handHistory.localizedString(this.requireContext()) + Timber.d("hand = $hhString") + + val shareIntent = Intent(Intent.ACTION_SEND) + shareIntent.type = "text/plain" + shareIntent.putExtra(Intent.EXTRA_TEXT, hhString) + + startActivity(Intent.createChooser(shareIntent, "Share hand history")) } diff --git a/app/src/main/res/drawable/ic_share.xml b/app/src/main/res/drawable/ic_share.xml new file mode 100644 index 00000000..608c297b --- /dev/null +++ b/app/src/main/res/drawable/ic_share.xml @@ -0,0 +1,10 @@ + + + + diff --git a/app/src/main/res/menu/toolbar_hand_history.xml b/app/src/main/res/menu/toolbar_hand_history.xml index d2d36210..dd5032ef 100644 --- a/app/src/main/res/menu/toolbar_hand_history.xml +++ b/app/src/main/res/menu/toolbar_hand_history.xml @@ -8,9 +8,9 @@ app:showAsAction="always" />