Fixes player stroke issue

hh
Laurent 6 years ago
parent 5d048015d8
commit 796ace74e3
  1. 5
      app/src/main/java/net/pokeranalytics/android/ui/modules/datalist/DataListFragment.kt
  2. 6
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt
  3. 5
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt
  4. 7
      app/src/main/java/net/pokeranalytics/android/ui/view/PlayerImageView.kt

@ -165,14 +165,13 @@ open class DataListFragment : DeletableItemFragment(), RowRepresentableDelegate
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
RequestCode.NEW_DATA.value -> {
if (this.model.isSelectionInstance) {
if (this.model.isSelectionInstance && resultCode == Activity.RESULT_OK) {
data?.getStringExtra(EditableDataActivity.IntentKey.PRIMARY_KEY.keyName)?.let { id ->
finishActivityWithSelection(id)
} ?: throw PAIllegalStateException("identifier not found")
}
}
}

@ -534,8 +534,12 @@ class HandHistoryAdapter(
delegate?.onItemClick(position, row, itemView.playerImage.tag as Int)
}
itemView.playerImage.setOnImageClickListener(listener)
val size = PlayerImageView.Size.SMALL
row.playerSetup?.player?.let { player ->
itemView.playerImage.setPlayer(player, PlayerImageView.Size.SMALL)
itemView.playerImage.setPlayer(player, size)
} ?: run {
itemView.playerImage.clear(size)
}
// Title

@ -1,6 +1,7 @@
package net.pokeranalytics.android.ui.modules.handhistory
import android.animation.ValueAnimator
import android.app.Activity
import android.app.AlertDialog
import android.content.Intent
import android.os.Bundle
@ -199,12 +200,16 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL
when (requestCode) {
RequestCode.PLAYER_SELECTION.ordinal -> {
if (resultCode == Activity.RESULT_OK) {
val playerId = data?.getStringExtra(BaseFragment.BundleKey.PRIMARY_KEY.value) ?: throw PAIllegalStateException("Primary key not set where as activity has finished")
getRealm().findById<Player>(playerId)?.let { player ->
this.model.playerSelected(player)
} ?: throw PAIllegalStateException("Player (id=$playerId) not found")
this.handHistoryAdapter.notifyDataSetChanged()
}
}
}
}

@ -67,7 +67,7 @@ class PlayerImageView : FrameLayout {
*/
private fun init() {
val layoutInflater = LayoutInflater.from(context)
playerImageView = layoutInflater.inflate(R.layout.view_player_image, this, false) as ConstraintLayout
this.playerImageView = layoutInflater.inflate(R.layout.view_player_image, this, false) as ConstraintLayout
val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
addView(playerImageView, layoutParams)
}
@ -145,4 +145,9 @@ class PlayerImageView : FrameLayout {
}
fun clear(size: Size = Size.NORMAL) {
val drawable = this.playerImageView.playerStroke.background as GradientDrawable?
drawable?.setStroke(size.getStrokeSize(), getColor(context, R.color.kaki))
}
}
Loading…
Cancel
Save