Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC Version 1.10.0 #107

Merged
merged 19 commits into from
Oct 25, 2019
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6c17863
Re-organizing collection repository
r0adkll Oct 23, 2019
8f7a5ef
Close #94 - Updated support contact email
r0adkll Oct 23, 2019
2fe7383
#99 - Improved the scrolling performance of the home screen w/ collec…
r0adkll Oct 23, 2019
7697363
#99 - Added toggle action that let's users view only missing cards in…
r0adkll Oct 23, 2019
e7ac39e
Close #99 - Added action to let user's increment an entire set at once
r0adkll Oct 23, 2019
87eec53
#101 - Added debounce to card clicks to reduce freqency at which a us…
r0adkll Oct 23, 2019
974d930
Fixed #100 - Fixed promo legal override issues where cards in the cut…
r0adkll Oct 23, 2019
fc57de3
Fixed #102 - Patched SDK for issue with cards not loading on some sets
r0adkll Oct 23, 2019
057c50b
Fixed Crashlytics#126 -> NPE in EditDragListener.kt causing crashes o…
r0adkll Oct 23, 2019
1179981
Fixed Crashlytics crash
r0adkll Oct 23, 2019
1ef697b
Refactoring out the old ListRecyclerAdapter in favor of one that comp…
r0adkll Oct 24, 2019
df1e3de
Copy and visual tweaks
r0adkll Oct 24, 2019
4f2c5f5
Fixed crashlytics issue in PCV
r0adkll Oct 24, 2019
c039010
Added some more login failure guards to close crashlytics issue
r0adkll Oct 24, 2019
b17400c
Added analytic calls to marketplace integrations and new collection a…
r0adkll Oct 25, 2019
312fcc9
Added app referrer to custom tabs
r0adkll Oct 25, 2019
e660131
Fixed #106 - updated privacy policy url to new domain
r0adkll Oct 25, 2019
532b9fd
Updated CHANGELOG.md
r0adkll Oct 25, 2019
186edc2
Updated Target to API 29 (Q)
r0adkll Oct 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed Crashlytics#126 -> NPE in EditDragListener.kt causing crashes o…
…n samsung tablet
r0adkll committed Oct 23, 2019

Verified

This commit was signed with the committer’s verified signature.
r0adkll Drew Heavner
commit 057c50bcf1a465104d2f9174a0fde28e865284ff
Original file line number Diff line number Diff line change
@@ -9,44 +9,43 @@ import com.r0adkll.deckbuilder.R
import com.r0adkll.deckbuilder.arch.domain.features.cards.model.PokemonCard
import com.r0adkll.deckbuilder.arch.ui.widgets.PokemonCardView


