Show/Hide villain cards implementation + drawable cleanup

bs
Laurent 5 years ago
parent f01386347a
commit 35c8ac274d
  1. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerAnimator.kt
  2. 41
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerFragment.kt
  3. 4
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/TableDrawer.kt
  4. 11
      app/src/main/java/net/pokeranalytics/android/util/Preferences.kt
  5. BIN
      app/src/main/res/drawable-xxhdpi/back_disclosure.png
  6. BIN
      app/src/main/res/drawable-xxhdpi/big_export.png
  7. BIN
      app/src/main/res/drawable-xxhdpi/blog_black.png
  8. BIN
      app/src/main/res/drawable-xxhdpi/bottom_disclosure.png
  9. BIN
      app/src/main/res/drawable-xxhdpi/cross.png
  10. BIN
      app/src/main/res/drawable-xxhdpi/disclosure.png
  11. BIN
      app/src/main/res/drawable-xxhdpi/facebook_black.png
  12. BIN
      app/src/main/res/drawable-xxhdpi/fullscreen.png
  13. BIN
      app/src/main/res/drawable-xxhdpi/icon_poker_chip.png
  14. BIN
      app/src/main/res/drawable-xxhdpi/insta_black.png
  15. BIN
      app/src/main/res/drawable-xxhdpi/logo_pa.png
  16. BIN
      app/src/main/res/drawable-xxhdpi/pause.png
  17. BIN
      app/src/main/res/drawable-xxhdpi/picto_allin.png
  18. BIN
      app/src/main/res/drawable-xxhdpi/picto_arrow_down.png
  19. BIN
      app/src/main/res/drawable-xxhdpi/picto_arrow_raise.png
  20. BIN
      app/src/main/res/drawable-xxhdpi/picto_arrow_right.png
  21. BIN
      app/src/main/res/drawable-xxhdpi/picto_arrow_up.png
  22. BIN
      app/src/main/res/drawable-xxhdpi/picto_bankroll.png
  23. BIN
      app/src/main/res/drawable-xxhdpi/picto_call_allin.png
  24. BIN
      app/src/main/res/drawable-xxhdpi/picto_cards.png
  25. BIN
      app/src/main/res/drawable-xxhdpi/picto_check.png
  26. BIN
      app/src/main/res/drawable-xxhdpi/picto_engrenage.png
  27. BIN
      app/src/main/res/drawable-xxhdpi/picto_gear_selected.png
  28. BIN
      app/src/main/res/drawable-xxhdpi/picto_m.png
  29. BIN
      app/src/main/res/drawable-xxhdpi/picto_reports.png
  30. BIN
      app/src/main/res/drawable-xxhdpi/picto_reports_selected.png
  31. BIN
      app/src/main/res/drawable-xxhdpi/picto_stars.png
  32. BIN
      app/src/main/res/drawable-xxhdpi/picto_stars_selected.png
  33. BIN
      app/src/main/res/drawable-xxhdpi/picto_stats.png
  34. BIN
      app/src/main/res/drawable-xxhdpi/picto_table.png
  35. BIN
      app/src/main/res/drawable-xxhdpi/picto_user.png
  36. BIN
      app/src/main/res/drawable-xxhdpi/picto_user_empty.png
  37. BIN
      app/src/main/res/drawable-xxhdpi/pro_subscriber.png
  38. BIN
      app/src/main/res/drawable-xxhdpi/star_pro.png
  39. BIN
      app/src/main/res/drawable-xxhdpi/star_semipro.png
  40. BIN
      app/src/main/res/drawable-xxhdpi/tab_calendar.png
  41. BIN
      app/src/main/res/drawable-xxhdpi/three_lines.png
  42. BIN
      app/src/main/res/drawable-xxhdpi/top_disclosure.png
  43. BIN
      app/src/main/res/drawable-xxhdpi/twitter_black.png
  44. 9
      app/src/main/res/drawable/ic_settings.xml
  45. 9
      app/src/main/res/layout/fragment_replayer.xml
  46. 27
      app/src/main/res/layout/view_replayer_settings.xml
  47. 1
      app/src/main/res/values/strings.xml
  48. 3
      app/src/main/res/values/styles.xml

