mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 20:19:42 +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,27 +135,21 @@ 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));
|
|
||||||
if (holder.binding.secondaryText != null) {
|
|
||||||
FlexibleUtils.highlightText(holder.binding.secondaryText,
|
FlexibleUtils.highlightText(holder.binding.secondaryText,
|
||||||
"@" + objectId,
|
"@" + objectId,
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)),
|
||||||
NextcloudTalkApplication.Companion.getSharedApplication()
|
viewThemeUtils
|
||||||
.getResources().getColor(R.color.colorPrimary));
|
.getScheme(holder.binding.secondaryText.getContext())
|
||||||
}
|
.getPrimary());
|
||||||
} 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) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
holder.binding.avatarDraweeView.getHierarchy().setPlaceholderImage(
|
holder.binding.avatarDraweeView.getHierarchy().setPlaceholderImage(
|
||||||
DisplayUtils.getRoundedDrawable(
|
DisplayUtils.getRoundedDrawable(
|
||||||
@ -166,7 +158,6 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
} else {
|
} else {
|
||||||
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
|
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
String avatarId = objectId;
|
String avatarId = objectId;
|
||||||
String avatarUrl = ApiUtils.getUrlForAvatar(currentUser.getBaseUrl(),
|
String avatarUrl = ApiUtils.getUrlForAvatar(currentUser.getBaseUrl(),
|
||||||
@ -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,9 +185,6 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void drawStatus(ParticipantItem.ParticipantItemViewHolder holder) {
|
private void drawStatus(ParticipantItem.ParticipantItemViewHolder holder) {
|
||||||
if (holder.binding.conversationInfoStatusMessage != null &&
|
|
||||||
holder.binding.participantStatusEmoji != null &&
|
|
||||||
holder.binding.userStatusImage != null) {
|
|
||||||
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context);
|
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context);
|
||||||
holder.binding.userStatusImage.setImageDrawable(new StatusDrawable(
|
holder.binding.userStatusImage.setImageDrawable(new StatusDrawable(
|
||||||
status,
|
status,
|
||||||
@ -231,7 +217,6 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void alignUsernameVertical(ParticipantItem.ParticipantItemViewHolder holder, float densityPixelsFromTop) {
|
private void alignUsernameVertical(ParticipantItem.ParticipantItemViewHolder holder, float densityPixelsFromTop) {
|
||||||
ConstraintLayout.LayoutParams layoutParams =
|
ConstraintLayout.LayoutParams layoutParams =
|
||||||
|
@ -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