class EditDragListener(
val dropZone: View,
private val dropZone: View,
dropListener: DropListener
) : View.OnDragListener {

private val actionAdd: TextView by lazy { dropZone.findViewById<TextView>(R.id.dropZoneAdd) }
private val actionRemove: TextView by lazy { dropZone.findViewById<TextView>(R.id.dropZoneRemove) }


init {
AddDragListener.attach(actionAdd, dropListener)
RemoveDragListener.attach(actionRemove, dropListener)
}


override fun onDrag(v: View, event: DragEvent): Boolean {
val state = event.localState as PokemonCardView.DragState
val card = state.view.card

return if (state.isEdit && card != null) {
when(event.action) {
DragEvent.ACTION_DRAG_STARTED -> {
showDropZone()
true
}
DragEvent.ACTION_DRAG_ENDED -> {
hideDropZone()
true
val state = event.localState as? PokemonCardView.DragState
if (state != null) {
val card = state.view.card
return if (state.isEdit && card != null) {
when (event.action) {
DragEvent.ACTION_DRAG_STARTED -> {
showDropZone()
true
}
DragEvent.ACTION_DRAG_ENDED -> {
hideDropZone()
true
}
else -> false
}
else -> false
} else {
false
}
} else {
false
return false
}
}


private fun showDropZone() {
dropZone.animate()
.translationY(0f)
@@ -55,7 +54,6 @@ class EditDragListener(
.start()
}


private fun hideDropZone() {
dropZone.animate()
.translationY(dropZone.resources.getDimension(R.dimen.dropzone_height_inverse))
@@ -64,7 +62,6 @@ class EditDragListener(
.start()
}


private class AddDragListener(
val actionAdd: View,
val listener: DropListener
@@ -74,35 +71,34 @@ class EditDragListener(
private val unselectedColor by lazy { actionAdd.color(R.color.dropzone_green) }

override fun onDrag(v: View, event: DragEvent): Boolean {
val state = event.localState as PokemonCardView.DragState
val card = state.view.card

if (state.isEdit && card != null) {
return when(event.action) {
DragEvent.ACTION_DRAG_ENTERED -> {
v.setBackgroundColor(selectedColor)
true
}
DragEvent.ACTION_DRAG_EXITED -> {
v.setBackgroundColor(unselectedColor)
true
}
DragEvent.ACTION_DROP -> {
listener.onAddCard(card)
true
val state = event.localState as? PokemonCardView.DragState
if (state != null) {
val card = state.view.card
if (state.isEdit && card != null) {
return when (event.action) {
DragEvent.ACTION_DRAG_ENTERED -> {
v.setBackgroundColor(selectedColor)
true
}
DragEvent.ACTION_DRAG_EXITED -> {
v.setBackgroundColor(unselectedColor)
true
}
DragEvent.ACTION_DROP -> {
listener.onAddCard(card)
true
}
DragEvent.ACTION_DRAG_ENDED -> {
v.setBackgroundColor(unselectedColor)
true
}
else -> true
}
DragEvent.ACTION_DRAG_ENDED -> {
v.setBackgroundColor(unselectedColor)
true
}
else -> true
}
} else {
return false
}
return false
}


companion object {

fun attach(target: View, dropListener: DropListener): AddDragListener {
@@ -113,7 +109,6 @@ class EditDragListener(
}
}


private class RemoveDragListener(
val actionRemove: View,
val listener: DropListener
@@ -123,35 +118,34 @@ class EditDragListener(
private val unselectedColor by lazy { actionRemove.color(R.color.dropzone_red) }

override fun onDrag(v: View, event: DragEvent): Boolean {
val state = event.localState as PokemonCardView.DragState
val card = state.view.card

if (state.isEdit && card != null) {
return when(event.action) {
DragEvent.ACTION_DRAG_ENTERED -> {
v.setBackgroundColor(selectedColor)
true
}
DragEvent.ACTION_DRAG_EXITED -> {
v.setBackgroundColor(unselectedColor)
true
}
DragEvent.ACTION_DROP -> {
listener.onRemoveCard(card)
true
}
DragEvent.ACTION_DRAG_ENDED -> {
v.setBackgroundColor(unselectedColor)
true
val state = event.localState as? PokemonCardView.DragState
if (state != null) {
val card = state.view.card
if (state.isEdit && card != null) {
return when (event.action) {
DragEvent.ACTION_DRAG_ENTERED -> {
v.setBackgroundColor(selectedColor)
true
}
DragEvent.ACTION_DRAG_EXITED -> {
v.setBackgroundColor(unselectedColor)
true
}
DragEvent.ACTION_DROP -> {
listener.onRemoveCard(card)
true
}
DragEvent.ACTION_DRAG_ENDED -> {
v.setBackgroundColor(unselectedColor)
true
}
else -> true
}
else -> true
}
} else {
return false
}
return false
}


companion object {

fun attach(target: View, dropListener: DropListener): RemoveDragListener {
@@ -162,14 +156,12 @@ class EditDragListener(
}
}


interface DropListener {

fun onAddCard(card: PokemonCard)
fun onRemoveCard(card: PokemonCard)
}


companion object {
private const val ANIM_DURATION = 150L

@@ -183,4 +175,4 @@ class EditDragListener(
return dragListener
}
}
}
}