Fix build

This commit is contained in:
nielsandriesse 2020-05-28 14:04:46 +10:00
parent 1b9908377c
commit 5f8f95898a

View File

@ -21,8 +21,6 @@ import android.view.MotionEvent
import android.widget.ImageView import android.widget.ImageView
import android.widget.RelativeLayout import android.widget.RelativeLayout
import network.loki.messenger.R import network.loki.messenger.R
import org.thoughtcrime.securesms.loki.utilities.getColorWithID
import org.thoughtcrime.securesms.loki.utilities.toPx
import org.thoughtcrime.securesms.loki.utilities.* import org.thoughtcrime.securesms.loki.utilities.*
class NewConversationButtonSetView : RelativeLayout { class NewConversationButtonSetView : RelativeLayout {
@ -215,7 +213,7 @@ class NewConversationButtonSetView : RelativeLayout {
when (event.action) { when (event.action) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
if (isExpanded) { if (isExpanded) {
if (sessionButton.contains(touch)) { delegate?.createNewPrivateChat(); collapse()} if (sessionButton.contains(touch)) { delegate?.createNewPrivateChat(); collapse() }
else if (closedGroupButton.contains(touch)) { delegate?.createNewClosedGroup(); collapse() } else if (closedGroupButton.contains(touch)) { delegate?.createNewClosedGroup(); collapse() }
else if (openGroupButton.contains(touch)) { delegate?.joinOpenGroup(); collapse() } else if (openGroupButton.contains(touch)) { delegate?.joinOpenGroup(); collapse() }
else if (mainButton.contains(touch)) { collapse() } else if (mainButton.contains(touch)) { collapse() }
@ -254,7 +252,7 @@ class NewConversationButtonSetView : RelativeLayout {
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
val distanceFromRestPosition = touch.distanceTo(buttonRestPosition) val distanceFromRestPosition = touch.distanceTo(buttonRestPosition)
if (distanceFromRestPosition > (minDragDistance + mainButton.collapsedSize / 2)) { if (distanceFromRestPosition > (minDragDistance + mainButton.collapsedSize / 2)) {
if (sessionButton.contains(touch) || touch.isAbove(sessionButton, dragMargin)) { delegate?.createNewPrivateChat(); collapse()} if (sessionButton.contains(touch) || touch.isAbove(sessionButton, dragMargin)) { delegate?.createNewPrivateChat(); collapse() }
else if (closedGroupButton.contains(touch) || touch.isRightOf(closedGroupButton, dragMargin)) { delegate?.createNewClosedGroup(); collapse() } else if (closedGroupButton.contains(touch) || touch.isRightOf(closedGroupButton, dragMargin)) { delegate?.createNewClosedGroup(); collapse() }
else if (openGroupButton.contains(touch) || touch.isLeftOf(openGroupButton, dragMargin)) { delegate?.joinOpenGroup(); collapse() } else if (openGroupButton.contains(touch) || touch.isLeftOf(openGroupButton, dragMargin)) { delegate?.joinOpenGroup(); collapse() }
else { else {
@ -273,6 +271,7 @@ class NewConversationButtonSetView : RelativeLayout {
} }
previousAction = event.action previousAction = event.action
return true return true
}
private fun expand() { private fun expand() {
val buttonsExcludingMainButton = listOf( sessionButton, closedGroupButton, openGroupButton ) val buttonsExcludingMainButton = listOf( sessionButton, closedGroupButton, openGroupButton )