mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 21:58:53 +01:00
Improved unread conversation visibility
This commit is contained in:
@@ -16,6 +16,7 @@ public class FontManager {
|
|||||||
public static final int TEXT_SIZE_LARGEST = 3;
|
public static final int TEXT_SIZE_LARGEST = 3;
|
||||||
|
|
||||||
// Attribute codes
|
// 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_PRIMARY = 0x1;
|
||||||
public static final int TEXT_TYPE_SECONDARY = 0x2;
|
public static final int TEXT_TYPE_SECONDARY = 0x2;
|
||||||
public static final int TEXT_TYPE_TERTIARY = 0x3;
|
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_LARGE) return 16;
|
||||||
if (fontSize == TEXT_SIZE_LARGEST) return 18;
|
if (fontSize == TEXT_SIZE_LARGEST) return 18;
|
||||||
break;
|
break;
|
||||||
|
case TEXT_TYPE_PRIMARY_BOLD:
|
||||||
case TEXT_TYPE_PRIMARY:
|
case TEXT_TYPE_PRIMARY:
|
||||||
case TEXT_TYPE_DIALOG_MESSAGE:
|
case TEXT_TYPE_DIALOG_MESSAGE:
|
||||||
if (fontSize == TEXT_SIZE_SMALL) return 14;
|
if (fontSize == TEXT_SIZE_SMALL) return 14;
|
||||||
@@ -77,6 +79,7 @@ public class FontManager {
|
|||||||
case FontManager.TEXT_TYPE_TOOLBAR:
|
case FontManager.TEXT_TYPE_TOOLBAR:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
case FontManager.TEXT_TYPE_PRIMARY_BOLD:
|
||||||
case FontManager.TEXT_TYPE_CATEGORY:
|
case FontManager.TEXT_TYPE_CATEGORY:
|
||||||
case FontManager.TEXT_TYPE_DIALOG_TITLE:
|
case FontManager.TEXT_TYPE_DIALOG_TITLE:
|
||||||
case FontManager.TEXT_TYPE_DIALOG_BUTTON:
|
case FontManager.TEXT_TYPE_DIALOG_BUTTON:
|
||||||
@@ -88,6 +91,7 @@ public class FontManager {
|
|||||||
public static ColorStateList getTextColor(Context context, int type) {
|
public static ColorStateList getTextColor(Context context, int type) {
|
||||||
// Colors and font weight
|
// Colors and font weight
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case FontManager.TEXT_TYPE_PRIMARY_BOLD:
|
||||||
case FontManager.TEXT_TYPE_PRIMARY:
|
case FontManager.TEXT_TYPE_PRIMARY:
|
||||||
boolean isNight = ThemeManager.getTheme() == ThemeManager.Theme.DARK ||
|
boolean isNight = ThemeManager.getTheme() == ThemeManager.Theme.DARK ||
|
||||||
ThemeManager.getTheme() == ThemeManager.Theme.BLACK;
|
ThemeManager.getTheme() == ThemeManager.Theme.BLACK;
|
||||||
|
|||||||
@@ -94,7 +94,9 @@ public abstract class LiveViewManager {
|
|||||||
if (!parents.containsKey(parent)) {
|
if (!parents.containsKey(parent)) {
|
||||||
parents.put(parent, new HashSet<>());
|
parents.put(parent, new HashSet<>());
|
||||||
}
|
}
|
||||||
parents.get(parent).add(view);
|
if (!parents.get(parent).contains(view)) {
|
||||||
|
parents.get(parent).add(view);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
WeakHashMap<Object, Set<LiveView>> set = new WeakHashMap<>();
|
WeakHashMap<Object, Set<LiveView>> set = new WeakHashMap<>();
|
||||||
set.put(parent, new HashSet<>());
|
set.put(parent, new HashSet<>());
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import com.moez.QKSMS.R;
|
import com.moez.QKSMS.R;
|
||||||
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
||||||
|
import com.moez.QKSMS.common.FontManager;
|
||||||
import com.moez.QKSMS.common.LiveViewManager;
|
import com.moez.QKSMS.common.LiveViewManager;
|
||||||
import com.moez.QKSMS.common.emoji.EmojiRegistry;
|
import com.moez.QKSMS.common.emoji.EmojiRegistry;
|
||||||
import com.moez.QKSMS.enums.QKPreference;
|
|
||||||
import com.moez.QKSMS.common.utils.DateFormatter;
|
import com.moez.QKSMS.common.utils.DateFormatter;
|
||||||
import com.moez.QKSMS.data.Contact;
|
import com.moez.QKSMS.data.Contact;
|
||||||
import com.moez.QKSMS.data.Conversation;
|
import com.moez.QKSMS.data.Conversation;
|
||||||
|
import com.moez.QKSMS.enums.QKPreference;
|
||||||
import com.moez.QKSMS.ui.ThemeManager;
|
import com.moez.QKSMS.ui.ThemeManager;
|
||||||
import com.moez.QKSMS.ui.base.QKActivity;
|
import com.moez.QKSMS.ui.base.QKActivity;
|
||||||
import com.moez.QKSMS.ui.base.RecyclerCursorAdapter;
|
import com.moez.QKSMS.ui.base.RecyclerCursorAdapter;
|
||||||
@@ -71,10 +72,14 @@ public class ConversationListAdapter extends RecyclerCursorAdapter<ConversationL
|
|||||||
holder.unreadView.setVisibility(View.VISIBLE);
|
holder.unreadView.setVisibility(View.VISIBLE);
|
||||||
holder.snippetView.setTextColor(ThemeManager.getTextOnBackgroundPrimary());
|
holder.snippetView.setTextColor(ThemeManager.getTextOnBackgroundPrimary());
|
||||||
holder.dateView.setTextColor(ThemeManager.getColor());
|
holder.dateView.setTextColor(ThemeManager.getColor());
|
||||||
|
holder.fromView.setType(FontManager.TEXT_TYPE_PRIMARY_BOLD);
|
||||||
|
holder.snippetView.setMaxLines(5);
|
||||||
} else {
|
} else {
|
||||||
holder.unreadView.setVisibility(View.GONE);
|
holder.unreadView.setVisibility(View.GONE);
|
||||||
holder.snippetView.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
|
holder.snippetView.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
|
||||||
holder.dateView.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
|
holder.dateView.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
|
||||||
|
holder.fromView.setType(FontManager.TEXT_TYPE_PRIMARY);
|
||||||
|
holder.snippetView.setMaxLines(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LiveViewManager.registerView(QKPreference.THEME, this, key -> {
|
LiveViewManager.registerView(QKPreference.THEME, this, key -> {
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ public class QKTextView extends TextView {
|
|||||||
setTextColor(FontManager.getTextColor(mContext, mType));
|
setTextColor(FontManager.getTextColor(mContext, mType));
|
||||||
setText(getText());
|
setText(getText());
|
||||||
|
|
||||||
|
setType(mType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
mType = type;
|
||||||
|
|
||||||
// Register for theme updates if we're text that changes color dynamically.
|
// Register for theme updates if we're text that changes color dynamically.
|
||||||
if (mType == FontManager.TEXT_TYPE_CATEGORY) {
|
if (mType == FontManager.TEXT_TYPE_CATEGORY) {
|
||||||
LiveViewManager.registerView(QKPreference.THEME, this, key ->
|
LiveViewManager.registerView(QKPreference.THEME, this, key ->
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="72dp"
|
android:layout_height="wrap_content"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:gravity="center_vertical"
|
android:gravity="top"
|
||||||
android:minHeight="72dp"
|
android:minHeight="72dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
@@ -18,20 +18,27 @@
|
|||||||
android:id="@+id/selected"
|
android:id="@+id/selected"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<com.moez.QKSMS.ui.view.AvatarView
|
<com.moez.QKSMS.ui.view.AvatarView
|
||||||
android:id="@+id/conversation_list_avatar"
|
android:id="@+id/conversation_list_avatar"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:src="@drawable/tools_avatar"
|
android:src="@drawable/tools_avatar"
|
||||||
app:initialSize="32dp" />
|
app:initialSize="32dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -68,7 +75,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:gravity="bottom">
|
android:gravity="top">
|
||||||
|
|
||||||
<com.moez.QKSMS.ui.view.QKTextView
|
<com.moez.QKSMS.ui.view.QKTextView
|
||||||
android:id="@+id/conversation_list_snippet"
|
android:id="@+id/conversation_list_snippet"
|
||||||
@@ -76,15 +83,18 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
|
android:ellipsize="end"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:singleLine="true"
|
android:singleLine="false"
|
||||||
tools:text="Hey! This is a test message. I'm just making this longer now" />
|
tools:text="Hey! This is a test message. I'm just making this longer now" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/conversation_list_badges"
|
android:id="@+id/conversation_list_badges"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<attr name="type">
|
<attr name="type">
|
||||||
|
<flag name="primary_bold" value="0" />
|
||||||
<flag name="primary" value="1" />
|
<flag name="primary" value="1" />
|
||||||
<flag name="secondary" value="2" />
|
<flag name="secondary" value="2" />
|
||||||
<flag name="tertiary" value="3" />
|
<flag name="tertiary" value="3" />
|
||||||
|
|||||||
Reference in New Issue
Block a user