[merge] Fix compile

Change-Id: I5df927a88f4eb786561a86d8986155ebe71baafd
This commit is contained in:
SpiritCroc 2024-08-01 20:15:58 +02:00
parent 3291517b8b
commit a10220f690
51 changed files with 157 additions and 151 deletions

View File

@ -49,7 +49,7 @@ public class ColorMatrixListPreference extends ListPreference {
} }
public ColorMatrixListPreference(Context context, AttributeSet attrs) { public ColorMatrixListPreference(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.dialogPreferenceStyle); this(context, attrs, android.R.attr.dialogPreferenceStyle);
} }
public ColorMatrixListPreference(Context context) { public ColorMatrixListPreference(Context context) {

View File

@ -18,7 +18,6 @@ package im.vector.app.core.epoxy.profiles.notifications
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.annotation.AttrRes
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
@ -29,7 +28,7 @@ import im.vector.app.core.epoxy.ClickListener
import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.epoxy.onClick import im.vector.app.core.epoxy.onClick
import im.vector.app.features.themes.ThemeUtils import im.vector.lib.strings.CommonStrings
/** /**
* SC: copy of RadioButtonItem, but with extra icon + different layout * SC: copy of RadioButtonItem, but with extra icon + different layout
@ -65,10 +64,10 @@ abstract class BottomSheetRadioButtonItem : VectorEpoxyModel<BottomSheetRadioBut
if (selected) { if (selected) {
holder.radioImage.setImageDrawable(ContextCompat.getDrawable(holder.view.context, R.drawable.ic_radio_on)) holder.radioImage.setImageDrawable(ContextCompat.getDrawable(holder.view.context, R.drawable.ic_radio_on))
holder.radioImage.contentDescription = holder.view.context.getString(R.string.a11y_checked) holder.radioImage.contentDescription = holder.view.context.getString(CommonStrings.a11y_checked)
} else { } else {
holder.radioImage.setImageDrawable(ContextCompat.getDrawable(holder.view.context, R.drawable.ic_radio_off)) holder.radioImage.setImageDrawable(ContextCompat.getDrawable(holder.view.context, R.drawable.ic_radio_off))
holder.radioImage.contentDescription = holder.view.context.getString(R.string.a11y_unchecked) holder.radioImage.contentDescription = holder.view.context.getString(CommonStrings.a11y_unchecked)
} }
holder.icon.setImageResource(iconRes ?: 0) holder.icon.setImageResource(iconRes ?: 0)

View File

@ -43,17 +43,13 @@ fun renderReactionImage(reactionUrl: String?,
.load(url) .load(url)
.centerCrop() .centerCrop()
.listener(object : RequestListener<Drawable> { .listener(object : RequestListener<Drawable> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>, isFirstResource: Boolean): Boolean {
Timber.w("Reaction image load failed for $effectiveReactionUrl: $e") Timber.w("Reaction image load failed for $effectiveReactionUrl: $e")
textView.isVisible = true textView.isVisible = true
imageView.isVisible = false imageView.isVisible = false
return false return false
} }
override fun onResourceReady(resource: Drawable?, override fun onResourceReady(resource: Drawable, model: Any, target: Target<Drawable>?, dataSource: DataSource, isFirstResource: Boolean): Boolean {
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean): Boolean {
return false return false
} }
}) })

View File

@ -63,7 +63,7 @@ class ImageContentRendererDataLoader(private val context: Context) :
} }
class ImageContentRendererDataFetcher( class ImageContentRendererDataFetcher(
context: Context, private val context: Context,
private val data: ImageContentRenderer.Data, private val data: ImageContentRenderer.Data,
private val width: Int, private val width: Int,
private val height: Int private val height: Int

View File

@ -143,7 +143,7 @@ open class VectorPreference : Preference {
} else { } else {
val bgDrawable = TypedValue() val bgDrawable = TypedValue()
context.theme.resolveAttribute(android.R.attr.selectableItemBackground, bgDrawable, true) context.theme.resolveAttribute(android.R.attr.selectableItemBackground, bgDrawable, true)
ViewCompat.setBackground(itemView, ContextCompat.getDrawable(context, bgDrawable.resourceId)) itemView.background = ContextCompat.getDrawable(context, bgDrawable.resourceId)
} }
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "onBindView") Timber.e(e, "onBindView")

View File

@ -92,7 +92,7 @@ class VectorSwitchPreference : SwitchPreference {
} else { } else {
val bgDrawable = TypedValue() val bgDrawable = TypedValue()
context.theme.resolveAttribute(android.R.attr.selectableItemBackground, bgDrawable, true) context.theme.resolveAttribute(android.R.attr.selectableItemBackground, bgDrawable, true)
ViewCompat.setBackground(itemView, ContextCompat.getDrawable(context, bgDrawable.resourceId)) itemView.background = ContextCompat.getDrawable(context, bgDrawable.resourceId)
} }
super.onBindViewHolder(holder) super.onBindViewHolder(holder)

View File

@ -9,8 +9,6 @@ import android.view.View
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.core.text.getSpans import androidx.core.text.getSpans
import androidx.core.text.toSpanned import androidx.core.text.toSpanned
import androidx.core.view.ViewCompat.LAYOUT_DIRECTION_RTL
import im.vector.app.R
import im.vector.app.features.html.HtmlCodeSpan import im.vector.app.features.html.HtmlCodeSpan
import io.noties.markwon.core.spans.EmphasisSpan import io.noties.markwon.core.spans.EmphasisSpan
import kotlin.math.ceil import kotlin.math.ceil
@ -67,7 +65,7 @@ interface AbstractFooteredTextView {
val lastLine = layout.lineCount - 1 val lastLine = layout.lineCount - 1
// Let's check if the last line's text has the same RTL behaviour as the layout direction. // Let's check if the last line's text has the same RTL behaviour as the layout direction.
val viewIsRtl = layoutDirection == LAYOUT_DIRECTION_RTL val viewIsRtl = layoutDirection == View.LAYOUT_DIRECTION_RTL
val looksLikeRtl = layout.getParagraphDirection(lastLine) == Layout.DIR_RIGHT_TO_LEFT val looksLikeRtl = layout.getParagraphDirection(lastLine) == Layout.DIR_RIGHT_TO_LEFT
/* /*
val lastVisibleCharacter = layout.getLineVisibleEnd(lastLine) - 1 val lastVisibleCharacter = layout.getLineVisibleEnd(lastLine) - 1
@ -104,7 +102,7 @@ interface AbstractFooteredTextView {
if (looksLikeRtl == viewIsRtl) if (looksLikeRtl == viewIsRtl)
widthLastLine widthLastLine
else else
(maxLineWidth + resources.getDimensionPixelSize(R.dimen.sc_footer_rtl_mismatch_extra_padding)) (maxLineWidth + resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_rtl_mismatch_extra_padding))
) + footerState.footerWidth ) + footerState.footerWidth
// If the last line is a multi-line code block, we have never space in the last line (as the black background always uses full width) // If the last line is a multi-line code block, we have never space in the last line (as the black background always uses full width)
@ -139,12 +137,12 @@ interface AbstractFooteredTextView {
newHeight += footerState.footerHeight newHeight += footerState.footerHeight
// Ensure enough width for footer bellow // Ensure enough width for footer bellow
newWidth = max(newWidth, footerState.footerWidth + newWidth = max(newWidth, footerState.footerWidth +
resources.getDimensionPixelSize(R.dimen.sc_footer_padding_compensation) + resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_padding_compensation) +
2 * resources.getDimensionPixelSize(R.dimen.sc_footer_overlay_padding)) 2 * resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_overlay_padding))
} }
if (addItalicPadding) { if (addItalicPadding) {
newWidth += resources.getDimensionPixelSize(R.dimen.italic_text_view_extra_padding) newWidth += resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.italic_text_view_extra_padding)
} }
//setMeasuredDimension(newWidth, newHeight) //setMeasuredDimension(newWidth, newHeight)

View File

@ -9,7 +9,7 @@ import im.vector.app.features.home.room.detail.timeline.view.ScMessageBubbleWrap
interface BubbleDependentView<H: VectorEpoxyHolder> { interface BubbleDependentView<H: VectorEpoxyHolder> {
fun getScBubbleMargin(resources: Resources): Int = resources.getDimensionPixelSize(R.dimen.dual_bubble_one_side_without_avatar_margin) fun getScBubbleMargin(resources: Resources): Int = resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.dual_bubble_one_side_without_avatar_margin)
fun getViewStubMinimumWidth(holder: H): Int = 0 fun getViewStubMinimumWidth(holder: H): Int = 0
fun allowFooterOverlay(holder: H, bubbleWrapView: ScMessageBubbleWrapView): Boolean = false fun allowFooterOverlay(holder: H, bubbleWrapView: ScMessageBubbleWrapView): Boolean = false

View File

@ -23,7 +23,7 @@ class FooteredTextView @JvmOverloads constructor(
setMeasuredDimension(updatedMeasures.first, updatedMeasures.second) setMeasuredDimension(updatedMeasures.first, updatedMeasures.second)
} }
override fun onDraw(canvas: Canvas?) { override fun onDraw(canvas: Canvas) {
updateFooterOnPreDraw(canvas) updateFooterOnPreDraw(canvas)
super.onDraw(canvas) super.onDraw(canvas)

View File

@ -46,8 +46,8 @@ class JoinConferenceView @JvmOverloads constructor(
super.onAttachedToWindow() super.onAttachedToWindow()
views = ViewJoinConferenceBinding.bind(this) views = ViewJoinConferenceBinding.bind(this)
views?.joinConferenceButton?.setOnClickListener { onJoinClicked?.invoke() } views?.joinConferenceButton?.setOnClickListener { onJoinClicked?.invoke() }
val colorFrom = ThemeUtils.getColor(context, R.attr.conference_animation_from) val colorFrom = ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.conference_animation_from)
val colorTo = ThemeUtils.getColor(context, R.attr.conference_animation_to) val colorTo = ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.conference_animation_to)
// Animate button color to highlight // Animate button color to highlight
backgroundAnimator = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo).apply { backgroundAnimator = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo).apply {
repeatMode = ValueAnimator.REVERSE repeatMode = ValueAnimator.REVERSE

View File

@ -28,6 +28,7 @@ import im.vector.app.features.autocomplete.member.AutocompleteEmojiDataItem
import im.vector.app.features.reactions.data.EmojiDataSource import im.vector.app.features.reactions.data.EmojiDataSource
import im.vector.app.features.reactions.data.EmojiItem import im.vector.app.features.reactions.data.EmojiItem
import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.settings.VectorPreferences
import im.vector.lib.strings.CommonStrings
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
@ -123,7 +124,7 @@ class AutocompleteEmojiPresenter @AssistedInject constructor(
val currentRoomEmotes = room.getAllEmojiItems(query) val currentRoomEmotes = room.getAllEmojiItems(query)
val allEmoteData = currentRoomEmotes.toAutocompleteItems().let { val allEmoteData = currentRoomEmotes.toAutocompleteItems().let {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
listOf(AutocompleteEmojiDataItem.Header(roomId, context.getString(R.string.custom_emotes_this_room))) + it listOf(AutocompleteEmojiDataItem.Header(roomId, context.getString(CommonStrings.custom_emotes_this_room))) + it
} else { } else {
emptyList() emptyList()
} }
@ -145,7 +146,7 @@ class AutocompleteEmojiPresenter @AssistedInject constructor(
emoteData += listOf( emoteData += listOf(
AutocompleteEmojiDataItem.Header( AutocompleteEmojiDataItem.Header(
AutocompleteEmojiController.ACCOUNT_DATA_EMOTE_ID, AutocompleteEmojiController.ACCOUNT_DATA_EMOTE_ID,
context.getString(R.string.custom_emotes_account_data) context.getString(CommonStrings.custom_emotes_account_data)
) )
) )
emoteData += userPack.toAutocompleteItems() emoteData += userPack.toAutocompleteItems()
@ -188,13 +189,13 @@ class AutocompleteEmojiPresenter @AssistedInject constructor(
packRoomId, packRoomId,
if (packName != null) { if (packName != null) {
context.getString( context.getString(
R.string.custom_emotes_named_other_room, CommonStrings.custom_emotes_named_other_room,
packName, packName,
packRoomName packRoomName
) )
} else { } else {
context.getString( context.getString(
R.string.custom_emotes_other_room, CommonStrings.custom_emotes_other_room,
packRoomName packRoomName
) )
} }

View File

@ -26,6 +26,8 @@ import im.vector.app.core.epoxy.ClickListener
import im.vector.app.core.epoxy.VectorEpoxyModel import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.epoxy.onClick import im.vector.app.core.epoxy.onClick
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import im.vector.lib.strings.CommonPlurals
import im.vector.lib.strings.CommonStrings
@EpoxyModelClass // Re-using item_autocomplete_emoji to avoid class-cast exceptions like https://github.com/SchildiChat/SchildiChat-android-rageshakes/issues/1040 @EpoxyModelClass // Re-using item_autocomplete_emoji to avoid class-cast exceptions like https://github.com/SchildiChat/SchildiChat-android-rageshakes/issues/1040
abstract class AutocompleteExpandItem : VectorEpoxyModel<AutocompleteEmojiItem.Holder>(R.layout.item_autocomplete_emoji) { abstract class AutocompleteExpandItem : VectorEpoxyModel<AutocompleteEmojiItem.Holder>(R.layout.item_autocomplete_emoji) {
@ -43,13 +45,13 @@ abstract class AutocompleteExpandItem : VectorEpoxyModel<AutocompleteEmojiItem.H
holder.emoteImage.isVisible = true holder.emoteImage.isVisible = true
holder.emojiNameText.isVisible = true holder.emojiNameText.isVisible = true
holder.emoteImage.setImageResource(R.drawable.ic_expand_more) holder.emoteImage.setImageResource(R.drawable.ic_expand_more)
holder.emoteImage.imageTintList = ColorStateList.valueOf(ThemeUtils.getColor(holder.emoteImage.context, R.attr.vctr_content_secondary)) holder.emoteImage.imageTintList = ColorStateList.valueOf(ThemeUtils.getColor(holder.emoteImage.context, im.vector.lib.ui.styles.R.attr.vctr_content_secondary))
holder.emojiText.typeface = Typeface.DEFAULT holder.emojiText.typeface = Typeface.DEFAULT
count.let { count.let {
if (it == null) { if (it == null) {
holder.emojiNameText.setText(R.string.room_profile_section_more) holder.emojiNameText.setText(CommonStrings.room_profile_section_more)
} else { } else {
holder.emojiNameText.text = holder.emojiNameText.resources.getQuantityString(R.plurals.message_reaction_show_more, it, it) holder.emojiNameText.text = holder.emojiNameText.resources.getQuantityString(CommonPlurals.message_reaction_show_more, it, it)
} }
} }
holder.emojiKeywordText.isVisible = false holder.emojiKeywordText.isVisible = false

View File

@ -40,6 +40,7 @@ import im.vector.app.features.session.coroutineScope
import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.settings.VectorPreferences
import im.vector.lib.core.utils.flow.chunk import im.vector.lib.core.utils.flow.chunk
import im.vector.lib.core.utils.timer.CountUpTimer import im.vector.lib.core.utils.timer.CountUpTimer
import im.vector.lib.strings.CommonStrings
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -308,7 +309,7 @@ class WebRtcCall(
add( add(
PeerConnection PeerConnection
.IceServer .IceServer
.builder("stun:" + stringProvider.getString(R.string.fallback_stun_server_url)) .builder("stun:" + stringProvider.getString(im.vector.app.config.R.string.fallback_stun_server_url))
.createIceServer() .createIceServer()
) )
} }

View File

@ -207,7 +207,7 @@ class IncomingVerificationRequestHandler @Inject constructor(
pr.transactionId, pr.transactionId,
) )
} }
colorAttribute = R.attr.verification_request_background colorAttribute = im.vector.lib.ui.styles.R.attr.verification_request_background
// 5mn expiration // 5mn expiration
expirationTimestamp = clock.epochMillis() + (5 * 60 * 1000L) expirationTimestamp = clock.epochMillis() + (5 * 60 * 1000L)
} }

View File

@ -162,10 +162,10 @@ fun BaseEpoxyVerificationController.renderAcceptDeclineRequest() {
bottomSheetVerificationActionItem { bottomSheetVerificationActionItem {
id("accept_pr") id("accept_pr")
title(host.stringProvider.getString(CommonStrings.action_accept)) title(host.stringProvider.getString(CommonStrings.action_accept))
titleColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)) titleColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color))
// subTitle(host.stringProvider.getString(CommonStrings.verification_request_start_notice)) // subTitle(host.stringProvider.getString(CommonStrings.verification_request_start_notice))
iconRes(R.drawable.ic_arrow_right) iconRes(R.drawable.ic_arrow_right)
iconColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)) iconColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color))
listener { host.listener?.acceptRequest() } listener { host.listener?.acceptRequest() }
} }
bottomSheetVerificationActionItem { bottomSheetVerificationActionItem {
@ -253,9 +253,9 @@ fun BaseEpoxyVerificationController.buildSasCodeActions() {
bottomSheetVerificationActionItem { bottomSheetVerificationActionItem {
id("ok") id("ok")
title(host.stringProvider.getString(CommonStrings.verification_sas_match)) title(host.stringProvider.getString(CommonStrings.verification_sas_match))
titleColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)) titleColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color))
iconRes(R.drawable.ic_check_on) iconRes(R.drawable.ic_check_on)
iconColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)) iconColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color))
listener { host.listener?.onMatchButtonTapped() } listener { host.listener?.onMatchButtonTapped() }
} }
} }
@ -356,9 +356,9 @@ fun BaseEpoxyVerificationController.renderQrTransaction(transaction: Verificatio
bottomSheetVerificationActionItem { bottomSheetVerificationActionItem {
id("confirm") id("confirm")
title(host.stringProvider.getString(CommonStrings.qr_code_scanned_by_other_yes)) title(host.stringProvider.getString(CommonStrings.qr_code_scanned_by_other_yes))
titleColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)) titleColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color))
iconRes(R.drawable.ic_check_on) iconRes(R.drawable.ic_check_on)
iconColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color)) iconColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color))
listener { host.listener?.onUserConfirmsQrCodeScanned() } listener { host.listener?.onUserConfirmsQrCodeScanned() }
} }
} }

View File

@ -645,8 +645,8 @@ class HomeActivity :
resources, resources,
menu.findItem(R.id.dev_base_theme), menu.findItem(R.id.dev_base_theme),
R.id.dev_base_theme_group, R.id.dev_base_theme_group,
R.array.theme_entries, im.vector.lib.strings.R.array.theme_entries,
R.array.theme_values, im.vector.lib.strings.R.array.theme_values,
ThemeUtils.getCurrentActiveTheme(this) ThemeUtils.getCurrentActiveTheme(this)
) { value -> ) { value ->
ThemeUtils.setCurrentActiveTheme(this, value) ThemeUtils.setCurrentActiveTheme(this, value)

View File

@ -957,8 +957,8 @@ class TimelineFragment :
resources, resources,
menu.findItem(R.id.dev_base_theme), menu.findItem(R.id.dev_base_theme),
R.id.dev_base_theme_group, R.id.dev_base_theme_group,
R.array.theme_entries, im.vector.lib.strings.R.array.theme_entries,
R.array.theme_values, im.vector.lib.strings.R.array.theme_values,
ThemeUtils.getCurrentActiveTheme(requireContext()) ThemeUtils.getCurrentActiveTheme(requireContext())
) { value -> ) { value ->
ThemeUtils.setCurrentActiveTheme(requireContext(), value) ThemeUtils.setCurrentActiveTheme(requireContext(), value)
@ -1129,7 +1129,7 @@ class TimelineFragment :
val badgeDrawable = DrawableCompat.wrap(badgeFrameLayout.background) val badgeDrawable = DrawableCompat.wrap(badgeFrameLayout.background)
val color = ThemeUtils.getColor( val color = ThemeUtils.getColor(
requireContext(), requireContext(),
if (userIsMentioned) R.attr.colorError else R.attr.colorAccent) if (userIsMentioned) com.google.android.material.R.attr.colorError else com.google.android.material.R.attr.colorAccent
) )
DrawableCompat.setTint(badgeDrawable, color) DrawableCompat.setTint(badgeDrawable, color)
badgeFrameLayout.background = badgeDrawable badgeFrameLayout.background = badgeDrawable
@ -1569,10 +1569,10 @@ class TimelineFragment :
views.includeRoomToolbar.roomToolbarSubtitleView.apply { views.includeRoomToolbar.roomToolbarSubtitleView.apply {
setTextOrHide(subtitle) setTextOrHide(subtitle)
if (typingMessage.isNullOrBlank()) { if (typingMessage.isNullOrBlank()) {
setTextColor(colorProvider.getColorFromAttribute(R.attr.vctr_content_secondary)) setTextColor(colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_content_secondary))
setTypeface(null, Typeface.NORMAL) setTypeface(null, Typeface.NORMAL)
} else { } else {
setTextColor(colorProvider.getColorFromAttribute(R.attr.colorPrimary)) setTextColor(colorProvider.getColorFromAttribute(com.google.android.material.R.attr.colorPrimary))
setTypeface(null, Typeface.BOLD) setTypeface(null, Typeface.BOLD)
} }
} }

View File

@ -558,7 +558,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
} }
private fun handleSendButtonVisibilityChanged(event: MessageComposerViewEvents.AnimateSendButtonVisibility) { private fun handleSendButtonVisibilityChanged(event: MessageComposerViewEvents.AnimateSendButtonVisibility) {
val sendButtonColor = ThemeUtils.getColor(views.composerLayout.context, if (event.isActive) R.attr.colorAccent else R.attr.vctr_content_tertiary) val sendButtonColor = ThemeUtils.getColor(views.composerLayout.context, if (event.isActive) com.google.android.material.R.attr.colorAccent else im.vector.lib.ui.styles.R.attr.vctr_content_tertiary)
views.composerLayout.sendButton.imageTintList = ColorStateList.valueOf(sendButtonColor) views.composerLayout.sendButton.imageTintList = ColorStateList.valueOf(sendButtonColor)
if (event.isVisible) { if (event.isVisible) {
if (views.composerLayout.sendButton.isVisible) { if (views.composerLayout.sendButton.isVisible) {

View File

@ -124,7 +124,7 @@ class ViewEditHistoryEpoxyController @Inject constructor(
diff_match_patch.Operation.INSERT -> { diff_match_patch.Operation.INSERT -> {
span { span {
text = it.text text = it.text
textColor = colorProvider.getColorFromAttribute(R.attr.vctr_encrypting_message_text_color) textColor = colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_encrypting_message_text_color)
} }
} }
else -> { else -> {

View File

@ -85,7 +85,7 @@ class DisplayableEventFormatter @Inject constructor(
timelineEvent.getVectorLastMessageContent()?.let { messageContent -> timelineEvent.getVectorLastMessageContent()?.let { messageContent ->
when (messageContent.msgType) { when (messageContent.msgType) {
MessageType.MSGTYPE_TEXT -> { MessageType.MSGTYPE_TEXT -> {
val body = messageContent.getTextDisplayableContent(imageFallback = stringProvider.getString(R.string.sent_an_image)) val body = messageContent.getTextDisplayableContent(imageFallback = stringProvider.getString(CommonStrings.sent_an_image))
if (messageContent is MessageTextContent && messageContent.matrixFormattedBody.isNullOrBlank().not()) { if (messageContent is MessageTextContent && messageContent.matrixFormattedBody.isNullOrBlank().not()) {
val localFormattedBody = htmlRenderer.get().parse(body) as Document val localFormattedBody = htmlRenderer.get().parse(body) as Document
val renderedBody = htmlRenderer.get().render(localFormattedBody) ?: body val renderedBody = htmlRenderer.get().render(localFormattedBody) ?: body
@ -115,11 +115,11 @@ class DisplayableEventFormatter @Inject constructor(
} }
} }
MessageType.MSGTYPE_VIDEO -> { MessageType.MSGTYPE_VIDEO -> {
val text = (messageContent as? MessageWithAttachmentContent)?.getCaption() ?: stringProvider.getString(CommonStrings.string.sent_a_video) val text = (messageContent as? MessageWithAttachmentContent)?.getCaption() ?: stringProvider.getString(CommonStrings.sent_a_video)
simpleFormat(senderName, text, appendAuthor) simpleFormat(senderName, text, appendAuthor)
} }
MessageType.MSGTYPE_FILE -> { MessageType.MSGTYPE_FILE -> {
val text = (messageContent as? MessageWithAttachmentContent)?.getCaption() ?: stringProvider.getString(CommonStrings.string.sent_a_file) val text = (messageContent as? MessageWithAttachmentContent)?.getCaption() ?: stringProvider.getString(CommonStrings.sent_a_file)
simpleFormat(senderName, text, appendAuthor) simpleFormat(senderName, text, appendAuthor)
} }
MessageType.MSGTYPE_LOCATION -> { MessageType.MSGTYPE_LOCATION -> {
@ -210,7 +210,7 @@ class DisplayableEventFormatter @Inject constructor(
(event.getClearContent().toModel() as? MessageContent)?.let { messageContent -> (event.getClearContent().toModel() as? MessageContent)?.let { messageContent ->
when (messageContent.msgType) { when (messageContent.msgType) {
MessageType.MSGTYPE_TEXT -> { MessageType.MSGTYPE_TEXT -> {
val body = messageContent.getTextDisplayableContent(imageFallback = stringProvider.getString(R.string.sent_an_image)) val body = messageContent.getTextDisplayableContent(imageFallback = stringProvider.getString(CommonStrings.sent_an_image))
if (messageContent is MessageTextContent && messageContent.matrixFormattedBody.isNullOrBlank().not()) { if (messageContent is MessageTextContent && messageContent.matrixFormattedBody.isNullOrBlank().not()) {
val localFormattedBody = htmlRenderer.get().parse(body) as Document val localFormattedBody = htmlRenderer.get().parse(body) as Document
val renderedBody = htmlRenderer.get().render(localFormattedBody) ?: body val renderedBody = htmlRenderer.get().render(localFormattedBody) ?: body

View File

@ -48,7 +48,7 @@ class MatrixItemColorProvider @Inject constructor(
USER_COLORING_FROM_PL -> { USER_COLORING_FROM_PL -> {
colorProvider.getColorFromAttribute( colorProvider.getColorFromAttribute(
when { when {
userInRoomInformation?.userPowerLevel == null -> R.attr.colorAccent // This is also used for avatars in the room overview userInRoomInformation?.userPowerLevel == null -> com.google.android.material.R.attr.colorAccent // This is also used for avatars in the room overview
userInRoomInformation.userPowerLevel >= 100 -> R.attr.user_color_pl_100 userInRoomInformation.userPowerLevel >= 100 -> R.attr.user_color_pl_100
userInRoomInformation.userPowerLevel >= 95 -> R.attr.user_color_pl_95 userInRoomInformation.userPowerLevel >= 95 -> R.attr.user_color_pl_95
userInRoomInformation.userPowerLevel >= 51 -> R.attr.user_color_pl_51 userInRoomInformation.userPowerLevel >= 51 -> R.attr.user_color_pl_51

View File

@ -172,16 +172,16 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder>(@LayoutRes layo
// else: dual-side bubbles (getBubbleMargin should not get called for other bubbleStyles) // else: dual-side bubbles (getBubbleMargin should not get called for other bubbleStyles)
// Direct chats usually have avatars hidden on both sides // Direct chats usually have avatars hidden on both sides
baseAttributes.informationData.isDirect -> resources.getDimensionPixelSize(R.dimen.dual_bubble_both_sides_without_avatar_margin) baseAttributes.informationData.isDirect -> resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.dual_bubble_both_sides_without_avatar_margin)
// No direct chat, but sent by me: other side has an avatar // No direct chat, but sent by me: other side has an avatar
baseAttributes.informationData.sentByMe -> { baseAttributes.informationData.sentByMe -> {
resources.getDimensionPixelSize(R.dimen.dual_bubble_one_side_without_avatar_margin) + resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.dual_bubble_one_side_without_avatar_margin) +
resources.getDimensionPixelSize(R.dimen.dual_bubble_one_side_avatar_offset) + resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.dual_bubble_one_side_avatar_offset) +
// SC bubbles use SMALL avatars // SC bubbles use SMALL avatars
ceil(AvatarSizeProvider.Companion.AvatarStyle.SMALL.avatarSizeDP * resources.displayMetrics.density).toInt() ceil(AvatarSizeProvider.Companion.AvatarStyle.SMALL.avatarSizeDP * resources.displayMetrics.density).toInt()
} }
// No direct chat, sent by other: my side has hidden avatar // No direct chat, sent by other: my side has hidden avatar
else -> resources.getDimensionPixelSize(R.dimen.dual_bubble_one_side_without_avatar_margin) else -> resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.dual_bubble_one_side_without_avatar_margin)
} }
} }

View File

@ -118,11 +118,11 @@ abstract class MessageFileItem : AbsMessageItem<MessageFileItem.Holder>() {
override fun getViewStubMinimumWidth(holder: Holder): Int { override fun getViewStubMinimumWidth(holder: Holder): Int {
// Guess text width for name and time // Guess text width for name and time
// On first call, holder.fileImageView.width is not initialized yet // On first call, holder.fileImageView.width is not initialized yet
val imageWidth = holder.fileImageView.resources.getDimensionPixelSize(R.dimen.file_icon_size) val imageWidth = holder.fileImageView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.file_icon_size)
val minimumWidthWithText = val minimumWidthWithText =
ceil(guessTextWidth(holder.filenameView, filename)).toInt() + ceil(guessTextWidth(holder.filenameView, filename)).toInt() +
imageWidth + imageWidth +
holder.filenameView.resources.getDimensionPixelSize(R.dimen.sc_bubble_guess_minimum_width_padding) holder.filenameView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_bubble_guess_minimum_width_padding)
val absoluteMinimumWidth = imageWidth*3 val absoluteMinimumWidth = imageWidth*3
return max(absoluteMinimumWidth, minimumWidthWithText) return max(absoluteMinimumWidth, minimumWidthWithText)
} }

View File

@ -43,6 +43,7 @@ import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLay
import im.vector.app.features.home.room.detail.timeline.tools.findPillsAndProcess import im.vector.app.features.home.room.detail.timeline.tools.findPillsAndProcess
import im.vector.app.features.media.ImageContentRenderer import im.vector.app.features.media.ImageContentRenderer
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import im.vector.lib.strings.CommonStrings
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.session.crypto.attachments.toElementToDecrypt import org.matrix.android.sdk.api.session.crypto.attachments.toElementToDecrypt
@ -77,8 +78,8 @@ class InReplyToView @JvmOverloads constructor(
private var state: PreviewReplyUiState = PreviewReplyUiState.NoReply private var state: PreviewReplyUiState = PreviewReplyUiState.NoReply
private val maxThumbnailWidth = context.resources.getDimensionPixelSize(R.dimen.reply_thumbnail_max_width) private val maxThumbnailWidth = context.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.reply_thumbnail_max_width)
private val maxThumbnailHeight = context.resources.getDimensionPixelSize(R.dimen.reply_thumbnail_height) private val maxThumbnailHeight = context.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.reply_thumbnail_height)
/** /**
* This methods is responsible for rendering the view according to the newState * This methods is responsible for rendering the view according to the newState
@ -150,8 +151,8 @@ class InReplyToView @JvmOverloads constructor(
hideViews() hideViews()
isVisible = true isVisible = true
views.replyTextView.isVisible = true views.replyTextView.isVisible = true
val color = ThemeUtils.getColor(context, R.attr.vctr_content_secondary) val color = ThemeUtils.getColor(context,im.vector.lib.ui.styles.R.attr.vctr_content_secondary)
views.replyTextView.text = SpannableString(context.getString(R.string.in_reply_to_loading)).apply { views.replyTextView.text = SpannableString(context.getString(CommonStrings.in_reply_to_loading)).apply {
setSpan(StyleSpan(Typeface.ITALIC), 0, length, 0) setSpan(StyleSpan(Typeface.ITALIC), 0, length, 0)
setSpan(ForegroundColorSpan(color), 0, length, 0) setSpan(ForegroundColorSpan(color), 0, length, 0)
} }
@ -163,8 +164,8 @@ class InReplyToView @JvmOverloads constructor(
isVisible = true isVisible = true
Timber.w(state.throwable, "Error rendering reply") Timber.w(state.throwable, "Error rendering reply")
views.replyTextView.isVisible = true views.replyTextView.isVisible = true
val color = ThemeUtils.getColor(context, R.attr.vctr_content_secondary) val color = ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.vctr_content_secondary)
views.replyTextView.text = SpannableString(context.getString(R.string.in_reply_to_error)).apply { views.replyTextView.text = SpannableString(context.getString(CommonStrings.in_reply_to_error)).apply {
setSpan(StyleSpan(Typeface.ITALIC), 0, length, 0) setSpan(StyleSpan(Typeface.ITALIC), 0, length, 0)
setSpan(ForegroundColorSpan(color), 0, length, 0) setSpan(ForegroundColorSpan(color), 0, length, 0)
} }
@ -201,7 +202,7 @@ class InReplyToView @JvmOverloads constructor(
private fun renderRedacted() { private fun renderRedacted() {
views.replyTextView.isVisible = true views.replyTextView.isVisible = true
views.replyTextView.setText(R.string.event_redacted) views.replyTextView.setText(CommonStrings.event_redacted)
} }
private fun renderTextContent( private fun renderTextContent(
@ -333,21 +334,21 @@ class InReplyToView @JvmOverloads constructor(
val bgColor = when (val layout = informationData.messageLayout) { val bgColor = when (val layout = informationData.messageLayout) {
is TimelineMessageLayout.ScBubble -> { is TimelineMessageLayout.ScBubble -> {
if (informationData.sentByMe && !layout.singleSidedLayout) { if (informationData.sentByMe && !layout.singleSidedLayout) {
ThemeUtils.getColor(context, R.attr.sc_message_bg_outgoing) ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.sc_message_bg_outgoing)
} else { } else {
ThemeUtils.getColor(context, R.attr.sc_message_bg_incoming) ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.sc_message_bg_incoming)
} }
} }
is TimelineMessageLayout.Bubble -> { is TimelineMessageLayout.Bubble -> {
if (layout.isPseudoBubble) { if (layout.isPseudoBubble) {
0 0
} else { } else {
val backgroundColorAttr = if (informationData.sentByMe) R.attr.vctr_message_bubble_outbound else R.attr.vctr_message_bubble_inbound val backgroundColorAttr = if (informationData.sentByMe) im.vector.lib.ui.styles.R.attr.vctr_message_bubble_outbound else im.vector.lib.ui.styles.R.attr.vctr_message_bubble_inbound
ThemeUtils.getColor(context, backgroundColorAttr) ThemeUtils.getColor(context, backgroundColorAttr)
} }
} }
is TimelineMessageLayout.Default -> { is TimelineMessageLayout.Default -> {
ThemeUtils.getColor(context, R.attr.vctr_system) ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.vctr_system)
} }
} }
val fadeView = views.expandableReplyView.getChildAt(1) val fadeView = views.expandableReplyView.getChildAt(1)

View File

@ -50,8 +50,8 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
init { init {
inflate(context, R.layout.view_message_bubble_sc, this) inflate(context, R.layout.view_message_bubble_sc, this)
context.withStyledAttributes(attrs, R.styleable.MessageBubble) { context.withStyledAttributes(attrs, im.vector.lib.ui.styles.R.styleable.MessageBubble) {
isIncoming = getBoolean(R.styleable.MessageBubble_incoming_style, false) isIncoming = getBoolean(im.vector.lib.ui.styles.R.styleable.MessageBubble_incoming_style, false)
} }
} }
@ -229,7 +229,7 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
renderStubMessageLayout(messageLayout, views.viewStubContainer.root) renderStubMessageLayout(messageLayout, views.viewStubContainer.root)
// Padding for views that align with the bubble (should be roughly the bubble tail width) // Padding for views that align with the bubble (should be roughly the bubble tail width)
val bubbleStartAlignWidth = views.informationBottom.resources.getDimensionPixelSize(R.dimen.sc_bubble_tail_size) val bubbleStartAlignWidth = views.informationBottom.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_bubble_tail_size)
if (messageLayout.reverseBubble) { if (messageLayout.reverseBubble) {
// Align reactions container to bubble // Align reactions container to bubble
views.informationBottom.setPaddingRelative( views.informationBottom.setPaddingRelative(
@ -274,10 +274,10 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
val shortPadding: Int val shortPadding: Int
bubbleView.setBackgroundResource(messageLayout.bubbleDrawable) bubbleView.setBackgroundResource(messageLayout.bubbleDrawable)
if (!messageLayout.isPseudoBubble) { if (!messageLayout.isPseudoBubble) {
longPadding = bubbleView.resources.getDimensionPixelSize(R.dimen.sc_bubble_inner_padding_long_side) longPadding = bubbleView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_bubble_inner_padding_long_side)
shortPadding = bubbleView.resources.getDimensionPixelSize(R.dimen.sc_bubble_inner_padding_short_side) shortPadding = bubbleView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_bubble_inner_padding_short_side)
} else { } else {
longPadding = bubbleView.resources.getDimensionPixelSize(R.dimen.sc_bubble_tail_size) longPadding = bubbleView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_bubble_tail_size)
shortPadding = 0//if (attributes.informationData.showInformation && !hideSenderInformation()) { 8 } else { 0 } shortPadding = 0//if (attributes.informationData.showInformation && !hideSenderInformation()) { 8 } else { 0 }
} }
if (messageLayout.reverseBubble != defaultRtl) { if (messageLayout.reverseBubble != defaultRtl) {
@ -326,8 +326,8 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
val endOf = if (defaultRtl) RelativeLayout.LEFT_OF else RelativeLayout.RIGHT_OF val endOf = if (defaultRtl) RelativeLayout.LEFT_OF else RelativeLayout.RIGHT_OF
val footerLayoutParams = views.bubbleFootView.layoutParams as RelativeLayout.LayoutParams val footerLayoutParams = views.bubbleFootView.layoutParams as RelativeLayout.LayoutParams
var footerMarginStartDp = views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_margin_start) var footerMarginStartDp = views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_margin_start)
var footerMarginEndDp = views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_margin_end) var footerMarginEndDp = views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_margin_end)
if (bubbleDependentView.allowFooterOverlay(holder, this)) { if (bubbleDependentView.allowFooterOverlay(holder, this)) {
footerLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.viewStubContainer) footerLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.viewStubContainer)
footerLayoutParams.addRule(alignEnd, R.id.viewStubContainer) footerLayoutParams.addRule(alignEnd, R.id.viewStubContainer)
@ -369,8 +369,8 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
footerLayoutParams.removeRule(startOf) footerLayoutParams.removeRule(startOf)
footerLayoutParams.removeRule(RelativeLayout.BELOW) footerLayoutParams.removeRule(RelativeLayout.BELOW)
// Reverse margins // Reverse margins
footerMarginStartDp = views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_reverse_margin_start) footerMarginStartDp = views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_reverse_margin_start)
footerMarginEndDp = views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_reverse_margin_end) footerMarginEndDp = views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_reverse_margin_end)
} }
else -> /* footer on the right / at the end */ { else -> /* footer on the right / at the end */ {
footerLayoutParams.addRule(endOf, R.id.viewStubContainer) footerLayoutParams.addRule(endOf, R.id.viewStubContainer)
@ -447,25 +447,25 @@ class ScMessageBubbleWrapView @JvmOverloads constructor(context: Context, attrs:
private fun styleFooterOverlay(messageLayout: TimelineMessageLayout.ScBubble) { private fun styleFooterOverlay(messageLayout: TimelineMessageLayout.ScBubble) {
views.bubbleFootView.setBackgroundResource(messageLayout.bubbleAppearance.timestampOverlay) views.bubbleFootView.setBackgroundResource(messageLayout.bubbleAppearance.timestampOverlay)
tintFooter(ThemeUtils.getColor(views.bubbleFootView.context, R.attr.timestamp_overlay_fg)) tintFooter(ThemeUtils.getColor(views.bubbleFootView.context, im.vector.lib.ui.styles.R.attr.timestamp_overlay_fg))
val padding = views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_overlay_padding) val padding = views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_overlay_padding)
views.bubbleFootView.setPaddingRelative( views.bubbleFootView.setPaddingRelative(
padding, padding,
padding, padding,
// compensate from inner view padding on the other side // compensate from inner view padding on the other side
padding + views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_padding_compensation), padding + views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_padding_compensation),
padding padding
) )
} }
private fun removeFooterOverlayStyle() { private fun removeFooterOverlayStyle() {
views.bubbleFootView.background = null views.bubbleFootView.background = null
tintFooter(ThemeUtils.getColor(views.bubbleFootView.context, R.attr.vctr_content_secondary)) tintFooter(ThemeUtils.getColor(views.bubbleFootView.context, im.vector.lib.ui.styles.R.attr.vctr_content_secondary))
views.bubbleFootView.setPaddingRelative( views.bubbleFootView.setPaddingRelative(
0, 0,
views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_noverlay_padding_top), views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_noverlay_padding_top),
0, 0,
views.bubbleFootView.resources.getDimensionPixelSize(R.dimen.sc_footer_noverlay_padding_bottom) views.bubbleFootView.resources.getDimensionPixelSize(im.vector.lib.ui.styles.R.dimen.sc_footer_noverlay_padding_bottom)
) )
} }

