mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
catch NPE for binding
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
2615da0121
commit
04c96dd400
@ -83,10 +83,7 @@ import org.greenrobot.eventbus.Subscribe
|
|||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
import org.parceler.Parcels
|
import org.parceler.Parcels
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.ArrayList
|
|
||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
import java.util.HashMap
|
|
||||||
import java.util.HashSet
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -154,7 +151,7 @@ class ContactsController(args: Bundle) :
|
|||||||
super.onAttach(view)
|
super.onAttach(view)
|
||||||
eventBus.register(this)
|
eventBus.register(this)
|
||||||
if (isNewConversationView) {
|
if (isNewConversationView) {
|
||||||
toggleNewCallHeaderVisibility(!isPublicCall)
|
toggleConversationPrivacyLayout(!isPublicCall)
|
||||||
}
|
}
|
||||||
if (isAddingParticipantsView) {
|
if (isAddingParticipantsView) {
|
||||||
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.GONE
|
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.GONE
|
||||||
@ -260,6 +257,7 @@ class ContactsController(args: Bundle) :
|
|||||||
override fun onSubscribe(d: Disposable) {
|
override fun onSubscribe(d: Disposable) {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNext(roomOverall: RoomOverall) {
|
override fun onNext(roomOverall: RoomOverall) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, currentUser)
|
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, currentUser)
|
||||||
@ -280,6 +278,7 @@ class ContactsController(args: Bundle) :
|
|||||||
override fun onSubscribe(d: Disposable) {
|
override fun onSubscribe(d: Disposable) {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNext(roomOverall: RoomOverall) {
|
override fun onNext(roomOverall: RoomOverall) {
|
||||||
bundle.putParcelable(
|
bundle.putParcelable(
|
||||||
BundleKeys.KEY_ACTIVE_CONVERSATION,
|
BundleKeys.KEY_ACTIVE_CONVERSATION,
|
||||||
@ -823,6 +822,7 @@ class ContactsController(args: Bundle) :
|
|||||||
override fun onSubscribe(d: Disposable) {
|
override fun onSubscribe(d: Disposable) {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNext(roomOverall: RoomOverall) {
|
override fun onNext(roomOverall: RoomOverall) {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
@ -846,6 +846,7 @@ class ContactsController(args: Bundle) :
|
|||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onComplete() {
|
override fun onComplete() {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
@ -895,15 +896,9 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun toggleCallHeader() {
|
private fun toggleCallHeader() {
|
||||||
toggleNewCallHeaderVisibility(isPublicCall)
|
toggleConversationPrivacyLayout(isPublicCall)
|
||||||
isPublicCall = !isPublicCall
|
isPublicCall = !isPublicCall
|
||||||
|
toggleConversationViaLinkVisibility(isPublicCall)
|
||||||
if (isPublicCall) {
|
|
||||||
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.GONE
|
|
||||||
updateGroupParticipantSelection()
|
|
||||||
} else {
|
|
||||||
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
enableContactForNonPublicCall()
|
enableContactForNonPublicCall()
|
||||||
checkAndHandleDoneMenuItem()
|
checkAndHandleDoneMenuItem()
|
||||||
@ -939,7 +934,7 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
private fun toggleNewCallHeaderVisibility(showInitialLayout: Boolean) {
|
private fun toggleConversationPrivacyLayout(showInitialLayout: Boolean) {
|
||||||
try {
|
try {
|
||||||
if (showInitialLayout) {
|
if (showInitialLayout) {
|
||||||
binding.conversationPrivacyToggle.initialRelativeLayout.visibility = View.VISIBLE
|
binding.conversationPrivacyToggle.initialRelativeLayout.visibility = View.VISIBLE
|
||||||
@ -955,6 +950,22 @@ class ContactsController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
|
private fun toggleConversationViaLinkVisibility(isPublicCall: Boolean) {
|
||||||
|
try {
|
||||||
|
if (isPublicCall) {
|
||||||
|
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.GONE
|
||||||
|
updateGroupParticipantSelection()
|
||||||
|
} else {
|
||||||
|
binding.joinConversationViaLink.joinConversationViaLinkRelativeLayout.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
} catch (npe: NullPointerException) {
|
||||||
|
// view binding can be null
|
||||||
|
// since this is called asynchronously and UI might have been destroyed in the meantime
|
||||||
|
Log.i(TAG, "UI destroyed - view binding already gone")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "ContactsController"
|
const val TAG = "ContactsController"
|
||||||
const val RETRIES: Long = 3
|
const val RETRIES: Long = 3
|
||||||
|
Loading…
Reference in New Issue
Block a user