@ -224,7 +224,7 @@ class ReplayerAnimator(var handHistory: HandHistory, var export: Boolean) {
private var tableHPadding = 0f
private var tableVPadding = 0f
val showVillainHands: Boolean = true
// var showVillainHands: Boolean = true
var potTextPoint = TextPoint(0f, 0f, 0f)
var totalPotTextPoint = TextPoint(0f, 0f, 0f)

@ -4,6 +4,8 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.*
import android.widget.PopupWindow
import android.widget.Switch
import androidx.lifecycle.ViewModelProviders
import io.realm.Sort
import kotlinx.android.synthetic.main.fragment_replayer.*
@ -12,6 +14,7 @@ import net.pokeranalytics.android.exceptions.PAIllegalStateException
import net.pokeranalytics.android.model.realm.handhistory.HandHistory
import net.pokeranalytics.android.ui.fragment.components.RealmFragment
import net.pokeranalytics.android.ui.modules.handhistory.HandHistoryActivity
import net.pokeranalytics.android.util.Preferences
import net.pokeranalytics.android.util.extensions.findById
class ReplayerFragment : RealmFragment() {
@ -101,6 +104,9 @@ class ReplayerFragment : RealmFragment() {
this.speed.setOnClickListener {
changeSpeed()
}
this.settings.setOnClickListener {
openSettings()
}
updateSpeedButtonText()
}
@ -217,4 +223,39 @@ class ReplayerFragment : RealmFragment() {
updateSpeedButtonText()
}
private fun openSettings() {
// val builder = AlertDialog.Builder(requireContext())
// Get the layout inflater
val inflater = requireActivity().layoutInflater
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
val view = inflater.inflate(R.layout.view_replayer_settings, null)
val switch = view.findViewById<Switch>(R.id.show_villain_cards)
switch.text = requireContext().getString(R.string.show_villain_cards)
switch.isChecked = Preferences.getShowVillainCards(requireContext())
switch.setOnCheckedChangeListener { _, isChecked ->
Preferences.setShowVillainCards(isChecked, requireContext())
this.replayer.refresh()
}
val popupWindow = PopupWindow(requireContext())
popupWindow.contentView = view
popupWindow.isFocusable = true
popupWindow.showAsDropDown(this.settings, 0, -300)
// builder.setView(view).setNegativeButton(R.string.ok) { dialog, _ ->
// dialog.cancel()
// }
//
// val dialog = builder.create()
// dialog.show()
}
}

@ -9,6 +9,7 @@ import net.pokeranalytics.android.model.handhistory.Position
import net.pokeranalytics.android.model.handhistory.Street
import net.pokeranalytics.android.model.realm.handhistory.Card
import net.pokeranalytics.android.ui.modules.handhistory.model.ComputedAction
import net.pokeranalytics.android.util.Preferences
import net.pokeranalytics.android.util.RANDOM_PLAYER
import net.pokeranalytics.android.util.extensions.formatted
@ -244,7 +245,8 @@ class TableDrawer {
val isHero = (animator.handHistory.heroIndex == playerIndex)
cardRects.forEachIndexed { j, cardRect ->
if (j < cards?.size ?: 0 && (animator.showVillainHands || isHero)) { // show card
val showVillainHands = Preferences.getShowVillainCards(context)
if (j < cards?.size ?: 0 && (showVillainHands || isHero)) { // show card
val card = cards?.get(j)!! // tested line before
drawCard(card, cardRect, canvas, context)
} else { // show hidden cards

@ -32,7 +32,8 @@ class Preferences {
PATCH_TRANSACTION_TYPES_NAMES("patchTransactionTypesNames"),
PATCH_BLINDS_FORMAT("patchBlindFormat"),
SHOW_STOP_NOTIFICATIONS("showStopNotifications"),
ADD_NEW_TRANSACTION_TYPES("addNewTransactionTypes")
ADD_NEW_TRANSACTION_TYPES("addNewTransactionTypes"),
SHOW_VILLAIN_CARDS("showVillainCards")
}
enum class FeedMessage {
@ -113,6 +114,14 @@ class Preferences {
return preferences.getBoolean(key.identifier, defaultValue ?: false)
}
fun setShowVillainCards(show: Boolean, context: Context) {
setBoolean(Keys.SHOW_VILLAIN_CARDS, show, context)
}
fun getShowVillainCards(context: Context): Boolean {
return getBoolean(Keys.SHOW_VILLAIN_CARDS, context, true)
}
fun setCurrencyCode(currencyCode: String, context: Context) {
setString(Keys.CURRENCY_CODE, currencyCode, context)
UserDefaults.setCurrencyValues(context)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"
android:fillColor="#ffffff"/>
</vector>

@ -108,6 +108,15 @@
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"/>
<ImageButton
android:id="@+id/settings"
style="@style/PokerAnalyticsTheme.ToolbarButton"
android:src="@drawable/ic_settings"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="2dp"
android:layout_marginEnd="2dp"/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:padding="16dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- <TextView-->
<!-- android:text="@string/show_villain_cards"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toStartOf="@+id/show_villain_cards"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- />-->
<Switch
android:id="@+id/show_villain_cards"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textColor="@color/white"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -804,5 +804,6 @@
<string name="video_retrieval_message">Your video has been generated at the following path</string>
<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>
</resources>

@ -324,17 +324,14 @@
<item name="android:windowAnimationStyle">@null</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<!-- <item name="android:panelFullBackground">@color/kaki_darker</item>-->
</style>
<style name="PokerAnalyticsTheme.AlertDialog" parent="Theme.MaterialComponents.Dialog">
<item name="colorAccent">@color/green</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:windowBackground">@color/grey_darker</item>
<!-- <item name="android:panelFullBackground">@color/kaki_darker</item>-->
</style>
<!-- EditText -->
<style name="PokerAnalyticsTheme.EditText" parent="Widget.AppCompat.EditText">

Loading…
Cancel
Save