Add banner at top of library when downloaded only mode is enabled

This commit is contained in:
arkon 2020-04-30 18:35:17 -04:00
parent 276cfed832
commit dff1f4dd52
2 changed files with 32 additions and 3 deletions

View file

@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.visible
import java.io.IOException import java.io.IOException
import kotlinx.android.synthetic.main.main_activity.tabs import kotlinx.android.synthetic.main.main_activity.tabs
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
@ -172,6 +173,10 @@ class LibraryController(
is LibrarySettingsSheet.Display.BadgeGroup -> onDownloadBadgeChanged() is LibrarySettingsSheet.Display.BadgeGroup -> onDownloadBadgeChanged()
} }
} }
if (preferences.downloadedOnly().get()) {
binding.downloadedOnly.visible()
}
} }
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) { override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {

View file

@ -4,10 +4,34 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.viewpager.widget.ViewPager <LinearLayout
android:id="@+id/library_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/downloaded_only"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSecondary"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
android:text="@string/label_downloaded_only"
android:textColor="?attr/colorOnSecondary" />
</FrameLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/library_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<eu.kanade.tachiyomi.widget.ActionToolbar <eu.kanade.tachiyomi.widget.ActionToolbar
android:id="@+id/action_toolbar" android:id="@+id/action_toolbar"