Binding for Browse Section

This commit is contained in:
Jays2Kings 2021-03-29 17:25:10 -04:00
parent c92b1ce956
commit 96aa91e75d
13 changed files with 155 additions and 156 deletions

View File

@ -2,9 +2,9 @@ package eu.kanade.tachiyomi.ui.extension
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
@ -13,15 +13,17 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.databinding.ExtensionsBottomSheetBinding
import eu.kanade.tachiyomi.databinding.RecyclerWithScrollerBinding
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.ui.extension.details.ExtensionDetailsController import eu.kanade.tachiyomi.ui.extension.details.ExtensionDetailsController
import eu.kanade.tachiyomi.ui.main.MainActivity
import eu.kanade.tachiyomi.ui.migration.MangaAdapter import eu.kanade.tachiyomi.ui.migration.MangaAdapter
import eu.kanade.tachiyomi.ui.migration.MangaItem import eu.kanade.tachiyomi.ui.migration.MangaItem
import eu.kanade.tachiyomi.ui.migration.SourceAdapter import eu.kanade.tachiyomi.ui.migration.SourceAdapter
import eu.kanade.tachiyomi.ui.migration.SourceItem import eu.kanade.tachiyomi.ui.migration.SourceItem
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
import eu.kanade.tachiyomi.ui.source.BrowseController import eu.kanade.tachiyomi.ui.source.BrowseController
import eu.kanade.tachiyomi.util.view.activityBinding
import eu.kanade.tachiyomi.util.view.collapse import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.expand import eu.kanade.tachiyomi.util.view.expand
@ -29,11 +31,6 @@ import eu.kanade.tachiyomi.util.view.isExpanded
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import eu.kanade.tachiyomi.widget.ViewPagerAdapter import eu.kanade.tachiyomi.widget.ViewPagerAdapter
import kotlinx.android.synthetic.main.extensions_bottom_sheet.view.*
import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.migration_controller.*
import kotlinx.android.synthetic.main.recents_controller.*
import kotlinx.android.synthetic.main.recycler_with_scroller.view.*
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -59,13 +56,17 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
private var extensions: List<ExtensionItem> = emptyList() private var extensions: List<ExtensionItem> = emptyList()
var canExpand = false var canExpand = false
private lateinit var binding: ExtensionsBottomSheetBinding
lateinit var controller: BrowseController lateinit var controller: BrowseController
val extensionFrameLayout = val extensionFrameLayout = RecyclerWithScrollerBinding.inflate(LayoutInflater.from(context))
inflate(context, R.layout.recycler_with_scroller, null) as FrameLayout val migrationFrameLayout = RecyclerWithScrollerBinding.inflate(LayoutInflater.from(context))
val migrationFrameLayout =
inflate(context, R.layout.recycler_with_scroller, null) as FrameLayout override fun onFinishInflate() {
super.onFinishInflate()
binding = ExtensionsBottomSheetBinding.bind(this)
}
fun onCreate(controller: BrowseController) { fun onCreate(controller: BrowseController) {
// Initialize adapter, scroll listener and recycler views // Initialize adapter, scroll listener and recycler views
@ -84,17 +85,16 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
migRecyler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context) migRecyler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context)
migRecyler.setHasFixedSize(true) migRecyler.setHasFixedSize(true)
adapter?.fastScroller = extensionFrameLayout.fast_scroller adapter?.fastScroller = extensionFrameLayout.fastScroller
this.controller = controller this.controller = controller
pager.doOnApplyWindowInsets { _, _, _ -> binding.pager.doOnApplyWindowInsets { _, _, _ ->
val bottomBar = val bottomBar = controller.activityBinding?.bottomNav
(this@ExtensionBottomSheet.controller.activity as? MainActivity)?.bottom_nav
extRecyler.updatePaddingRelative(bottom = bottomBar?.height ?: 0) extRecyler.updatePaddingRelative(bottom = bottomBar?.height ?: 0)
migRecyler.updatePaddingRelative(bottom = bottomBar?.height ?: 0) migRecyler.updatePaddingRelative(bottom = bottomBar?.height ?: 0)
} }
pager.adapter = TabbedSheetAdapter() binding.pager.adapter = TabbedSheetAdapter()
tabs.setupWithViewPager(pager) binding.tabs.setupWithViewPager(binding.pager)
tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) { override fun onTabSelected(tab: TabLayout.Tab?) {
if (canExpand) { if (canExpand) {
this@ExtensionBottomSheet.sheetBehavior?.expand() this@ExtensionBottomSheet.sheetBehavior?.expand()
@ -103,34 +103,35 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
when (tab?.position) { when (tab?.position) {
0 -> extensionFrameLayout 0 -> extensionFrameLayout
else -> migrationFrameLayout else -> migrationFrameLayout
}.recycler?.isNestedScrollingEnabled = true }.recycler.isNestedScrollingEnabled = true
when (tab?.position) { when (tab?.position) {
0 -> extensionFrameLayout 0 -> extensionFrameLayout
else -> migrationFrameLayout else -> migrationFrameLayout
}.recycler?.requestLayout() }.recycler.requestLayout()
} }
override fun onTabUnselected(tab: TabLayout.Tab?) { override fun onTabUnselected(tab: TabLayout.Tab?) {
when (tab?.position) { when (tab?.position) {
0 -> extensionFrameLayout 0 -> extensionFrameLayout
else -> migrationFrameLayout else -> migrationFrameLayout
}.recycler?.isNestedScrollingEnabled = false }.recycler.isNestedScrollingEnabled = false
if (tab?.position == 1) { if (tab?.position == 1) {
presenter.deselectSource() presenter.deselectSource()
} }
} }
override fun onTabReselected(tab: TabLayout.Tab?) { override fun onTabReselected(tab: TabLayout.Tab?) {
this@ExtensionBottomSheet.sheetBehavior?.expand() this@ExtensionBottomSheet.sheetBehavior?.expand()
when (tab?.position) { when (tab?.position) {
0 -> extensionFrameLayout 0 -> extensionFrameLayout
else -> migrationFrameLayout else -> migrationFrameLayout
}.recycler?.isNestedScrollingEnabled = true }.recycler.isNestedScrollingEnabled = true
} }
}) })
presenter.onCreate() presenter.onCreate()
updateExtTitle() updateExtTitle()
sheet_layout.setOnClickListener { binding.sheetLayout.setOnClickListener {
if (!sheetBehavior.isExpanded()) { if (!sheetBehavior.isExpanded()) {
sheetBehavior?.expand() sheetBehavior?.expand()
fetchOnlineExtensionsIfNeeded() fetchOnlineExtensionsIfNeeded()
@ -150,8 +151,8 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
fun updateExtTitle() { fun updateExtTitle() {
val extCount = presenter.getExtensionUpdateCount() val extCount = presenter.getExtensionUpdateCount()
if (extCount > 0) tabs.getTabAt(0)?.orCreateBadge if (extCount > 0) binding.tabs.getTabAt(0)?.orCreateBadge
else tabs.getTabAt(0)?.removeBadge() else binding.tabs.getTabAt(0)?.removeBadge()
} }
override fun onButtonClick(position: Int) { override fun onButtonClick(position: Int) {
@ -174,7 +175,7 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
} }
override fun onItemClick(view: View?, position: Int): Boolean { override fun onItemClick(view: View?, position: Int): Boolean {
when (tabs.selectedTabPosition) { when (binding.tabs.selectedTabPosition) {
0 -> { 0 -> {
val extension = val extension =
(adapter?.getItem(position) as? ExtensionItem)?.extension ?: return false (adapter?.getItem(position) as? ExtensionItem)?.extension ?: return false
@ -202,7 +203,7 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
} }
override fun onItemLongClick(position: Int) { override fun onItemLongClick(position: Int) {
if (tabs.selectedTabPosition == 0) { if (binding.tabs.selectedTabPosition == 0) {
val extension = (adapter?.getItem(position) as? ExtensionItem)?.extension ?: return val extension = (adapter?.getItem(position) as? ExtensionItem)?.extension ?: return
if (extension is Extension.Installed || extension is Extension.Untrusted) { if (extension is Extension.Installed || extension is Extension.Untrusted) {
uninstallExtension(extension.pkgName) uninstallExtension(extension.pkgName)
@ -246,7 +247,7 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
if (migAdapter !is SourceAdapter) { if (migAdapter !is SourceAdapter) {
migAdapter = SourceAdapter(this) migAdapter = SourceAdapter(this)
migRecyler.adapter = migAdapter migRecyler.adapter = migAdapter
migAdapter?.fastScroller = migrationFrameLayout.fast_scroller migAdapter?.fastScroller = migrationFrameLayout.fastScroller
} }
migAdapter?.updateDataSet(sources, true) migAdapter?.updateDataSet(sources, true)
} }
@ -256,7 +257,7 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
if (migAdapter !is MangaAdapter) { if (migAdapter !is MangaAdapter) {
migAdapter = MangaAdapter(this) migAdapter = MangaAdapter(this)
migRecyler.adapter = migAdapter migRecyler.adapter = migAdapter
migAdapter?.fastScroller = migrationFrameLayout.fast_scroller migAdapter?.fastScroller = migrationFrameLayout.fastScroller
} }
migAdapter?.updateDataSet(manga, true) migAdapter?.updateDataSet(manga, true)
} }
@ -275,7 +276,7 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
} }
fun canGoBack(): Boolean { fun canGoBack(): Boolean {
if (tabs.selectedTabPosition == 1 && migAdapter is MangaAdapter) { if (binding.tabs.selectedTabPosition == 1 && migAdapter is MangaAdapter) {
presenter.deselectSource() presenter.deselectSource()
return false return false
} }
@ -298,8 +299,8 @@ class ExtensionBottomSheet @JvmOverloads constructor(context: Context, attrs: At
override fun createView(container: ViewGroup, position: Int): View { override fun createView(container: ViewGroup, position: Int): View {
return when (position) { return when (position) {
0 -> extensionFrameLayout 0 -> extensionFrameLayout.root
else -> migrationFrameLayout else -> migrationFrameLayout.root
} }
} }

View File

@ -5,14 +5,16 @@ import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.databinding.ExtensionCardHeaderBinding
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.extension_card_header.*
class ExtensionGroupHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) : class ExtensionGroupHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
private val binding = ExtensionCardHeaderBinding.bind(view)
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
fun bind(item: ExtensionGroupItem) { fun bind(item: ExtensionGroupItem) {
title.text = item.name binding.title.text = item.name
} }
} }

View File

@ -15,8 +15,7 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.resetStrokeColor import eu.kanade.tachiyomi.util.view.resetStrokeColor
import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget import eu.kanade.tachiyomi.data.image.coil.CoverViewTarget
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import kotlinx.android.synthetic.main.extension_card_item.* import eu.kanade.tachiyomi.databinding.ExtensionCardItemBinding
import kotlinx.android.synthetic.main.source_global_search_controller_card_item.*
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.util.Locale import java.util.Locale
@ -24,8 +23,9 @@ import java.util.Locale
class ExtensionHolder(view: View, val adapter: ExtensionAdapter) : class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
private val binding = ExtensionCardItemBinding.bind(view)
init { init {
ext_button.setOnClickListener { binding.extButton.setOnClickListener {
adapter.buttonClickListener.onButtonClick(flexibleAdapterPosition) adapter.buttonClickListener.onButtonClick(flexibleAdapterPosition)
} }
} }
@ -38,10 +38,10 @@ class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
val extension = item.extension val extension = item.extension
// Set source name // Set source name
ext_title.text = extension.name binding.extTitle.text = extension.name
version.text = extension.versionName binding.version.text = extension.versionName
lang.text = LocaleHelper.getDisplayName(extension.lang) binding.lang.text = LocaleHelper.getDisplayName(extension.lang)
warning.text = when { binding.warning.text = when {
extension is Extension.Untrusted -> itemView.context.getString(R.string.untrusted) extension is Extension.Untrusted -> itemView.context.getString(R.string.untrusted)
extension is Extension.Installed && extension.isObsolete -> itemView.context.getString(R.string.obsolete) extension is Extension.Installed && extension.isObsolete -> itemView.context.getString(R.string.obsolete)
extension is Extension.Installed && extension.isUnofficial -> itemView.context.getString(R.string.unofficial) extension is Extension.Installed && extension.isUnofficial -> itemView.context.getString(R.string.unofficial)
@ -49,20 +49,20 @@ class ExtensionHolder(view: View, val adapter: ExtensionAdapter) :
else -> "" else -> ""
}.toUpperCase(Locale.ROOT) }.toUpperCase(Locale.ROOT)
edit_button.clear() binding.sourceImage.clear()
if (extension is Extension.Available) { if (extension is Extension.Available) {
edit_button.load(extension.iconUrl) { binding.sourceImage.load(extension.iconUrl) {
target(CoverViewTarget(edit_button, progress)) target(CoverViewTarget(binding.sourceImage))
} }
} else { } else {
extension.getApplicationIcon(itemView.context)?.let { edit_button.setImageDrawable(it) } extension.getApplicationIcon(itemView.context)?.let { binding.sourceImage.setImageDrawable(it) }
} }
bindButton(item) bindButton(item)
} }
@Suppress("ResourceType") @Suppress("ResourceType")
fun bindButton(item: ExtensionItem) = with(ext_button) { fun bindButton(item: ExtensionItem) = with(binding.extButton) {
isEnabled = true isEnabled = true
isClickable = true isClickable = true
isActivated = false isActivated = false

View File

@ -6,21 +6,22 @@ import coil.api.clear
import coil.api.loadAny import coil.api.loadAny
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.databinding.MangaListItemBinding
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.manga_list_item.*
class MangaHolder( class MangaHolder(
view: View, view: View,
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>> adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
) : BaseFlexibleViewHolder(view, adapter) { ) : BaseFlexibleViewHolder(view, adapter) {
private val binding = MangaListItemBinding.bind(view)
fun bind(item: MangaItem) { fun bind(item: MangaItem) {
// Update the title of the manga. // Update the title of the manga.
title.text = item.manga.title binding.title.text = item.manga.title
subtitle.text = "" binding.subtitle.text = ""
// Update the cover. // Update the cover.
cover_thumbnail.clear() binding.coverThumbnail.clear()
cover_thumbnail.loadAny(item.manga) binding.coverThumbnail.loadAny(item.manga)
} }
} }

View File

@ -1,18 +1,17 @@
package eu.kanade.tachiyomi.ui.migration package eu.kanade.tachiyomi.ui.migration
import android.view.View import android.view.View
import eu.kanade.tachiyomi.databinding.MigrationCardItemBinding
import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.source.icon
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.migration_card_item.*
import kotlinx.android.synthetic.main.source_item.edit_button
import kotlinx.android.synthetic.main.source_item.title
class SourceHolder(view: View, val adapter: SourceAdapter) : class SourceHolder(view: View, val adapter: SourceAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
private val binding = MigrationCardItemBinding.bind(view)
init { init {
migration_all.setOnClickListener { binding.migrationAll.setOnClickListener {
adapter.allClickListener?.onAllClick(flexibleAdapterPosition) adapter.allClickListener.onAllClick(flexibleAdapterPosition)
} }
} }
@ -20,11 +19,11 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
val source = item.source val source = item.source
// Set source name // Set source name
title.text = source.name binding.title.text = source.name
// Set circle letter image. // Set circle letter image.
itemView.post { itemView.post {
edit_button?.setImageDrawable(source.icon()) binding.sourceImage.setImageDrawable(source.icon())
} }
} }
} }

View File

@ -3,16 +3,18 @@ package eu.kanade.tachiyomi.ui.migration.manga.design
import android.graphics.Paint.STRIKE_THRU_TEXT_FLAG import android.graphics.Paint.STRIKE_THRU_TEXT_FLAG
import android.view.View import android.view.View
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.databinding.MigrationSourceItemBinding
import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.source.icon
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.migration_source_item.*
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
class MigrationSourceHolder(view: View, val adapter: MigrationSourceAdapter) : class MigrationSourceHolder(view: View, val adapter: MigrationSourceAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
private val binding = MigrationSourceItemBinding.bind(view)
init { init {
setDragHandleView(reorder) setDragHandleView(binding.reorder)
} }
fun bind(source: HttpSource, sourceEnabled: Boolean) { fun bind(source: HttpSource, sourceEnabled: Boolean) {
@ -20,21 +22,21 @@ class MigrationSourceHolder(view: View, val adapter: MigrationSourceAdapter) :
val isMultiLanguage = preferences.enabledLanguages().get().size > 1 val isMultiLanguage = preferences.enabledLanguages().get().size > 1
// Set capitalized title. // Set capitalized title.
val sourceName = if (isMultiLanguage) source.toString() else source.name.capitalize() val sourceName = if (isMultiLanguage) source.toString() else source.name.capitalize()
title.text = sourceName binding.title.text = sourceName
// Update circle letter image. // Update circle letter image.
itemView.post { itemView.post {
val icon = source.icon() val icon = source.icon()
if (icon != null) edit_button?.setImageDrawable(icon) if (icon != null) binding.sourceImage.setImageDrawable(icon)
} }
if (sourceEnabled) { if (sourceEnabled) {
title.alpha = 1.0f binding.title.alpha = 1.0f
edit_button.alpha = 1.0f binding.sourceImage.alpha = 1.0f
title.paintFlags = title.paintFlags and STRIKE_THRU_TEXT_FLAG.inv() binding.title.paintFlags = binding.title.paintFlags and STRIKE_THRU_TEXT_FLAG.inv()
} else { } else {
title.alpha = DISABLED_ALPHA binding.title.alpha = DISABLED_ALPHA
edit_button.alpha = DISABLED_ALPHA binding.sourceImage.alpha = DISABLED_ALPHA
title.paintFlags = title.paintFlags or STRIKE_THRU_TEXT_FLAG binding.title.paintFlags = binding.title.paintFlags or STRIKE_THRU_TEXT_FLAG
} }
} }

View File

@ -54,15 +54,6 @@ import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.extensions_bottom_sheet.*
import kotlinx.android.synthetic.main.extensions_bottom_sheet.ext_bottom_sheet
import kotlinx.android.synthetic.main.extensions_bottom_sheet.sheet_layout
import kotlinx.android.synthetic.main.extensions_bottom_sheet.view.*
import kotlinx.android.synthetic.main.filter_bottom_sheet.*
import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.recycler_with_scroller.view.*
import kotlinx.android.synthetic.main.rounded_category_hopper.*
import kotlinx.android.synthetic.main.browse_controller.*
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import kotlin.math.max import kotlin.math.max
@ -110,7 +101,7 @@ class BrowseController :
override fun getTitle(): String? { override fun getTitle(): String? {
return if (showingExtensions) { return if (showingExtensions) {
view?.context?.getString( view?.context?.getString(
when (ext_bottom_sheet.tabs.selectedTabPosition) { when (binding.bottomSheet.tabs.selectedTabPosition) {
0 -> R.string.extensions 0 -> R.string.extensions
else -> R.string.source_migration else -> R.string.source_migration
} }
@ -130,7 +121,8 @@ class BrowseController :
* @return inflated view. * @return inflated view.
*/ */
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
return inflater.inflate(R.layout.browse_controller, container, false) binding = BrowseControllerBinding.inflate(inflater)
return binding.root
} }
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
@ -138,42 +130,41 @@ class BrowseController :
adapter = SourceAdapter(this) adapter = SourceAdapter(this)
// Create recycler and set adapter. // Create binding.recycler and set adapter.
recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) binding.recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
recycler.adapter = adapter binding.recycler.adapter = adapter
adapter?.isSwipeEnabled = true adapter?.isSwipeEnabled = true
// recycler.addItemDecoration(SourceDividerItemDecoration(view.context)) // binding.recycler.addItemDecoration(SourceDividerItemDecoration(view.context))
val attrsArray = intArrayOf(android.R.attr.actionBarSize) val attrsArray = intArrayOf(android.R.attr.actionBarSize)
val array = view.context.obtainStyledAttributes(attrsArray) val array = view.context.obtainStyledAttributes(attrsArray)
val appBarHeight = array.getDimensionPixelSize(0, 0) val appBarHeight = array.getDimensionPixelSize(0, 0)
array.recycle() array.recycle()
scrollViewWith( scrollViewWith(
recycler, binding.recycler,
afterInsets = { afterInsets = {
headerHeight = it.systemWindowInsetTop + appBarHeight headerHeight = it.systemWindowInsetTop + appBarHeight
recycler.updatePaddingRelative(bottom = activity?.bottom_nav?.height ?: 0) binding.recycler.updatePaddingRelative(bottom = activityBinding?.bottomNav?.height ?: 0)
}, },
onBottomNavUpdate = { onBottomNavUpdate = {
setBottomPadding() setBottomPadding()
} }
) )
recycler?.post { binding.recycler?.post {
setBottomSheetTabs(if (ext_bottom_sheet?.sheetBehavior.isCollapsed()) 0f else 1f) setBottomSheetTabs(if (binding.bottomSheet.extBottomSheet?.sheetBehavior.isCollapsed()) 0f else 1f)
} }
requestPermissionsSafe(arrayOf(WRITE_EXTERNAL_STORAGE), 301) requestPermissionsSafe(arrayOf(WRITE_EXTERNAL_STORAGE), 301)
ext_bottom_sheet.onCreate(this) binding.bottomSheet.extBottomSheet.onCreate(this)
ext_bottom_sheet.sheetBehavior?.addBottomSheetCallback( binding.bottomSheet.extBottomSheet.sheetBehavior?.addBottomSheetCallback(
object : BottomSheetBehavior object : BottomSheetBehavior
.BottomSheetCallback() { .BottomSheetCallback() {
override fun onSlide(bottomSheet: View, progress: Float) { override fun onSlide(bottomSheet: View, progress: Float) {
val recycler = recycler ?: return binding.shadow2.alpha = (1 - max(0f, progress)) * 0.25f
shadow2?.alpha = (1 - max(0f, progress)) * 0.25f
activityBinding?.appBar?.elevation = min( activityBinding?.appBar?.elevation = min(
(1f - progress) * 15f, (1f - progress) * 15f,
if (recycler.canScrollVertically(-1)) 15f else 0f if (binding.recycler.canScrollVertically(-1)) 15f else 0f
) )
activityBinding?.appBar?.y = max(activityBinding!!.appBar.y, -headerHeight * (1 - progress)) activityBinding?.appBar?.y = max(activityBinding!!.appBar.y, -headerHeight * (1 - progress))
val oldShow = showingExtensions val oldShow = showingExtensions
@ -186,7 +177,7 @@ class BrowseController :
} }
override fun onStateChanged(p0: View, state: Int) { override fun onStateChanged(p0: View, state: Int) {
val extBottomSheet = ext_bottom_sheet ?: return val extBottomSheet = binding.bottomSheet.extBottomSheet ?: return
if (state == BottomSheetBehavior.STATE_EXPANDED) { if (state == BottomSheetBehavior.STATE_EXPANDED) {
activityBinding?.appBar?.y = 0f activityBinding?.appBar?.y = 0f
} }
@ -204,8 +195,8 @@ class BrowseController :
retainViewMode = if (state == BottomSheetBehavior.STATE_EXPANDED) { retainViewMode = if (state == BottomSheetBehavior.STATE_EXPANDED) {
RetainViewMode.RETAIN_DETACH RetainViewMode.RETAIN_DETACH
} else RetainViewMode.RELEASE_DETACH } else RetainViewMode.RELEASE_DETACH
sheet_layout.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED binding.bottomSheet.sheetLayout.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED
sheet_layout.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED binding.bottomSheet.sheetLayout.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED
if (state == BottomSheetBehavior.STATE_COLLAPSED || state == BottomSheetBehavior.STATE_EXPANDED) { if (state == BottomSheetBehavior.STATE_COLLAPSED || state == BottomSheetBehavior.STATE_EXPANDED) {
setBottomSheetTabs(if (state == BottomSheetBehavior.STATE_COLLAPSED) 0f else 1f) setBottomSheetTabs(if (state == BottomSheetBehavior.STATE_COLLAPSED) 0f else 1f)
} }
@ -214,7 +205,7 @@ class BrowseController :
) )
if (showingExtensions) { if (showingExtensions) {
ext_bottom_sheet.sheetBehavior?.expand() binding.bottomSheet.extBottomSheet.sheetBehavior?.expand()
} }
} }
@ -224,22 +215,22 @@ class BrowseController :
} }
fun setBottomSheetTabs(progress: Float) { fun setBottomSheetTabs(progress: Float) {
val bottomSheet = ext_bottom_sheet ?: return val bottomSheet = binding.bottomSheet.extBottomSheet ?: return
ext_bottom_sheet.tabs.updateLayoutParams<ViewGroup.MarginLayoutParams> { binding.bottomSheet.tabs.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = ((activityBinding?.appBar?.height?.minus(9f.dpToPx) ?: 0f) * progress).toInt() topMargin = ((activityBinding?.appBar?.height?.minus(9f.dpToPx) ?: 0f) * progress).toInt()
} }
val selectedColor = ColorUtils.setAlphaComponent( val selectedColor = ColorUtils.setAlphaComponent(
ContextCompat.getColor(ext_bottom_sheet.tabs.context, R.color.colorAccent), ContextCompat.getColor(binding.bottomSheet.tabs.context, R.color.colorAccent),
(progress * 255).toInt() (progress * 255).toInt()
) )
val unselectedColor = ColorUtils.setAlphaComponent( val unselectedColor = ColorUtils.setAlphaComponent(
bottomSheet.context.getResourceColor(R.attr.colorOnBackground), bottomSheet.context.getResourceColor(R.attr.colorOnBackground),
153 153
) )
ext_bottom_sheet.sheet_layout.elevation = progress * 5 binding.bottomSheet.sheetLayout.elevation = progress * 5
ext_bottom_sheet.pager.alpha = progress * 10 binding.bottomSheet.pager.alpha = progress * 10
ext_bottom_sheet.tabs.setSelectedTabIndicatorColor(selectedColor) binding.bottomSheet.tabs.setSelectedTabIndicatorColor(selectedColor)
ext_bottom_sheet.tabs.setTabTextColors( binding.bottomSheet.tabs.setTabTextColors(
ColorUtils.blendARGB( ColorUtils.blendARGB(
bottomSheet.context.getResourceColor(R.attr.actionBarTintColor), bottomSheet.context.getResourceColor(R.attr.actionBarTintColor),
unselectedColor, unselectedColor,
@ -252,7 +243,7 @@ class BrowseController :
) )
) )
ext_bottom_sheet.sheet_layout.backgroundTintList = ColorStateList.valueOf( binding.bottomSheet.sheetLayout.backgroundTintList = ColorStateList.valueOf(
ColorUtils.blendARGB( ColorUtils.blendARGB(
bottomSheet.context.getResourceColor(R.attr.colorPrimaryVariant), bottomSheet.context.getResourceColor(R.attr.colorPrimaryVariant),
bottomSheet.context.getResourceColor(R.attr.colorSecondary), bottomSheet.context.getResourceColor(R.attr.colorSecondary),
@ -262,43 +253,43 @@ class BrowseController :
} }
private fun setBottomPadding() { private fun setBottomPadding() {
val bottomBar = activity?.bottom_nav ?: return val bottomBar = activityBinding?.bottomNav ?: return
ext_bottom_sheet ?: return binding.bottomSheet.extBottomSheet ?: return
val pad = bottomBar.translationY - bottomBar.height val pad = bottomBar.translationY - bottomBar.height
val padding = max( val padding = max(
(-pad).toInt(), (-pad).toInt(),
if (ext_bottom_sheet.sheetBehavior.isExpanded()) 0 else { if (binding.bottomSheet.extBottomSheet.sheetBehavior.isExpanded()) 0 else {
view?.rootWindowInsets?.systemWindowInsetBottom ?: 0 view?.rootWindowInsets?.systemWindowInsetBottom ?: 0
} }
) )
shadow2.translationY = pad binding.shadow2.translationY = pad
ext_bottom_sheet.sheetBehavior?.peekHeight = 58.spToPx + padding binding.bottomSheet.extBottomSheet.sheetBehavior?.peekHeight = 58.spToPx + padding
ext_bottom_sheet.extensionFrameLayout.fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> { binding.bottomSheet.extBottomSheet.extensionFrameLayout.fastScroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = -pad.toInt() bottomMargin = -pad.toInt()
} }
ext_bottom_sheet.migrationFrameLayout.fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> { binding.bottomSheet.extBottomSheet.migrationFrameLayout.fastScroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = -pad.toInt() bottomMargin = -pad.toInt()
} }
} }
override fun showSheet() { override fun showSheet() {
ext_bottom_sheet.sheetBehavior?.expand() binding.bottomSheet.extBottomSheet.sheetBehavior?.expand()
} }
override fun toggleSheet() { override fun toggleSheet() {
if (!ext_bottom_sheet.sheetBehavior.isCollapsed()) { if (!binding.bottomSheet.extBottomSheet.sheetBehavior.isCollapsed()) {
ext_bottom_sheet.sheetBehavior?.collapse() binding.bottomSheet.extBottomSheet.sheetBehavior?.collapse()
} else { } else {
ext_bottom_sheet.sheetBehavior?.expand() binding.bottomSheet.extBottomSheet.sheetBehavior?.expand()
} }
} }
override fun sheetIsExpanded(): Boolean = ext_bottom_sheet.sheetBehavior.isExpanded() override fun sheetIsExpanded(): Boolean = binding.bottomSheet.extBottomSheet.sheetBehavior.isExpanded()
override fun handleSheetBack(): Boolean { override fun handleSheetBack(): Boolean {
if (!ext_bottom_sheet.sheetBehavior.isCollapsed()) { if (!binding.bottomSheet.extBottomSheet.sheetBehavior.isCollapsed()) {
if (ext_bottom_sheet.canGoBack()) { if (binding.bottomSheet.extBottomSheet.canGoBack()) {
ext_bottom_sheet.sheetBehavior?.collapse() binding.bottomSheet.extBottomSheet.sheetBehavior?.collapse()
} }
return true return true
} }
@ -313,20 +304,20 @@ class BrowseController :
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) { override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeStarted(handler, type) super.onChangeStarted(handler, type)
if (!type.isPush) { if (!type.isPush) {
ext_bottom_sheet.updateExtTitle() binding.bottomSheet.extBottomSheet.updateExtTitle()
ext_bottom_sheet.presenter.refreshExtensions() binding.bottomSheet.extBottomSheet.presenter.refreshExtensions()
presenter.updateSources() presenter.updateSources()
} }
if (!type.isEnter) { if (!type.isEnter) {
ext_bottom_sheet.canExpand = false binding.bottomSheet.extBottomSheet.canExpand = false
activityBinding?.appBar?.elevation = activityBinding?.appBar?.elevation =
when { when {
ext_bottom_sheet.sheetBehavior.isExpanded() -> 0f binding.bottomSheet.extBottomSheet.sheetBehavior.isExpanded() -> 0f
recycler.canScrollVertically(-1) -> 15f binding.recycler.canScrollVertically(-1) -> 15f
else -> 0f else -> 0f
} }
} else { } else {
ext_bottom_sheet.presenter.refreshMigrations() binding.bottomSheet.extBottomSheet.presenter.refreshMigrations()
} }
setBottomPadding() setBottomPadding()
} }
@ -334,15 +325,15 @@ class BrowseController :
override fun onChangeEnded(handler: ControllerChangeHandler, type: ControllerChangeType) { override fun onChangeEnded(handler: ControllerChangeHandler, type: ControllerChangeType) {
super.onChangeEnded(handler, type) super.onChangeEnded(handler, type)
if (type.isEnter) { if (type.isEnter) {
ext_bottom_sheet.canExpand = true binding.bottomSheet.extBottomSheet.canExpand = true
setBottomPadding() setBottomPadding()
} }
} }
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity) super.onActivityResumed(activity)
ext_bottom_sheet?.presenter?.refreshExtensions() binding.bottomSheet.extBottomSheet?.presenter?.refreshExtensions()
ext_bottom_sheet?.presenter?.refreshMigrations() binding.bottomSheet.extBottomSheet?.presenter?.refreshMigrations()
setBottomPadding() setBottomPadding()
} }
@ -362,7 +353,7 @@ class BrowseController :
presenter.updateSources() presenter.updateSources()
snackbar = view?.snack(R.string.source_hidden, Snackbar.LENGTH_INDEFINITE) { snackbar = view?.snack(R.string.source_hidden, Snackbar.LENGTH_INDEFINITE) {
anchorView = ext_bottom_sheet anchorView = binding.bottomSheet.extBottomSheet
setAction(R.string.undo) { setAction(R.string.undo) {
val newCurrent = preferences.hiddenSources().get() val newCurrent = preferences.hiddenSources().get()
preferences.hiddenSources().set(newCurrent - source.id.toString()) preferences.hiddenSources().set(newCurrent - source.id.toString())
@ -410,8 +401,8 @@ class BrowseController :
} }
override fun expandSearch() { override fun expandSearch() {
if (showingExtensions) ext_bottom_sheet.sheetBehavior?.collapse() if (showingExtensions) binding.bottomSheet.extBottomSheet.sheetBehavior?.collapse()
else activity?.toolbar?.menu?.findItem(R.id.action_search)?.expandActionView() else activityBinding?.toolbar?.menu?.findItem(R.id.action_search)?.expandActionView()
} }
/** /**
@ -423,7 +414,7 @@ class BrowseController :
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
if (onRoot) (activity as? MainActivity)?.setDismissIcon(showingExtensions) if (onRoot) (activity as? MainActivity)?.setDismissIcon(showingExtensions)
if (showingExtensions) { if (showingExtensions) {
if (ext_bottom_sheet.tabs.selectedTabPosition == 0) { if (binding.bottomSheet.tabs.selectedTabPosition == 0) {
// Inflate menu // Inflate menu
inflater.inflate(R.menu.extension_main, menu) inflater.inflate(R.menu.extension_main, menu)
@ -437,7 +428,7 @@ class BrowseController :
// Create query listener which opens the global search view. // Create query listener which opens the global search view.
setOnQueryTextChangeListener(searchView) { setOnQueryTextChangeListener(searchView) {
extQuery = it ?: "" extQuery = it ?: ""
ext_bottom_sheet.drawExtensions() binding.bottomSheet.extBottomSheet.drawExtensions()
true true
} }
} else { } else {

View File

@ -3,22 +3,24 @@ package eu.kanade.tachiyomi.ui.source
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.view.View import android.view.View
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.SourceItemBinding
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.source.icon
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
import kotlinx.android.synthetic.main.source_item.*
class SourceHolder(view: View, val adapter: SourceAdapter) : class SourceHolder(view: View, val adapter: SourceAdapter) :
BaseFlexibleViewHolder(view, adapter) { BaseFlexibleViewHolder(view, adapter) {
val binding = SourceItemBinding.bind(view)
init { init {
source_pin.setOnClickListener { binding.sourcePin.setOnClickListener {
adapter.sourceListener.onPinClick(flexibleAdapterPosition) adapter.sourceListener.onPinClick(flexibleAdapterPosition)
} }
source_latest.setOnClickListener { binding.sourceLatest.setOnClickListener {
adapter.sourceListener.onLatestClick(flexibleAdapterPosition) adapter.sourceListener.onLatestClick(flexibleAdapterPosition)
} }
} }
@ -28,10 +30,10 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
// setCardEdges(item) // setCardEdges(item)
// Set source name // Set source name
title.text = source.name binding.title.text = source.name
val isPinned = item.isPinned ?: item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false val isPinned = item.isPinned ?: item.header?.code?.equals(SourcePresenter.PINNED_KEY) ?: false
source_pin.apply { binding.sourcePin.apply {
imageTintList = ColorStateList.valueOf( imageTintList = ColorStateList.valueOf(
context.getResourceColor( context.getResourceColor(
if (isPinned) R.attr.colorAccent if (isPinned) R.attr.colorAccent
@ -48,27 +50,27 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
itemView.post { itemView.post {
val icon = source.icon() val icon = source.icon()
when { when {
icon != null -> edit_button.setImageDrawable(icon) icon != null -> binding.sourceImage.setImageDrawable(icon)
item.source.id == LocalSource.ID -> edit_button.setImageResource(R.mipmap.ic_local_source) item.source.id == LocalSource.ID -> binding.sourceImage.setImageResource(R.mipmap.ic_local_source)
} }
} }
if (source.supportsLatest) { if (source.supportsLatest) {
source_latest.visible() binding.sourceLatest.visible()
} else { } else {
source_latest.gone() binding.sourceLatest.gone()
} }
} }
override fun getFrontView(): View { override fun getFrontView(): View {
return card return binding.card
} }
override fun getRearLeftView(): View { override fun getRearLeftView(): View {
return left_view return binding.leftView
} }
override fun getRearRightView(): View { override fun getRearRightView(): View {
return right_view return binding.rightView
} }
} }

View File

@ -30,9 +30,10 @@
android:background="@drawable/shape_gradient_top_shadow" android:background="@drawable/shape_gradient_top_shadow"
android:paddingBottom="10dp" android:paddingBottom="10dp"
app:layout_anchorGravity="top" app:layout_anchorGravity="top"
app:layout_anchor="@id/ext_bottom_sheet" /> app:layout_anchor="@id/bottom_sheet" />
<!-- Adding bottom sheet after main content --> <!-- Adding bottom sheet after main content -->
<include layout="@layout/extensions_bottom_sheet"/> <include layout="@layout/extensions_bottom_sheet"
android:id="@+id/bottom_sheet"/>
<View <View
android:id="@+id/shadow2" android:id="@+id/shadow2"

View File

@ -12,7 +12,7 @@
android:background="@drawable/list_item_selector"> android:background="@drawable/list_item_selector">
<ImageView <ImageView
android:id="@+id/edit_button" android:id="@+id/source_image"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:padding="12dp" android:padding="12dp"
@ -34,7 +34,7 @@
android:textSize="14sp" android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/lang" app:layout_constraintBottom_toTopOf="@id/lang"
app:layout_constraintEnd_toStartOf="@id/ext_button" app:layout_constraintEnd_toStartOf="@id/ext_button"
app:layout_constraintStart_toEndOf="@id/edit_button" app:layout_constraintStart_toEndOf="@id/source_image"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
tools:text="Batoto" /> tools:text="Batoto" />
@ -47,7 +47,7 @@
android:maxLines="1" android:maxLines="1"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/edit_button" app:layout_constraintStart_toEndOf="@id/source_image"
app:layout_constraintTop_toBottomOf="@+id/ext_title" app:layout_constraintTop_toBottomOf="@+id/ext_title"
tools:text="English" tools:text="English"
tools:visibility="visible" /> tools:visibility="visible" />

View File

@ -13,7 +13,7 @@
android:background="@drawable/list_item_selector"> android:background="@drawable/list_item_selector">
<ImageView <ImageView
android:id="@+id/edit_button" android:id="@+id/source_image"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@ -34,7 +34,7 @@
android:ellipsize="end" android:ellipsize="end"
android:textAppearance="@style/TextAppearance.Regular.SubHeading" android:textAppearance="@style/TextAppearance.Regular.SubHeading"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/edit_button" app:layout_constraintStart_toEndOf="@id/source_image"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/migration_all" app:layout_constraintEnd_toStartOf="@+id/migration_all"
tools:text="Source title"/> tools:text="Source title"/>

View File

@ -8,7 +8,7 @@
android:background="@drawable/list_item_selector"> android:background="@drawable/list_item_selector">
<ImageView <ImageView
android:id="@+id/edit_button" android:id="@+id/source_image"
android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height" android:layout_width="@dimen/material_component_lists_single_line_with_avatar_height"
android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height" android:layout_height="@dimen/material_component_lists_single_line_with_avatar_height"
android:paddingLeft="@dimen/material_component_lists_icon_left_padding" android:paddingLeft="@dimen/material_component_lists_icon_left_padding"

View File

@ -51,7 +51,7 @@
android:background="@drawable/list_item_selector"> android:background="@drawable/list_item_selector">
<ImageView <ImageView
android:id="@+id/edit_button" android:id="@+id/source_image"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
@ -73,7 +73,7 @@
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/source_latest" app:layout_constraintEnd_toStartOf="@+id/source_latest"
app:layout_constraintStart_toEndOf="@+id/edit_button" app:layout_constraintStart_toEndOf="@+id/source_image"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Source title" /> tools:text="Source title" />
@ -98,7 +98,7 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:src="@drawable/ic_pin_24dp" android:src="@drawable/ic_pin_24dp"
android:tint="?colorAccent" app:tint="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"