mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 02:18:24 +01:00
Minor XML refactoring
This commit is contained in:
parent
b1b97c19d4
commit
dc80a5ffbd
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.library
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.design.widget.AppBarLayout
|
|
||||||
import android.support.design.widget.TabLayout
|
import android.support.design.widget.TabLayout
|
||||||
import android.support.v7.view.ActionMode
|
import android.support.v7.view.ActionMode
|
||||||
import android.support.v7.widget.SearchView
|
import android.support.v7.widget.SearchView
|
||||||
@ -18,7 +17,6 @@ import eu.kanade.tachiyomi.event.LibraryMangaEvent
|
|||||||
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment
|
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment
|
||||||
import eu.kanade.tachiyomi.ui.category.CategoryActivity
|
import eu.kanade.tachiyomi.ui.category.CategoryActivity
|
||||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import eu.kanade.tachiyomi.util.inflate
|
|
||||||
import eu.kanade.tachiyomi.util.toast
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_library.*
|
import kotlinx.android.synthetic.main.fragment_library.*
|
||||||
@ -41,13 +39,8 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
|||||||
/**
|
/**
|
||||||
* TabLayout of the categories.
|
* TabLayout of the categories.
|
||||||
*/
|
*/
|
||||||
private lateinit var tabs: TabLayout
|
private val tabs: TabLayout
|
||||||
|
get() = (activity as MainActivity).tabs
|
||||||
/**
|
|
||||||
* AppBarLayout from [MainActivity].
|
|
||||||
*/
|
|
||||||
private val appbar: AppBarLayout
|
|
||||||
get() = (activity as MainActivity).appbar
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Position of the active category.
|
* Position of the active category.
|
||||||
@ -70,7 +63,6 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
|||||||
*/
|
*/
|
||||||
private var selectedCoverManga: Manga? = null
|
private var selectedCoverManga: Manga? = null
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status of isFilterDownloaded
|
* Status of isFilterDownloaded
|
||||||
*/
|
*/
|
||||||
@ -122,10 +114,6 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
|||||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||||
setToolbarTitle(getString(R.string.label_library))
|
setToolbarTitle(getString(R.string.label_library))
|
||||||
|
|
||||||
tabs = appbar.inflate(R.layout.library_tab_layout) as TabLayout
|
|
||||||
|
|
||||||
appbar.addView(tabs)
|
|
||||||
|
|
||||||
adapter = LibraryAdapter(childFragmentManager)
|
adapter = LibraryAdapter(childFragmentManager)
|
||||||
view_pager.adapter = adapter
|
view_pager.adapter = adapter
|
||||||
tabs.setupWithViewPager(view_pager)
|
tabs.setupWithViewPager(view_pager)
|
||||||
@ -138,7 +126,7 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
appbar.removeView(tabs)
|
tabs.visibility = View.GONE
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.ui.manga.info.MangaInfoFragment
|
|||||||
import eu.kanade.tachiyomi.ui.manga.myanimelist.MyAnimeListFragment
|
import eu.kanade.tachiyomi.ui.manga.myanimelist.MyAnimeListFragment
|
||||||
import eu.kanade.tachiyomi.util.SharedData
|
import eu.kanade.tachiyomi.util.SharedData
|
||||||
import kotlinx.android.synthetic.main.activity_manga.*
|
import kotlinx.android.synthetic.main.activity_manga.*
|
||||||
import kotlinx.android.synthetic.main.tab_layout.*
|
|
||||||
import kotlinx.android.synthetic.main.toolbar.*
|
import kotlinx.android.synthetic.main.toolbar.*
|
||||||
import nucleus.factory.RequiresPresenter
|
import nucleus.factory.RequiresPresenter
|
||||||
|
|
||||||
|
@ -19,6 +19,19 @@
|
|||||||
|
|
||||||
<include layout="@layout/toolbar"/>
|
<include layout="@layout/toolbar"/>
|
||||||
|
|
||||||
|
<android.support.design.widget.TabLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:theme="@style/Theme.ActionBar.Tab"
|
||||||
|
app:tabIndicatorColor="@android:color/white"
|
||||||
|
app:tabGravity="center"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
app:tabMinWidth="75dp"/>
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,14 @@
|
|||||||
|
|
||||||
<include layout="@layout/toolbar"/>
|
<include layout="@layout/toolbar"/>
|
||||||
|
|
||||||
<include layout="@layout/tab_layout"/>
|
<android.support.design.widget.TabLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/Theme.ActionBar.Tab.Filled"
|
||||||
|
app:tabIndicatorColor="@android:color/white" />
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.design.widget.TabLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/tabs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:theme="@style/Theme.ActionBar.Tab"
|
|
||||||
app:tabIndicatorColor="@android:color/white"
|
|
||||||
app:tabGravity="center"
|
|
||||||
app:tabMode="scrollable"
|
|
||||||
app:tabMinWidth="75dp"/>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.design.widget.TabLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/tabs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/Theme.ActionBar.Tab.Filled"
|
|
||||||
app:tabIndicatorColor="@android:color/white"
|
|
||||||
/>
|
|
@ -2,6 +2,14 @@
|
|||||||
<android.support.v7.preference.PreferenceScreen
|
<android.support.v7.preference.PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
||||||
|
android:defaultValue="1"
|
||||||
|
android:entries="@array/themes"
|
||||||
|
android:entryValues="@array/themes_values"
|
||||||
|
android:key="@string/pref_theme_key"
|
||||||
|
android:summary="%s"
|
||||||
|
android:title="@string/pref_theme"/>
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
<eu.kanade.tachiyomi.widget.preference.SimpleDialogPreference
|
||||||
android:dialogLayout="@layout/pref_library_columns"
|
android:dialogLayout="@layout/pref_library_columns"
|
||||||
android:key="@string/pref_library_columns_dialog_key"
|
android:key="@string/pref_library_columns_dialog_key"
|
||||||
@ -16,14 +24,6 @@
|
|||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/pref_library_update_interval"/>
|
android:title="@string/pref_library_update_interval"/>
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.widget.preference.IntListPreference
|
|
||||||
android:defaultValue="1"
|
|
||||||
android:entries="@array/themes"
|
|
||||||
android:entryValues="@array/themes_values"
|
|
||||||
android:key="@string/pref_theme_key"
|
|
||||||
android:summary="%s"
|
|
||||||
android:title="@string/pref_theme"/>
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/pref_update_only_non_completed_key"
|
android:key="@string/pref_update_only_non_completed_key"
|
||||||
|
Loading…
Reference in New Issue
Block a user