mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
#1600 Add unread indicator
This commit is contained in:
parent
783e72f592
commit
6573f5e180
2 changed files with 25 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
@ -76,6 +77,17 @@
|
|||
android:layout_margin="5dp"
|
||||
android:contentDescription="@string/description_menu" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/reading_item_unread_icon"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_alignTop="@id/reading_item_title"
|
||||
android:src="@drawable/g_icn_unread"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_title"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -84,7 +96,7 @@
|
|||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_toLeftOf="@id/story_context_menu_button"
|
||||
android:textSize="17sp" />
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/reading_item_date"
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.newsblur.fragment
|
|||
import android.content.*
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
|
@ -188,7 +189,7 @@ class ReadingItemFragment : NbFragment(), PopupMenu.OnMenuItemClickListener {
|
|||
updateTrainButton()
|
||||
updateShareButton()
|
||||
updateSaveButton()
|
||||
updateMarkReadButton()
|
||||
updatStoryReadUI()
|
||||
setupItemCommentsAndShares()
|
||||
|
||||
binding.readingScrollview.registerScrollChangeListener(readingActivity)
|
||||
|
@ -365,13 +366,21 @@ class ReadingItemFragment : NbFragment(), PopupMenu.OnMenuItemClickListener {
|
|||
else feedUtils.markStoryAsRead(story!!, requireContext())
|
||||
}
|
||||
|
||||
private fun updateMarkReadButton() {
|
||||
private fun updatStoryReadUI() {
|
||||
if (markStoryReadBehavior == MarkStoryReadBehavior.MANUALLY) {
|
||||
readingItemActionsBinding.markReadStoryButton.visibility = View.VISIBLE
|
||||
readingItemActionsBinding.markReadStoryButton.setStoryReadState(requireContext(), story!!.read)
|
||||
} else {
|
||||
readingItemActionsBinding.markReadStoryButton.visibility = View.GONE
|
||||
}
|
||||
|
||||
story?.let {
|
||||
val (typeFace, iconVisibility) =
|
||||
if (it.read) Typeface.create(binding.readingItemTitle.typeface, Typeface.NORMAL) to View.GONE
|
||||
else Typeface.create(binding.readingItemTitle.typeface, Typeface.BOLD) to View.VISIBLE
|
||||
binding.readingItemTitle.typeface = typeFace
|
||||
binding.readingItemUnreadIcon.visibility = iconVisibility
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickTrain() {
|
||||
|
@ -647,7 +656,7 @@ class ReadingItemFragment : NbFragment(), PopupMenu.OnMenuItemClickListener {
|
|||
if (updateType and UPDATE_STORY != 0) {
|
||||
updateSaveButton()
|
||||
updateShareButton()
|
||||
updateMarkReadButton()
|
||||
updatStoryReadUI()
|
||||
setupItemCommentsAndShares()
|
||||
}
|
||||
if (updateType and UPDATE_TEXT != 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue