Messaging: Fix warnings about drawables and colors
* They need the theme provided now * Follow the suggestion by AS (sometimes we use ResourcesCompat, sometimes not) Change-Id: Ie3023fee13a6fc04bd4b912721ba19dcc08befba
This commit is contained in:
@@ -22,6 +22,7 @@ import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import androidx.core.text.BidiFormatter;
|
||||
import androidx.core.text.TextDirectionHeuristicsCompat;
|
||||
@@ -37,6 +38,8 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.annotation.VisibleForAnimation;
|
||||
@@ -162,8 +165,9 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mSnippetTextView.addOnLayoutChangeListener(this);
|
||||
|
||||
final Resources resources = getContext().getResources();
|
||||
mListItemReadColor = resources.getColor(R.color.conversation_list_item_read);
|
||||
mListItemUnreadColor = resources.getColor(R.color.conversation_list_item_unread);
|
||||
final Resources.Theme theme = getContext().getTheme();
|
||||
mListItemReadColor = resources.getColor(R.color.conversation_list_item_read, theme);
|
||||
mListItemUnreadColor = resources.getColor(R.color.conversation_list_item_unread, theme);
|
||||
|
||||
mListItemReadTypeface = Typefaces.getRobotoNormal();
|
||||
mListItemUnreadTypeface = Typefaces.getRobotoBold();
|
||||
@@ -403,7 +407,8 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
final boolean isDefaultSmsApp = PhoneUtils.getDefault().isDefaultSmsApp();
|
||||
// don't show the error state unless we're the default sms app
|
||||
if (mData.getIsFailedStatus() && isDefaultSmsApp) {
|
||||
mTimestampTextView.setTextColor(resources.getColor(R.color.conversation_list_error));
|
||||
mTimestampTextView.setTextColor(resources.getColor(R.color.conversation_list_error,
|
||||
getContext().getTheme()));
|
||||
mTimestampTextView.setTypeface(mListItemReadTypeface, typefaceStyle);
|
||||
int failureMessageId = R.string.message_status_download_failed;
|
||||
if (mData.getIsMessageTypeOutgoing()) {
|
||||
@@ -499,16 +504,15 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mAudioAttachmentView.setOnLongClickListener(this);
|
||||
mAudioAttachmentView.setVisibility(audioPreviewVisiblity);
|
||||
|
||||
Drawable archiveDrawable = ResourcesCompat.getDrawable(
|
||||
getResources(), R.drawable.ic_archive_small_dark, getContext().getTheme());
|
||||
if (PrefsUtils.isSwipeRightToDeleteEnabled()) {
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_delete_small_dark));
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_archive_small_dark));
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(ResourcesCompat.getDrawable(
|
||||
getResources(), R.drawable.ic_delete_small_dark, getContext().getTheme()));
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(archiveDrawable);
|
||||
} else {
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_archive_small_dark));
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_archive_small_dark));
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(archiveDrawable);
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(archiveDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user