theme Mentions filter

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-08-02 13:08:11 +02:00
parent 9a7ef3ca6c
commit 37d88b7ea5
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 46 additions and 61 deletions

View File

@ -32,7 +32,6 @@ import android.view.View;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.data.user.model.User;
import com.nextcloud.talk.models.json.mention.Mention;
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 java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import androidx.constraintlayout.widget.ConstraintLayout;
@ -137,27 +135,21 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
FlexibleUtils.highlightText(holder.binding.nameText,
displayName,
String.valueOf(adapter.getFilter(String.class)),
Objects.requireNonNull(NextcloudTalkApplication
.Companion
.getSharedApplication())
.getResources().getColor(R.color.colorPrimary));
if (holder.binding.secondaryText != null) {
viewThemeUtils
.getScheme(holder.binding.secondaryText.getContext())
.getPrimary());
FlexibleUtils.highlightText(holder.binding.secondaryText,
"@" + objectId,
String.valueOf(adapter.getFilter(String.class)),
NextcloudTalkApplication.Companion.getSharedApplication()
.getResources().getColor(R.color.colorPrimary));
}
viewThemeUtils
.getScheme(holder.binding.secondaryText.getContext())
.getPrimary());
} else {
holder.binding.nameText.setText(displayName);
if (holder.binding.secondaryText != null) {
holder.binding.secondaryText.setText("@" + objectId);
}
}
if (SOURCE_CALLS.equals(source)) {
if (holder.binding.avatarDraweeView != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
holder.binding.avatarDraweeView.getHierarchy().setPlaceholderImage(
DisplayUtils.getRoundedDrawable(
@ -166,7 +158,6 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
} else {
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_group);
}
}
} else {
String avatarId = objectId;
String avatarUrl = ApiUtils.getUrlForAvatar(currentUser.getBaseUrl(),
@ -180,9 +171,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
false);
}
if (holder.binding.avatarDraweeView != null) {
holder.binding.avatarDraweeView.setController(null);
}
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
.setOldController(holder.binding.avatarDraweeView.getController())
@ -196,9 +185,6 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
}
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);
holder.binding.userStatusImage.setImageDrawable(new StatusDrawable(
status,
@ -231,7 +217,6 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
}
}
}
}
private void alignUsernameVertical(ParticipantItem.ParticipantItemViewHolder holder, float densityPixelsFromTop) {
ConstraintLayout.LayoutParams layoutParams =

View File

@ -78,7 +78,7 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
/**
* Scheme for painting elements
*/
private fun getScheme(context: Context): Scheme = when {
fun getScheme(context: Context): Scheme = when {
isDarkMode(context) -> theme.darkScheme
else -> theme.lightScheme
}