View File

@ -616,9 +616,9 @@ class RoomListFragment :
val emptyState = when (roomListParams.displayMode) { val emptyState = when (roomListParams.displayMode) {
RoomListDisplayMode.ALL -> RoomListDisplayMode.ALL ->
StateView.State.Empty( StateView.State.Empty(
title = getString(R.string.all_list_rooms_empty_title), title = getString(CommonStrings.all_list_rooms_empty_title),
image = ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_group), image = ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_group),
message = getString(R.string.all_list_rooms_empty_body) message = getString(CommonStrings.all_list_rooms_empty_body)
) )
RoomListDisplayMode.NOTIFICATIONS -> { RoomListDisplayMode.NOTIFICATIONS -> {
StateView.State.Empty( StateView.State.Empty(

View File

@ -130,7 +130,7 @@ class RoomListSectionBuilder(
addSection( addSection(
sections = sections, sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries, activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.invitations_header, nameRes = CommonStrings.invitations_header,
notifyOfLocalEcho = true, notifyOfLocalEcho = true,
explicitSpaceId = explicitSpaceId, explicitSpaceId = explicitSpaceId,
sortOrder = sortOrder, sortOrder = sortOrder,
@ -143,7 +143,7 @@ class RoomListSectionBuilder(
addSection( addSection(
sections, sections,
activeSpaceAwareQueries, activeSpaceAwareQueries,
R.string.bottom_action_favourites, CommonStrings.bottom_action_favourites,
false, false,
spaceFilterStrategy = if (onlyOrphansInHome) { spaceFilterStrategy = if (onlyOrphansInHome) {
RoomListViewModel.SpaceFilterStrategy.ORPHANS_IF_SPACE_NULL RoomListViewModel.SpaceFilterStrategy.ORPHANS_IF_SPACE_NULL
@ -160,7 +160,7 @@ class RoomListSectionBuilder(
addSection( addSection(
sections = sections, sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries, activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.normal_priority_header, nameRes = CommonStrings.normal_priority_header,
notifyOfLocalEcho = false, notifyOfLocalEcho = false,
explicitSpaceId = explicitSpaceId, explicitSpaceId = explicitSpaceId,
sortOrder = sortOrder, sortOrder = sortOrder,
@ -177,7 +177,7 @@ class RoomListSectionBuilder(
addSection( addSection(
sections = sections, sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries, activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.low_priority_header, nameRes = CommonStrings.low_priority_header,
notifyOfLocalEcho = false, notifyOfLocalEcho = false,
explicitSpaceId = explicitSpaceId, explicitSpaceId = explicitSpaceId,
sortOrder = sortOrder, sortOrder = sortOrder,
@ -194,7 +194,7 @@ class RoomListSectionBuilder(
addSection( addSection(
sections = sections, sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries, activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.system_alerts_header, nameRes = CommonStrings.system_alerts_header,
notifyOfLocalEcho = false, notifyOfLocalEcho = false,
explicitSpaceId = explicitSpaceId, explicitSpaceId = explicitSpaceId,
sortOrder = sortOrder, sortOrder = sortOrder,

View File

@ -127,9 +127,9 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>(R.layo
// Mirror unreadCounterBadgeView colors // Mirror unreadCounterBadgeView colors
holder.unreadIndentIndicator.setBackgroundColor( holder.unreadIndentIndicator.setBackgroundColor(
when { when {
showHighlighted -> ThemeUtils.getColor(holder.unreadIndentIndicator.context, R.attr.colorError) showHighlighted -> ThemeUtils.getColor(holder.unreadIndentIndicator.context, com.google.android.material.R.attr.colorError)
unreadNotificationCount > 0 || markedUnread -> ThemeUtils.getColor(holder.unreadIndentIndicator.context, R.attr.colorAccent) unreadNotificationCount > 0 || markedUnread -> ThemeUtils.getColor(holder.unreadIndentIndicator.context, com.google.android.material.R.attr.colorAccent)
hasUnreadMessage -> ThemeUtils.getColor(holder.unreadIndentIndicator.context, R.attr.unread_line_unimportant) hasUnreadMessage -> ThemeUtils.getColor(holder.unreadIndentIndicator.context, im.vector.lib.ui.styles.R.attr.unread_line_unimportant)
else -> 0 else -> 0
} }
) )

View File

@ -18,6 +18,7 @@ package im.vector.app.features.home.room.list.actions
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
import com.airbnb.epoxy.TypedEpoxyController import com.airbnb.epoxy.TypedEpoxyController
import im.vector.app.R
import im.vector.app.core.epoxy.bottomSheetDividerItem import im.vector.app.core.epoxy.bottomSheetDividerItem
import im.vector.app.core.epoxy.bottomsheet.bottomSheetActionItem import im.vector.app.core.epoxy.bottomsheet.bottomSheetActionItem
import im.vector.app.core.epoxy.bottomsheet.bottomSheetRoomPreviewItem import im.vector.app.core.epoxy.bottomsheet.bottomSheetRoomPreviewItem

View File

@ -29,22 +29,22 @@ sealed class RoomListQuickActionsSharedAction(
) : VectorSharedAction { ) : VectorSharedAction {
data class MarkUnread(val roomId: String) : RoomListQuickActionsSharedAction( data class MarkUnread(val roomId: String) : RoomListQuickActionsSharedAction(
R.string.room_list_quick_actions_mark_room_unread, CommonStrings.room_list_quick_actions_mark_room_unread,
R.drawable.ic_room_actions_mark_room_unread R.drawable.ic_room_actions_mark_room_unread
) )
data class MarkRead(val roomId: String) : RoomListQuickActionsSharedAction( data class MarkRead(val roomId: String) : RoomListQuickActionsSharedAction(
R.string.room_list_quick_actions_mark_room_read, CommonStrings.room_list_quick_actions_mark_room_read,
R.drawable.ic_room_actions_mark_room_read R.drawable.ic_room_actions_mark_room_read
) )
data class OpenAtBottom(val roomId: String) : RoomListQuickActionsSharedAction( data class OpenAtBottom(val roomId: String) : RoomListQuickActionsSharedAction(
R.string.room_list_quick_actions_open_at_bottom, CommonStrings.room_list_quick_actions_open_at_bottom,
R.drawable.ic_room_actions_open_at_bottom R.drawable.ic_room_actions_open_at_bottom
) )
data class OpenAnonymous(val roomId: String) : RoomListQuickActionsSharedAction( data class OpenAnonymous(val roomId: String) : RoomListQuickActionsSharedAction(
R.string.room_list_quick_actions_open_anonymous, CommonStrings.room_list_quick_actions_open_anonymous,
R.drawable.ic_room_actions_open_anonymous R.drawable.ic_room_actions_open_anonymous
) )

View File

@ -33,6 +33,7 @@ import im.vector.app.features.displayname.getBestName
import im.vector.app.features.home.AvatarRenderer import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.list.UnreadCounterBadgeView import im.vector.app.features.home.room.list.UnreadCounterBadgeView
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import im.vector.lib.strings.CommonStrings
import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.MatrixItem
@EpoxyModelClass @EpoxyModelClass
@ -64,8 +65,8 @@ abstract class SpaceBarItem : VectorEpoxyModel<SpaceBarItem.Holder>(R.layout.spa
matrixItem.let { matrixItem.let {
if (it == null) { if (it == null) {
holder.avatarImageView.setImageResource(R.drawable.ic_space_home) holder.avatarImageView.setImageResource(R.drawable.ic_space_home)
holder.avatarImageView.imageTintList = ColorStateList.valueOf(ThemeUtils.getColor(holder.avatarImageView.context, R.attr.vctr_content_primary)) holder.avatarImageView.imageTintList = ColorStateList.valueOf(ThemeUtils.getColor(holder.avatarImageView.context, im.vector.lib.ui.styles.R.attr.vctr_content_primary))
holder.avatarImageView.contentDescription = holder.rootView.context.getString(R.string.group_details_home) holder.avatarImageView.contentDescription = holder.rootView.context.getString(CommonStrings.group_details_home)
} else { } else {
holder.avatarImageView.imageTintList = null holder.avatarImageView.imageTintList = null
avatarRenderer.render(it, holder.avatarImageView) avatarRenderer.render(it, holder.avatarImageView)

View File

@ -84,11 +84,11 @@ abstract class ThreadListItem : VectorEpoxyModel<ThreadListItem.Holder>(R.layout
when (threadNotificationState) { when (threadNotificationState) {
ThreadNotificationState.NEW_MESSAGE -> { ThreadNotificationState.NEW_MESSAGE -> {
holder.unreadImageView.isVisible = true holder.unreadImageView.isVisible = true
holder.unreadImageView.setColorFilter(ThemeUtils.getColor(holder.view.context, R.attr.colorAccent)) holder.unreadImageView.setColorFilter(ThemeUtils.getColor(holder.view.context, com.google.android.material.R.attr.colorAccent))
} }
ThreadNotificationState.NEW_HIGHLIGHTED_MESSAGE -> { ThreadNotificationState.NEW_HIGHLIGHTED_MESSAGE -> {
holder.unreadImageView.isVisible = true holder.unreadImageView.isVisible = true
holder.unreadImageView.setColorFilter(ThemeUtils.getColor(holder.view.context, R.attr.colorError)) holder.unreadImageView.setColorFilter(ThemeUtils.getColor(holder.view.context, com.google.android.material.R.attr.colorError))
} }
else -> { else -> {
holder.unreadImageView.isVisible = false holder.unreadImageView.isVisible = false

View File

@ -102,9 +102,9 @@ class EventHtmlRenderer @Inject constructor(
} }
private fun resolveCodeBlockBackground() = private fun resolveCodeBlockBackground() =
ThemeUtils.getColor(context, R.attr.code_block_bg_color) ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.code_block_bg_color)
private fun resolveQuoteBarColor() = private fun resolveQuoteBarColor() =
ThemeUtils.getColor(context, R.attr.quote_bar_color) ThemeUtils.getColor(context, im.vector.lib.ui.styles.R.attr.quote_bar_color)
private var codeBlockBackground: Int = resolveCodeBlockBackground() private var codeBlockBackground: Int = resolveCodeBlockBackground()
private var quoteBarColor: Int = resolveQuoteBarColor() private var quoteBarColor: Int = resolveQuoteBarColor()

View File

@ -144,7 +144,7 @@ class LoginFragment :
} }
if (error == 0) { if (error == 0) {
loginViewModel.handle(LoginAction.LoginOrRegister(login, password, getString(R.string.login_mobile_device_sc))) loginViewModel.handle(LoginAction.LoginOrRegister(login, password, getString(CommonStrings.login_mobile_device_sc)))
} }
} }

View File

@ -16,6 +16,7 @@
package im.vector.app.features.login package im.vector.app.features.login
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@ -45,6 +46,8 @@ open class PromptSimplifiedModeActivity : VectorBaseActivity<ActivityLoginBindin
} }
} }
@Deprecated("Deprecated in Java")
@SuppressLint("MissingSuperCall")
override fun onBackPressed() { override fun onBackPressed() {
// Don't call super - we don't want to quit on back press, user should select a mode // Don't call super - we don't want to quit on back press, user should select a mode
} }

View File

@ -118,7 +118,7 @@ class ImageContentRenderer @Inject constructor(
.load(imageUrl) .load(imageUrl)
.fitCenter() .fitCenter()
.listener(object: RequestListener<Drawable> { .listener(object: RequestListener<Drawable> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>, isFirstResource: Boolean): Boolean {
Timber.e("Rendering url $imageUrl failed: $e") Timber.e("Rendering url $imageUrl failed: $e")
if (hideOnFail) { if (hideOnFail) {
imageView.isGone = true imageView.isGone = true
@ -126,7 +126,7 @@ class ImageContentRenderer @Inject constructor(
return false return false
} }
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { override fun onResourceReady(resource: Drawable, model: Any, target: Target<Drawable>?, dataSource: DataSource, isFirstResource: Boolean): Boolean {
if (hideOnFail) { if (hideOnFail) {
imageView.isVisible = true imageView.isVisible = true
} }
@ -162,13 +162,13 @@ class ImageContentRenderer @Inject constructor(
var request = createGlideRequest(data, mode, imageView, size) var request = createGlideRequest(data, mode, imageView, size)
.listener(object : RequestListener<Drawable> { .listener(object : RequestListener<Drawable> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>, isFirstResource: Boolean): Boolean {
Timber.e(e, "Glide image render failed") Timber.e(e, "Glide image render failed")
return false return false
} }
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { override fun onResourceReady(resource: Drawable, model: Any, target: Target<Drawable>?, dataSource: DataSource, isFirstResource: Boolean): Boolean {
if (resource != null /*&& (data.width == null || data.height == null || data.width == 0 || data.height == 0)*/) { //if ((data.width == null || data.height == null || data.width == 0 || data.height == 0)) {
val updatedData = data.copy(width = resource.intrinsicWidth, height = resource.intrinsicHeight) val updatedData = data.copy(width = resource.intrinsicWidth, height = resource.intrinsicHeight)
val newSize = processSize(updatedData, mode) val newSize = processSize(updatedData, mode)
imageView.updateLayoutParams { imageView.updateLayoutParams {
@ -176,7 +176,7 @@ class ImageContentRenderer @Inject constructor(
height = newSize.height height = newSize.height
} }
onImageSizeListener?.onImageSizeUpdated(newSize.width, newSize.height) onImageSizeListener?.onImageSizeUpdated(newSize.width, newSize.height)
} //}
return false return false
} }
}) })

View File

@ -946,7 +946,7 @@ class NotificationUtils @Inject constructor(
noisy: Boolean, noisy: Boolean,
lastMessageTimestamp: Long lastMessageTimestamp: Long
): Notification { ): Notification {
val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) val accentColor = ContextCompat.getColor(context, im.vector.lib.ui.styles.R.color.notification_accent_color)
val smallIcon = R.drawable.ic_status_bar_sc val smallIcon = R.drawable.ic_status_bar_sc
return NotificationCompat.Builder(context, if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID) return NotificationCompat.Builder(context, if (noisy) NOISY_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID)

View File

@ -117,7 +117,7 @@ class CreatePollController @Inject constructor(
genericButtonItem { genericButtonItem {
id("add_option") id("add_option")
text(host.stringProvider.getString(CommonStrings.create_poll_add_option)) text(host.stringProvider.getString(CommonStrings.create_poll_add_option))
textColor(host.colorProvider.getColorFromAttribute(R.attr.colorAccent)) textColor(host.colorProvider.getColorFromAttribute(com.google.android.material.R.attr.colorAccent))
gravity(Gravity.START) gravity(Gravity.START)
bold(true) bold(true)
highlight(false) highlight(false)

View File

@ -54,9 +54,9 @@ class EmojiSearchResultController @Inject constructor(
if (!vectorPreferences.simplifiedMode()) { if (!vectorPreferences.simplifiedMode()) {
// Extra EmojiItem to allow reacting with freeform text // Extra EmojiItem to allow reacting with freeform text
val freeformReaction = EmojiItem( val freeformReaction = EmojiItem(
name = stringProvider.getString(R.string.freeform_react_with, data.query), name = stringProvider.getString(CommonStrings.freeform_react_with, data.query),
unicode = "", unicode = "",
keywords = listOf(stringProvider.getString(R.string.freeform_reaction_summary)) keywords = listOf(stringProvider.getString(CommonStrings.freeform_reaction_summary))
) )
emojiSearchResultItem { emojiSearchResultItem {
id("de.spiritcroc.riotx.freeform-reaction.${data.query}") id("de.spiritcroc.riotx.freeform-reaction.${data.query}")

View File

@ -98,7 +98,7 @@ class CreateRoomController @Inject constructor(
settingsSectionTitleItem { settingsSectionTitleItem {
id("settingsSection") id("settingsSection")
titleResId(R.string.create_room_settings_section) titleResId(CommonStrings.create_room_settings_section)
id("visibility") id("visibility")
titleResId(CommonStrings.room_settings_room_access_title) titleResId(CommonStrings.room_settings_room_access_title)
} }

View File

@ -153,7 +153,7 @@ class RoomMemberProfileController @Inject constructor(
id("verify_footer") id("verify_footer")
text(host.stringProvider.getString(CommonStrings.room_profile_encrypted_subtitle).toEpoxyCharSequence()) text(host.stringProvider.getString(CommonStrings.room_profile_encrypted_subtitle).toEpoxyCharSequence())
centered(false) centered(false)
backgroundColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_header_background)) backgroundColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_header_background))
} }
} }
} else { } else {
@ -175,7 +175,7 @@ class RoomMemberProfileController @Inject constructor(
id("verify_footer_not_encrypted") id("verify_footer_not_encrypted")
text(host.stringProvider.getString(CommonStrings.room_profile_not_encrypted_subtitle).toEpoxyCharSequence()) text(host.stringProvider.getString(CommonStrings.room_profile_not_encrypted_subtitle).toEpoxyCharSequence())
centered(false) centered(false)
backgroundColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_header_background)) backgroundColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_header_background))
} }
} }
} }

View File

@ -156,7 +156,7 @@ class RoomProfileController @Inject constructor(
genericFooterItem { genericFooterItem {
id("e2e info") id("e2e info")
centered(false) centered(false)
backgroundColor(host.colorProvider.getColorFromAttribute(R.attr.vctr_header_background)) backgroundColor(host.colorProvider.getColorFromAttribute(im.vector.lib.ui.styles.R.attr.vctr_header_background))
text( text(
span { span {
apply { apply {

View File

@ -61,10 +61,10 @@ enum class RoomMemberListCategories(@StringRes val titleRes: Int) {
USER(CommonStrings.room_member_power_level_users), USER(CommonStrings.room_member_power_level_users),
// Singular variants // Singular variants
SG_ADMIN(R.string.power_level_admin), SG_ADMIN(CommonStrings.power_level_admin),
SG_MODERATOR(R.string.power_level_moderator), SG_MODERATOR(CommonStrings.power_level_moderator),
SG_CUSTOM(R.string.power_level_custom_no_value), SG_CUSTOM(CommonStrings.power_level_custom_no_value),
SG_USER(R.string.power_level_default), SG_USER(CommonStrings.power_level_default),
// Header for unified members // Header for unified members
MEMBER(R.string.room_member_power_level_users) MEMBER(CommonStrings.room_member_power_level_users)
} }

View File

@ -119,12 +119,12 @@ class VectorSettingsAdvancedSettingsFragment :
findPreference<VectorPreference>("SETTINGS_APPLY_SC_DEFAULT_SETTINGS")?.let { findPreference<VectorPreference>("SETTINGS_APPLY_SC_DEFAULT_SETTINGS")?.let {
it.onPreferenceClickListener = Preference.OnPreferenceClickListener { it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.settings_apply_sc_default_settings_dialog_title) .setTitle(CommonStrings.settings_apply_sc_default_settings_dialog_title)
.setMessage(R.string.settings_apply_sc_default_settings_dialog_summary) .setMessage(CommonStrings.settings_apply_sc_default_settings_dialog_summary)
.setPositiveButton(R.string._continue) { _, _ -> .setPositiveButton(CommonStrings._continue) { _, _ ->
vectorPreferences.applyScDefaultValues() vectorPreferences.applyScDefaultValues()
} }
.setNegativeButton(R.string.action_cancel) { _, _ -> /* Just close dialog */ } .setNegativeButton(CommonStrings.action_cancel) { _, _ -> /* Just close dialog */ }
.show() .show()
true true
} }

View File

@ -21,13 +21,14 @@ import de.spiritcroc.preference.ColorMatrixListPreference
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.restart import im.vector.app.core.extensions.restart
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import im.vector.lib.strings.CommonStrings
import javax.inject.Inject import javax.inject.Inject
class VectorSettingsAdvancedThemeFragment @Inject constructor( class VectorSettingsAdvancedThemeFragment @Inject constructor(
//private val vectorPreferences: VectorPreferences //private val vectorPreferences: VectorPreferences
) : VectorSettingsBaseFragment() { ) : VectorSettingsBaseFragment() {
override var titleRes = R.string.settings_advanced_theme_settings override var titleRes = CommonStrings.settings_advanced_theme_settings
override val preferenceXmlRes = R.xml.vector_settings_advanced_theme_settings override val preferenceXmlRes = R.xml.vector_settings_advanced_theme_settings
override fun bindPref() { override fun bindPref() {

View File

@ -17,13 +17,14 @@
package im.vector.app.features.settings package im.vector.app.features.settings
import im.vector.app.R import im.vector.app.R
import im.vector.lib.strings.CommonStrings
import javax.inject.Inject import javax.inject.Inject
class VectorSettingsBubbleAppearanceFragment @Inject constructor( class VectorSettingsBubbleAppearanceFragment @Inject constructor(
//private val vectorPreferences: VectorPreferences //private val vectorPreferences: VectorPreferences
) : VectorSettingsBaseFragment() { ) : VectorSettingsBaseFragment() {
override var titleRes = R.string.bubble_appearance override var titleRes = CommonStrings.bubble_appearance
override val preferenceXmlRes = R.xml.vector_settings_bubble_appearance override val preferenceXmlRes = R.xml.vector_settings_bubble_appearance
override fun bindPref() { override fun bindPref() {

View File

@ -118,7 +118,7 @@ class VectorSettingsPreferencesFragment :
} }
} }
if (ThemeUtils.darkThemePossible(requireContext())) { if (ThemeUtils.darkThemePossible(requireContext())) {
lightThemePref.title = getString(R.string.settings_light_theme) lightThemePref.title = getString(CommonStrings.settings_light_theme)
darkThemePref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> darkThemePref.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue is String) { if (newValue is String) {
ThemeUtils.setApplicationDarkTheme(requireContext().applicationContext, newValue) ThemeUtils.setApplicationDarkTheme(requireContext().applicationContext, newValue)
@ -132,7 +132,7 @@ class VectorSettingsPreferencesFragment :
} }
} }
} else { } else {
lightThemePref.title = getString(R.string.settings_theme) lightThemePref.title = getString(CommonStrings.settings_theme)
darkThemePref.parent?.removePreference(darkThemePref) darkThemePref.parent?.removePreference(darkThemePref)
} }

View File

@ -6,13 +6,14 @@ import androidx.preference.PreferenceGroup
import de.spiritcroc.matrixsdk.util.DbgUtil import de.spiritcroc.matrixsdk.util.DbgUtil
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.preference.VectorSwitchPreference import im.vector.app.core.preference.VectorSwitchPreference
import im.vector.lib.strings.CommonStrings
import javax.inject.Inject import javax.inject.Inject
class VectorSettingsScDebuggingFragment @Inject constructor( class VectorSettingsScDebuggingFragment @Inject constructor(
//private val vectorPreferences: VectorPreferences //private val vectorPreferences: VectorPreferences
) : VectorSettingsBaseFragment() { ) : VectorSettingsBaseFragment() {
override var titleRes = R.string.settings_sc_debugging override var titleRes = CommonStrings.settings_sc_debugging
override val preferenceXmlRes = R.xml.vector_settings_sc_debugging override val preferenceXmlRes = R.xml.vector_settings_sc_debugging
companion object { companion object {
@ -22,16 +23,16 @@ class VectorSettingsScDebuggingFragment @Inject constructor(
data class DbgPref(val key: String, @StringRes val stringRes: Int) data class DbgPref(val key: String, @StringRes val stringRes: Int)
private val dbgLoggingPrefs = arrayOf( private val dbgLoggingPrefs = arrayOf(
DbgPref(DbgUtil.DBG_TIMELINE_CHUNKS, R.string.settings_sc_dbg_timeline_chunks), DbgPref(DbgUtil.DBG_TIMELINE_CHUNKS, CommonStrings.settings_sc_dbg_timeline_chunks),
DbgPref(DbgUtil.DBG_READ_MARKER, R.string.settings_sc_dbg_read_marker), DbgPref(DbgUtil.DBG_READ_MARKER, CommonStrings.settings_sc_dbg_read_marker),
DbgPref(DbgUtil.DBG_READ_RECEIPTS, R.string.settings_sc_dbg_read_receipts), DbgPref(DbgUtil.DBG_READ_RECEIPTS, CommonStrings.settings_sc_dbg_read_receipts),
DbgPref(DbgUtil.DBG_VIEW_PAGER, R.string.settings_sc_dbg_view_pager), DbgPref(DbgUtil.DBG_VIEW_PAGER, CommonStrings.settings_sc_dbg_view_pager),
) )
private val dbgVisualsPrefs = arrayOf( private val dbgVisualsPrefs = arrayOf(
DbgPref(DbgUtil.DBG_SHOW_DISPLAY_INDEX, R.string.settings_sc_dbg_show_display_index), DbgPref(DbgUtil.DBG_SHOW_DISPLAY_INDEX, CommonStrings.settings_sc_dbg_show_display_index),
DbgPref(DbgUtil.DBG_SHOW_READ_TRACKING, R.string.settings_sc_dbg_show_read_tracking), DbgPref(DbgUtil.DBG_SHOW_READ_TRACKING, CommonStrings.settings_sc_dbg_show_read_tracking),
DbgPref(DbgUtil.DBG_VIEW_PAGER_VISUALS, R.string.settings_sc_dbg_view_pager_visuals), DbgPref(DbgUtil.DBG_VIEW_PAGER_VISUALS, CommonStrings.settings_sc_dbg_view_pager_visuals),
DbgPref(DbgUtil.DBG_SHOW_DUPLICATE_READ_RECEIPTS, R.string.settings_sc_dbg_show_duplicate_read_receipts), DbgPref(DbgUtil.DBG_SHOW_DUPLICATE_READ_RECEIPTS, CommonStrings.settings_sc_dbg_show_duplicate_read_receipts),
) )
val dbgPrefs = dbgLoggingPrefs + dbgVisualsPrefs val dbgPrefs = dbgLoggingPrefs + dbgVisualsPrefs

View File

@ -64,8 +64,8 @@ class VectorSettingsVoiceVideoFragment : VectorSettingsBaseFragment() {
} }
useDefaultStunPreference.let { useDefaultStunPreference.let {
val stun = getString(R.string.fallback_stun_server_url) val stun = getString(im.vector.app.config.R.string.fallback_stun_server_url)
it.summary = getString(R.string.settings_call_ringtone_use_default_stun_summary, stun) it.summary = getString(CommonStrings.settings_call_ringtone_use_default_stun_summary, stun)
} }
mCallRingtonePreference.let { mCallRingtonePreference.let {

View File

@ -143,7 +143,7 @@ data class ScBubbleAppearance(
} }
val defaultScBubbleAppearance = ScBubbleAppearance( val defaultScBubbleAppearance = ScBubbleAppearance(
R.dimen.sc_bubble_radius, im.vector.lib.ui.styles.R.dimen.sc_bubble_radius,
R.drawable.msg_bubble_text_outgoing, R.drawable.msg_bubble_text_outgoing,
R.drawable.msg_bubble_text_incoming, R.drawable.msg_bubble_text_incoming,
R.drawable.msg_bubble_text_outgoing_notail, R.drawable.msg_bubble_text_outgoing_notail,
@ -154,7 +154,7 @@ val defaultScBubbleAppearance = ScBubbleAppearance(
) )
val r1ScBubbleAppearance = ScBubbleAppearance( val r1ScBubbleAppearance = ScBubbleAppearance(
R.dimen.sc_bubble_r1_radius, im.vector.lib.ui.styles.R.dimen.sc_bubble_r1_radius,
R.drawable.msg_bubble_r1_text_outgoing, R.drawable.msg_bubble_r1_text_outgoing,
R.drawable.msg_bubble_r1_text_incoming, R.drawable.msg_bubble_r1_text_incoming,
R.drawable.msg_bubble_r1_text_outgoing_notail, R.drawable.msg_bubble_r1_text_outgoing_notail,
@ -166,7 +166,7 @@ val r1ScBubbleAppearance = ScBubbleAppearance(
val r2ScBubbleAppearance = ScBubbleAppearance( val r2ScBubbleAppearance = ScBubbleAppearance(
R.dimen.sc_bubble_r2_radius, im.vector.lib.ui.styles.R.dimen.sc_bubble_r2_radius,
R.drawable.msg_bubble_r2_text_outgoing, R.drawable.msg_bubble_r2_text_outgoing,
R.drawable.msg_bubble_r2_text_incoming, R.drawable.msg_bubble_r2_text_incoming,
R.drawable.msg_bubble_r2_text_outgoing_notail, R.drawable.msg_bubble_r2_text_outgoing_notail,

View File

@ -374,7 +374,7 @@ object ThemeUtils {
} catch (e: Exception) { } catch (e: Exception) {
when (colorAttribute) { when (colorAttribute) {
android.R.attr.colorAccent -> ContextCompat.getColor(c, R.color.accent_sc) android.R.attr.colorAccent -> ContextCompat.getColor(c, R.color.accent_sc)
R.attr.colorAccent -> ContextCompat.getColor(c, R.color.accent_sc) com.google.android.material.R.attr.colorAccent -> ContextCompat.getColor(c, R.color.accent_sc)
else -> { else -> {
Timber.e(e, "Unable to get color") Timber.e(e, "Unable to get color")
ContextCompat.getColor(c, android.R.color.holo_red_dark) ContextCompat.getColor(c, android.R.color.holo_red_dark)