Added Unread badge option

And with this, the filter bottom sheet is done
This commit is contained in:
Jay 2020-02-08 16:40:19 -08:00
parent 4ba197c713
commit 05cb2c0b6b
19 changed files with 339 additions and 63 deletions

View File

@ -239,6 +239,8 @@ class PreferencesHelper(val context: Context) {
fun lastExtCheck() = rxPrefs.getLong("last_ext_check", 0)
fun unreadBadgeType() = rxPrefs.getInteger("unread_badge_type", 1)
fun upgradeFilters() {
val filterDl = rxPrefs.getBoolean(Keys.filterDownloaded, false).getOrDefault()
val filterUn = rxPrefs.getBoolean(Keys.filterUnread, false).getOrDefault()

View File

@ -12,6 +12,7 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.catalogue_grid_item.view.*
@ -29,8 +30,11 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
val parent = adapter.recyclerView
return if (parent is AutofitRecyclerView) {
view.apply {
card.layoutParams = FrameLayout.LayoutParams(
MATCH_PARENT, parent.itemWidth / 3 * 4)
/*val params = card.layoutParams
//val fiveDp = 10.dpToPx
params.height = MATCH_PARENT
params.width = parent.itemWidth / 3 * 4
card.layoutParams = params*/
gradient.layoutParams = FrameLayout.LayoutParams(
MATCH_PARENT, parent.itemWidth / 3 * 4 / 2, Gravity.BOTTOM)
}

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.library
import android.content.Context
import android.content.res.Configuration
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
@ -27,6 +28,7 @@ import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.filter_bottom_sheet.*
import kotlinx.android.synthetic.main.library_category.view.*
import kotlinx.android.synthetic.main.library_controller.*
import kotlinx.coroutines.delay
@ -110,11 +112,16 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
else {
fast_scroller.setIgnoreTouchesOutsideHandle(false)
}
if (MainActivity.bottomNav) {
val config = resources?.configuration
val phoneLandscape = (config?.orientation == Configuration.ORIENTATION_LANDSCAPE &&
(config.screenLayout.and(Configuration.SCREENLAYOUT_SIZE_MASK)) <
Configuration.SCREENLAYOUT_SIZE_LARGE)
if (MainActivity.bottomNav && !phoneLandscape) {
val height = context.resources.getDimensionPixelSize(R.dimen.rounder_radius) + 5.dpToPx
recycler.updatePaddingRelative(bottom = height)
}
else {
else if (!MainActivity.bottomNav) {
recycler.doOnApplyWindowInsets { v, insets, padding ->
v.updatePaddingRelative(bottom = padding.bottom + insets.systemWindowInsetBottom)

View File

@ -228,7 +228,9 @@ class LibraryController(
FilterBottomSheet.ACTION_FILTER -> onFilterChanged()
FilterBottomSheet.ACTION_SORT -> onSortChanged()
FilterBottomSheet.ACTION_DISPLAY -> reattachAdapter()
FilterBottomSheet.ACTION_BADGE -> onDownloadBadgeChanged()
FilterBottomSheet.ACTION_DOWNLOAD_BADGE ->
presenter.requestDownloadBadgesUpdate()
FilterBottomSheet.ACTION_UNREAD_BADGE -> presenter.requestUnreadBadgesUpdate()
FilterBottomSheet.ACTION_CAT_SORT -> onCatSortChanged()
}
}
@ -566,8 +568,14 @@ class LibraryController(
when (item.itemId) {
R.id.action_search -> expandActionViewFromInteraction = true
R.id.action_library_filter -> {
if (MainActivity.bottomNav) bottom_sheet.sheetBehavior?.state =
BottomSheetBehavior.STATE_EXPANDED
if (MainActivity.bottomNav) {
if (bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED)
bottom_sheet.sheetBehavior?.state =
BottomSheetBehavior.STATE_EXPANDED
else
bottom_sheet.sheetBehavior?.state =
BottomSheetBehavior.STATE_COLLAPSED
}
else navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
}
R.id.action_edit_categories -> {

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.library
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.signature.ObjectKey
@ -9,6 +10,8 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import kotlinx.android.synthetic.main.catalogue_grid_item.*
/**
@ -42,25 +45,27 @@ class LibraryGridHolder(
// Update the unread count and its visibility.
with(unread_text) {
visibility = if (item.manga.unread > 0) View.VISIBLE else View.GONE
visibility =
if (item.manga.unread > 0 && item.unreadType == 1) View.VISIBLE else View.GONE
text = item.manga.unread.toString()
}
// Update the download count and its visibility.
unread_badge.visibility =
if (item.manga.unread > 0 && item.unreadType == 0) View.VISIBLE else View.GONE
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE
text = item.downloadCount.toString()
}
//set local visibility if its local manga
local_text.visibility = if(item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
// Update the cover.
GlideApp.with(view.context).clear(thumbnail)
GlideApp.with(view.context)
.load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.manga.id!!).toString()))
.centerCrop()
.into(thumbnail)
.load(item.manga)
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.manga.id!!).toString()))
.centerCrop().into(thumbnail)
}
}

View File

@ -23,6 +23,7 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
AbstractFlexibleItem<LibraryHolder>(), IFilterable<String> {
var downloadCount = -1
var unreadType = 1
override fun getLayoutRes(): Int {
return if (libraryAsList.getOrDefault())

View File

@ -10,6 +10,13 @@ import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.signature.ObjectKey
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import kotlinx.android.synthetic.main.catalogue_grid_item.*
import kotlinx.android.synthetic.main.catalogue_list_item.download_text
import kotlinx.android.synthetic.main.catalogue_list_item.local_text
import kotlinx.android.synthetic.main.catalogue_list_item.thumbnail
import kotlinx.android.synthetic.main.catalogue_list_item.title
import kotlinx.android.synthetic.main.catalogue_list_item.unread_badge
import kotlinx.android.synthetic.main.catalogue_list_item.unread_text
/**
* Class used to hold the displayed data of a manga in the library, like the cover or the title.
@ -38,9 +45,12 @@ class LibraryListHolder(
// Update the unread count and its visibility.
with(unread_text) {
visibility = if (item.manga.unread > 0) View.VISIBLE else View.GONE
visibility = if (item.manga.unread > 0 && item.unreadType == 1) View.VISIBLE else
View.GONE
text = item.manga.unread.toString()
}
unread_badge.visibility =
if (item.manga.unread > 0 && item.unreadType == 0) View.VISIBLE else View.GONE
// Update the download count and its visibility.
with(download_text) {
visibility = if (item.downloadCount > 0) View.VISIBLE else View.GONE

View File

@ -217,6 +217,15 @@ class LibraryPresenter(
}
}
private fun setUnreadBadge(map: LibraryMap) {
val unreadType = preferences.unreadBadgeType().getOrDefault()
for ((_, itemList) in map) {
for (item in itemList) {
item.unreadType = unreadType
}
}
}
private fun applyCatSort(map: LibraryMap, catId: Int?): LibraryMap {
if (catId == null) return map
val categoryManga = map[catId] ?: return map
@ -400,11 +409,12 @@ class LibraryPresenter(
val categories = db.getCategories().executeAsBlocking().toMutableList()
val libraryAsList = preferences.libraryAsList()
val showCategories = !preferences.hideCategories().getOrDefault()
val unreadBadgeType = preferences.unreadBadgeType().getOrDefault()
var libraryManga = db.getLibraryMangas().executeAsBlocking()
if (!showCategories)
libraryManga = libraryManga.distinctBy { it.id }
val libraryMap = libraryManga.map { manga ->
LibraryItem(manga, libraryAsList)
LibraryItem(manga, libraryAsList).apply { unreadType = unreadBadgeType }
}.groupBy {
if (showCategories) it.manga.category else 0
}
@ -488,7 +498,7 @@ class LibraryPresenter(
}
/**
* Requests the library to have download badges added.
* Requests the library to have download badges added/removed.
*/
fun requestDownloadBadgesUpdate() {
//getLibrary()
@ -503,6 +513,22 @@ class LibraryPresenter(
}
}
/**
* Requests the library to have unread badges changed.
*/
fun requestUnreadBadgesUpdate() {
//getLibrary()
launchUI {
val mangaMap = rawMangaMap ?: return@launchUI
withContext(Dispatchers.IO) { setUnreadBadge(mangaMap) }
rawMangaMap = mangaMap
val current = currentMangaMap ?: return@launchUI
withContext(Dispatchers.IO) { setUnreadBadge(current) }
currentMangaMap = current
view?.onNextLibraryUpdate(categories, current)
}
}
/**
* Requests the library to be sorted.
*/

View File

@ -41,6 +41,7 @@ import kotlinx.coroutines.withContext
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import kotlin.math.min
import kotlin.math.roundToInt
class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
@ -103,7 +104,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
topbar.setOnClickListener {
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
topbar.animate().alpha(0f).setDuration(100).start()
//topbar.animate().alpha(0f).setDuration(100).start()
} else {
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
}
@ -131,8 +132,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
}
})
topbar.viewTreeObserver.addOnGlobalLayoutListener {
val phoneLandscape = (context.resources.configuration?.orientation ==
Configuration.ORIENTATION_LANDSCAPE && !isTablet())
val phoneLandscape = (isLandscape() && !isTablet())
sheetBehavior?.peekHeight = if (phoneLandscape) {
if (shadow2.visibility != View.GONE) {
shadow.gone()
@ -162,7 +162,11 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
downloadCheckbox.isChecked = preferences.downloadBadge().getOrDefault()
downloadCheckbox.setOnCheckedChangeListener { _, isChecked ->
preferences.downloadBadge().set(isChecked)
onGroupClicked(ACTION_BADGE)
onGroupClicked(ACTION_DOWNLOAD_BADGE)
}
setUnreadIcon()
unread_badge.setOnClickListener {
showUnreadMenu()
}
displayGroup.bindToPreference(preferences.libraryAsList())
@ -376,7 +380,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
!preferences.librarySortingAscending().getOrDefault() ->
R.drawable.ic_arrow_down_white_24dp
else -> R.drawable.ic_arrow_up_white_24dp
}, android.R.attr.colorAccent
}
)
// Finally show the PopupMenu
@ -417,8 +421,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
currentItem?.icon = tintVector(
if (category.isAscending()) R.drawable.ic_arrow_up_white_24dp
else R.drawable.ic_arrow_down_white_24dp,
android.R.attr.colorAccent
else R.drawable.ic_arrow_down_white_24dp
)
// Finally show the PopupMenu
@ -498,7 +501,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
sortId == LibrarySort.DRAG_AND_DROP -> R.drawable.ic_sort_white_24dp
preferences.librarySortingAscending().getOrDefault() -> R.drawable.ic_arrow_up_white_24dp
else -> R.drawable.ic_arrow_down_white_24dp
}, android.R.attr.colorAccent
}
)
}
mainSortTextView.text = withContext(Dispatchers.IO) {
@ -534,7 +537,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
sortId == LibrarySort.DRAG_AND_DROP -> R.drawable.ic_label_outline_white_24dp
lastCategory?.isAscending() == true -> R.drawable.ic_arrow_up_white_24dp
else -> R.drawable.ic_arrow_down_white_24dp
}, android.R.attr.colorAccent
}
)
}
catSortTextView.text = withContext(Dispatchers.IO) {
@ -573,9 +576,9 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
private fun Boolean.toInt() = if (this) 1 else 0
private fun tintVector(resId: Int, attrId: Int? = null): Drawable? {
private fun tintVector(resId: Int): Drawable? {
return ContextCompat.getDrawable(context, resId)?.mutate()?.apply {
setTint(context.getResourceColor(attrId ?: android.R.attr.textColorPrimary))
setTint(context.getResourceColor(android.R.attr.colorAccent))
}
}
@ -639,12 +642,54 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
filterScrollView.scrollTo(0, 0)
}
private fun showUnreadMenu() {
val popup = PopupMenu(context, unread_badge)
popup.menuInflater.inflate(R.menu.unread_badge, popup.menu)
popup.menu.getItem(min(preferences.unreadBadgeType().getOrDefault(), 1) + 1).isChecked =
true
popup.setOnMenuItemClickListener { menuItem ->
preferences.unreadBadgeType().set(when (menuItem.itemId) {
R.id.action_no_unread -> -1
R.id.action_any_unread -> 0
else -> 1
})
setUnreadIcon()
onGroupClicked(ACTION_UNREAD_BADGE)
true
}
// Finally show the PopupMenu
popup.show()
}
private fun setUnreadIcon() {
launchUI {
val unreadType = preferences.unreadBadgeType().getOrDefault()
val drawableL = withContext(Dispatchers.IO) {
tintVector(
when (unreadType){
-1 -> R.drawable.ic_check_box_outline_blank_24dp
0 -> R.drawable.ic_unread_circle_white_24dp
else -> R.drawable.ic_looks_two_white_24dp
}
)
}
unread_badge.setCompoundDrawablesRelativeWithIntrinsicBounds(
drawableL, null, null, null
)
}
}
companion object {
const val ACTION_REFRESH = 0
const val ACTION_SORT = 1
const val ACTION_FILTER = 2
const val ACTION_DISPLAY = 3
const val ACTION_BADGE = 4
const val ACTION_CAT_SORT = 5
const val ACTION_DOWNLOAD_BADGE = 4
const val ACTION_UNREAD_BADGE = 5
const val ACTION_CAT_SORT = 6
}
}

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM15,11c0,1.11 -0.9,2 -2,2h-2v2h4v2L9,17v-4c0,-1.11 0.9,-2 2,-2h2L13,9L9,9L9,7h4c1.1,0 2,0.89 2,2v2z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#010101" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
</vector>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:background="@android:color/white">
<item>
<shape>
<gradient
android:type="radial"
android:gradientRadius="20dp"
android:endColor="@android:color/transparent"
android:centerColor="@android:color/black"
android:startColor="@android:color/black"/>
<corners android:radius="19dp" />
</shape>
</item>
<item
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp">
<!--whatever you want in the background, here i preferred solid white -->
<shape android:shape="oval">
<corners android:radius="16dp" />
<size
android:width="32dp"
android:height="32dp" />
<solid android:color="?android:attr/colorAccent"/>
</shape>
</item>
</layer-list>

