diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt deleted file mode 100644 index 71ef190053..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/LoginSource.kt +++ /dev/null @@ -1,14 +0,0 @@ -package eu.kanade.tachiyomi.source.online - -import eu.kanade.tachiyomi.source.Source -import okhttp3.Response -import rx.Observable - -interface LoginSource : Source { - - fun isLogged(): Boolean - - fun login(username: String, password: String): Observable - - fun isAuthenticationSuccessful(response: Response): Boolean -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt index b7f80ba0e7..b57fb25674 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CatalogueController.kt @@ -75,7 +75,7 @@ class CatalogueController : NucleusController(), var headerHeight = 0 - var showingExtenions = false + var showingExtensions = false /** * Called when controller is initialized. @@ -85,7 +85,7 @@ class CatalogueController : NucleusController(), } override fun getTitle(): String? { - return if (showingExtenions) + return if (showingExtensions) applicationContext?.getString(R.string.extensions) else applicationContext?.getString(R.string.sources) } @@ -114,7 +114,7 @@ class CatalogueController : NucleusController(), // Create recycler and set adapter. recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) recycler.adapter = adapter - recycler.addItemDecoration(SourceDividerItemDecoration(view.context)) + // recycler.addItemDecoration(SourceDividerItemDecoration(view.context)) val attrsArray = intArrayOf(android.R.attr.actionBarSize) val array = view.context.obtainStyledAttributes(attrsArray) val appBarHeight = array.getDimensionPixelSize(0, 0) @@ -135,9 +135,9 @@ class CatalogueController : NucleusController(), sheet_layout.alpha = 1 - progress activity?.appbar?.y = max(activity!!.appbar.y, -headerHeight * (1 - progress)) - val oldShow = showingExtenions - showingExtenions = progress > 0.92f - if (oldShow != showingExtenions) { + val oldShow = showingExtensions + showingExtensions = progress > 0.92f + if (oldShow != showingExtensions) { setTitle() activity?.invalidateOptionsMenu() } @@ -149,7 +149,7 @@ class CatalogueController : NucleusController(), state == BottomSheetBehavior.STATE_COLLAPSED) { sheet_layout.alpha = if (state == BottomSheetBehavior.STATE_COLLAPSED) 1f else 0f - showingExtenions = state == BottomSheetBehavior.STATE_EXPANDED + showingExtensions = state == BottomSheetBehavior.STATE_EXPANDED setTitle() if (state == BottomSheetBehavior.STATE_EXPANDED) ext_bottom_sheet.fetchOnlineExtensionsIfNeeded() @@ -164,7 +164,7 @@ class CatalogueController : NucleusController(), } }) - if (showingExtenions) { + if (showingExtensions) { ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED } } @@ -276,7 +276,7 @@ class CatalogueController : NucleusController(), } override fun expandSearch() { - if (showingExtenions) + if (showingExtensions) ext_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED else activity?.toolbar?.menu?.findItem(R.id.action_search)?.expandActionView() } @@ -288,8 +288,8 @@ class CatalogueController : NucleusController(), * @param inflater used to load the menu xml. */ override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - if (onRoot) (activity as? MainActivity)?.setDismissIcon(showingExtenions) - if (showingExtenions) { + if (onRoot) (activity as? MainActivity)?.setDismissIcon(showingExtensions) + if (showingExtensions) { // Inflate menu inflater.inflate(R.menu.extension_main, menu) @@ -340,7 +340,7 @@ class CatalogueController : NucleusController(), // Initialize option to open catalogue settings. R.id.action_filter -> { val controller = - if (showingExtenions) + if (showingExtensions) SettingsExtensionsController() else SettingsSourcesController() router.pushController( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt index a268f29e43..403debef83 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceDividerItemDecoration.kt @@ -26,8 +26,8 @@ class SourceDividerItemDecoration(context: Context) : androidx.recyclerview.widg val params = child.layoutParams as androidx.recyclerview.widget.RecyclerView.LayoutParams val top = child.bottom + params.bottomMargin val bottom = top + divider.intrinsicHeight - val left = parent.paddingStart + holder.margin - val right = parent.width - parent.paddingEnd - holder.margin + val left = parent.paddingStart // + holder.margin + val right = parent.width - parent.paddingEnd // - holder.margin divider.setBounds(left, top, right, bottom) divider.draw(c) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceHolder.kt index 3245948790..54af3f6f92 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/SourceHolder.kt @@ -1,33 +1,24 @@ package eu.kanade.tachiyomi.ui.catalogue import android.view.View -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.icon -import eu.kanade.tachiyomi.source.online.LoginSource import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder -import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.roundTextIcon import eu.kanade.tachiyomi.util.view.visible -import io.github.mthli.slice.Slice import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.* -class SourceHolder(view: View, override val adapter: CatalogueAdapter) : - BaseFlexibleViewHolder(view, adapter), - SlicedHolder { +class SourceHolder(view: View, val adapter: CatalogueAdapter) : + BaseFlexibleViewHolder(view, adapter) { - override val slice = Slice(card).apply { + /*override val slice = Slice(card).apply { setColor(adapter.cardBackground) } override val viewToSlice: View - get() = card + get() = card*/ init { - source_browse.setOnClickListener { - adapter.browseClickListener.onBrowseClick(adapterPosition) - } - source_latest.setOnClickListener { adapter.latestClickListener.onLatestClick(adapterPosition) } @@ -35,7 +26,7 @@ class SourceHolder(view: View, override val adapter: CatalogueAdapter) : fun bind(item: SourceItem) { val source = item.source - setCardEdges(item) + // setCardEdges(item) // Set source name title.text = source.name @@ -47,17 +38,10 @@ class SourceHolder(view: View, override val adapter: CatalogueAdapter) : else edit_button.roundTextIcon(source.name) } - // If source is login, show only login option - if (source is LoginSource && !source.isLogged()) { - source_browse.setText(R.string.login) - source_latest.gone() + if (source.supportsLatest) { + source_latest.visible() } else { - source_browse.setText(R.string.browse) - if (source.supportsLatest) { - source_latest.visible() - } else { - source_latest.gone() - } + source_latest.gone() } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchPresenter.kt index 887fee8515..d6e0698d11 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/global_search/CatalogueSearchPresenter.kt @@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.SManga -import eu.kanade.tachiyomi.source.online.LoginSource import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCataloguePresenter import rx.Observable @@ -104,8 +103,8 @@ open class CatalogueSearchPresenter( val languages = preferencesHelper.enabledLanguages().getOrDefault() val hiddenCatalogues = preferencesHelper.hiddenCatalogues().getOrDefault() - return sourceManager.getCatalogueSources().filter { it.lang in languages } - .filterNot { it is LoginSource && !it.isLogged() } + return sourceManager.getCatalogueSources() + .filter { it.lang in languages } .filterNot { it.id.toString() in hiddenCatalogues } .sortedBy { "(${it.lang}) ${it.name}" } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt index b25fd604af..2bd2bc7b7d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceHolder.kt @@ -1,13 +1,15 @@ package eu.kanade.tachiyomi.ui.migration import android.view.View -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.icon import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.SlicedHolder import eu.kanade.tachiyomi.util.view.roundTextIcon import io.github.mthli.slice.Slice -import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.* +import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.card +import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.edit_button +import kotlinx.android.synthetic.main.catalogue_main_controller_card_item.title +import kotlinx.android.synthetic.main.migration_card_item.* class SourceHolder(view: View, override val adapter: SourceAdapter) : BaseFlexibleViewHolder(view, adapter), @@ -21,12 +23,10 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : get() = card init { - source_latest.text = view.context.getString(R.string.auto) - source_browse.setText(R.string.select) - source_browse.setOnClickListener { + migration_auto.setOnClickListener { adapter.selectClickListener?.onSelectClick(adapterPosition) } - source_latest.setOnClickListener { + migration_select.setOnClickListener { adapter.autoClickListener?.onAutoClick(adapterPosition) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt index 6668d252dd..267c625841 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SourceItem.kt @@ -21,7 +21,7 @@ data class SourceItem(val source: Source, val header: SelectionHeader? = null) : * Returns the layout resource of this item. */ override fun getLayoutRes(): Int { - return R.layout.catalogue_main_controller_card_item + return R.layout.migration_card_item } /** diff --git a/app/src/main/res/drawable/ic_alert_octagram_24dp.xml b/app/src/main/res/drawable/ic_alert_octagram_24dp.xml new file mode 100644 index 0000000000..5f2b7e1afb --- /dev/null +++ b/app/src/main/res/drawable/ic_alert_octagram_24dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/catalogue_main_controller_card.xml b/app/src/main/res/layout/catalogue_main_controller_card.xml index e0ba18d4ab..d127f870ff 100644 --- a/app/src/main/res/layout/catalogue_main_controller_card.xml +++ b/app/src/main/res/layout/catalogue_main_controller_card.xml @@ -7,12 +7,12 @@ diff --git a/app/src/main/res/layout/catalogue_main_controller_card_item.xml b/app/src/main/res/layout/catalogue_main_controller_card_item.xml index 84532a8d85..ed1afb2e4b 100644 --- a/app/src/main/res/layout/catalogue_main_controller_card_item.xml +++ b/app/src/main/res/layout/catalogue_main_controller_card_item.xml @@ -16,6 +16,7 @@ android:id="@+id/edit_button" android:layout_width="0dp" android:layout_height="0dp" + android:layout_marginStart="6dp" android:padding="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintDimensionRatio="1:1" @@ -31,32 +32,24 @@ android:paddingStart="0dp" android:paddingEnd="8dp" android:ellipsize="end" - android:textAppearance="@style/TextAppearance.Regular.SubHeading" + android:textColor="?android:textColorPrimary" app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/source_latest" app:layout_constraintStart_toEndOf="@+id/edit_button" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintEnd_toStartOf="@+id/source_latest" - tools:text="Source title"/> + tools:text="Source title" /> -