mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Migration away from getScheme() calls
Signed-off-by: Julius Linus <julius.linus@nextcloud.com>
This commit is contained in:
parent
1bb9faf1bc
commit
31cedf0da5
@ -1080,13 +1080,11 @@ class CallActivity : CallBaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getSpotlightView(): SpotlightView? {
|
private fun getSpotlightView(): SpotlightView? {
|
||||||
val primary = viewThemeUtils.getScheme(binding!!.audioOutputButton.context).primary
|
val builder = SpotlightView.Builder(this)
|
||||||
return SpotlightView.Builder(this)
|
|
||||||
.introAnimationDuration(300)
|
.introAnimationDuration(300)
|
||||||
.enableRevealAnimation(true)
|
.enableRevealAnimation(true)
|
||||||
.performClick(false)
|
.performClick(false)
|
||||||
.fadeinTextDuration(400)
|
.fadeinTextDuration(400)
|
||||||
.headingTvColor(primary)
|
|
||||||
.headingTvSize(20)
|
.headingTvSize(20)
|
||||||
.headingTvText(resources.getString(R.string.nc_push_to_talk))
|
.headingTvText(resources.getString(R.string.nc_push_to_talk))
|
||||||
.subHeadingTvColor(resources.getColor(R.color.bg_default, null))
|
.subHeadingTvColor(resources.getColor(R.color.bg_default, null))
|
||||||
@ -1095,11 +1093,11 @@ class CallActivity : CallBaseActivity() {
|
|||||||
.maskColor(Color.parseColor("#dc000000"))
|
.maskColor(Color.parseColor("#dc000000"))
|
||||||
.target(binding!!.microphoneButton)
|
.target(binding!!.microphoneButton)
|
||||||
.lineAnimDuration(400)
|
.lineAnimDuration(400)
|
||||||
.lineAndArcColor(primary)
|
|
||||||
.enableDismissAfterShown(true)
|
.enableDismissAfterShown(true)
|
||||||
.dismissOnBackPress(true)
|
.dismissOnBackPress(true)
|
||||||
.usageId("pushToTalk")
|
.usageId("pushToTalk")
|
||||||
.show()
|
|
||||||
|
return viewThemeUtils.talk.themeSpotlightView(context, builder).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCameraClick() {
|
private fun onCameraClick() {
|
||||||
|
@ -41,7 +41,6 @@ import androidx.annotation.Nullable;
|
|||||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||||
import eu.davidea.flexibleadapter.items.IFilterable;
|
import eu.davidea.flexibleadapter.items.IFilterable;
|
||||||
import eu.davidea.flexibleadapter.utils.FlexibleUtils;
|
|
||||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||||
|
|
||||||
public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.UserItemViewHolder> implements
|
public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.UserItemViewHolder> implements
|
||||||
@ -65,8 +64,7 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o instanceof AdvancedUserItem) {
|
if (o instanceof AdvancedUserItem inItem) {
|
||||||
AdvancedUserItem inItem = (AdvancedUserItem) o;
|
|
||||||
return participant.equals(inItem.getModel());
|
return participant.equals(inItem.getModel());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -107,11 +105,10 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
|||||||
public void bindViewHolder(FlexibleAdapter adapter, UserItemViewHolder holder, int position, List payloads) {
|
public void bindViewHolder(FlexibleAdapter adapter, UserItemViewHolder holder, int position, List payloads) {
|
||||||
|
|
||||||
if (adapter.hasFilter()) {
|
if (adapter.hasFilter()) {
|
||||||
FlexibleUtils.highlightText(
|
viewThemeUtils.talk.themeAndHighlightText(
|
||||||
holder.binding.userName,
|
holder.binding.userName,
|
||||||
participant.getDisplayName(),
|
participant.getDisplayName(),
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)));
|
||||||
viewThemeUtils.getScheme(holder.binding.userName.getContext()).getPrimary());
|
|
||||||
} else {
|
} else {
|
||||||
holder.binding.userName.setText(participant.getDisplayName());
|
holder.binding.userName.setText(participant.getDisplayName());
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ import eu.davidea.flexibleadapter.FlexibleAdapter;
|
|||||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||||
import eu.davidea.flexibleadapter.items.IFilterable;
|
import eu.davidea.flexibleadapter.items.IFilterable;
|
||||||
import eu.davidea.flexibleadapter.items.ISectionable;
|
import eu.davidea.flexibleadapter.items.ISectionable;
|
||||||
import eu.davidea.flexibleadapter.utils.FlexibleUtils;
|
|
||||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||||
|
|
||||||
public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemViewHolder> implements
|
public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemViewHolder> implements
|
||||||
@ -74,8 +73,7 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o instanceof ContactItem) {
|
if (o instanceof ContactItem inItem) {
|
||||||
ContactItem inItem = (ContactItem) o;
|
|
||||||
return participant.getCalculatedActorType() == inItem.getModel().getCalculatedActorType() &&
|
return participant.getCalculatedActorType() == inItem.getModel().getCalculatedActorType() &&
|
||||||
participant.getCalculatedActorId().equals(inItem.getModel().getCalculatedActorId());
|
participant.getCalculatedActorId().equals(inItem.getModel().getCalculatedActorId());
|
||||||
}
|
}
|
||||||
@ -135,10 +133,9 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
|||||||
holder.binding.nameText.setText(participant.getDisplayName());
|
holder.binding.nameText.setText(participant.getDisplayName());
|
||||||
|
|
||||||
if (adapter.hasFilter()) {
|
if (adapter.hasFilter()) {
|
||||||
FlexibleUtils.highlightText(holder.binding.nameText,
|
viewThemeUtils.talk.themeAndHighlightText(holder.binding.nameText,
|
||||||
participant.getDisplayName(),
|
participant.getDisplayName(),
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)));
|
||||||
viewThemeUtils.getScheme(holder.binding.nameText.getContext()).getPrimary());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(participant.getDisplayName()) &&
|
if (TextUtils.isEmpty(participant.getDisplayName()) &&
|
||||||
|
@ -48,7 +48,6 @@ import eu.davidea.flexibleadapter.FlexibleAdapter;
|
|||||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||||
import eu.davidea.flexibleadapter.items.IFilterable;
|
import eu.davidea.flexibleadapter.items.IFilterable;
|
||||||
import eu.davidea.flexibleadapter.items.IFlexible;
|
import eu.davidea.flexibleadapter.items.IFlexible;
|
||||||
import eu.davidea.flexibleadapter.utils.FlexibleUtils;
|
|
||||||
|
|
||||||
public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantItem.ParticipantItemViewHolder>
|
public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantItem.ParticipantItemViewHolder>
|
||||||
implements IFilterable<String> {
|
implements IFilterable<String> {
|
||||||
@ -103,8 +102,7 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o instanceof MentionAutocompleteItem) {
|
if (o instanceof MentionAutocompleteItem inItem) {
|
||||||
MentionAutocompleteItem inItem = (MentionAutocompleteItem) o;
|
|
||||||
return (objectId.equals(inItem.objectId) && displayName.equals(inItem.displayName));
|
return (objectId.equals(inItem.objectId) && displayName.equals(inItem.displayName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,18 +136,12 @@ public class MentionAutocompleteItem extends AbstractFlexibleItem<ParticipantIte
|
|||||||
R.color.conversation_item_header,
|
R.color.conversation_item_header,
|
||||||
null));
|
null));
|
||||||
if (adapter.hasFilter()) {
|
if (adapter.hasFilter()) {
|
||||||
FlexibleUtils.highlightText(holder.binding.nameText,
|
viewThemeUtils.talk.themeAndHighlightText(holder.binding.nameText,
|
||||||
displayName,
|
displayName,
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)));
|
||||||
viewThemeUtils
|
viewThemeUtils.talk.themeAndHighlightText(holder.binding.secondaryText,
|
||||||
.getScheme(holder.binding.secondaryText.getContext())
|
|
||||||
.getPrimary());
|
|
||||||
FlexibleUtils.highlightText(holder.binding.secondaryText,
|
|
||||||
"@" + objectId,
|
"@" + objectId,
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)));
|
||||||
viewThemeUtils
|
|
||||||
.getScheme(holder.binding.secondaryText.getContext())
|
|
||||||
.getPrimary());
|
|
||||||
} else {
|
} else {
|
||||||
holder.binding.nameText.setText(displayName);
|
holder.binding.nameText.setText(displayName);
|
||||||
holder.binding.secondaryText.setText("@" + objectId);
|
holder.binding.secondaryText.setText("@" + objectId);
|
||||||
|
@ -51,7 +51,6 @@ import androidx.core.content.res.ResourcesCompat;
|
|||||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||||
import eu.davidea.flexibleadapter.items.IFilterable;
|
import eu.davidea.flexibleadapter.items.IFilterable;
|
||||||
import eu.davidea.flexibleadapter.utils.FlexibleUtils;
|
|
||||||
import eu.davidea.viewholders.FlexibleViewHolder;
|
import eu.davidea.viewholders.FlexibleViewHolder;
|
||||||
|
|
||||||
public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.ParticipantItemViewHolder> implements
|
public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.ParticipantItemViewHolder> implements
|
||||||
@ -81,8 +80,7 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o instanceof ParticipantItem) {
|
if (o instanceof ParticipantItem inItem) {
|
||||||
ParticipantItem inItem = (ParticipantItem) o;
|
|
||||||
return participant.getCalculatedActorType() == inItem.getModel().getCalculatedActorType() &&
|
return participant.getCalculatedActorType() == inItem.getModel().getCalculatedActorType() &&
|
||||||
participant.getCalculatedActorId().equals(inItem.getModel().getCalculatedActorId());
|
participant.getCalculatedActorId().equals(inItem.getModel().getCalculatedActorId());
|
||||||
}
|
}
|
||||||
@ -129,9 +127,8 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
|||||||
holder.binding.nameText.setText(participant.getDisplayName());
|
holder.binding.nameText.setText(participant.getDisplayName());
|
||||||
|
|
||||||
if (adapter.hasFilter()) {
|
if (adapter.hasFilter()) {
|
||||||
FlexibleUtils.highlightText(holder.binding.nameText, participant.getDisplayName(),
|
viewThemeUtils.talk.themeAndHighlightText(holder.binding.nameText, participant.getDisplayName(),
|
||||||
String.valueOf(adapter.getFilter(String.class)),
|
String.valueOf(adapter.getFilter(String.class)));
|
||||||
viewThemeUtils.getScheme(holder.binding.nameText.getContext()).getPrimary());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(participant.getDisplayName()) &&
|
if (TextUtils.isEmpty(participant.getDisplayName()) &&
|
||||||
|
@ -84,7 +84,8 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
var processedMessageText = messageUtils.enrichChatMessageText(
|
var processedMessageText = messageUtils.enrichChatMessageText(
|
||||||
binding.messageText.context,
|
binding.messageText.context,
|
||||||
message,
|
message,
|
||||||
binding.messageText.context.resources.getColor(R.color.nc_incoming_text_default)
|
true,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
processedMessageText = messageUtils.processMessageParameters(
|
processedMessageText = messageUtils.processMessageParameters(
|
||||||
@ -198,9 +199,8 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
binding.messageQuote.quotedMessage.context.resources.getColor(
|
true,
|
||||||
R.color.nc_incoming_text_default
|
viewThemeUtils
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.messageQuote.quotedMessageAuthor
|
binding.messageQuote.quotedMessageAuthor
|
||||||
|
@ -96,7 +96,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
|
|
||||||
itemView.isSelected = false
|
itemView.isSelected = false
|
||||||
|
|
||||||
val textSize = context?.resources!!.getDimension(R.dimen.chat_text_size)
|
val textSize = context.resources!!.getDimension(R.dimen.chat_text_size)
|
||||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||||
binding.messageText.text = message.text
|
binding.messageText.text = message.text
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
if (!message.isDeleted && message.parentMessage != null) {
|
if (!message.isDeleted && message.parentMessage != null) {
|
||||||
val parentChatMessage = message.parentMessage
|
val parentChatMessage = message.parentMessage
|
||||||
parentChatMessage!!.activeUser = message.activeUser
|
parentChatMessage!!.activeUser = message.activeUser
|
||||||
parentChatMessage!!.imageUrl?.let {
|
parentChatMessage.imageUrl?.let {
|
||||||
binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE
|
binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE
|
||||||
binding.messageQuote.quotedMessageImage.load(it) {
|
binding.messageQuote.quotedMessageImage.load(it) {
|
||||||
addHeader(
|
addHeader(
|
||||||
@ -178,18 +178,17 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
||||||
}
|
}
|
||||||
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
|
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
|
||||||
?: context!!.getText(R.string.nc_nick_guest)
|
?: context.getText(R.string.nc_nick_guest)
|
||||||
binding.messageQuote.quotedMessage.text = messageUtils
|
binding.messageQuote.quotedMessage.text = messageUtils
|
||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
binding.messageQuote.quotedMessage.context.resources.getColor(
|
true,
|
||||||
R.color.nc_incoming_text_default
|
viewThemeUtils
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.messageQuote.quotedMessageAuthor
|
binding.messageQuote.quotedMessageAuthor
|
||||||
.setTextColor(context!!.resources.getColor(R.color.textColorMaxContrast, null))
|
.setTextColor(context.resources.getColor(R.color.textColorMaxContrast, null))
|
||||||
|
|
||||||
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
||||||
viewThemeUtils.platform.colorViewBackground(binding.messageQuote.quoteColoredView)
|
viewThemeUtils.platform.colorViewBackground(binding.messageQuote.quoteColoredView)
|
||||||
@ -217,7 +216,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.webview.settings?.javaScriptEnabled = true
|
binding.webview.settings.javaScriptEnabled = true
|
||||||
|
|
||||||
binding.webview.webViewClient = object : WebViewClient() {
|
binding.webview.webViewClient = object : WebViewClient() {
|
||||||
@Deprecated("Use shouldOverrideUrlLoading(WebView view, WebResourceRequest request)")
|
@Deprecated("Use shouldOverrideUrlLoading(WebView view, WebResourceRequest request)")
|
||||||
@ -234,10 +233,10 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
|
|
||||||
val urlStringBuffer = StringBuffer("file:///android_asset/leafletMapMessagePreview.html")
|
val urlStringBuffer = StringBuffer("file:///android_asset/leafletMapMessagePreview.html")
|
||||||
urlStringBuffer.append(
|
urlStringBuffer.append(
|
||||||
"?mapProviderUrl=" + URLEncoder.encode(context!!.getString(R.string.osm_tile_server_url))
|
"?mapProviderUrl=" + URLEncoder.encode(context.getString(R.string.osm_tile_server_url))
|
||||||
)
|
)
|
||||||
urlStringBuffer.append(
|
urlStringBuffer.append(
|
||||||
"&mapProviderAttribution=" + URLEncoder.encode(context!!.getString(R.string.osm_tile_server_attributation))
|
"&mapProviderAttribution=" + URLEncoder.encode(context.getString(R.string.osm_tile_server_attributation))
|
||||||
)
|
)
|
||||||
urlStringBuffer.append("&locationLat=" + URLEncoder.encode(locationLat))
|
urlStringBuffer.append("&locationLat=" + URLEncoder.encode(locationLat))
|
||||||
urlStringBuffer.append("&locationLon=" + URLEncoder.encode(locationLon))
|
urlStringBuffer.append("&locationLon=" + URLEncoder.encode(locationLon))
|
||||||
@ -262,7 +261,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
val geoLinkWithMarker = addMarkerToGeoLink(locationGeoLink!!)
|
val geoLinkWithMarker = addMarkerToGeoLink(locationGeoLink!!)
|
||||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(geoLinkWithMarker))
|
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(geoLinkWithMarker))
|
||||||
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
context!!.startActivity(browserIntent)
|
context.startActivity(browserIntent)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
||||||
Log.e(TAG, "locationGeoLink was null or empty")
|
Log.e(TAG, "locationGeoLink was null or empty")
|
||||||
|
@ -206,9 +206,8 @@ class IncomingPollMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
binding.messageQuote.quotedMessage.context.resources.getColor(
|
true,
|
||||||
R.color.nc_incoming_text_default
|
viewThemeUtils
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.messageQuote.quotedMessageAuthor
|
binding.messageQuote.quotedMessageAuthor
|
||||||
|
@ -88,7 +88,8 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
|||||||
var processedMessageText = messageUtils.enrichChatMessageText(
|
var processedMessageText = messageUtils.enrichChatMessageText(
|
||||||
binding.messageText.context,
|
binding.messageText.context,
|
||||||
message,
|
message,
|
||||||
binding.messageText.context.resources.getColor(R.color.nc_incoming_text_default)
|
true,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
processedMessageText = messageUtils.processMessageParameters(
|
processedMessageText = messageUtils.processMessageParameters(
|
||||||
@ -197,7 +198,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
|||||||
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
||||||
}
|
}
|
||||||
binding.messageQuote.quotedMessageAuthor.text = if (parentChatMessage.actorDisplayName.isNullOrEmpty()) {
|
binding.messageQuote.quotedMessageAuthor.text = if (parentChatMessage.actorDisplayName.isNullOrEmpty()) {
|
||||||
context!!.getText(R.string.nc_nick_guest)
|
context.getText(R.string.nc_nick_guest)
|
||||||
} else {
|
} else {
|
||||||
parentChatMessage.actorDisplayName
|
parentChatMessage.actorDisplayName
|
||||||
}
|
}
|
||||||
@ -206,7 +207,8 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
binding.messageQuote.quotedMessage.context.resources.getColor(R.color.nc_incoming_text_default)
|
true,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {
|
||||||
@ -217,7 +219,7 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.messageQuote.quotedChatMessageView.setOnClickListener() {
|
binding.messageQuote.quotedChatMessageView.setOnClickListener {
|
||||||
val chatActivity = commonMessageInterface as ChatActivity
|
val chatActivity = commonMessageInterface as ChatActivity
|
||||||
chatActivity.jumpToQuotedMessage(parentChatMessage)
|
chatActivity.jumpToQuotedMessage(parentChatMessage)
|
||||||
}
|
}
|
||||||
|
@ -304,9 +304,8 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
binding.messageQuote.quotedMessage.context.resources.getColor(
|
true,
|
||||||
R.color.nc_incoming_text_default
|
viewThemeUtils
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.messageQuote.quotedMessageAuthor
|
binding.messageQuote.quotedMessageAuthor
|
||||||
|
@ -24,11 +24,11 @@ package com.nextcloud.talk.adapters.messages
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import coil.load
|
import coil.load
|
||||||
|
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
@ -78,12 +78,12 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
|
|||||||
super.onBind(message)
|
super.onBind(message)
|
||||||
this.message = message
|
this.message = message
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
val textColor = viewThemeUtils.getScheme(binding.messageTime.context).onSurfaceVariant
|
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)
|
||||||
binding.messageTime.setTextColor(textColor)
|
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
|
|
||||||
colorizeMessageBubble(message)
|
colorizeMessageBubble(message)
|
||||||
var processedMessageText = messageUtils.enrichChatMessageText(binding.messageText.context, message, textColor)
|
var processedMessageText =
|
||||||
|
messageUtils.enrichChatMessageText(binding.messageText.context, message, false, viewThemeUtils)
|
||||||
processedMessageText = messageUtils.processMessageParameters(
|
processedMessageText = messageUtils.processMessageParameters(
|
||||||
binding.messageText.context,
|
binding.messageText.context,
|
||||||
viewThemeUtils,
|
viewThemeUtils,
|
||||||
@ -106,18 +106,15 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
val readStatusContentDescriptionString = when (message.readStatus) {
|
val readStatusContentDescriptionString = when (message.readStatus) {
|
||||||
ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
|
ReadStatus.READ -> context.resources?.getString(R.string.nc_message_read)
|
||||||
ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
|
ReadStatus.SENT -> context.resources?.getString(R.string.nc_message_sent)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
readStatusDrawableInt?.let { drawableInt ->
|
readStatusDrawableInt?.let { drawableInt ->
|
||||||
AppCompatResources.getDrawable(context, drawableInt)?.let {
|
AppCompatResources.getDrawable(context, drawableInt)?.let {
|
||||||
binding.checkMark.setImageDrawable(it)
|
binding.checkMark.setImageDrawable(it)
|
||||||
binding.checkMark.setColorFilter(
|
viewThemeUtils.talk.themeMessageCheckMark(binding.checkMark)
|
||||||
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
|
|
||||||
PorterDuff.Mode.SRC_ATOP
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +173,8 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
|
false,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
||||||
|
@ -25,7 +25,6 @@ package com.nextcloud.talk.adapters.messages
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
@ -38,6 +37,7 @@ import androidx.appcompat.content.res.AppCompatResources
|
|||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import coil.load
|
import coil.load
|
||||||
import com.google.android.flexbox.FlexboxLayout
|
import com.google.android.flexbox.FlexboxLayout
|
||||||
|
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||||
@ -84,15 +84,14 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
|
|||||||
override fun onBind(message: ChatMessage) {
|
override fun onBind(message: ChatMessage) {
|
||||||
super.onBind(message)
|
super.onBind(message)
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
val textColor = viewThemeUtils.getScheme(binding.messageTime.context).onSurfaceVariant
|
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)
|
||||||
binding.messageTime.setTextColor(textColor)
|
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
|
|
||||||
realView.isSelected = false
|
realView.isSelected = false
|
||||||
val layoutParams = binding.messageTime.layoutParams as FlexboxLayout.LayoutParams
|
val layoutParams = binding.messageTime.layoutParams as FlexboxLayout.LayoutParams
|
||||||
layoutParams.isWrapBefore = false
|
layoutParams.isWrapBefore = false
|
||||||
|
|
||||||
val textSize = context!!.resources.getDimension(R.dimen.chat_text_size)
|
val textSize = context.resources.getDimension(R.dimen.chat_text_size)
|
||||||
|
|
||||||
colorizeMessageBubble(message)
|
colorizeMessageBubble(message)
|
||||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||||
@ -110,22 +109,19 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
val readStatusContentDescriptionString = when (message.readStatus) {
|
val readStatusContentDescriptionString = when (message.readStatus) {
|
||||||
ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
|
ReadStatus.READ -> context.resources?.getString(R.string.nc_message_read)
|
||||||
ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
|
ReadStatus.SENT -> context.resources?.getString(R.string.nc_message_sent)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
readStatusDrawableInt?.let { drawableInt ->
|
readStatusDrawableInt?.let { drawableInt ->
|
||||||
AppCompatResources.getDrawable(context!!, drawableInt)?.let {
|
AppCompatResources.getDrawable(context, drawableInt)?.let {
|
||||||
binding.checkMark.setImageDrawable(it)
|
binding.checkMark.setImageDrawable(it)
|
||||||
binding.checkMark.setColorFilter(
|
viewThemeUtils.talk.themeMessageCheckMark(binding.checkMark)
|
||||||
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
|
|
||||||
PorterDuff.Mode.SRC_ATOP
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.checkMark.setContentDescription(readStatusContentDescriptionString)
|
binding.checkMark.contentDescription = readStatusContentDescriptionString
|
||||||
|
|
||||||
// geo-location
|
// geo-location
|
||||||
setLocationDataOnMessageItem(message)
|
setLocationDataOnMessageItem(message)
|
||||||
@ -163,7 +159,7 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.webview.settings?.javaScriptEnabled = true
|
binding.webview.settings.javaScriptEnabled = true
|
||||||
|
|
||||||
binding.webview.webViewClient = object : WebViewClient() {
|
binding.webview.webViewClient = object : WebViewClient() {
|
||||||
@Deprecated("Use shouldOverrideUrlLoading(WebView view, WebResourceRequest request)")
|
@Deprecated("Use shouldOverrideUrlLoading(WebView view, WebResourceRequest request)")
|
||||||
@ -180,11 +176,11 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
|
|||||||
|
|
||||||
val urlStringBuffer = StringBuffer("file:///android_asset/leafletMapMessagePreview.html")
|
val urlStringBuffer = StringBuffer("file:///android_asset/leafletMapMessagePreview.html")
|
||||||
urlStringBuffer.append(
|
urlStringBuffer.append(
|
||||||
"?mapProviderUrl=" + URLEncoder.encode(context!!.getString(R.string.osm_tile_server_url))
|
"?mapProviderUrl=" + URLEncoder.encode(context.getString(R.string.osm_tile_server_url))
|
||||||
)
|
)
|
||||||
urlStringBuffer.append(
|
urlStringBuffer.append(
|
||||||
"&mapProviderAttribution=" + URLEncoder.encode(
|
"&mapProviderAttribution=" + URLEncoder.encode(
|
||||||
context!!.getString(
|
context.getString(
|
||||||
R.string
|
R.string
|
||||||
.osm_tile_server_attributation
|
.osm_tile_server_attributation
|
||||||
)
|
)
|
||||||
@ -224,12 +220,13 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
|
|||||||
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
||||||
}
|
}
|
||||||
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
|
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
|
||||||
?: context!!.getText(R.string.nc_nick_guest)
|
?: context.getText(R.string.nc_nick_guest)
|
||||||
binding.messageQuote.quotedMessage.text = messageUtils
|
binding.messageQuote.quotedMessage.text = messageUtils
|
||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
|
false,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
||||||
@ -250,7 +247,7 @@ class OutcomingLocationMessageViewHolder(incomingView: View) :
|
|||||||
val geoLinkWithMarker = addMarkerToGeoLink(locationGeoLink!!)
|
val geoLinkWithMarker = addMarkerToGeoLink(locationGeoLink!!)
|
||||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(geoLinkWithMarker))
|
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(geoLinkWithMarker))
|
||||||
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
context!!.startActivity(browserIntent)
|
context.startActivity(browserIntent)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
||||||
Log.e(TAG, "locationGeoLink was null or empty")
|
Log.e(TAG, "locationGeoLink was null or empty")
|
||||||
|
@ -23,11 +23,11 @@ package com.nextcloud.talk.adapters.messages
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import coil.load
|
import coil.load
|
||||||
|
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
@ -78,8 +78,7 @@ class OutcomingPollMessageViewHolder(outcomingView: View, payload: Any) :
|
|||||||
super.onBind(message)
|
super.onBind(message)
|
||||||
this.message = message
|
this.message = message
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
val textColor = viewThemeUtils.getScheme(binding.messageTime.context).onSurfaceVariant
|
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)
|
||||||
binding.messageTime.setTextColor(textColor)
|
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
|
|
||||||
colorizeMessageBubble(message)
|
colorizeMessageBubble(message)
|
||||||
@ -96,18 +95,15 @@ class OutcomingPollMessageViewHolder(outcomingView: View, payload: Any) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
val readStatusContentDescriptionString = when (message.readStatus) {
|
val readStatusContentDescriptionString = when (message.readStatus) {
|
||||||
ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
|
ReadStatus.READ -> context.resources?.getString(R.string.nc_message_read)
|
||||||
ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
|
ReadStatus.SENT -> context.resources?.getString(R.string.nc_message_sent)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
readStatusDrawableInt?.let { drawableInt ->
|
readStatusDrawableInt?.let { drawableInt ->
|
||||||
AppCompatResources.getDrawable(context, drawableInt)?.let {
|
AppCompatResources.getDrawable(context, drawableInt)?.let {
|
||||||
binding.checkMark.setImageDrawable(it)
|
binding.checkMark.setImageDrawable(it)
|
||||||
binding.checkMark.setColorFilter(
|
viewThemeUtils.talk.themeMessageCheckMark(binding.checkMark)
|
||||||
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
|
|
||||||
PorterDuff.Mode.SRC_ATOP
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +187,8 @@ class OutcomingPollMessageViewHolder(outcomingView: View, payload: Any) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
|
false,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
package com.nextcloud.talk.adapters.messages
|
package com.nextcloud.talk.adapters.messages
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import coil.load
|
import coil.load
|
||||||
import com.google.android.flexbox.FlexboxLayout
|
import com.google.android.flexbox.FlexboxLayout
|
||||||
|
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||||
@ -71,11 +71,12 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||||||
realView.isSelected = false
|
realView.isSelected = false
|
||||||
val layoutParams = binding.messageTime.layoutParams as FlexboxLayout.LayoutParams
|
val layoutParams = binding.messageTime.layoutParams as FlexboxLayout.LayoutParams
|
||||||
layoutParams.isWrapBefore = false
|
layoutParams.isWrapBefore = false
|
||||||
var textSize = context!!.resources.getDimension(R.dimen.chat_text_size)
|
var textSize = context.resources.getDimension(R.dimen.chat_text_size)
|
||||||
val textColor = viewThemeUtils.getScheme(binding.messageText.context).onSurfaceVariant
|
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)
|
||||||
binding.messageTime.setTextColor(textColor)
|
var processedMessageText = messageUtils.enrichChatMessageText(
|
||||||
|
binding.messageText.context, message, false,
|
||||||
var processedMessageText = messageUtils.enrichChatMessageText(binding.messageText.context, message, textColor)
|
viewThemeUtils
|
||||||
|
)
|
||||||
processedMessageText = messageUtils.processMessageParameters(
|
processedMessageText = messageUtils.processMessageParameters(
|
||||||
binding.messageText.context,
|
binding.messageText.context,
|
||||||
viewThemeUtils,
|
viewThemeUtils,
|
||||||
@ -98,7 +99,7 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||||||
|
|
||||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||||
binding.messageTime.layoutParams = layoutParams
|
binding.messageTime.layoutParams = layoutParams
|
||||||
binding.messageText.setTextColor(textColor)
|
viewThemeUtils.platform.colorTextView(binding.messageText, ColorRole.ON_SURFACE_VARIANT)
|
||||||
binding.messageText.text = processedMessageText
|
binding.messageText.text = processedMessageText
|
||||||
|
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
@ -118,22 +119,19 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||||||
}
|
}
|
||||||
|
|
||||||
val readStatusContentDescriptionString = when (message.readStatus) {
|
val readStatusContentDescriptionString = when (message.readStatus) {
|
||||||
ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
|
ReadStatus.READ -> context.resources?.getString(R.string.nc_message_read)
|
||||||
ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
|
ReadStatus.SENT -> context.resources?.getString(R.string.nc_message_sent)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
readStatusDrawableInt?.let { drawableInt ->
|
readStatusDrawableInt?.let { drawableInt ->
|
||||||
ResourcesCompat.getDrawable(context!!.resources, drawableInt, null)?.let {
|
ResourcesCompat.getDrawable(context.resources, drawableInt, null)?.let {
|
||||||
binding.checkMark.setImageDrawable(it)
|
binding.checkMark.setImageDrawable(it)
|
||||||
binding.checkMark.setColorFilter(
|
viewThemeUtils.talk.themeMessageCheckMark(binding.checkMark)
|
||||||
viewThemeUtils.getScheme(binding.messageText.context).onSurfaceVariant,
|
|
||||||
PorterDuff.Mode.SRC_ATOP
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.checkMark.setContentDescription(readStatusContentDescriptionString)
|
binding.checkMark.contentDescription = readStatusContentDescriptionString
|
||||||
|
|
||||||
itemView.setTag(R.string.replyable_message_view_tag, message.replyable)
|
itemView.setTag(R.string.replyable_message_view_tag, message.replyable)
|
||||||
|
|
||||||
@ -158,7 +156,6 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||||||
|
|
||||||
private fun processParentMessage(message: ChatMessage) {
|
private fun processParentMessage(message: ChatMessage) {
|
||||||
val parentChatMessage = message.parentMessage
|
val parentChatMessage = message.parentMessage
|
||||||
val textColor = viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
|
|
||||||
parentChatMessage!!.activeUser = message.activeUser
|
parentChatMessage!!.activeUser = message.activeUser
|
||||||
parentChatMessage.imageUrl?.let {
|
parentChatMessage.imageUrl?.let {
|
||||||
binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE
|
binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE
|
||||||
@ -172,19 +169,20 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||||||
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
binding.messageQuote.quotedMessageImage.visibility = View.GONE
|
||||||
}
|
}
|
||||||
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
|
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
|
||||||
?: context!!.getText(R.string.nc_nick_guest)
|
?: context.getText(R.string.nc_nick_guest)
|
||||||
binding.messageQuote.quotedMessage.text = messageUtils
|
binding.messageQuote.quotedMessage.text = messageUtils
|
||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
textColor
|
false,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.messageQuote.quotedMessageAuthor.setTextColor(textColor)
|
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
||||||
binding.messageQuote.quotedMessage.setTextColor(textColor)
|
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
||||||
binding.messageQuote.quoteColoredView.setBackgroundColor(textColor)
|
viewThemeUtils.talk.colorOutgoingQuoteBackground(binding.messageQuote.quoteColoredView)
|
||||||
|
|
||||||
binding.messageQuote.quotedChatMessageView.setOnClickListener() {
|
binding.messageQuote.quotedChatMessageView.setOnClickListener {
|
||||||
val chatActivity = commonMessageInterface as ChatActivity
|
val chatActivity = commonMessageInterface as ChatActivity
|
||||||
chatActivity.jumpToQuotedMessage(parentChatMessage)
|
chatActivity.jumpToQuotedMessage(parentChatMessage)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ package com.nextcloud.talk.adapters.messages
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -86,8 +85,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
|
|||||||
super.onBind(message)
|
super.onBind(message)
|
||||||
this.message = message
|
this.message = message
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
val textColor = viewThemeUtils.getScheme(binding.messageTime.context).onSurfaceVariant
|
viewThemeUtils.platform.colorTextView(binding.messageTime, ColorRole.ON_SURFACE_VARIANT)
|
||||||
binding.messageTime.setTextColor(textColor)
|
|
||||||
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
|
||||||
|
|
||||||
colorizeMessageBubble(message)
|
colorizeMessageBubble(message)
|
||||||
@ -139,10 +137,7 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
|
|||||||
readStatusDrawableInt?.let { drawableInt ->
|
readStatusDrawableInt?.let { drawableInt ->
|
||||||
AppCompatResources.getDrawable(context!!, drawableInt)?.let {
|
AppCompatResources.getDrawable(context!!, drawableInt)?.let {
|
||||||
binding.checkMark.setImageDrawable(it)
|
binding.checkMark.setImageDrawable(it)
|
||||||
binding.checkMark.setColorFilter(
|
viewThemeUtils.talk.themeMessageCheckMark(binding.checkMark)
|
||||||
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
|
|
||||||
PorterDuff.Mode.SRC_ATOP
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +286,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) :
|
|||||||
.enrichChatReplyMessageText(
|
.enrichChatReplyMessageText(
|
||||||
binding.messageQuote.quotedMessage.context,
|
binding.messageQuote.quotedMessage.context,
|
||||||
parentChatMessage,
|
parentChatMessage,
|
||||||
viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
|
false,
|
||||||
|
viewThemeUtils
|
||||||
)
|
)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
|
||||||
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
|
||||||
|
@ -28,7 +28,6 @@ package com.nextcloud.talk.adapters.messages
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
@ -235,17 +234,14 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
|
|||||||
if (message.selectedIndividualHashMap!!.containsKey(KEY_MIMETYPE)) {
|
if (message.selectedIndividualHashMap!!.containsKey(KEY_MIMETYPE)) {
|
||||||
val mimetype = message.selectedIndividualHashMap!![KEY_MIMETYPE]
|
val mimetype = message.selectedIndividualHashMap!![KEY_MIMETYPE]
|
||||||
val drawableResourceId = getDrawableResourceIdForMimeType(mimetype)
|
val drawableResourceId = getDrawableResourceIdForMimeType(mimetype)
|
||||||
val drawable = ContextCompat.getDrawable(context!!, drawableResourceId)
|
var drawable = ContextCompat.getDrawable(context!!, drawableResourceId)
|
||||||
if (drawable != null &&
|
if (drawable != null &&
|
||||||
(
|
(
|
||||||
drawableResourceId == R.drawable.ic_mimetype_folder ||
|
drawableResourceId == R.drawable.ic_mimetype_folder ||
|
||||||
drawableResourceId == R.drawable.ic_mimetype_package_x_generic
|
drawableResourceId == R.drawable.ic_mimetype_package_x_generic
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
drawable.setColorFilter(
|
drawable = viewThemeUtils?.platform?.tintDrawable(context!!, drawable)
|
||||||
viewThemeUtils!!.getScheme(image.context).primary,
|
|
||||||
PorterDuff.Mode.SRC_ATOP
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
placeholder = drawable
|
placeholder = drawable
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,8 +25,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import com.nextcloud.talk.R
|
|
||||||
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
|
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
|
||||||
import com.nextcloud.talk.models.json.chat.ChatMessage
|
import com.nextcloud.talk.models.json.chat.ChatMessage
|
||||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||||
@ -65,7 +63,7 @@ class Reaction {
|
|||||||
val isSelfReaction = message.reactionsSelf != null &&
|
val isSelfReaction = message.reactionsSelf != null &&
|
||||||
message.reactionsSelf!!.isNotEmpty() &&
|
message.reactionsSelf!!.isNotEmpty() &&
|
||||||
message.reactionsSelf!!.contains(emoji)
|
message.reactionsSelf!!.contains(emoji)
|
||||||
val textColor = getTextColor(isOutgoingMessage, isSelfReaction, binding, viewThemeUtils)
|
val textColor = viewThemeUtils.talk.getTextColor(isOutgoingMessage, isSelfReaction, binding)
|
||||||
val emojiWithAmountWrapper = getEmojiWithAmountWrapperLayout(
|
val emojiWithAmountWrapper = getEmojiWithAmountWrapperLayout(
|
||||||
binding.reactionsEmojiWrapper.context,
|
binding.reactionsEmojiWrapper.context,
|
||||||
emoji,
|
emoji,
|
||||||
@ -112,15 +110,7 @@ class Reaction {
|
|||||||
emojiWithAmountWrapper.layoutParams = layoutInfo.wrapperParams
|
emojiWithAmountWrapper.layoutParams = layoutInfo.wrapperParams
|
||||||
|
|
||||||
if (layoutInfo.isSelfReaction) {
|
if (layoutInfo.isSelfReaction) {
|
||||||
val color = if (layoutInfo.isOutgoingMessage) {
|
layoutInfo.viewThemeUtils.talk.setCheckedBackground(emojiWithAmountWrapper, layoutInfo.isOutgoingMessage)
|
||||||
ContextCompat.getColor(
|
|
||||||
emojiWithAmountWrapper.context,
|
|
||||||
R.color.bg_message_list_incoming_bubble
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
layoutInfo.viewThemeUtils.getScheme(emojiWithAmountWrapper.context).primaryContainer
|
|
||||||
}
|
|
||||||
layoutInfo.viewThemeUtils.talk.setCheckedBackground(emojiWithAmountWrapper, color)
|
|
||||||
|
|
||||||
emojiWithAmountWrapper.setPaddingRelative(
|
emojiWithAmountWrapper.setPaddingRelative(
|
||||||
layoutInfo.paddingSide,
|
layoutInfo.paddingSide,
|
||||||
@ -176,19 +166,6 @@ class Reaction {
|
|||||||
return amountParams
|
return amountParams
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTextColor(
|
|
||||||
isOutgoingMessage: Boolean,
|
|
||||||
isSelfReaction: Boolean,
|
|
||||||
binding: ReactionsInsideMessageBinding,
|
|
||||||
viewThemeUtils: ViewThemeUtils
|
|
||||||
): Int {
|
|
||||||
var textColor = viewThemeUtils.getScheme(binding.root.context).onSurfaceVariant
|
|
||||||
if (!isOutgoingMessage || isSelfReaction) {
|
|
||||||
textColor = ContextCompat.getColor(binding.root.context, R.color.high_emphasis_text)
|
|
||||||
}
|
|
||||||
return textColor
|
|
||||||
}
|
|
||||||
|
|
||||||
private data class EmojiWithAmountWrapperLayoutInfo(
|
private data class EmojiWithAmountWrapperLayoutInfo(
|
||||||
val textColor: Int,
|
val textColor: Int,
|
||||||
val amountParams: LinearLayout.LayoutParams,
|
val amountParams: LinearLayout.LayoutParams,
|
||||||
|
@ -1618,9 +1618,10 @@ class ChatActivity :
|
|||||||
currentConversation!!.status,
|
currentConversation!!.status,
|
||||||
null,
|
null,
|
||||||
size,
|
size,
|
||||||
viewThemeUtils.platform.getScheme(binding.chatToolbar.context).surface,
|
0,
|
||||||
binding.chatToolbar.context
|
binding.chatToolbar.context
|
||||||
)
|
)
|
||||||
|
viewThemeUtils.talk.themeStatusDrawable(context, status)
|
||||||
binding.chatToolbar.findViewById<ImageView>(R.id.chat_toolbar_avatar)
|
binding.chatToolbar.findViewById<ImageView>(R.id.chat_toolbar_avatar)
|
||||||
.setImageDrawable(BitmapDrawable(resources, bitmap))
|
.setImageDrawable(BitmapDrawable(resources, bitmap))
|
||||||
binding.chatToolbar.findViewById<ImageView>(R.id.chat_toolbar_status)
|
binding.chatToolbar.findViewById<ImageView>(R.id.chat_toolbar_status)
|
||||||
|
@ -26,7 +26,6 @@ package com.nextcloud.talk.remotefilebrowser.activities
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
@ -90,13 +89,10 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
binding = ActivityRemoteFileBrowserBinding.inflate(layoutInflater)
|
binding = ActivityRemoteFileBrowserBinding.inflate(layoutInflater)
|
||||||
setSupportActionBar(binding.remoteFileBrowserItemsToolbar)
|
setSupportActionBar(binding.remoteFileBrowserItemsToolbar)
|
||||||
viewThemeUtils.material.themeToolbar(binding.remoteFileBrowserItemsToolbar)
|
viewThemeUtils.material.themeToolbar(binding.remoteFileBrowserItemsToolbar)
|
||||||
val scheme = viewThemeUtils.getScheme(binding.sortListButtonGroup.context)
|
viewThemeUtils.talk.themeSortListButtonGroup(binding.sortListButtonGroup)
|
||||||
binding.sortListButtonGroup.setBackgroundColor(scheme.surface)
|
viewThemeUtils.talk.themeSortButton(binding.sortButton)
|
||||||
binding.sortButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
|
|
||||||
binding.sortButton.setTextColor(scheme.onSurface)
|
|
||||||
viewThemeUtils.material.colorMaterialTextButton(binding.sortButton)
|
viewThemeUtils.material.colorMaterialTextButton(binding.sortButton)
|
||||||
binding.pathNavigationBackButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
|
viewThemeUtils.talk.themePathNavigationButton(binding.pathNavigationBackButton)
|
||||||
binding.pathNavigationBackButton.setTextColor(scheme.onSurface)
|
|
||||||
viewThemeUtils.material.colorMaterialTextButton(binding.pathNavigationBackButton)
|
viewThemeUtils.material.colorMaterialTextButton(binding.pathNavigationBackButton)
|
||||||
viewThemeUtils.platform.themeStatusBar(this)
|
viewThemeUtils.platform.themeStatusBar(this)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
@ -199,7 +195,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
super.onCreateOptionsMenu(menu)
|
super.onCreateOptionsMenu(menu)
|
||||||
menuInflater.inflate(R.menu.menu_share_files, menu)
|
menuInflater.inflate(R.menu.menu_share_files, menu)
|
||||||
filesSelectionDoneMenuItem = menu?.findItem(R.id.files_selection_done)
|
filesSelectionDoneMenuItem = menu.findItem(R.id.files_selection_done)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
|
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
@ -44,11 +45,17 @@ public class StatusDrawable extends Drawable {
|
|||||||
private String text;
|
private String text;
|
||||||
private StatusDrawableType icon = StatusDrawableType.UNDEFINED;
|
private StatusDrawableType icon = StatusDrawableType.UNDEFINED;
|
||||||
private Paint textPaint;
|
private Paint textPaint;
|
||||||
private final int backgroundColor;
|
private int backgroundColor;
|
||||||
private final float radius;
|
private final float radius;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public StatusDrawable(String status, String statusIcon, float statusSize, int backgroundColor, Context context) {
|
public void colorStatusDrawable(@ColorInt int color) {
|
||||||
|
backgroundColor = color;
|
||||||
|
invalidateSelf();
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatusDrawable(String status, String statusIcon, float statusSize, int backgroundColor,
|
||||||
|
Context context) {
|
||||||
radius = statusSize;
|
radius = statusSize;
|
||||||
this.backgroundColor = backgroundColor;
|
this.backgroundColor = backgroundColor;
|
||||||
|
|
||||||
@ -58,19 +65,17 @@ public class StatusDrawable extends Drawable {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
} else if (TextUtils.isEmpty(statusIcon) && status != null) {
|
} else if (TextUtils.isEmpty(statusIcon) && status != null) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "online":
|
case "online" -> {
|
||||||
icon = StatusDrawableType.ONLINE;
|
icon = StatusDrawableType.ONLINE;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
break;
|
}
|
||||||
|
case "away" -> {
|
||||||
case "away":
|
|
||||||
icon = StatusDrawableType.AWAY;
|
icon = StatusDrawableType.AWAY;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
break;
|
}
|
||||||
|
default -> {
|
||||||
default:
|
}
|
||||||
// do not show
|
// do not show
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
text = statusIcon;
|
text = statusIcon;
|
||||||
|
@ -329,12 +329,14 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||||||
private void drawStatus() {
|
private void drawStatus() {
|
||||||
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, getContext());
|
float size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, getContext());
|
||||||
binding.currentAccount.ticker.setBackground(null);
|
binding.currentAccount.ticker.setBackground(null);
|
||||||
binding.currentAccount.ticker.setImageDrawable(new StatusDrawable(
|
StatusDrawable drawable = new StatusDrawable(
|
||||||
status.getStatus(),
|
status.getStatus(),
|
||||||
status.getIcon(),
|
status.getIcon(),
|
||||||
size,
|
size,
|
||||||
viewThemeUtils.getScheme(binding.currentAccount.ticker.getContext()).getSurface(),
|
0,
|
||||||
getContext()));
|
getContext());
|
||||||
|
viewThemeUtils.talk.themeStatusDrawable(binding.currentAccount.ticker.getContext(), drawable);
|
||||||
|
binding.currentAccount.ticker.setImageDrawable(drawable);
|
||||||
binding.currentAccount.ticker.setVisibility(View.VISIBLE);
|
binding.currentAccount.ticker.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,13 +26,19 @@ import android.content.Context
|
|||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.graphics.PorterDuffColorFilter
|
import android.graphics.PorterDuffColorFilter
|
||||||
|
import android.graphics.Typeface
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.graphics.drawable.LayerDrawable
|
import android.graphics.drawable.LayerDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.text.Spannable
|
||||||
|
import android.text.Spanned
|
||||||
|
import android.text.style.ForegroundColorSpan
|
||||||
|
import android.text.style.StyleSpan
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.RelativeLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
@ -42,17 +48,23 @@ import androidx.core.content.res.ResourcesCompat
|
|||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
|
import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
import com.google.android.material.materialswitch.MaterialSwitch
|
import com.google.android.material.materialswitch.MaterialSwitch
|
||||||
import com.nextcloud.android.common.ui.theme.MaterialSchemes
|
import com.nextcloud.android.common.ui.theme.MaterialSchemes
|
||||||
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
|
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
|
||||||
import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils
|
import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
|
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
|
||||||
import com.nextcloud.talk.ui.MicInputCloud
|
import com.nextcloud.talk.ui.MicInputCloud
|
||||||
|
import com.nextcloud.talk.ui.StatusDrawable
|
||||||
import com.nextcloud.talk.ui.WaveformSeekBar
|
import com.nextcloud.talk.ui.WaveformSeekBar
|
||||||
import com.nextcloud.talk.utils.DisplayUtils
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
import com.nextcloud.talk.utils.DrawableUtils
|
import com.nextcloud.talk.utils.DrawableUtils
|
||||||
|
import com.nextcloud.talk.utils.message.MessageUtils
|
||||||
import com.vanniktech.emoji.EmojiTextView
|
import com.vanniktech.emoji.EmojiTextView
|
||||||
|
import com.wooplr.spotlight.SpotlightView
|
||||||
|
import eu.davidea.flexibleadapter.utils.FlexibleUtils
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@ -160,11 +172,19 @@ class TalkSpecificViewThemeUtils @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setCheckedBackground(linearLayout: LinearLayout, @ColorInt backgroundColor: Int) {
|
fun setCheckedBackground(linearLayout: LinearLayout, incoming: Boolean) {
|
||||||
withScheme(linearLayout) { scheme ->
|
withScheme(linearLayout) { scheme ->
|
||||||
val drawable = AppCompatResources
|
val drawable = AppCompatResources
|
||||||
.getDrawable(linearLayout.context, R.drawable.reaction_self_background)!!
|
.getDrawable(linearLayout.context, R.drawable.reaction_self_background)!!
|
||||||
.mutate()
|
.mutate()
|
||||||
|
val backgroundColor = if (incoming) {
|
||||||
|
scheme.primaryContainer
|
||||||
|
} else {
|
||||||
|
ContextCompat.getColor(
|
||||||
|
linearLayout.context,
|
||||||
|
R.color.bg_message_list_incoming_bubble
|
||||||
|
)
|
||||||
|
}
|
||||||
DrawableCompat.setTintList(
|
DrawableCompat.setTintList(
|
||||||
drawable,
|
drawable,
|
||||||
ColorStateList.valueOf(backgroundColor)
|
ColorStateList.valueOf(backgroundColor)
|
||||||
@ -263,6 +283,107 @@ class TalkSpecificViewThemeUtils @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun themeForegroundColorSpan(context: Context): ForegroundColorSpan {
|
||||||
|
return withScheme(context) { scheme ->
|
||||||
|
return@withScheme ForegroundColorSpan(scheme.primary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeSpotlightView(context: Context, builder: SpotlightView.Builder): SpotlightView.Builder {
|
||||||
|
return withScheme(context) { scheme ->
|
||||||
|
return@withScheme builder.headingTvColor(scheme.primary).lineAndArcColor(scheme.primary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeAndHighlightText(
|
||||||
|
textView: TextView,
|
||||||
|
originalText: String?,
|
||||||
|
c: String?
|
||||||
|
) {
|
||||||
|
withScheme(textView) { scheme ->
|
||||||
|
var constraint = c
|
||||||
|
constraint = FlexibleUtils.toLowerCase(constraint)
|
||||||
|
var start = FlexibleUtils.toLowerCase(originalText).indexOf(constraint)
|
||||||
|
if (start != -1) {
|
||||||
|
val spanText = Spannable.Factory.getInstance().newSpannable(originalText)
|
||||||
|
do {
|
||||||
|
val end = start + constraint.length
|
||||||
|
spanText.setSpan(
|
||||||
|
ForegroundColorSpan(scheme.primary),
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
|
)
|
||||||
|
spanText.setSpan(StyleSpan(Typeface.BOLD), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
|
start = FlexibleUtils.toLowerCase(originalText)
|
||||||
|
.indexOf(constraint, end + 1) // +1 skips the consecutive span
|
||||||
|
} while (start != -1)
|
||||||
|
textView.setText(spanText, TextView.BufferType.SPANNABLE)
|
||||||
|
} else {
|
||||||
|
textView.setText(originalText, TextView.BufferType.NORMAL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeSortButton(sortButton: MaterialButton) {
|
||||||
|
withScheme(sortButton) { scheme ->
|
||||||
|
sortButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
|
||||||
|
sortButton.setTextColor(scheme.onSurface)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themePathNavigationButton(navigationBtn: MaterialButton) {
|
||||||
|
withScheme(navigationBtn) { scheme ->
|
||||||
|
navigationBtn.iconTint = ColorStateList.valueOf(scheme.onSurface)
|
||||||
|
navigationBtn.setTextColor(scheme.onSurface)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeSortListButtonGroup(relativeLayout: RelativeLayout) {
|
||||||
|
withScheme(relativeLayout) { scheme ->
|
||||||
|
relativeLayout.setBackgroundColor(scheme.surface)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeStatusDrawable(context: Context, statusDrawable: StatusDrawable) {
|
||||||
|
withScheme(context) { scheme ->
|
||||||
|
statusDrawable.colorStatusDrawable(scheme.surface)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeMessageCheckMark(imageView: ImageView) {
|
||||||
|
withScheme(imageView) { scheme ->
|
||||||
|
imageView.setColorFilter(
|
||||||
|
scheme.onSurfaceVariant,
|
||||||
|
PorterDuff.Mode.SRC_ATOP
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun themeMarkdown(context: Context, message: String, incoming: Boolean): Spanned {
|
||||||
|
return withScheme(context) { scheme ->
|
||||||
|
return@withScheme if (incoming) {
|
||||||
|
MessageUtils(context).getRenderedMarkdownText(context, message, R.color.nc_incoming_text_default)
|
||||||
|
} else {
|
||||||
|
MessageUtils(context).getRenderedMarkdownText(context, message, scheme.onSurfaceVariant)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTextColor(
|
||||||
|
isOutgoingMessage: Boolean,
|
||||||
|
isSelfReaction: Boolean,
|
||||||
|
binding: ReactionsInsideMessageBinding,
|
||||||
|
): Int {
|
||||||
|
return withScheme(binding.root) { scheme ->
|
||||||
|
return@withScheme if (!isOutgoingMessage || isSelfReaction) {
|
||||||
|
ContextCompat.getColor(binding.root.context, R.color.high_emphasis_text)
|
||||||
|
} else {
|
||||||
|
scheme.onSurfaceVariant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
|
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
|
||||||
R.drawable.ic_mimetype_package_x_generic,
|
R.drawable.ic_mimetype_package_x_generic,
|
||||||
|
@ -292,7 +292,7 @@ public class DisplayUtils {
|
|||||||
|
|
||||||
if (chipXmlRes == R.xml.chip_you) {
|
if (chipXmlRes == R.xml.chip_you) {
|
||||||
spannableString.setSpan(
|
spannableString.setSpan(
|
||||||
new ForegroundColorSpan(viewThemeUtils.getScheme(context).getOnPrimary()),
|
viewThemeUtils.talk.themeForegroundColorSpan(context),
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
@ -40,28 +40,48 @@ import io.noties.markwon.ext.tasklist.TaskListDrawable
|
|||||||
import io.noties.markwon.ext.tasklist.TaskListPlugin
|
import io.noties.markwon.ext.tasklist.TaskListPlugin
|
||||||
|
|
||||||
class MessageUtils(val context: Context) {
|
class MessageUtils(val context: Context) {
|
||||||
fun enrichChatReplyMessageText(context: Context, message: ChatMessage, textColor: Int): Spanned? {
|
fun enrichChatReplyMessageText(
|
||||||
|
context: Context,
|
||||||
|
message: ChatMessage,
|
||||||
|
incoming: Boolean,
|
||||||
|
viewThemeUtils: ViewThemeUtils
|
||||||
|
): Spanned? {
|
||||||
return if (message.message == null) {
|
return if (message.message == null) {
|
||||||
null
|
null
|
||||||
} else if (message.renderMarkdown == false) {
|
} else if (message.renderMarkdown == false) {
|
||||||
SpannableString(DisplayUtils.ellipsize(message.text, MAX_REPLY_LENGTH))
|
SpannableString(DisplayUtils.ellipsize(message.text, MAX_REPLY_LENGTH))
|
||||||
} else {
|
} else {
|
||||||
enrichChatMessageText(context, DisplayUtils.ellipsize(message.text, MAX_REPLY_LENGTH), textColor)
|
enrichChatMessageText(
|
||||||
|
context,
|
||||||
|
DisplayUtils.ellipsize(message.text, MAX_REPLY_LENGTH),
|
||||||
|
incoming,
|
||||||
|
viewThemeUtils
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun enrichChatMessageText(context: Context, message: ChatMessage, textColor: Int): Spanned? {
|
fun enrichChatMessageText(
|
||||||
|
context: Context,
|
||||||
|
message: ChatMessage,
|
||||||
|
incoming: Boolean,
|
||||||
|
viewThemeUtils: ViewThemeUtils
|
||||||
|
): Spanned? {
|
||||||
return if (message.message == null) {
|
return if (message.message == null) {
|
||||||
null
|
null
|
||||||
} else if (message.renderMarkdown == false) {
|
} else if (message.renderMarkdown == false) {
|
||||||
SpannableString(message.message)
|
SpannableString(message.message)
|
||||||
} else {
|
} else {
|
||||||
enrichChatMessageText(context, message.message!!, textColor)
|
enrichChatMessageText(context, message.text, incoming, viewThemeUtils)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enrichChatMessageText(context: Context, message: String, textColor: Int): Spanned {
|
private fun enrichChatMessageText(
|
||||||
return getRenderedMarkdownText(context, message, textColor)
|
context: Context,
|
||||||
|
message: String,
|
||||||
|
incoming: Boolean,
|
||||||
|
viewThemeUtils: ViewThemeUtils
|
||||||
|
): Spanned {
|
||||||
|
return viewThemeUtils.talk.themeMarkdown(context, message, incoming)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun processMessageParameters(
|
fun processMessageParameters(
|
||||||
@ -131,7 +151,7 @@ class MessageUtils(val context: Context) {
|
|||||||
return messageStringInternal
|
return messageStringInternal
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRenderedMarkdownText(context: Context, markdown: String, textColor: Int): Spanned {
|
fun getRenderedMarkdownText(context: Context, markdown: String, textColor: Int): Spanned {
|
||||||
val drawable = TaskListDrawable(textColor, textColor, context.getColor(R.color.bg_default))
|
val drawable = TaskListDrawable(textColor, textColor, context.getColor(R.color.bg_default))
|
||||||
val markwon = Markwon.builder(context).usePlugin(object : AbstractMarkwonPlugin() {
|
val markwon = Markwon.builder(context).usePlugin(object : AbstractMarkwonPlugin() {
|
||||||
override fun configureTheme(builder: MarkwonTheme.Builder) {
|
override fun configureTheme(builder: MarkwonTheme.Builder) {
|
||||||
|
Loading…
Reference in New Issue
Block a user