mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
Changed fragment_manga_chapters.xml. Fix #221
This commit is contained in:
parent
ce271649ac
commit
bc473055b9
@ -76,12 +76,12 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* Status of isFilterDownloaded
|
||||||
*/
|
*/
|
||||||
var isFilterDownloaded = false
|
var isFilterDownloaded = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* Status of isFilterUnread
|
||||||
*/
|
*/
|
||||||
var isFilterUnread = false
|
var isFilterUnread = false
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.manga.chapter
|
package eu.kanade.tachiyomi.ui.manga.chapter
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v4.content.ContextCompat
|
|
||||||
import android.support.v7.view.ActionMode
|
import android.support.v7.view.ActionMode
|
||||||
import android.support.v7.widget.LinearLayoutManager
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
import android.view.*
|
import android.view.*
|
||||||
@ -71,7 +70,7 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
|||||||
|
|
||||||
swipe_refresh.setOnRefreshListener { fetchChapters() }
|
swipe_refresh.setOnRefreshListener { fetchChapters() }
|
||||||
|
|
||||||
next_unread_btn.setOnClickListener { v ->
|
fab.setOnClickListener { v ->
|
||||||
val chapter = presenter.getNextUnreadChapter()
|
val chapter = presenter.getNextUnreadChapter()
|
||||||
if (chapter != null) {
|
if (chapter != null) {
|
||||||
openChapter(chapter)
|
openChapter(chapter)
|
||||||
@ -93,35 +92,37 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
|||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
inflater.inflate(R.menu.chapters, menu)
|
inflater.inflate(R.menu.chapters, menu)
|
||||||
|
menu.findItem(R.id.action_filter_unread).isChecked = presenter.onlyUnread()
|
||||||
|
menu.findItem(R.id.action_filter_downloaded).isChecked = presenter.onlyDownloaded()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.action_display_mode -> showDisplayModeDialog()
|
R.id.action_display_mode -> showDisplayModeDialog()
|
||||||
R.id.manga_download -> showDownloadDialog()
|
R.id.manga_download -> showDownloadDialog()
|
||||||
|
R.id.action_filter_unread -> {
|
||||||
|
item.isChecked = !item.isChecked
|
||||||
|
presenter.setReadFilter(item.isChecked)
|
||||||
|
}
|
||||||
|
R.id.action_filter_downloaded -> {
|
||||||
|
item.isChecked = !item.isChecked
|
||||||
|
presenter.setDownloadedFilter(item.isChecked)
|
||||||
|
}
|
||||||
|
R.id.action_filter_empty -> {
|
||||||
|
presenter.setReadFilter(false)
|
||||||
|
presenter.setDownloadedFilter(false)
|
||||||
|
activity.supportInvalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
R.id.action_sort -> presenter.revertSortOrder()
|
||||||
else -> return super.onOptionsItemSelected(item)
|
else -> return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onNextManga(manga: Manga) {
|
fun onNextManga(manga: Manga) {
|
||||||
// Remove listeners before setting the values
|
|
||||||
show_unread.setOnCheckedChangeListener(null)
|
|
||||||
show_downloaded.setOnCheckedChangeListener(null)
|
|
||||||
sort_btn.setOnClickListener(null)
|
|
||||||
|
|
||||||
// Set initial values
|
// Set initial values
|
||||||
setReadFilter()
|
setReadFilter()
|
||||||
setDownloadedFilter()
|
setDownloadedFilter()
|
||||||
setSortIcon()
|
|
||||||
|
|
||||||
// Init listeners
|
|
||||||
show_unread.setOnCheckedChangeListener { arg, isChecked -> presenter.setReadFilter(isChecked) }
|
|
||||||
show_downloaded.setOnCheckedChangeListener { v, isChecked -> presenter.setDownloadedFilter(isChecked) }
|
|
||||||
sort_btn.setOnClickListener {
|
|
||||||
presenter.revertSortOrder()
|
|
||||||
setSortIcon()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onNextChapters(chapters: List<Chapter>) {
|
fun onNextChapters(chapters: List<Chapter>) {
|
||||||
@ -341,23 +342,12 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
|||||||
actionMode?.title = getString(R.string.label_selected, count)
|
actionMode?.title = getString(R.string.label_selected, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSortIcon() {
|
|
||||||
sort_btn?.let {
|
|
||||||
val aToZ = presenter.sortOrder()
|
|
||||||
it.setImageResource(if (!aToZ) R.drawable.ic_expand_less_white_36dp else R.drawable.ic_expand_more_white_36dp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setReadFilter() {
|
fun setReadFilter() {
|
||||||
show_unread?.let {
|
this.activity.supportInvalidateOptionsMenu()
|
||||||
it.isChecked = presenter.onlyUnread()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDownloadedFilter() {
|
fun setDownloadedFilter() {
|
||||||
show_downloaded?.let {
|
this.activity.supportInvalidateOptionsMenu()
|
||||||
it.isChecked = presenter.onlyDownloaded()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M14.94,4.66h-4.72l2.36,-2.36zM10.25,19.37h4.66l-2.33,2.33zM6.1,6.27L1.6,17.73h1.84l0.92,-2.45h5.11l0.92,2.45h1.84L7.74,6.27L6.1,6.27zM4.97,13.64l1.94,-5.18 1.94,5.18L4.97,13.64zM15.73,16.14h6.12v1.59h-8.53v-1.29l5.92,-8.56h-5.88v-1.6h8.3v1.26l-5.93,8.6z"/>
|
||||||
|
</vector>
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -26,78 +27,10 @@
|
|||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
style="@style/Theme.Widget.FAB"
|
||||||
|
app:layout_anchor="@id/recycler"
|
||||||
|
app:srcCompat="@drawable/ic_play_arrow_white_24dp"/>
|
||||||
|
|
||||||
<RelativeLayout
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
android:id="@+id/toolbar_bottom"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:elevation="4dp"
|
|
||||||
android:gravity="top|start"
|
|
||||||
android:paddingLeft="12dp"
|
|
||||||
android:paddingRight="12dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sort_btn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="?android:selectableItemBackground"
|
|
||||||
android:title="@string/action_sort_up"
|
|
||||||
tools:src="@drawable/ic_expand_less_white_36dp"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_toEndOf="@+id/sort_btn"
|
|
||||||
android:layout_toLeftOf="@+id/next_unread_btn"
|
|
||||||
android:layout_toRightOf="@+id/sort_btn"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:background="@color/md_white_1000"/>
|
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatCheckBox
|
|
||||||
android:id="@+id/show_unread"
|
|
||||||
style="@style/Theme.Widget.CheckBox.Light"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:checkable="true"
|
|
||||||
android:text="@string/action_show_unread"
|
|
||||||
android:title="@string/action_show_unread"/>
|
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatCheckBox
|
|
||||||
android:id="@+id/show_downloaded"
|
|
||||||
style="@style/Theme.Widget.CheckBox.Light"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:checkable="true"
|
|
||||||
android:text="@string/action_show_downloaded"
|
|
||||||
android:title="@string/action_show_downloaded"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:background="@color/md_white_1000"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageView
|
|
||||||
android:id="@+id/next_unread_btn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:title="@string/action_next_unread"
|
|
||||||
app:srcCompat="@drawable/ic_play_arrow_white_36dp"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
@ -3,12 +3,38 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:title="@string/action_display_mode"
|
android:id="@+id/action_filter"
|
||||||
|
android:icon="@drawable/ic_filter_list_white_24dp"
|
||||||
|
android:title="@string/action_filter"
|
||||||
|
app:showAsAction="ifRoom">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_filter_downloaded"
|
||||||
|
android:checkable="true"
|
||||||
|
android:title="@string/action_filter_downloaded"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_filter_unread"
|
||||||
|
android:checkable="true"
|
||||||
|
android:title="@string/action_filter_unread"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_filter_empty"
|
||||||
|
android:title="@string/action_filter_empty"/>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_sort"
|
||||||
|
android:icon="@drawable/ic_sort_by_alpha_white_24dp"
|
||||||
|
android:title="@string/action_sort"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item
|
||||||
android:id="@+id/action_display_mode"
|
android:id="@+id/action_display_mode"
|
||||||
|
android:title="@string/action_display_mode"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:title="@string/manga_download"
|
|
||||||
android:id="@+id/manga_download"
|
android:id="@+id/manga_download"
|
||||||
|
android:title="@string/manga_download"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
@ -48,6 +48,7 @@
|
|||||||
<string name="action_open_in_browser">Open in browser</string>
|
<string name="action_open_in_browser">Open in browser</string>
|
||||||
<string name="action_display_mode">Change display mode</string>
|
<string name="action_display_mode">Change display mode</string>
|
||||||
<string name="action_cancel">Cancel</string>
|
<string name="action_cancel">Cancel</string>
|
||||||
|
<string name="action_sort">Sort</string>
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<string name="button_ok">OK</string>
|
<string name="button_ok">OK</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user