mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-20 03:05:01 +01:00
Merge pull request #4408 from arkascha/issues-3920-note-to-self-messages-should-take-up-most-of-the-screen-width
Make messages in 'Note To Self' chat room take full available screen width
This commit is contained in:
commit
4b88136744
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Nextcloud Talk - Android Client
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.nextcloud.talk.adapters.messages
|
||||||
|
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingDeckCardMessageBinding
|
||||||
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingLinkPreviewMessageBinding
|
||||||
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingLocationMessageBinding
|
||||||
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingPollMessageBinding
|
||||||
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingTextMessageBinding
|
||||||
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingVoiceMessageBinding
|
||||||
|
import com.nextcloud.talk.models.domain.ConversationModel
|
||||||
|
import com.nextcloud.talk.models.json.conversations.ConversationEnums.ConversationType
|
||||||
|
|
||||||
|
interface AdjustableMessageHolderInterface {
|
||||||
|
|
||||||
|
val binding: ViewBinding
|
||||||
|
|
||||||
|
fun adjustIfNoteToSelf(viewHolder: AdjustableMessageHolderInterface, currentConversation: ConversationModel?) {
|
||||||
|
if (currentConversation?.type == ConversationType.NOTE_TO_SELF) {
|
||||||
|
when (viewHolder.binding.javaClass) {
|
||||||
|
ItemCustomOutcomingTextMessageBinding::class.java ->
|
||||||
|
(viewHolder.binding as ItemCustomOutcomingTextMessageBinding).bubble
|
||||||
|
ItemCustomOutcomingDeckCardMessageBinding::class.java ->
|
||||||
|
(viewHolder.binding as ItemCustomOutcomingDeckCardMessageBinding).bubble
|
||||||
|
ItemCustomOutcomingLinkPreviewMessageBinding::class.java ->
|
||||||
|
(viewHolder.binding as ItemCustomOutcomingLinkPreviewMessageBinding).bubble
|
||||||
|
ItemCustomOutcomingPollMessageBinding::class.java ->
|
||||||
|
(viewHolder.binding as ItemCustomOutcomingPollMessageBinding).bubble
|
||||||
|
ItemCustomOutcomingVoiceMessageBinding::class.java ->
|
||||||
|
(viewHolder.binding as ItemCustomOutcomingVoiceMessageBinding).bubble
|
||||||
|
ItemCustomOutcomingLocationMessageBinding::class.java ->
|
||||||
|
(viewHolder.binding as ItemCustomOutcomingLocationMessageBinding).bubble
|
||||||
|
else -> null
|
||||||
|
}?.let {
|
||||||
|
RelativeLayout.LayoutParams(binding.root.layoutParams).apply {
|
||||||
|
marginStart = 0
|
||||||
|
marginEnd = 0
|
||||||
|
}.run {
|
||||||
|
it.layoutParams = this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nextcloud Talk - Android Client
|
* Nextcloud Talk - Android Client
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
* SPDX-FileCopyrightText: 2024 Sowjanya Kota<sowjanya.kch@gmail.com>
|
* SPDX-FileCopyrightText: 2024 Sowjanya Kota<sowjanya.kch@gmail.com>
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
@ -43,9 +44,10 @@ import javax.inject.Inject
|
|||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class OutcomingDeckCardViewHolder(
|
class OutcomingDeckCardViewHolder(
|
||||||
outcomingView: View
|
outcomingView: View
|
||||||
) : MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(outcomingView) {
|
) : MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(outcomingView),
|
||||||
|
AdjustableMessageHolderInterface {
|
||||||
|
|
||||||
private val binding: ItemCustomOutcomingDeckCardMessageBinding = ItemCustomOutcomingDeckCardMessageBinding.bind(
|
override val binding: ItemCustomOutcomingDeckCardMessageBinding = ItemCustomOutcomingDeckCardMessageBinding.bind(
|
||||||
itemView
|
itemView
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nextcloud Talk - Android Client
|
* Nextcloud Talk - Android Client
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
* SPDX-FileCopyrightText: 2022 Marcel Hibbe <dev@mhibbe.de>
|
* SPDX-FileCopyrightText: 2022 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* SPDX-FileCopyrightText: 2017-2019 Mario Danic <mario@lovelyhq.com>
|
* SPDX-FileCopyrightText: 2017-2019 Mario Danic <mario@lovelyhq.com>
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
@ -38,9 +39,10 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
|
class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
|
||||||
MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(outcomingView, payload) {
|
MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(outcomingView, payload),
|
||||||
|
AdjustableMessageHolderInterface {
|
||||||
|
|
||||||
private val binding: ItemCustomOutcomingLinkPreviewMessageBinding =
|
override val binding: ItemCustomOutcomingLinkPreviewMessageBinding =
|
||||||
ItemCustomOutcomingLinkPreviewMessageBinding.bind(itemView)
|
ItemCustomOutcomingLinkPreviewMessageBinding.bind(itemView)
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nextcloud Talk - Android Client
|
* Nextcloud Talk - Android Client
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
* SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
|
* SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* SPDX-FileCopyrightText: 2017-2018 Mario Danic <mario@lovelyhq.com>
|
* SPDX-FileCopyrightText: 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
@ -47,8 +48,10 @@ import kotlin.math.roundToInt
|
|||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class OutcomingLocationMessageViewHolder(incomingView: View) :
|
class OutcomingLocationMessageViewHolder(incomingView: View) :
|
||||||
MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(incomingView) {
|
MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(incomingView),
|
||||||
private val binding: ItemCustomOutcomingLocationMessageBinding =
|
AdjustableMessageHolderInterface {
|
||||||
|
|
||||||
|
override val binding: ItemCustomOutcomingLocationMessageBinding =
|
||||||
ItemCustomOutcomingLocationMessageBinding.bind(itemView)
|
ItemCustomOutcomingLocationMessageBinding.bind(itemView)
|
||||||
private val realView: View = itemView
|
private val realView: View = itemView
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nextcloud Talk - Android Client
|
* Nextcloud Talk - Android Client
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
* SPDX-FileCopyrightText: 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
* SPDX-FileCopyrightText: 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
|
* SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
* SPDX-FileCopyrightText: 2017-2018 Mario Danic <mario@lovelyhq.com>
|
* SPDX-FileCopyrightText: 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||||
@ -38,8 +39,11 @@ import kotlinx.coroutines.withContext
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewHolder<ChatMessage>(itemView) {
|
class OutcomingTextMessageViewHolder(itemView: View) :
|
||||||
private val binding: ItemCustomOutcomingTextMessageBinding = ItemCustomOutcomingTextMessageBinding.bind(itemView)
|
OutcomingTextMessageViewHolder<ChatMessage>(itemView),
|
||||||
|
AdjustableMessageHolderInterface {
|
||||||
|
|
||||||
|
override val binding: ItemCustomOutcomingTextMessageBinding = ItemCustomOutcomingTextMessageBinding.bind(itemView)
|
||||||
private val realView: View = itemView
|
private val realView: View = itemView
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nextcloud Talk - Android Client
|
* Nextcloud Talk - Android Client
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
* SPDX-FileCopyrightText: 2023 Andy Scherzinger <info@andy-scherzinger.de>
|
* SPDX-FileCopyrightText: 2023 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* SPDX-FileCopyrightText: 2023 Julius Linus <juliuslinus1@gmail.com>
|
* SPDX-FileCopyrightText: 2023 Julius Linus <juliuslinus1@gmail.com>
|
||||||
* SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
|
* SPDX-FileCopyrightText: 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
@ -45,9 +46,10 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
@AutoInjector(NextcloudTalkApplication::class)
|
||||||
class OutcomingVoiceMessageViewHolder(outcomingView: View) :
|
class OutcomingVoiceMessageViewHolder(outcomingView: View) :
|
||||||
MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(outcomingView) {
|
MessageHolders.OutcomingTextMessageViewHolder<ChatMessage>(outcomingView),
|
||||||
|
AdjustableMessageHolderInterface {
|
||||||
|
|
||||||
private val binding: ItemCustomOutcomingVoiceMessageBinding = ItemCustomOutcomingVoiceMessageBinding.bind(itemView)
|
override val binding: ItemCustomOutcomingVoiceMessageBinding = ItemCustomOutcomingVoiceMessageBinding.bind(itemView)
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Nextcloud Talk - Android Client
|
* Nextcloud Talk - Android Client
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Christian Reiner <foss@christian-reiner.info>
|
||||||
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <tobias.kaminsky@nextcloud.com>
|
* SPDX-FileCopyrightText: 2020 Tobias Kaminsky <tobias.kaminsky@nextcloud.com>
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
@ -34,43 +35,50 @@ public class TalkMessagesListAdapter<M extends IMessage> extends MessagesListAda
|
|||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||||
|
|
||||||
|
if (holder instanceof IncomingTextMessageViewHolder holderInstance) {
|
||||||
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
|
} else if (holder instanceof OutcomingTextMessageViewHolder holderInstance) {
|
||||||
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
|
holderInstance.adjustIfNoteToSelf(holderInstance, chatActivity.getCurrentConversation());
|
||||||
|
|
||||||
if (holder instanceof IncomingTextMessageViewHolder) {
|
} else if (holder instanceof IncomingLocationMessageViewHolder holderInstance) {
|
||||||
((IncomingTextMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
} else if (holder instanceof OutcomingTextMessageViewHolder) {
|
} else if (holder instanceof OutcomingLocationMessageViewHolder holderInstance) {
|
||||||
((OutcomingTextMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
|
holderInstance.adjustIfNoteToSelf(holderInstance, chatActivity.getCurrentConversation());
|
||||||
|
|
||||||
} else if (holder instanceof IncomingLocationMessageViewHolder) {
|
} else if (holder instanceof IncomingLinkPreviewMessageViewHolder holderInstance) {
|
||||||
((IncomingLocationMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
} else if (holder instanceof OutcomingLocationMessageViewHolder) {
|
} else if (holder instanceof OutcomingLinkPreviewMessageViewHolder holderInstance) {
|
||||||
((OutcomingLocationMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
|
holderInstance.adjustIfNoteToSelf(holderInstance, chatActivity.getCurrentConversation());
|
||||||
|
|
||||||
} else if (holder instanceof IncomingLinkPreviewMessageViewHolder) {
|
} else if (holder instanceof IncomingVoiceMessageViewHolder holderInstance) {
|
||||||
((IncomingLinkPreviewMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignVoiceMessageInterface(chatActivity);
|
||||||
} else if (holder instanceof OutcomingLinkPreviewMessageViewHolder) {
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
((OutcomingLinkPreviewMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
} else if (holder instanceof OutcomingVoiceMessageViewHolder holderInstance) {
|
||||||
|
holderInstance.assignVoiceMessageInterface(chatActivity);
|
||||||
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
|
holderInstance.adjustIfNoteToSelf(holderInstance, chatActivity.getCurrentConversation());
|
||||||
|
|
||||||
} else if (holder instanceof IncomingVoiceMessageViewHolder) {
|
} else if (holder instanceof PreviewMessageViewHolder holderInstance) {
|
||||||
((IncomingVoiceMessageViewHolder) holder).assignVoiceMessageInterface(chatActivity);
|
holderInstance.assignPreviewMessageInterface(chatActivity);
|
||||||
((IncomingVoiceMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
} else if (holder instanceof OutcomingVoiceMessageViewHolder) {
|
|
||||||
((OutcomingVoiceMessageViewHolder) holder).assignVoiceMessageInterface(chatActivity);
|
|
||||||
((OutcomingVoiceMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
|
||||||
|
|
||||||
} else if (holder instanceof PreviewMessageViewHolder) {
|
} else if (holder instanceof SystemMessageViewHolder holderInstance) {
|
||||||
((PreviewMessageViewHolder) holder).assignPreviewMessageInterface(chatActivity);
|
holderInstance.assignSystemMessageInterface(chatActivity);
|
||||||
((PreviewMessageViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
|
||||||
|
|
||||||
} else if (holder instanceof SystemMessageViewHolder) {
|
} else if (holder instanceof CallStartedViewHolder holderInstance) {
|
||||||
((SystemMessageViewHolder) holder).assignSystemMessageInterface(chatActivity);
|
holderInstance.assignCallStartedMessageInterface(chatActivity);
|
||||||
} else if (holder instanceof CallStartedViewHolder) {
|
|
||||||
((CallStartedViewHolder) holder).assignCallStartedMessageInterface(chatActivity);
|
} else if (holder instanceof TemporaryMessageViewHolder holderInstance) {
|
||||||
} else if (holder instanceof TemporaryMessageViewHolder) {
|
holderInstance.assignTemporaryMessageInterface(chatActivity);
|
||||||
((TemporaryMessageViewHolder) holder).assignTemporaryMessageInterface(chatActivity);
|
|
||||||
}else if (holder instanceof IncomingDeckCardViewHolder){
|
} else if (holder instanceof IncomingDeckCardViewHolder holderInstance) {
|
||||||
((IncomingDeckCardViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
} else if(holder instanceof OutcomingDeckCardViewHolder){
|
} else if (holder instanceof OutcomingDeckCardViewHolder holderInstance) {
|
||||||
((OutcomingDeckCardViewHolder) holder).assignCommonMessageInterface(chatActivity);
|
holderInstance.assignCommonMessageInterface(chatActivity);
|
||||||
|
holderInstance.adjustIfNoteToSelf(holderInstance, chatActivity.getCurrentConversation());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBindViewHolder(holder, position);
|
super.onBindViewHolder(holder, position);
|
||||||
|
@ -86,8 +86,8 @@ public class CallParticipantList {
|
|||||||
callParticipants.remove(callParticipant.getSessionId());
|
callParticipants.remove(callParticipant.getSessionId());
|
||||||
// No need to copy it, as it will be no longer used.
|
// No need to copy it, as it will be no longer used.
|
||||||
callParticipant.setInCall(Participant.InCallFlags.DISCONNECTED);
|
callParticipant.setInCall(Participant.InCallFlags.DISCONNECTED);
|
||||||
left.add(callParticipant);
|
|
||||||
}
|
}
|
||||||
|
left.addAll(knownCallParticipantsNotFound);
|
||||||
|
|
||||||
if (!joined.isEmpty() || !updated.isEmpty() || !left.isEmpty()) {
|
if (!joined.isEmpty() || !updated.isEmpty() || !left.isEmpty()) {
|
||||||
callParticipantListNotifier.notifyChanged(joined, updated, left, unchanged);
|
callParticipantListNotifier.notifyChanged(joined, updated, left, unchanged);
|
||||||
|
@ -141,12 +141,12 @@ class ChatViewModel @Inject constructor(
|
|||||||
val getReminderExistState: LiveData<ViewState>
|
val getReminderExistState: LiveData<ViewState>
|
||||||
get() = _getReminderExistState
|
get() = _getReminderExistState
|
||||||
|
|
||||||
object NoteToSelfNotAvaliableState : ViewState
|
object NoteToSelfNotAvailableState : ViewState
|
||||||
open class NoteToSelfAvaliableState(val roomToken: String) : ViewState
|
open class NoteToSelfAvailableState(val roomToken: String) : ViewState
|
||||||
|
|
||||||
private val _getNoteToSelfAvaliability: MutableLiveData<ViewState> = MutableLiveData(NoteToSelfNotAvaliableState)
|
private val _getNoteToSelfAvailability: MutableLiveData<ViewState> = MutableLiveData(NoteToSelfNotAvailableState)
|
||||||
val getNoteToSelfAvaliability: LiveData<ViewState>
|
val getNoteToSelfAvailability: LiveData<ViewState>
|
||||||
get() = _getNoteToSelfAvaliability
|
get() = _getNoteToSelfAvailability
|
||||||
|
|
||||||
object GetRoomStartState : ViewState
|
object GetRoomStartState : ViewState
|
||||||
object GetRoomErrorState : ViewState
|
object GetRoomErrorState : ViewState
|
||||||
@ -732,9 +732,9 @@ class ChatViewModel @Inject constructor(
|
|||||||
val model = ConversationModel.mapToConversationModel(it, userProvider.currentUser.blockingGet())
|
val model = ConversationModel.mapToConversationModel(it, userProvider.currentUser.blockingGet())
|
||||||
ConversationUtils.isNoteToSelfConversation(model)
|
ConversationUtils.isNoteToSelfConversation(model)
|
||||||
}
|
}
|
||||||
_getNoteToSelfAvaliability.value = NoteToSelfAvaliableState(noteToSelf.token!!)
|
_getNoteToSelfAvailability.value = NoteToSelfAvailableState(noteToSelf.token!!)
|
||||||
} catch (e: NoSuchElementException) {
|
} catch (e: NoSuchElementException) {
|
||||||
_getNoteToSelfAvaliability.value = NoteToSelfNotAvaliableState
|
_getNoteToSelfAvailability.value = NoteToSelfNotAvailableState
|
||||||
Log.e(TAG, "Note to self not found $e")
|
Log.e(TAG, "Note to self not found $e")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,28 +126,33 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull MentionOverall mentionOverall) {
|
public void onNext(@NonNull MentionOverall mentionOverall) {
|
||||||
List<Mention> mentionsList = mentionOverall.getOcs().getData();
|
if (mentionOverall.getOcs() != null) {
|
||||||
|
List<Mention> mentionsList = mentionOverall.getOcs().getData();
|
||||||
|
|
||||||
if (mentionsList.size() == 0) {
|
if (mentionsList != null) {
|
||||||
adapter.clear();
|
|
||||||
} else {
|
if (mentionsList.isEmpty()) {
|
||||||
List<AbstractFlexibleItem> internalAbstractFlexibleItemList =
|
adapter.clear();
|
||||||
new ArrayList<>(mentionsList.size());
|
} else {
|
||||||
for (Mention mention : mentionsList) {
|
List<AbstractFlexibleItem> internalAbstractFlexibleItemList =
|
||||||
internalAbstractFlexibleItemList.add(
|
new ArrayList<>(mentionsList.size());
|
||||||
new MentionAutocompleteItem(
|
for (Mention mention : mentionsList) {
|
||||||
mention,
|
internalAbstractFlexibleItemList.add(
|
||||||
currentUser,
|
new MentionAutocompleteItem(
|
||||||
context,
|
mention,
|
||||||
roomToken,
|
currentUser,
|
||||||
viewThemeUtils));
|
context,
|
||||||
|
roomToken,
|
||||||
|
viewThemeUtils));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adapter.getItemCount() != 0) {
|
||||||
|
adapter.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.updateDataSet(internalAbstractFlexibleItemList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter.getItemCount() != 0) {
|
|
||||||
adapter.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
adapter.updateDataSet(internalAbstractFlexibleItemList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
themeViews();
|
themeViews();
|
||||||
setupCurrentUser(user);
|
setupCurrentUser(user);
|
||||||
setupListeners(user);
|
setupListeners();
|
||||||
setupAdapter();
|
setupAdapter();
|
||||||
prepareViews();
|
prepareViews();
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
adapter.updateDataSet(userItems, false);
|
adapter.updateDataSet(userItems, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupListeners(User user) {
|
private void setupListeners() {
|
||||||
// Creating listeners for quick-actions
|
// Creating listeners for quick-actions
|
||||||
binding.currentAccount.getRoot().setOnClickListener(v -> dismiss());
|
binding.currentAccount.getRoot().setOnClickListener(v -> dismiss());
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
binding.setStatus.setOnClickListener(v -> {
|
binding.setStatus.setOnClickListener(v -> {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
||||||
if (status != null) {
|
if (status != null && getActivity() != null) {
|
||||||
SetStatusDialogFragment setStatusDialog = SetStatusDialogFragment.newInstance(status);
|
SetStatusDialogFragment setStatusDialog = SetStatusDialogFragment.newInstance(status);
|
||||||
setStatusDialog.show(getActivity().getSupportFragmentManager(), "fragment_set_status");
|
setStatusDialog.show(getActivity().getSupportFragmentManager(), "fragment_set_status");
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,9 +120,9 @@ class MessageActionsDialog(
|
|||||||
),
|
),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
chatActivity.chatViewModel.getNoteToSelfAvaliability.observe(this) { state ->
|
chatActivity.chatViewModel.getNoteToSelfAvailability.observe(this) { state ->
|
||||||
when (state) {
|
when (state) {
|
||||||
is ChatViewModel.NoteToSelfAvaliableState -> {
|
is ChatViewModel.NoteToSelfAvailableState -> {
|
||||||
initMenuAddToNote(
|
initMenuAddToNote(
|
||||||
!message.isDeleted && !ConversationUtils.isNoteToSelfConversation(currentConversation),
|
!message.isDeleted && !ConversationUtils.isNoteToSelfConversation(currentConversation),
|
||||||
state.roomToken
|
state.roomToken
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
build:
|
build:
|
||||||
maxIssues: 178
|
maxIssues: 179
|
||||||
weights:
|
weights:
|
||||||
# complexity: 2
|
# complexity: 2
|
||||||
# LongParameterList: 1
|
# LongParameterList: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user