mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 00:01:54 +01:00
Replace some usages of findViewById
This commit is contained in:
parent
135c371d88
commit
5ef5087406
@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.ui.base.controller.FabController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.view.shrinkOnScroll
|
||||
import kotlinx.android.synthetic.main.main_activity.root_coordinator
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
@ -197,7 +198,7 @@ class CategoryController :
|
||||
R.id.action_delete -> {
|
||||
undoHelper = UndoHelper(adapter, this)
|
||||
undoHelper?.start(
|
||||
adapter.selectedPositions, activity!!.findViewById(R.id.root_coordinator),
|
||||
adapter.selectedPositions, activity!!.root_coordinator,
|
||||
R.string.snack_categories_deleted, R.string.action_undo, 3000
|
||||
)
|
||||
|
||||
|
@ -48,6 +48,8 @@ import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import java.util.Date
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlinx.android.synthetic.main.main_activity.appbar
|
||||
import kotlinx.android.synthetic.main.main_activity.tabs
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
@ -114,8 +116,7 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||
true
|
||||
}
|
||||
|
||||
val container: ViewGroup = findViewById(R.id.controller_container)
|
||||
|
||||
val container: ViewGroup = binding.controllerContainer
|
||||
router = Conductor.attachRouter(this, container, savedInstanceState)
|
||||
if (!router.hasRootController()) {
|
||||
// Set start screen
|
||||
@ -428,8 +429,8 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||
* collapsing AppBarLayout.
|
||||
*/
|
||||
fun View.offsetAppbarHeight(activity: Activity) {
|
||||
val appbar: AppBarLayout = activity.findViewById(R.id.appbar)
|
||||
val tabs: TabLayout = activity.findViewById(R.id.tabs)
|
||||
val appbar: AppBarLayout = activity.appbar
|
||||
val tabs: TabLayout = activity.tabs
|
||||
appbar.addOnOffsetChangedListener(
|
||||
AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset ->
|
||||
val maxAbsOffset = appBarLayout.measuredHeight - tabs.measuredHeight
|
||||
|
@ -13,7 +13,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ActionMode
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.recyclerview.widget.ConcatAdapter
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
@ -69,6 +68,7 @@ import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.shrinkOnScroll
|
||||
import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import kotlinx.android.synthetic.main.main_activity.root_coordinator
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
@ -516,7 +516,7 @@ class MangaController :
|
||||
private fun toggleFavorite() {
|
||||
val isNowFavorite = presenter.toggleFavorite()
|
||||
if (activity != null && !isNowFavorite && presenter.hasDownloads()) {
|
||||
activity!!.findViewById<CoordinatorLayout>(R.id.root_coordinator)?.snack(activity!!.getString(R.string.delete_downloads_for_manga)) {
|
||||
activity!!.root_coordinator?.snack(activity!!.getString(R.string.delete_downloads_for_manga)) {
|
||||
setAction(R.string.action_delete) {
|
||||
presenter.deleteDownloads()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user