mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 05:05:22 +01:00
Add button to remove reading history in recents
As an alternative to long press (which in another commit can be removed)
This commit is contained in:
parent
0c66d3b8b6
commit
bb31a16190
@ -27,6 +27,7 @@ class RecentMangaAdapter(val delegate: RecentsInterface) :
|
||||
|
||||
interface RecentMangaInterface {
|
||||
fun onCoverClick(position: Int)
|
||||
fun onRemoveHistoryClicked(position: Int)
|
||||
fun markAsRead(position: Int)
|
||||
fun isSearching(): Boolean
|
||||
fun setViewType(viewType: Int)
|
||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.recents
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.image.coil.loadLibraryManga
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
@ -21,11 +22,13 @@ class RecentMangaHolder(
|
||||
|
||||
init {
|
||||
binding.cardLayout.setOnClickListener { adapter.delegate.onCoverClick(flexibleAdapterPosition) }
|
||||
binding.removeHistory.setOnClickListener { adapter.delegate.onRemoveHistoryClicked(flexibleAdapterPosition) }
|
||||
}
|
||||
|
||||
fun bind(item: RecentMangaItem) {
|
||||
binding.downloadButton.downloadButton.visibleIf(item.mch.manga.source != LocalSource.ID)
|
||||
|
||||
binding.removeHistory.isVisible = item.mch.history.id != null
|
||||
binding.title.apply {
|
||||
text = item.chapter.name
|
||||
ChapterUtil.setTextViewForChapter(this, item)
|
||||
|
@ -364,6 +364,10 @@ class RecentsController(bundle: Bundle? = null) :
|
||||
router.pushController(MangaDetailsController(manga).withFadeTransaction())
|
||||
}
|
||||
|
||||
override fun onRemoveHistoryClicked(position: Int) {
|
||||
onItemLongClick(position)
|
||||
}
|
||||
|
||||
fun showHistory() {
|
||||
presenter.toggleGroupRecents(RecentsPresenter.VIEW_TYPE_ONLY_HISTORY, false)
|
||||
}
|
||||
|
8
app/src/main/res/drawable/ic_eye_remove_outline_24dp.xml
Normal file
8
app/src/main/res/drawable/ic_eye_remove_outline_24dp.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- drawable/eye_remove_outline.xml -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#000" android:pathData="M22.54 16.88L20.41 19L22.54 21.12L21.12 22.54L19 20.41L16.88 22.54L15.47 21.12L17.59 19L15.47 16.88L16.88 15.47L19 17.59L21.12 15.47L22.54 16.88M12 9C10.34 9 9 10.34 9 12S10.34 15 12 15 15 13.66 15 12 13.66 9 12 9M12 17.5C8.24 17.5 4.83 15.36 3.18 12C4.83 8.64 8.24 6.5 12 6.5S19.17 8.64 20.82 12C20.63 12.39 20.41 12.77 20.17 13.13C20.85 13.26 21.5 13.5 22.07 13.85C22.43 13.27 22.74 12.65 23 12C21.27 7.61 17 4.5 12 4.5S2.73 7.61 1 12C2.73 16.39 7 19.5 12 19.5C12.35 19.5 12.69 19.5 13.03 19.45C13 19.3 13 19.15 13 19C13 18.45 13.08 17.92 13.22 17.41C12.82 17.46 12.41 17.5 12 17.5Z" />
|
||||
</vector>
|
@ -125,7 +125,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="14sp"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/download_button"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_layout"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subtitle"
|
||||
@ -145,19 +145,37 @@
|
||||
android:progress="10"
|
||||
android:progressTint="?colorAccent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/download_button"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_layout"
|
||||
app:layout_constraintStart_toStartOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/button_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/remove_history"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/next_title"
|
||||
android:padding="8dp"
|
||||
app:tint="@color/holo_red"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
android:tooltipText="@string/reset_chapter_history"
|
||||
app:srcCompat="@drawable/ic_eye_remove_outline_24dp" />
|
||||
<include
|
||||
layout="@layout/download_button"
|
||||
android:id="@+id/download_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitle" />
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/bottom_line"
|
||||
|
@ -16,6 +16,8 @@
|
||||
<color name="strong_divider">@color/md_white_1000_38</color>
|
||||
<color name="divider">@color/md_white_1000_12</color>
|
||||
<color name="download">@color/material_green_700</color>
|
||||
<color name="holo_red">#cc4444</color>
|
||||
|
||||
|
||||
<color name="background">#1C1C1D</color>
|
||||
<color name="dialog">#212121</color>
|
||||
|
@ -60,6 +60,7 @@
|
||||
<color name="md_blue_A400">#2979FF</color>
|
||||
|
||||
<color name="md_red_500">#F44336</color>
|
||||
<color name="holo_red">#AA2200</color>
|
||||
|
||||
<color name="pale_green">#99CC99</color>
|
||||
|
||||
|
@ -207,6 +207,7 @@
|
||||
<string name="updates">Updates</string>
|
||||
<string name="newly_added">Newly added</string>
|
||||
<string name="history">History</string>
|
||||
<string name="reset_chapter_history">Reset chapter history</string>
|
||||
<string name="recent_updates">Recent updates</string>
|
||||
<string name="this_will_remove_the_read_date_for_x_question">This will remove the read date of
|
||||
\"%1$s\". Are you sure?</string>
|
||||
|
Loading…
Reference in New Issue
Block a user