diff --git a/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java b/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java index 3fba1805..e3b8e12e 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/common/FontManager.java @@ -16,6 +16,7 @@ public class FontManager { public static final int TEXT_SIZE_LARGEST = 3; // Attribute codes + public static final int TEXT_TYPE_PRIMARY_BOLD = 0x0; public static final int TEXT_TYPE_PRIMARY = 0x1; public static final int TEXT_TYPE_SECONDARY = 0x2; public static final int TEXT_TYPE_TERTIARY = 0x3; @@ -49,6 +50,7 @@ public class FontManager { if (fontSize == TEXT_SIZE_LARGE) return 16; if (fontSize == TEXT_SIZE_LARGEST) return 18; break; + case TEXT_TYPE_PRIMARY_BOLD: case TEXT_TYPE_PRIMARY: case TEXT_TYPE_DIALOG_MESSAGE: if (fontSize == TEXT_SIZE_SMALL) return 14; @@ -77,6 +79,7 @@ public class FontManager { case FontManager.TEXT_TYPE_TOOLBAR: return false; + case FontManager.TEXT_TYPE_PRIMARY_BOLD: case FontManager.TEXT_TYPE_CATEGORY: case FontManager.TEXT_TYPE_DIALOG_TITLE: case FontManager.TEXT_TYPE_DIALOG_BUTTON: @@ -88,6 +91,7 @@ public class FontManager { public static ColorStateList getTextColor(Context context, int type) { // Colors and font weight switch (type) { + case FontManager.TEXT_TYPE_PRIMARY_BOLD: case FontManager.TEXT_TYPE_PRIMARY: boolean isNight = ThemeManager.getTheme() == ThemeManager.Theme.DARK || ThemeManager.getTheme() == ThemeManager.Theme.BLACK; diff --git a/QKSMS/src/main/java/com/moez/QKSMS/common/LiveViewManager.java b/QKSMS/src/main/java/com/moez/QKSMS/common/LiveViewManager.java index 0ec12dd2..b7d55897 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/common/LiveViewManager.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/common/LiveViewManager.java @@ -94,7 +94,9 @@ public abstract class LiveViewManager { if (!parents.containsKey(parent)) { parents.put(parent, new HashSet<>()); } - parents.get(parent).add(view); + if (!parents.get(parent).contains(view)) { + parents.get(parent).add(view); + } } else { WeakHashMap> set = new WeakHashMap<>(); set.put(parent, new HashSet<>()); diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java index fff6dcee..a0ac5368 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/conversationlist/ConversationListAdapter.java @@ -6,12 +6,13 @@ import android.view.View; import android.view.ViewGroup; import com.moez.QKSMS.R; import com.moez.QKSMS.common.ConversationPrefsHelper; +import com.moez.QKSMS.common.FontManager; import com.moez.QKSMS.common.LiveViewManager; import com.moez.QKSMS.common.emoji.EmojiRegistry; -import com.moez.QKSMS.enums.QKPreference; import com.moez.QKSMS.common.utils.DateFormatter; import com.moez.QKSMS.data.Contact; import com.moez.QKSMS.data.Conversation; +import com.moez.QKSMS.enums.QKPreference; import com.moez.QKSMS.ui.ThemeManager; import com.moez.QKSMS.ui.base.QKActivity; import com.moez.QKSMS.ui.base.RecyclerCursorAdapter; @@ -71,10 +72,14 @@ public class ConversationListAdapter extends RecyclerCursorAdapter { diff --git a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java index 07f9190b..2822fc7d 100644 --- a/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java +++ b/QKSMS/src/main/java/com/moez/QKSMS/ui/view/QKTextView.java @@ -63,6 +63,12 @@ public class QKTextView extends TextView { setTextColor(FontManager.getTextColor(mContext, mType)); setText(getText()); + setType(mType); + } + + public void setType(int type) { + mType = type; + // Register for theme updates if we're text that changes color dynamically. if (mType == FontManager.TEXT_TYPE_CATEGORY) { LiveViewManager.registerView(QKPreference.THEME, this, key -> diff --git a/QKSMS/src/main/res/layout/list_item_conversation.xml b/QKSMS/src/main/res/layout/list_item_conversation.xml index 5a189f02..f3a9b130 100644 --- a/QKSMS/src/main/res/layout/list_item_conversation.xml +++ b/QKSMS/src/main/res/layout/list_item_conversation.xml @@ -5,10 +5,10 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" - android:layout_height="72dp" + android:layout_height="wrap_content" android:animateLayoutChanges="true" android:background="?android:attr/selectableItemBackground" - android:gravity="center_vertical" + android:gravity="top" android:minHeight="72dp" android:orientation="horizontal" android:paddingLeft="16dp" @@ -18,20 +18,27 @@ android:id="@+id/selected" android:layout_width="24dp" android:layout_height="24dp" + android:layout_marginBottom="24dp" android:layout_marginRight="16dp" + android:layout_marginTop="24dp" android:visibility="gone" /> @@ -68,7 +75,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:animateLayoutChanges="true" - android:gravity="bottom"> + android:gravity="top"> +