diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index 69ab7003e0..2d427c07b9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -2,18 +2,16 @@ package eu.kanade.tachiyomi.ui.manga import android.Manifest.permission.WRITE_EXTERNAL_STORAGE import android.os.Bundle -import com.google.android.material.tabs.TabLayout -import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.LinearLayout -import android.widget.TextView +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat import com.bluelinelabs.conductor.ControllerChangeHandler import com.bluelinelabs.conductor.ControllerChangeType import com.bluelinelabs.conductor.Router import com.bluelinelabs.conductor.RouterTransaction import com.bluelinelabs.conductor.support.RouterPagerAdapter +import com.google.android.material.tabs.TabLayout import com.jakewharton.rxrelay.BehaviorRelay import com.jakewharton.rxrelay.PublishRelay import eu.kanade.tachiyomi.R @@ -29,8 +27,8 @@ import eu.kanade.tachiyomi.ui.manga.chapter.ChaptersController import eu.kanade.tachiyomi.ui.manga.info.MangaInfoController import eu.kanade.tachiyomi.ui.manga.track.TrackController import eu.kanade.tachiyomi.util.toast -import kotlinx.android.synthetic.main.main_activity.* -import kotlinx.android.synthetic.main.manga_controller.* +import kotlinx.android.synthetic.main.main_activity.tabs +import kotlinx.android.synthetic.main.manga_controller.manga_pager import rx.Subscription import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -140,10 +138,7 @@ class MangaController : RxController, TabbedController { VectorDrawableCompat.create(resources!!, R.drawable.ic_done_white_18dp, null) else null - val view = tabField.get(tab) as LinearLayout - val textView = view.getChildAt(1) as TextView - textView.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null) - textView.compoundDrawablePadding = if (visible) 4 else 0 + tab.icon = drawable } private inner class MangaDetailAdapter : RouterPagerAdapter(this@MangaController) { @@ -185,9 +180,6 @@ class MangaController : RxController, TabbedController { const val INFO_CONTROLLER = 0 const val CHAPTERS_CONTROLLER = 1 const val TRACK_CONTROLLER = 2 - - private val tabField = TabLayout.Tab::class.java.getDeclaredField("view") - .apply { isAccessible = true } } } diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index 23310e5190..d7e6e1bf45 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -31,6 +31,7 @@ android:layout_height="wrap_content" android:theme="@style/Theme.ActionBar.Tab" app:tabIndicatorColor="@android:color/white" + app:tabInlineLabel="true" app:tabGravity="center" app:tabMode="scrollable" app:tabMinWidth="75dp"/>