Update incognito mode hint view
This commit is contained in:
@@ -37,10 +37,10 @@ import org.koitharu.kotatsu.list.domain.MangaListMapper
|
||||
import org.koitharu.kotatsu.list.domain.QuickFilterListener
|
||||
import org.koitharu.kotatsu.list.ui.MangaListViewModel
|
||||
import org.koitharu.kotatsu.list.ui.model.EmptyState
|
||||
import org.koitharu.kotatsu.list.ui.model.InfoModel
|
||||
import org.koitharu.kotatsu.list.ui.model.ListHeader
|
||||
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||
import org.koitharu.kotatsu.list.ui.model.LoadingState
|
||||
import org.koitharu.kotatsu.list.ui.model.TipModel
|
||||
import org.koitharu.kotatsu.list.ui.model.toErrorState
|
||||
import org.koitharu.kotatsu.local.data.LocalMangaRepository
|
||||
import org.koitharu.kotatsu.parsers.model.Manga
|
||||
@@ -175,13 +175,11 @@ class HistoryListViewModel @Inject constructor(
|
||||
val result = ArrayList<ListModel>((if (grouped) (list.size * 1.4).toInt() else list.size) + 2)
|
||||
result += quickFilter.filterItem(filters)
|
||||
if (isIncognito) {
|
||||
result += TipModel(
|
||||
result += InfoModel(
|
||||
key = AppSettings.KEY_INCOGNITO_MODE,
|
||||
title = R.string.incognito_mode,
|
||||
text = R.string.incognito_mode_hint,
|
||||
icon = R.drawable.ic_incognito,
|
||||
primaryButtonText = 0,
|
||||
secondaryButtonText = 0,
|
||||
)
|
||||
}
|
||||
val order = sortOrder.value
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.koitharu.kotatsu.list.ui.adapter
|
||||
|
||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
||||
import org.koitharu.kotatsu.core.util.ext.setTextAndVisible
|
||||
import org.koitharu.kotatsu.databinding.ItemInfoBinding
|
||||
import org.koitharu.kotatsu.list.ui.model.InfoModel
|
||||
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||
|
||||
fun infoAD() = adapterDelegateViewBinding<InfoModel, ListModel, ItemInfoBinding>(
|
||||
{ layoutInflater, parent -> ItemInfoBinding.inflate(layoutInflater, parent, false) },
|
||||
) {
|
||||
|
||||
bind {
|
||||
binding.textViewTitle.setText(item.title)
|
||||
binding.textViewBody.setTextAndVisible(item.text)
|
||||
binding.textViewTitle.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
item.icon, 0, 0, 0,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ enum class ListItemType {
|
||||
EXPLORE_SOURCE_LIST,
|
||||
EXPLORE_SUGGESTION,
|
||||
TIP,
|
||||
INFO,
|
||||
HINT_EMPTY,
|
||||
PAGE_THUMB,
|
||||
FEED,
|
||||
|
||||
@@ -26,5 +26,6 @@ open class MangaListAdapter(
|
||||
addDelegate(ListItemType.HEADER, listHeaderAD(listener))
|
||||
addDelegate(ListItemType.FILTER_HEADER, quickFilterAD(listener))
|
||||
addDelegate(ListItemType.TIP, tipAD(listener))
|
||||
addDelegate(ListItemType.INFO, infoAD())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class TypedListSpacingDecoration(
|
||||
ListItemType.CATEGORY_LARGE,
|
||||
ListItemType.NAV_ITEM,
|
||||
ListItemType.CHAPTER_LIST,
|
||||
ListItemType.INFO,
|
||||
null,
|
||||
-> outRect.set(0)
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.koitharu.kotatsu.list.ui.model
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
data class InfoModel(
|
||||
val key: String,
|
||||
@StringRes val title: Int,
|
||||
@StringRes val text: Int,
|
||||
@DrawableRes val icon: Int,
|
||||
) : ListModel {
|
||||
|
||||
override fun areItemsTheSame(other: ListModel): Boolean {
|
||||
return other is InfoModel && other.key == key
|
||||
}
|
||||
}
|
||||
49
app/src/main/res/layout/item_info.xml
Normal file
49
app/src/main/res/layout/item_info.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
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="wrap_content"
|
||||
android:paddingTop="6dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/view_line"
|
||||
android:layout_width="4dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@drawable/bg_chip"
|
||||
android:backgroundTint="?colorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="?textAppearanceTitleMedium"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/view_line"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:drawableStartCompat="@drawable/ic_app_update"
|
||||
tools:text="Уведомления отключены" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_body"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:textAppearance="?textAppearanceBodyMedium"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/textView_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView_title"
|
||||
tools:text="Включите их, чтобы ничего не пропускать. Откройте настройки системы и разрешите их отправку." />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user