Remove reflection to show tracking checkmark

Icon now shows up on the left, but code is less fragile.
This commit is contained in:
arkon 2020-01-19 16:26:38 -05:00
parent 879d260202
commit 5bad914411
2 changed files with 6 additions and 13 deletions

View File

@ -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 }
}
}

View File

@ -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"/>