mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:55:11 +01:00
Replaced filter button in reader with open manga in webview
This commit is contained in:
parent
6616189463
commit
0184b0678d
@ -48,6 +48,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.L2RPagerViewer
|
|||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
||||||
|
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||||
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
||||||
import eu.kanade.tachiyomi.util.system.GLUtil
|
import eu.kanade.tachiyomi.util.system.GLUtil
|
||||||
import eu.kanade.tachiyomi.util.system.ThemeUtil
|
import eu.kanade.tachiyomi.util.system.ThemeUtil
|
||||||
@ -745,6 +746,20 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun openMangaInBrowser() {
|
||||||
|
val source = presenter.getSource() ?: return
|
||||||
|
val url = try {
|
||||||
|
source.mangaDetailsRequest(presenter.manga!!).url.toString()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val intent = WebViewActivity.newIntent(
|
||||||
|
applicationContext, source.id, url, presenter.manga!!.title
|
||||||
|
)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that handles the user preferences of the reader.
|
* Class that handles the user preferences of the reader.
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.data.track.TrackManager
|
|||||||
import eu.kanade.tachiyomi.source.LocalSource
|
import eu.kanade.tachiyomi.source.LocalSource
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||||
import eu.kanade.tachiyomi.ui.reader.chapter.ReaderChapterItem
|
import eu.kanade.tachiyomi.ui.reader.chapter.ReaderChapterItem
|
||||||
import eu.kanade.tachiyomi.ui.reader.loader.ChapterLoader
|
import eu.kanade.tachiyomi.ui.reader.loader.ChapterLoader
|
||||||
@ -452,6 +453,8 @@ class ReaderPresenter(
|
|||||||
return viewerChaptersRelay.value?.currChapter
|
return viewerChaptersRelay.value?.currChapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getSource() = sourceManager.getOrStub(manga!!.source) as? HttpSource
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the viewer position used by this manga or the default one.
|
* Returns the viewer position used by this manga or the default one.
|
||||||
*/
|
*/
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.chapter
|
|
||||||
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
|
||||||
import eu.kanade.tachiyomi.R
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|
||||||
import eu.kanade.tachiyomi.util.view.expand
|
|
||||||
import eu.kanade.tachiyomi.util.view.setBottomEdge
|
|
||||||
import eu.kanade.tachiyomi.util.view.setEdgeToEdge
|
|
||||||
import kotlinx.android.synthetic.main.chapter_filter_layout.*
|
|
||||||
import kotlinx.android.synthetic.main.chapter_filter_sheet.*
|
|
||||||
import kotlinx.android.synthetic.main.reader_chapters_sheet.*
|
|
||||||
|
|
||||||
class ChapterFilterSheet(activity: ReaderActivity, manga: Manga) :
|
|
||||||
BottomSheetDialog(activity, R.style.BottomSheetDialogTheme) {
|
|
||||||
|
|
||||||
init {
|
|
||||||
val view = activity.layoutInflater.inflate(R.layout.chapter_filter_sheet, null)
|
|
||||||
setContentView(view)
|
|
||||||
BottomSheetBehavior.from(view.parent as ViewGroup).expand()
|
|
||||||
setEdgeToEdge(activity, view)
|
|
||||||
setBottomEdge(show_bookmark, activity)
|
|
||||||
|
|
||||||
chapter_filter_layout.setCheckboxes(manga)
|
|
||||||
setOnDismissListener {
|
|
||||||
activity.presenter.setFilters(
|
|
||||||
show_read.isChecked,
|
|
||||||
show_unread.isChecked,
|
|
||||||
show_download.isChecked,
|
|
||||||
show_bookmark.isChecked
|
|
||||||
)
|
|
||||||
activity.chapters_bottom_sheet.refreshList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -53,8 +53,8 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filter_button.setOnClickListener {
|
webview_button.setOnClickListener {
|
||||||
ChapterFilterSheet(activity, presenter.manga!!).show()
|
activity.openMangaInBrowser()
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
@ -66,8 +66,8 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
|||||||
pill.alpha = (1 - max(0f, progress)) * 0.25f
|
pill.alpha = (1 - max(0f, progress)) * 0.25f
|
||||||
val trueProgress = max(progress, 0f)
|
val trueProgress = max(progress, 0f)
|
||||||
chapters_button.alpha = 1 - trueProgress
|
chapters_button.alpha = 1 - trueProgress
|
||||||
filter_button.alpha = trueProgress
|
webview_button.alpha = trueProgress
|
||||||
filter_button.visibleIf(filter_button.alpha > 0)
|
webview_button.visibleIf(webview_button.alpha > 0)
|
||||||
chapters_button.visInvisIf(chapters_button.alpha > 0)
|
chapters_button.visInvisIf(chapters_button.alpha > 0)
|
||||||
backgroundTintList =
|
backgroundTintList =
|
||||||
ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress))
|
ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress))
|
||||||
@ -87,15 +87,15 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
|||||||
chapter_recycler.height / 2 - 30.dpToPx
|
chapter_recycler.height / 2 - 30.dpToPx
|
||||||
)
|
)
|
||||||
chapters_button.alpha = 1f
|
chapters_button.alpha = 1f
|
||||||
filter_button.alpha = 0f
|
webview_button.alpha = 0f
|
||||||
}
|
}
|
||||||
if (state == BottomSheetBehavior.STATE_EXPANDED) {
|
if (state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||||
chapter_recycler.alpha = 1f
|
chapter_recycler.alpha = 1f
|
||||||
chapters_button.alpha = 0f
|
chapters_button.alpha = 0f
|
||||||
filter_button.alpha = 1f
|
webview_button.alpha = 1f
|
||||||
if (activity.sheetManageNavColor) activity.window.navigationBarColor = primary
|
if (activity.sheetManageNavColor) activity.window.navigationBarColor = primary
|
||||||
}
|
}
|
||||||
filter_button.visibleIf(state != BottomSheetBehavior.STATE_COLLAPSED)
|
webview_button.visibleIf(state != BottomSheetBehavior.STATE_COLLAPSED)
|
||||||
chapters_button.visInvisIf(state != BottomSheetBehavior.STATE_EXPANDED)
|
chapters_button.visInvisIf(state != BottomSheetBehavior.STATE_EXPANDED)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/bottom_sheet_rounded_background">
|
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.ui.manga.chapter.ChapterFilterLayout
|
|
||||||
android:id="@+id/chapter_filter_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
</FrameLayout>
|
|
@ -28,7 +28,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/filter_button"
|
android:id="@+id/webview_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
@ -52,8 +52,8 @@
|
|||||||
android:textAlignment="textEnd"
|
android:textAlignment="textEnd"
|
||||||
android:textColor="?android:textColorHint"
|
android:textColor="?android:textColorHint"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@id/chapters_title"
|
app:layout_constraintBaseline_toBaselineOf="@id/chapters_title"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/filter_button"
|
app:layout_constraintBottom_toBottomOf="@id/webview_button"
|
||||||
app:layout_constraintEnd_toStartOf="@id/filter_button"
|
app:layout_constraintEnd_toStartOf="@id/webview_button"
|
||||||
app:layout_constraintStart_toEndOf="@+id/chapters_title"
|
app:layout_constraintStart_toEndOf="@+id/chapters_title"
|
||||||
app:layout_constraintTop_toTopOf="@id/filter_button" />
|
app:layout_constraintTop_toTopOf="@id/webview_button" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -46,19 +46,19 @@
|
|||||||
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
|
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/filter_button"
|
android:id="@+id/webview_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/next"
|
android:contentDescription="@string/open_in_webview"
|
||||||
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
||||||
android:tint="?actionBarTintColor"
|
android:tint="?actionBarTintColor"
|
||||||
android:tooltipText="@string/filter"
|
android:tooltipText="@string/open_in_webview"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:alpha="0.0"
|
android:alpha="0.0"
|
||||||
app:srcCompat="@drawable/ic_filter_list_24dp" />
|
app:srcCompat="@drawable/ic_open_in_webview_24dp" />
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
|
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
|
||||||
android:id="@+id/page_seekbar"
|
android:id="@+id/page_seekbar"
|
||||||
|
Loading…
Reference in New Issue
Block a user