~singpolyma/cheogram-android

a4537baf66eee5bf7789f486edd02c41c58a5027 — Stephen Paul Weber 8 months ago e551558
Don't assume dark background for mismatched encryption

Since we removed those other backgrounds ages ago...
M src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java => src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +15 -7
@@ 923,7 923,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
            }
        }

        boolean darkBackground = type == RECEIVED && (!isInValidSession || mUseGreenBackground) || activity.isDarkTheme();
        boolean darkBackground = (type == RECEIVED && mUseGreenBackground) || activity.isDarkTheme();

        if (type == DATE_SEPARATOR) {
            if (UIHelper.today(message.getTimeSent())) {


@@ 1116,13 1116,13 @@ public class MessageAdapter extends ArrayAdapter<Message> {
                viewHolder.commands_list.setOnItemClickListener(null);
            }

            if (!mUseGreenBackground) {
                viewHolder.message_box.getBackground().setColorFilter(
                    StyledAttributes.getColor(activity, mUseGreenBackground ? R.attr.message_bubble_received_bg : R.attr.color_background_primary),
                    PorterDuff.Mode.SRC_ATOP
                );
            }
            if (isInValidSession) {
                if (!mUseGreenBackground) {
                    viewHolder.message_box.getBackground().setColorFilter(
                        StyledAttributes.getColor(activity, mUseGreenBackground ? R.attr.message_bubble_received_bg : R.attr.color_background_primary),
                        PorterDuff.Mode.SRC_ATOP
                    );
                }
                viewHolder.encryption.setVisibility(View.GONE);
            } else {
                viewHolder.encryption.setVisibility(View.VISIBLE);


@@ 1143,6 1143,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
            }
        }

        if (darkBackground) {
            if (viewHolder.subject != null) viewHolder.subject.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark_Bold);
            if (viewHolder.encryption != null) viewHolder.encryption.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark_Bold);
        } else {
            if (viewHolder.subject != null) viewHolder.subject.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Bold);
            if (viewHolder.encryption != null) viewHolder.encryption.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_Bold);
        }

        displayStatus(viewHolder, message, type, darkBackground);

        return view;

M src/main/res/values/styles.xml => src/main/res/values/styles.xml +4 -0
@@ 123,6 123,10 @@
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearance.Conversations.Caption.Bold" parent="TextAppearance.Conversations.Caption">
        <item name="android:textStyle">bold</item>
    </style>

    <style name="TextAppearance.Conversations.Caption.Warning" parent="TextAppearance.Conversations.Caption">
        <item name="android:textColor">@color/red_a700</item>
    </style>