View File

@ -127,7 +127,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginEnd="14dp"
android:layout_marginEnd="30dp"
android:baselineAligned="false"
android:gravity="center|start"
android:orientation="horizontal">
@ -166,11 +166,39 @@
</RadioGroup>
</LinearLayout>
<CheckBox
android:id="@+id/downloadCheckbox"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_display_download_badge"/>
android:orientation="horizontal"
android:baselineAligned="false"
android:gravity="center|start"
>
<CheckBox
android:id="@+id/downloadCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/action_display_download_badge" />
<TextView
android:id="@+id/unread_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:clickable="true"
android:drawablePadding="6dp"
android:background="@drawable/square_ripple"
android:focusable="true"
android:gravity="start|center"
android:padding="5dp"
android:text="@string/action_display_unread_badge"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="15sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>

View File

@ -127,7 +127,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginEnd="14dp"
android:layout_marginEnd="30dp"
android:baselineAligned="false"
android:gravity="center|start"
android:orientation="horizontal">
@ -166,11 +166,39 @@
</RadioGroup>
</LinearLayout>
<CheckBox
android:id="@+id/downloadCheckbox"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_display_download_badge"/>
android:orientation="horizontal"
android:baselineAligned="false"
android:gravity="center|start"
>
<CheckBox
android:id="@+id/downloadCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/action_display_download_badge" />
<TextView
android:id="@+id/unread_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:clickable="true"
android:drawablePadding="6dp"
android:background="@drawable/square_ripple"
android:focusable="true"
android:gravity="start|center"
android:padding="5dp"
android:text="@string/action_display_unread_badge"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="15sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>

