mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
theme Mentions filter
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
9a7ef3ca6c
commit
37d88b7ea5
@ -32,7 +32,6 @@ import android.view.View;
|
|||||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||||
import com.facebook.drawee.interfaces.DraweeController;
|
import com.facebook.drawee.interfaces.DraweeController;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
|
||||||
import com.nextcloud.talk.data.user.model.User;
|
import com.nextcloud.talk.data.user.model.User;
|
||||||
import com.nextcloud.talk.models.json.mention.Mention;
|
import com.nextcloud.talk.models.json.mention.Mention;
|
||||||
import com.nextcloud.talk.models.json.status.StatusType;
|
import com.nextcloud.talk.models.json.status.StatusType;
|
||||||
@ -42,7 +41,6 @@ import com.nextcloud.talk.utils.ApiUtils;
|
|||||||
import com.nextcloud.talk.utils.DisplayUtils;
|
import com.nextcloud.talk.utils.DisplayUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
@ -137,35 +135,28 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
FlexibleUtils.highlightText(holder.binding.nameText,
|
FlexibleUtils.highlightText(holder.binding.nameText,
|
||||||
displayName,
|
displayName,
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)),
|
||||||
Objects.requireNonNull(NextcloudTalkApplication
|
viewThemeUtils
|
||||||
.Companion
|
.getScheme(holder.binding.secondaryText.getContext())
|
||||||
.getSharedApplication())
|
.getPrimary());
|
||||||
.getResources().getColor(R.color.colorPrimary));
|
FlexibleUtils.highlightText(holder.binding.secondaryText,
|
||||||
if (holder.binding.secondaryText != null) {
|
"@" + objectId,
|
||||||
FlexibleUtils.highlightText(holder.binding.secondaryText,
|
String.valueOf(adapter.getFilter(String.class)),
|
||||||
"@" + objectId,
|
viewThemeUtils
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
.getScheme(holder.binding.secondaryText.getContext())
|
||||||
NextcloudTalkApplication.Companion.getSharedApplication()
|
.getPrimary());
|
||||||
.getResources().getColor(R.color.colorPrimary));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
holder.binding.nameText.setText(displayName);
|
holder.binding.nameText.setText(displayName);
|
||||||
if (holder.binding.secondaryText != null) {
|
holder.binding.secondaryText.setText("@" + objectId);
|
||||||
holder.binding.secondaryText.setText("@" + objectId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SOURCE_CALLS.equals(source)) {
|
if (SOURCE_CALLS.equals(source)) {
|
||||||
if (holder.binding.avatarDraweeView != null) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
holder.binding.avatarDraweeView.getHierarchy().setPlaceholderImage(
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
DisplayUtils.getRoundedDrawable(
|
||||||
holder.binding.avatarDraweeView.getHierarchy().setPlaceholderImage(
|
viewThemeUtils.themePlaceholderAvatar(holder.binding.avatarDraweeView,
|
||||||
DisplayUtils.getRoundedDrawable(
|
R.drawable.ic_avatar_group)));
|
||||||
viewThemeUtils.themePlaceholderAvatar(holder.binding.avatarDraweeView,
|
} else {
|
||||||
R.drawable.ic_avatar_group)));
|
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
|
||||||
} else {
|
|
||||||
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String avatarId = objectId;
|
String avatarId = objectId;
|
||||||
@ -180,9 +171,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.binding.avatarDraweeView != null) {
|
holder.binding.avatarDraweeView.setController(null);
|
||||||
holder.binding.avatarDraweeView.setController(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
||||||
.setOldController(holder.binding.avatarDraweeView.getController())
|
.setOldController(holder.binding.avatarDraweeView.getController())
|
||||||
@ -196,39 +185,35 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void drawStatus(ParticipantItem.ParticipantItemViewHolder holder) {
|
private void drawStatus(ParticipantItem.ParticipantItemViewHolder holder) {
|
||||||
if (holder.binding.conversationInfoStatusMessage != null &&
|
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context);
|
||||||
holder.binding.participantStatusEmoji != null &&
|
holder.binding.userStatusImage.setImageDrawable(new StatusDrawable(
|
||||||
holder.binding.userStatusImage != null) {
|
status,
|
||||||
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context);
|
NO_ICON,
|
||||||
holder.binding.userStatusImage.setImageDrawable(new StatusDrawable(
|
size,
|
||||||
status,
|
context.getResources().getColor(R.color.bg_default),
|
||||||
NO_ICON,
|
context));
|
||||||
size,
|
|
||||||
context.getResources().getColor(R.color.bg_default),
|
|
||||||
context));
|
|
||||||
|
|
||||||
if (statusMessage != null) {
|
if (statusMessage != null) {
|
||||||
holder.binding.conversationInfoStatusMessage.setText(statusMessage);
|
holder.binding.conversationInfoStatusMessage.setText(statusMessage);
|
||||||
alignUsernameVertical(holder, 0);
|
alignUsernameVertical(holder, 0);
|
||||||
} else {
|
} else {
|
||||||
holder.binding.conversationInfoStatusMessage.setText("");
|
holder.binding.conversationInfoStatusMessage.setText("");
|
||||||
alignUsernameVertical(holder, 10);
|
alignUsernameVertical(holder, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusIcon != null && !statusIcon.isEmpty()) {
|
||||||
|
holder.binding.participantStatusEmoji.setText(statusIcon);
|
||||||
|
} else {
|
||||||
|
holder.binding.participantStatusEmoji.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != null && status.equals(StatusType.DND.getString())) {
|
||||||
|
if (statusMessage == null || statusMessage.isEmpty()) {
|
||||||
|
holder.binding.conversationInfoStatusMessage.setText(R.string.dnd);
|
||||||
}
|
}
|
||||||
|
} else if (status != null && status.equals(StatusType.AWAY.getString())) {
|
||||||
if (statusIcon != null && !statusIcon.isEmpty()) {
|
if (statusMessage == null || statusMessage.isEmpty()) {
|
||||||
holder.binding.participantStatusEmoji.setText(statusIcon);
|
holder.binding.conversationInfoStatusMessage.setText(R.string.away);
|
||||||
} else {
|
|
||||||
holder.binding.participantStatusEmoji.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status != null && status.equals(StatusType.DND.getString())) {
|
|
||||||
if (statusMessage == null || statusMessage.isEmpty()) {
|
|
||||||
holder.binding.conversationInfoStatusMessage.setText(R.string.dnd);
|
|
||||||
}
|
|
||||||
} else if (status != null && status.equals(StatusType.AWAY.getString())) {
|
|
||||||
if (statusMessage == null || statusMessage.isEmpty()) {
|
|
||||||
holder.binding.conversationInfoStatusMessage.setText(R.string.away);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
|||||||
/**
|
/**
|
||||||
* Scheme for painting elements
|
* Scheme for painting elements
|
||||||
*/
|
*/
|
||||||
private fun getScheme(context: Context): Scheme = when {
|
fun getScheme(context: Context): Scheme = when {
|
||||||
isDarkMode(context) -> theme.darkScheme
|
isDarkMode(context) -> theme.darkScheme
|
||||||
else -> theme.lightScheme
|
else -> theme.lightScheme
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user