Browse Source

Merge pull request #25 from Thodoris1999/develop

change unread dot color to accent
pull/27/head
Apostolos Fanakis 7 years ago
committed by GitHub
parent
commit
a0c7b8668a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java
  2. 13
      app/src/main/res/layout/activity_board_topic.xml

11
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java

@ -6,7 +6,6 @@ import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -232,9 +231,10 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
}); });
topicViewHolder.topicSubject.setTypeface(Typeface.createFromAsset(context.getAssets() topicViewHolder.topicSubject.setTypeface(Typeface.createFromAsset(context.getAssets()
, "fonts/fontawesome-webfont.ttf")); , "fonts/fontawesome-webfont.ttf"));
String lockedSticky = topic.isUnread() ? topicViewHolder.topicUnreadDot.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/fontawesome-webfont.ttf"));
Html.fromHtml("<font size=\"1\">" + context.getString(R.string.fa_circle) + "</font> ").toString() : ""; if (topic.isUnread())
lockedSticky += topic.getSubject(); topicViewHolder.topicUnreadDot.setVisibility(View.VISIBLE);
String lockedSticky = topic.getSubject();
if (topic.isLocked()) if (topic.isLocked())
lockedSticky += " " + context.getResources().getString(R.string.fa_lock); lockedSticky += " " + context.getResources().getString(R.string.fa_lock);
if (topic.isSticky()) { if (topic.isSticky()) {
@ -290,7 +290,7 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static class TopicViewHolder extends RecyclerView.ViewHolder { private static class TopicViewHolder extends RecyclerView.ViewHolder {
final LinearLayout topicRow, topicExpandable; final LinearLayout topicRow, topicExpandable;
final TextView topicSubject, topicStartedBy, topicStats, topicLastPost; final TextView topicSubject, topicStartedBy, topicStats, topicLastPost, topicUnreadDot;
final ImageButton showHideExpandable; final ImageButton showHideExpandable;
TopicViewHolder(View topic) { TopicViewHolder(View topic) {
@ -298,6 +298,7 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
topicRow = topic.findViewById(R.id.topic_row_linear); topicRow = topic.findViewById(R.id.topic_row_linear);
topicExpandable = topic.findViewById(R.id.topic_expandable); topicExpandable = topic.findViewById(R.id.topic_expandable);
showHideExpandable = topic.findViewById(R.id.topic_expand_collapse_button); showHideExpandable = topic.findViewById(R.id.topic_expand_collapse_button);
topicUnreadDot = topic.findViewById(R.id.topic_unread_dot);
topicSubject = topic.findViewById(R.id.topic_subject); topicSubject = topic.findViewById(R.id.topic_subject);
topicStartedBy = topic.findViewById(R.id.topic_started_by); topicStartedBy = topic.findViewById(R.id.topic_started_by);
topicStats = topic.findViewById(R.id.topic_stats); topicStats = topic.findViewById(R.id.topic_stats);

13
app/src/main/res/layout/activity_board_topic.xml

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topic_row_linear" android:id="@+id/topic_row_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -17,6 +18,18 @@
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView
android:id="@+id/topic_unread_dot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/fa_circle"
android:textColor="@color/accent"
android:visibility="invisible"
android:layout_marginEnd="6dp"
android:textSize="9sp"
tools:ignore="SmallSp" />
<TextView <TextView
android:id="@+id/topic_subject" android:id="@+id/topic_subject"
android:layout_width="0dp" android:layout_width="0dp"

Loading…
Cancel
Save