mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-25 22:29:45 +03:00
Minor cleanup
This commit is contained in:
parent
9065362fde
commit
b40af7c3c6
8 changed files with 16 additions and 30 deletions
|
@ -11,7 +11,7 @@ Tachiyomi is a free and open source manga reader for Android 5.0 and above.
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
Features include:
|
Features include:
|
||||||
* Online reading from sources such as MangaDex, MangaSee, Mangakakalot, [and more](https://github.com/tachiyomiorg/tachiyomi-extensions)
|
* Online reading from [a variety of sources](https://github.com/tachiyomiorg/tachiyomi-extensions)
|
||||||
* Local reading of downloaded manga
|
* Local reading of downloaded manga
|
||||||
* A configurable reader with multiple viewers, reading directions and other settings.
|
* A configurable reader with multiple viewers, reading directions and other settings.
|
||||||
* [MyAnimeList](https://myanimelist.net/), [AniList](https://anilist.co/), [Kitsu](https://kitsu.io/), [Shikimori](https://shikimori.one), and [Bangumi](https://bgm.tv/) support
|
* [MyAnimeList](https://myanimelist.net/), [AniList](https://anilist.co/), [Kitsu](https://kitsu.io/), [Shikimori](https://shikimori.one), and [Bangumi](https://bgm.tv/) support
|
||||||
|
|
|
@ -104,7 +104,7 @@ class SearchPresenter(
|
||||||
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
||||||
val maxChapterRead = prevMangaChapters
|
val maxChapterRead = prevMangaChapters
|
||||||
.filter { it.read }
|
.filter { it.read }
|
||||||
.maxByOrNull { it.chapter_number }?.chapter_number
|
.maxOfOrNull { it.chapter_number }
|
||||||
if (maxChapterRead != null) {
|
if (maxChapterRead != null) {
|
||||||
val dbChapters = db.getChapters(manga).executeAsBlocking()
|
val dbChapters = db.getChapters(manga).executeAsBlocking()
|
||||||
for (chapter in dbChapters) {
|
for (chapter in dbChapters) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.databinding.SourceMainControllerCardItemBinding
|
||||||
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.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
||||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
||||||
|
|
||||||
class SourceHolder(private val view: View, val adapter: SourceAdapter) :
|
class SourceHolder(private val view: View, val adapter: SourceAdapter) :
|
||||||
|
@ -46,9 +45,9 @@ class SourceHolder(private val view: View, val adapter: SourceAdapter) :
|
||||||
|
|
||||||
binding.pin.isVisible = true
|
binding.pin.isVisible = true
|
||||||
if (item.isPinned) {
|
if (item.isPinned) {
|
||||||
binding.pin.setVectorCompat(R.drawable.ic_push_pin_24dp, view.context.getResourceColor(R.attr.colorAccent))
|
binding.pin.setVectorCompat(R.drawable.ic_push_pin_24dp, R.attr.colorAccent)
|
||||||
} else {
|
} else {
|
||||||
binding.pin.setVectorCompat(R.drawable.ic_push_pin_outline_24dp, view.context.getResourceColor(android.R.attr.textColorHint))
|
binding.pin.setVectorCompat(R.drawable.ic_push_pin_outline_24dp, android.R.attr.textColorHint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,12 @@ class CrashLogUtil(private val context: Context) {
|
||||||
with(notificationBuilder) {
|
with(notificationBuilder) {
|
||||||
setContentTitle(context.getString(R.string.crash_log_saved))
|
setContentTitle(context.getString(R.string.crash_log_saved))
|
||||||
|
|
||||||
// Clear old actions if they exist
|
|
||||||
clearActions()
|
clearActions()
|
||||||
|
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_folder_24dp,
|
R.drawable.ic_folder_24dp,
|
||||||
context.getString(R.string.action_open_log),
|
context.getString(R.string.action_open_log),
|
||||||
NotificationReceiver.openErrorLogPendingActivity(context, uri)
|
NotificationReceiver.openErrorLogPendingActivity(context, uri)
|
||||||
)
|
)
|
||||||
|
|
||||||
addAction(
|
addAction(
|
||||||
R.drawable.ic_share_24dp,
|
R.drawable.ic_share_24dp,
|
||||||
context.getString(R.string.action_share),
|
context.getString(R.string.action_share),
|
||||||
|
|
|
@ -157,3 +157,5 @@ private fun shouldUpdateDbChapter(dbChapter: Chapter, sourceChapter: SChapter):
|
||||||
dbChapter.date_upload != sourceChapter.date_upload ||
|
dbChapter.date_upload != sourceChapter.date_upload ||
|
||||||
dbChapter.chapter_number != sourceChapter.chapter_number
|
dbChapter.chapter_number != sourceChapter.chapter_number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NoChaptersException : Exception()
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.util.chapter
|
|
||||||
|
|
||||||
class NoChaptersException : Exception()
|
|
|
@ -1,19 +1,21 @@
|
||||||
package eu.kanade.tachiyomi.util.view
|
package eu.kanade.tachiyomi.util.view
|
||||||
|
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a vector on a [ImageView].
|
* Set a vector on a [ImageView].
|
||||||
*
|
*
|
||||||
* @param drawable id of drawable resource
|
* @param drawable id of drawable resource
|
||||||
*/
|
*/
|
||||||
fun ImageView.setVectorCompat(@DrawableRes drawable: Int, tint: Int? = null) {
|
fun ImageView.setVectorCompat(@DrawableRes drawable: Int, @AttrRes tint: Int? = null) {
|
||||||
val vector = AppCompatResources.getDrawable(context, drawable)
|
val vector = AppCompatResources.getDrawable(context, drawable)
|
||||||
if (tint != null) {
|
if (tint != null) {
|
||||||
vector?.mutate()
|
vector?.mutate()
|
||||||
vector?.setTint(tint)
|
vector?.setTint(context.getResourceColor(tint))
|
||||||
}
|
}
|
||||||
setImageDrawable(vector)
|
setImageDrawable(vector)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package eu.kanade.tachiyomi.widget.materialdialogs
|
package eu.kanade.tachiyomi.widget.materialdialogs
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.annotation.AttrRes
|
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
|
||||||
import androidx.appcompat.widget.AppCompatImageView
|
import androidx.appcompat.widget.AppCompatImageView
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
||||||
|
|
||||||
class QuadStateCheckBox @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
class QuadStateCheckBox @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||||
AppCompatImageView(context, attrs) {
|
AppCompatImageView(context, attrs) {
|
||||||
|
@ -19,19 +16,11 @@ class QuadStateCheckBox @JvmOverloads constructor(context: Context, attrs: Attri
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateDrawable() {
|
private fun updateDrawable() {
|
||||||
val drawable = when (state) {
|
when (state) {
|
||||||
State.UNCHECKED -> tintVector(context, R.drawable.ic_check_box_outline_blank_24dp, R.attr.colorControlNormal)
|
State.UNCHECKED -> setVectorCompat(R.drawable.ic_check_box_outline_blank_24dp, R.attr.colorControlNormal)
|
||||||
State.INDETERMINATE -> tintVector(context, R.drawable.ic_indeterminate_check_box_24dp)
|
State.INDETERMINATE -> setVectorCompat(R.drawable.ic_indeterminate_check_box_24dp, R.attr.colorAccent)
|
||||||
State.CHECKED -> tintVector(context, R.drawable.ic_check_box_24dp)
|
State.CHECKED -> setVectorCompat(R.drawable.ic_check_box_24dp, R.attr.colorAccent)
|
||||||
State.INVERSED -> tintVector(context, R.drawable.ic_check_box_x_24dp)
|
State.INVERSED -> setVectorCompat(R.drawable.ic_check_box_x_24dp, R.attr.colorAccent)
|
||||||
}
|
|
||||||
|
|
||||||
setImageDrawable(drawable)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun tintVector(context: Context, resId: Int, @AttrRes colorAttrRes: Int = R.attr.colorAccent): Drawable {
|
|
||||||
return AppCompatResources.getDrawable(context, resId)!!.apply {
|
|
||||||
setTint(context.getResourceColor(colorAttrRes))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue