Change sharing button + improve text export

hh
Laurent 6 years ago
parent 1cd4dfc229
commit 2f45fee417
  1. 4
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt
  2. 13
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt
  3. 10
      app/src/main/res/drawable/ic_share.xml
  4. 6
      app/src/main/res/menu/toolbar_hand_history.xml

@ -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<Position>, 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")
}

@ -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"))
}

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>

@ -8,9 +8,9 @@
app:showAsAction="always" />
<item
android:id="@+id/export"
android:title="@string/export"
android:icon="@drawable/ic_get_app"
android:id="@+id/share"
android:title="@string/sharing"
android:icon="@drawable/ic_share"
app:showAsAction="always" />
<!-- <item-->

Loading…
Cancel
Save