View File

@ -30,6 +30,7 @@
android:background="@drawable/gradient_shape"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/badge_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="7dp"
@ -116,6 +117,14 @@
android:visibility="gone"
android:layout_gravity="center"/>
</FrameLayout>
<ImageView
android:id="@+id/unread_badge"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="end"
android:src="@drawable/unread_circle_badge"/>
</FrameLayout>

View File

@ -59,6 +59,32 @@
android:textColor="@color/md_white_1000"
tools:visibility="visible"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="@+id/download_text"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"/>
<TextView
android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:textColor="@color/md_white_1000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_red_500"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/unread_text"
android:maxLines="1"
android:visibility="gone"
tools:text="122"
tools:visibility="visible"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="@+id/unread_text"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
@ -83,35 +109,22 @@
tools:text="130"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/download_text"
app:layout_constraintEnd_toStartOf="@+id/unread_badge"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/download_text"
style="@style/TextAppearance.Regular.Caption.Light"
android:textColor="@color/md_white_1000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/md_red_500"
android:paddingBottom="1dp"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:paddingTop="1dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/unread_text"
android:maxLines="1"
android:visibility="gone"
tools:text="122"
tools:visibility="visible"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent"
<ImageView
android:id="@+id/unread_badge"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="end"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"/>
android:src="@drawable/unread_circle_badge"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -162,11 +162,39 @@
</RadioGroup>
</LinearLayout>
<CheckBox
android:id="@+id/downloadCheckbox"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_display_download_badge"/>
android:orientation="horizontal"
android:baselineAligned="false"
android:gravity="center|start"
>
<CheckBox
android:id="@+id/downloadCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/action_display_download_badge" />
<TextView
android:id="@+id/unread_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:clickable="true"
android:drawablePadding="6dp"
android:background="@drawable/square_ripple"
android:focusable="true"
android:gravity="start|center"
android:padding="5dp"
android:text="@string/action_display_unread_badge"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="15sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group
android:id="@+id/reorder_group"
android:checkableBehavior="single">
<item
android:id="@+id/action_no_unread"
android:title="@string/action_display_hide_unread" />
<item
android:id="@+id/action_any_unread"
android:title="@string/action_display_any_unread" />
<item
android:id="@+id/action_all_unread"
android:title="@string/action_display_all_unread" />
</group>
</menu>

View File

@ -97,6 +97,10 @@
<string name="action_display_grid">Grid</string>
<string name="action_display_list">List</string>
<string name="action_display_download_badge">Download badges</string>
<string name="action_display_unread_badge">Unread badges</string>
<string name="action_display_all_unread">All unread</string>
<string name="action_display_any_unread">Any unread</string>
<string name="action_display_hide_unread">Hide unread</string>
<string name="action_set_filter">Set filter</string>
<string name="action_cancel">Cancel</string>
<string name="action_sort">Sort</string>