diff --git a/app/build.gradle b/app/build.gradle index 11551ccdc..a2e8d10d0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -216,7 +216,6 @@ dependencies { implementation 'eu.davidea:flexible-adapter:5.1.0' implementation 'eu.davidea:flexible-adapter-ui:1.0.0' implementation 'com.nononsenseapps:filepicker:2.5.2' - implementation 'com.github.Kennyc1012:TextDrawable:2.0.1' implementation 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0' implementation 'com.github.mthli:Slice:v1.3' implementation 'com.github.chrisbanes:PhotoView:2.3.0' diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt index ef48469b3..b9510868a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryAdapter.kt @@ -23,13 +23,6 @@ class CategoryAdapter(controller: CategoryController) : (0 until itemCount).forEach { getItem(it)?.isSelected = false } } - /** - * Clears the active selections from the model. - */ - fun clearModelSelection() { - selectedPositions.forEach { getItem(it)?.isSelected = false } - } - /** * Toggles the selection of the given position. * diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt index 48b4f54b9..2549592a7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryHolder.kt @@ -3,8 +3,6 @@ package eu.kanade.tachiyomi.ui.category import android.view.View import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder -import eu.kanade.tachiyomi.util.view.roundTextIcon -import kotlinx.android.synthetic.main.categories_item.image import kotlinx.android.synthetic.main.categories_item.reorder import kotlinx.android.synthetic.main.categories_item.title @@ -17,12 +15,6 @@ import kotlinx.android.synthetic.main.categories_item.title class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleViewHolder(view, adapter) { init { - // Create round letter image onclick to simulate long click - image.setOnClickListener { - // Simulate long click on this view to enter selection mode - onLongClick(view) - } - setDragHandleView(reorder) } @@ -34,11 +26,6 @@ class CategoryHolder(view: View, val adapter: CategoryAdapter) : BaseFlexibleVie fun bind(category: Category) { // Set capitalized title. title.text = category.name.capitalize() - - // Update circle letter image. - itemView.post { - image.roundTextIcon(category.name) - } } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt index 4c4409f56..7af2d2368 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt @@ -100,7 +100,7 @@ class CategoryPresenter( /** * Returns true if a category with the given name already exists. */ - fun categoryExists(name: String): Boolean { + private fun categoryExists(name: String): Boolean { return categories.any { it.name.equals(name, true) } } } 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 129841194..f88fba4e5 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 @@ -6,7 +6,6 @@ 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.gone -import eu.kanade.tachiyomi.util.view.roundTextIcon import io.github.mthli.slice.Slice import kotlinx.android.synthetic.main.source_main_controller_card_item.card import kotlinx.android.synthetic.main.source_main_controller_card_item.image @@ -43,8 +42,9 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : // Set circle letter image. itemView.post { val icon = source.icon() - if (icon != null) image.setImageDrawable(icon) - else image.roundTextIcon(source.name) + if (icon != null) { + image.setImageDrawable(icon) + } } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt index 55601923a..683f7ad34 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/SourceHolder.kt @@ -7,7 +7,6 @@ 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.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.source_main_controller_card_item.card @@ -50,7 +49,6 @@ class SourceHolder(view: View, override val adapter: SourceAdapter) : when { icon != null -> image.setImageDrawable(icon) item.source.id == LocalSource.ID -> image.setImageResource(R.mipmap.ic_local_source) - else -> image.roundTextIcon(source.name) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index c27f4c2cb..82130b8de 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -4,12 +4,10 @@ package eu.kanade.tachiyomi.util.view import android.graphics.Color import android.graphics.Point -import android.graphics.Typeface import android.view.Gravity import android.view.Menu import android.view.MenuItem import android.view.View -import android.widget.ImageView import android.widget.TextView import androidx.annotation.MenuRes import androidx.appcompat.widget.PopupMenu @@ -18,10 +16,7 @@ import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import com.google.android.material.snackbar.Snackbar -import com.kennyc.textdrawable.ColorGenerator -import com.kennyc.textdrawable.TextDrawable import eu.kanade.tachiyomi.R -import kotlin.math.min /** * Returns coordinates of view. @@ -86,28 +81,6 @@ inline fun View.toggle() { visibleIf { visibility == View.GONE } } -/** - * Sets a round TextDrawable into an ImageView determined by input. - * - * @param text text of [TextDrawable] - */ -fun ImageView.roundTextIcon(text: String) { - val letter = text.take(1).toUpperCase() - val size = min(this.width, this.height) - - setImageDrawable( - TextDrawable( - shape = TextDrawable.DRAWABLE_SHAPE_OVAL, - desiredWidth = size, - desiredHeight = size, - typeFace = Typeface.DEFAULT, - textColor = Color.WHITE, - text = letter, - color = ColorGenerator.MATERIAL.getColor(letter) - ) - ) -} - /** * Shrink an ExtendedFloatingActionButton when the associated RecyclerView is scrolled down. * diff --git a/app/src/main/res/layout/categories_item.xml b/app/src/main/res/layout/categories_item.xml index 59e6c8b7d..7286bbb3d 100644 --- a/app/src/main/res/layout/categories_item.xml +++ b/app/src/main/res/layout/categories_item.xml @@ -1,5 +1,5 @@ - + android:scaleType="center" + app:srcCompat="@drawable/ic_reorder_grey_24dp" + app:tint="?android:attr/textColorPrimary" + tools:ignore="ContentDescription" /> + + - - - +