Reader now using app theme, clean up of unused drawables; attrs; colors

This commit is contained in:
Jay 2020-04-19 17:28:59 -04:00
parent aef79bafad
commit 5b5239c5eb
55 changed files with 124 additions and 563 deletions

View File

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.base.activity
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.main.SearchActivity import eu.kanade.tachiyomi.ui.main.SearchActivity
import eu.kanade.tachiyomi.ui.security.BiometricActivity import eu.kanade.tachiyomi.ui.security.BiometricActivity
@ -23,12 +22,7 @@ abstract class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
AppCompatDelegate.setDefaultNightMode(ThemeUtil.nightMode(preferences.theme())) AppCompatDelegate.setDefaultNightMode(ThemeUtil.nightMode(preferences.theme()))
val theme = preferences.theme() setTheme(ThemeUtil.theme(preferences.theme()))
setTheme(when {
ThemeUtil.isAMOLEDTheme(theme) -> R.style.Theme_Tachiyomi_Amoled
ThemeUtil.isBlueTheme(theme) -> R.style.Theme_Tachiyomi_AllBlue
else -> R.style.Theme_Tachiyomi
})
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
SecureActivityDelegate.setSecure(this) SecureActivityDelegate.setSecure(this)
} }

View File

@ -55,7 +55,7 @@ class DownloadHolder(private val view: View, val adapter: DownloadAdapter) :
migration_menu.visibleIf(adapterPosition != 0 || adapterPosition != adapter.itemCount - 1) migration_menu.visibleIf(adapterPosition != 0 || adapterPosition != adapter.itemCount - 1)
migration_menu.setVectorCompat( migration_menu.setVectorCompat(
R.drawable.ic_more_vert_black_24dp, view.context R.drawable.ic_more_vert_black_24dp, view.context
.getResourceColor(R.attr.icon_color)) .getResourceColor(android.R.attr.textColorPrimary))
} }
/** /**

View File

@ -314,8 +314,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (updates > 0) { if (updates > 0) {
val badge = bottom_nav.getOrCreateBadge(R.id.nav_browse) val badge = bottom_nav.getOrCreateBadge(R.id.nav_browse)
badge.number = updates badge.number = updates
badge.backgroundColor = getResourceColor(R.attr.badgeColor)
badge.badgeTextColor = Color.WHITE
} else { } else {
bottom_nav.removeBadge(R.id.nav_browse) bottom_nav.removeBadge(R.id.nav_browse)
} }

View File

@ -53,11 +53,11 @@ class MigrationProcessHolder(
val source = item.manga.mangaSource() val source = item.manga.mangaSource()
migration_menu.setVectorCompat( migration_menu.setVectorCompat(
R.drawable.ic_more_vert_black_24dp, view.context.getResourceColor(R.attr.icon_color) R.drawable.ic_more_vert_black_24dp, view.context.getResourceColor(android.R.attr.textColorPrimary)
) )
skip_manga.setVectorCompat( skip_manga.setVectorCompat(
R.drawable.ic_close_white_24dp, view.context.getResourceColor( R.drawable.ic_close_white_24dp, view.context.getResourceColor(
R.attr.icon_color android.R.attr.textColorPrimary
) )
) )
migration_menu.invisible() migration_menu.invisible()

View File

@ -22,6 +22,7 @@ import android.view.animation.Animation
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
import android.widget.SeekBar import android.widget.SeekBar
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.core.graphics.ColorUtils
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
@ -130,6 +131,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
var sheetManageNavColor = false var sheetManageNavColor = false
var lightStatusBar = false
/** /**
* Progress dialog used when switching chapters from the menu buttons. * Progress dialog used when switching chapters from the menu buttons.
*/ */
@ -162,15 +165,24 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
*/ */
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
AppCompatDelegate.setDefaultNightMode(ThemeUtil.nightMode(preferences.theme())) AppCompatDelegate.setDefaultNightMode(ThemeUtil.nightMode(preferences.theme()))
setTheme(when (preferences.readerTheme().getOrDefault()) { setTheme(ThemeUtil.theme(preferences.theme()))
0 -> R.style.Theme_Base_Reader_Light
1 -> R.style.Theme_Base_Reader_Dark
else -> R.style.Theme_Base_Reader
})
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.reader_activity) setContentView(R.layout.reader_activity)
val a = obtainStyledAttributes(intArrayOf(android.R.attr.windowLightStatusBar))
lightStatusBar = a.getBoolean(0, false)
a.recycle()
setNotchCutoutMode() setNotchCutoutMode()
if (lightStatusBar) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) reader_layout.systemUiVisibility =
reader_layout.systemUiVisibility.or(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR)
reader_layout.systemUiVisibility =
reader_layout.systemUiVisibility.or(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) reader_layout.systemUiVisibility =
reader_layout.systemUiVisibility.rem(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR)
reader_layout.systemUiVisibility =
reader_layout.systemUiVisibility.rem(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
}
if (presenter.needsInit()) { if (presenter.needsInit()) {
val manga = intent.extras!!.getLong("manga", -1) val manga = intent.extras!!.getLong("manga", -1)
@ -300,6 +312,10 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
private fun initializeMenu() { private fun initializeMenu() {
// Set toolbar // Set toolbar
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
val primaryColor = ColorUtils.setAlphaComponent(getResourceColor(R.attr.colorSecondary),
200)
toolbar.setBackgroundColor(primaryColor)
window.statusBarColor = primaryColor
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
toolbar.setNavigationOnClickListener { toolbar.setNavigationOnClickListener {
onBackPressed() onBackPressed()
@ -327,7 +343,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
} }
// if in landscape with 2/3 button mode, fully opaque nav bar // if in landscape with 2/3 button mode, fully opaque nav bar
else if (insets.systemWindowInsetLeft > 0 || insets.systemWindowInsetRight > 0) { else if (insets.systemWindowInsetLeft > 0 || insets.systemWindowInsetRight > 0) {
window.navigationBarColor = getResourceColor(R.attr.colorPrimary) window.navigationBarColor = getResourceColor(R.attr.colorSecondary)
false false
} }
// if in portrait with 2/3 button mode, translucent nav bar // if in portrait with 2/3 button mode, translucent nav bar
@ -702,10 +718,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
subscriptions += Observable.merge(initialRotation, rotationUpdates) subscriptions += Observable.merge(initialRotation, rotationUpdates)
.subscribe { setOrientation(it) } .subscribe { setOrientation(it) }
subscriptions += preferences.readerTheme().asObservable()
.skip(1) // We only care about updates
.subscribe { recreate() }
subscriptions += preferences.showPageNumber().asObservable() subscriptions += preferences.showPageNumber().asObservable()
.subscribe { setPageNumberVisibility(it) } .subscribe { setPageNumberVisibility(it) }

View File

@ -6,9 +6,7 @@ import android.graphics.Color
import android.os.Build import android.os.Build
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -40,8 +38,12 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
fun setup(activity: ReaderActivity) { fun setup(activity: ReaderActivity) {
presenter = activity.presenter presenter = activity.presenter
val primary = activity.getResourceColor(R.attr.colorPrimary) val primary = ColorUtils.setAlphaComponent(
val fullPrimary = ContextCompat.getColor(activity, R.color.darkPrimaryColor) activity.getResourceColor(
R.attr.colorSecondary
), 200
)
val fullPrimary = activity.getResourceColor(R.attr.colorSecondary)
sheetBehavior = BottomSheetBehavior.from(this) sheetBehavior = BottomSheetBehavior.from(this)
chapters_button.setOnClickListener { chapters_button.setOnClickListener {
if (sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) sheetBehavior?.state = if (sheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) sheetBehavior?.state =
@ -58,7 +60,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
sheetBehavior?.peekHeight = sheetBehavior?.peekHeight =
peek + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) insets.mandatorySystemGestureInsets.bottom peek + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) insets.mandatorySystemGestureInsets.bottom
else insets.systemWindowInsetBottom else insets.systemWindowInsetBottom
chapters_bottom_sheet.updateLayoutParams<ViewGroup.MarginLayoutParams> { chapters_bottom_sheet.updateLayoutParams<MarginLayoutParams> {
height = 280.dpToPx + insets.systemWindowInsetBottom height = 280.dpToPx + insets.systemWindowInsetBottom
} }
chapter_recycler.updatePaddingRelative(bottom = insets.systemWindowInsetBottom) chapter_recycler.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
@ -66,7 +68,8 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() { sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, progress: Float) { override fun onSlide(bottomSheet: View, progress: Float) {
val trueProgress = max(progress, 0f) val trueProgress = max(progress, 0f)
backgroundTintList = ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress)) backgroundTintList =
ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress))
chapter_recycler.alpha = trueProgress chapter_recycler.alpha = trueProgress
if (activity.sheetManageNavColor) activity.window.navigationBarColor = if (activity.sheetManageNavColor) activity.window.navigationBarColor =
lerpColor(ColorUtils.setAlphaComponent(primary, 0), primary, trueProgress) lerpColor(ColorUtils.setAlphaComponent(primary, 0), primary, trueProgress)
@ -106,12 +109,22 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
} }
} }
override fun onClick(v: View, position: Int, fastAdapter: FastAdapter<ReaderChapterItem>, item: ReaderChapterItem) { override fun onClick(
v: View,
position: Int,
fastAdapter: FastAdapter<ReaderChapterItem>,
item: ReaderChapterItem
) {
presenter.toggleBookmark(item.chapter) presenter.toggleBookmark(item.chapter)
refreshList() refreshList()
} }
}) })
backgroundTintList = ColorStateList.valueOf(
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) primary
else fullPrimary
)
chapter_recycler.layoutManager = LinearLayoutManager(context) chapter_recycler.layoutManager = LinearLayoutManager(context)
refreshList() refreshList()
} }

View File

@ -113,7 +113,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
viewer.setSelection(activity.presenter.manga?.viewer ?: 0, false) viewer.setSelection(activity.presenter.manga?.viewer ?: 0, false)
rotation_mode.bindToPreference(preferences.rotation(), 1) rotation_mode.bindToPreference(preferences.rotation(), 1)
background_color.bindToPreference(preferences.readerTheme(), 0, true) background_color.bindToPreference(preferences.readerTheme(), 0)
show_page_number.bindToPreference(preferences.showPageNumber()) show_page_number.bindToPreference(preferences.showPageNumber())
fullscreen.bindToPreference(preferences.fullscreen()) fullscreen.bindToPreference(preferences.fullscreen())
keepscreen.bindToPreference(preferences.keepScreenOn()) keepscreen.bindToPreference(preferences.keepScreenOn())
@ -155,12 +155,10 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) :
*/ */
private fun Spinner.bindToPreference( private fun Spinner.bindToPreference(
pref: Preference<Int>, pref: Preference<Int>,
offset: Int = 0, offset: Int = 0
shouldDismiss: Boolean = false
) { ) {
onItemSelectedListener = IgnoreFirstSpinnerListener { position -> onItemSelectedListener = IgnoreFirstSpinnerListener { position ->
pref.set(position + offset) pref.set(position + offset)
if (shouldDismiss) dismiss()
} }
setSelection(pref.getOrDefault() - offset, false) setSelection(pref.getOrDefault() - offset, false)
} }

View File

@ -219,28 +219,26 @@ class HttpPageLoader(
private fun HttpSource.getCachedImage(page: ReaderPage): Observable<ReaderPage> { private fun HttpSource.getCachedImage(page: ReaderPage): Observable<ReaderPage> {
val imageUrl = page.imageUrl ?: return Observable.just(page) val imageUrl = page.imageUrl ?: return Observable.just(page)
return Observable.just(page) return Observable.just(page).flatMap {
.flatMap {
if (!chapterCache.isImageInCache(imageUrl)) { if (!chapterCache.isImageInCache(imageUrl)) {
cacheImage(page) cacheImage(page)
} else { } else {
Observable.just(page) Observable.just(page)
} }
} }.doOnNext {
.doOnNext {
val readerTheme = preferences.readerTheme().getOrDefault() val readerTheme = preferences.readerTheme().getOrDefault()
if (readerTheme >= 2) { if (readerTheme >= 2) {
val stream = chapterCache.getImageFile(imageUrl).inputStream() val stream = chapterCache.getImageFile(imageUrl).inputStream()
val image = BitmapFactory.decodeStream(stream) val image = BitmapFactory.decodeStream(stream)
page.bg = ImageUtil.autoSetBackground(image, readerTheme == 2) page.bg = ImageUtil.autoSetBackground(
image, readerTheme == 2, preferences.context
)
page.bgAlwaysWhite = readerTheme == 2 page.bgAlwaysWhite = readerTheme == 2
stream.close() stream.close()
} }
page.stream = { chapterCache.getImageFile(imageUrl).inputStream() } page.stream = { chapterCache.getImageFile(imageUrl).inputStream() }
page.status = Page.READY page.status = Page.READY
} }.doOnError { page.status = Page.ERROR }.onErrorReturn { page }
.doOnError { page.status = Page.ERROR }
.onErrorReturn { page }
} }
/** /**

View File

@ -78,7 +78,7 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
.register({ volumeKeysInverted = it }) .register({ volumeKeysInverted = it })
preferences.readerTheme() preferences.readerTheme()
.register({ readerTheme = it }) .register({ readerTheme = it }, { imagePropertyChangedListener?.invoke() })
preferences.alwaysShowChapterTransition() preferences.alwaysShowChapterTransition()
.register({ alwaysShowChapterTransition = it }) .register({ alwaysShowChapterTransition = it })

View File

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.graphics.PointF import android.graphics.PointF
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
import android.view.GestureDetector import android.view.GestureDetector
@ -36,6 +37,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig.ZoomType import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig.ZoomType
import eu.kanade.tachiyomi.util.system.ImageUtil import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.ThemeUtil
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
@ -272,7 +274,9 @@ class PagerPageHolder(
} }
} }
} else { } else {
initSubsamplingImageView().setImage(ImageSource.inputStream(openStream!!)) val imageView = initSubsamplingImageView()
imageView.setImage(ImageSource.inputStream(openStream!!))
imageView.background = ColorDrawable(ThemeUtil.readerBackgroundColor(viewer.config.readerTheme))
} }
} else { } else {
val imageView = initImageView() val imageView = initImageView()
@ -292,7 +296,7 @@ class PagerPageHolder(
val preferences by injectLazy<PreferencesHelper>() val preferences by injectLazy<PreferencesHelper>()
ImageUtil.autoSetBackground(BitmapFactory.decodeByteArray( ImageUtil.autoSetBackground(BitmapFactory.decodeByteArray(
bytesArray, 0, bytesArray.size bytesArray, 0, bytesArray.size
), preferences.readerTheme().getOrDefault() == 2) ), preferences.readerTheme().getOrDefault() == 2, context)
} }
} }

View File

@ -40,6 +40,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
var sidePadding = 0 var sidePadding = 0
private set private set
var readerTheme = 0
private set
init { init {
preferences.readWithTapping() preferences.readWithTapping()
.register({ tappingEnabled = it }) .register({ tappingEnabled = it })
@ -64,6 +67,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
preferences.webtoonSidePadding() preferences.webtoonSidePadding()
.register({ sidePadding = it }, { imagePropertyChangedListener?.invoke() }) .register({ sidePadding = it }, { imagePropertyChangedListener?.invoke() })
preferences.readerTheme()
.register({ readerTheme = it }, { imagePropertyChangedListener?.invoke() })
} }
fun unsubscribe() { fun unsubscribe() {

View File

@ -152,7 +152,7 @@ class WebtoonTransitionHolder(
is ReaderChapter.State.Error -> setError(state.error, transition) is ReaderChapter.State.Error -> setError(state.error, transition)
is ReaderChapter.State.Loaded -> setLoaded() is ReaderChapter.State.Loaded -> setLoaded()
} }
pagesContainer.visibleIf { pagesContainer.childCount > 0 } pagesContainer.visibleIf(pagesContainer.childCount > 0)
} }
addSubscription(statusSubscription) addSubscription(statusSubscription)

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.util.system package eu.kanade.tachiyomi.util.system
import android.content.Context
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
@ -55,8 +56,9 @@ object ImageUtil {
return null return null
} }
fun autoSetBackground(image: Bitmap?, useWhiteAlways: Boolean): Drawable { fun autoSetBackground(image: Bitmap?, useWhiteAlways: Boolean, context: Context): Drawable {
val backgroundColor = if (useWhiteAlways) Color.WHITE else android.R.attr.colorBackground val backgroundColor = if (useWhiteAlways) Color.WHITE else
context.getResourceColor(android.R.attr.colorBackground)
if (image == null) return ColorDrawable(backgroundColor) if (image == null) return ColorDrawable(backgroundColor)
if (image.width < 50 || image.height < 50) if (image.width < 50 || image.height < 50)
return ColorDrawable(backgroundColor) return ColorDrawable(backgroundColor)

View File

@ -1,6 +1,8 @@
package eu.kanade.tachiyomi.util.system package eu.kanade.tachiyomi.util.system
import android.graphics.Color
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import eu.kanade.tachiyomi.R
object ThemeUtil { object ThemeUtil {
fun isBlueTheme(theme: Int): Boolean { fun isBlueTheme(theme: Int): Boolean {
@ -11,6 +13,21 @@ object ThemeUtil {
return theme == 3 || theme == 6 return theme == 3 || theme == 6
} }
fun theme(theme: Int): Int {
return when {
isAMOLEDTheme(theme) -> R.style.Theme_Tachiyomi_Amoled
isBlueTheme(theme) -> R.style.Theme_Tachiyomi_AllBlue
else -> R.style.Theme_Tachiyomi
}
}
fun readerBackgroundColor(theme: Int): Int {
return when (theme) {
1 -> Color.BLACK
else -> Color.WHITE
}
}
fun nightMode(theme: Int): Int { fun nightMode(theme: Int): Int {
return when (theme) { return when (theme) {
1, 8 -> AppCompatDelegate.MODE_NIGHT_NO 1, 8 -> AppCompatDelegate.MODE_NIGHT_NO

View File

@ -24,7 +24,6 @@ import androidx.annotation.Px
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.core.math.MathUtils.clamp import androidx.core.math.MathUtils.clamp
import androidx.core.view.ViewCompat
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
@ -38,6 +37,7 @@ import com.google.android.material.button.MaterialButton
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
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.util.system.ThemeUtil
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.main_activity.*
@ -67,28 +67,19 @@ fun View.snack(
f: (Snackbar.() -> Unit)? = null f: (Snackbar.() -> Unit)? = null
): Snackbar { ): Snackbar {
val snack = Snackbar.make(this, message, length) val snack = Snackbar.make(this, message, length)
/* when {
Build.VERSION.SDK_INT >= 23 -> {
val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft
val rightM = if (this is CoordinatorLayout) 0
else rootWindowInsets.systemWindowInsetRight
snack.config(context, rootWindowInsets
.systemWindowInsetBottom, rightM, leftM)
}
else -> snack.config(context)
}*/
if (f != null) { if (f != null) {
snack.f() snack.f()
} }
val theme = Injekt.get<PreferencesHelper>().theme() val theme = Injekt.get<PreferencesHelper>().theme()
if (theme == 3) { val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
if (ThemeUtil.isAMOLEDTheme(theme) && currentNightMode == Configuration.UI_MODE_NIGHT_YES) {
val textView: TextView = val textView: TextView =
snack.view.findViewById(com.google.android.material.R.id.snackbar_text) snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
val button: Button? = val button: Button? =
snack.view.findViewById(com.google.android.material.R.id.snackbar_action) snack.view.findViewById(com.google.android.material.R.id.snackbar_action)
textView.setTextColor(context.getResourceColor(R.attr.snackbar_text)) textView.setTextColor(Color.WHITE)
button?.setTextColor(context.getResourceColor(R.attr.snackbar_text)) button?.setTextColor(Color.WHITE)
snack.config(context) snack.view.backgroundTintList = ColorStateList.valueOf(Color.DKGRAY)
} }
snack.show() snack.show()
return snack return snack
@ -102,20 +93,6 @@ fun View.snack(
return snack(context.getString(resource), length, f) return snack(context.getString(resource), length, f)
} }
fun Snackbar.config(
context: Context,
bottomMargin: Int = 0,
rightMargin: Int = 0,
leftMargin: Int = 0
) {
val params = this.view.layoutParams as ViewGroup.MarginLayoutParams
params.setMargins(12 + leftMargin, 12, 12 + rightMargin, 12 + bottomMargin)
this.view.layoutParams = params
this.view.background = context.getDrawable(R.drawable.bg_snackbar)
ViewCompat.setElevation(this.view, 6f)
}
fun Snackbar.getText(): CharSequence { fun Snackbar.getText(): CharSequence {
val textView: TextView = view.findViewById(com.google.android.material.R.id.snackbar_text) val textView: TextView = view.findViewById(com.google.android.material.R.id.snackbar_text)
return textView.text return textView.text
@ -133,10 +110,6 @@ inline fun View.gone() {
visibility = View.GONE visibility = View.GONE
} }
inline fun View.visibleIf(block: () -> Boolean) {
visibility = if (block()) View.VISIBLE else View.GONE
}
inline fun View.visibleIf(show: Boolean) { inline fun View.visibleIf(show: Boolean) {
visibility = if (show) View.VISIBLE else View.GONE visibility = if (show) View.VISIBLE else View.GONE
} }

View File

@ -1,108 +0,0 @@
package eu.kanade.tachiyomi.widget
import android.content.Context
import android.text.SpannableStringBuilder
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.view.inflate
import kotlinx.android.synthetic.main.download_custom_amount.view.*
import timber.log.Timber
/**
* Custom dialog to select how many chapters to download.
*/
class DialogCustomDownloadView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
LinearLayout(context, attrs) {
/**
* Current amount of custom download chooser.
*/
var amount: Int = 0
private set
/**
* Minimal value of custom download chooser.
*/
private var min = 0
/**
* Maximal value of custom download chooser.
*/
private var max = 0
init {
// Add view to stack
addView(inflate(R.layout.download_custom_amount))
}
/**
* Called when view is added
*
* @param child
*/
override fun onViewAdded(child: View) {
super.onViewAdded(child)
// Set download count to 0.
myNumber.text = SpannableStringBuilder(getAmount(0).toString())
// When user presses button decrease amount by 10.
btn_decrease_10.setOnClickListener {
myNumber.text = SpannableStringBuilder(getAmount(amount - 10).toString())
}
// When user presses button increase amount by 10.
btn_increase_10.setOnClickListener {
myNumber.text = SpannableStringBuilder(getAmount(amount + 10).toString())
}
// When user presses button decrease amount by 1.
btn_decrease.setOnClickListener {
myNumber.text = SpannableStringBuilder(getAmount(amount - 1).toString())
}
// When user presses button increase amount by 1.
btn_increase.setOnClickListener {
myNumber.text = SpannableStringBuilder(getAmount(amount + 1).toString())
}
// When user inputs custom number set amount equal to input.
myNumber.addTextChangedListener(object : SimpleTextWatcher() {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
try {
amount = getAmount(Integer.parseInt(s.toString()))
} catch (error: NumberFormatException) {
// Catch NumberFormatException to prevent parse exception when input is empty.
Timber.e(error)
}
}
})
}
/**
* Set min max of custom download amount chooser.
* @param min minimal downloads
* @param max maximal downloads
*/
fun setMinMax(min: Int, max: Int) {
this.min = min
this.max = max
}
/**
* Returns amount to download.
* if minimal downloads is less than input return minimal downloads.
* if Maximal downloads is more than input return maximal downloads.
*
* @return amount to download.
*/
private fun getAmount(input: Int): Int {
return when {
input > max -> max
input < min -> min
else -> input
}
}
}

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="14dp"
android:topRightRadius="14dp" />
<solid android:color="@android:color/black" />
</shape>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="14dp"
android:topRightRadius="14dp" />
<solid android:color="?android:attr/colorPrimary" />
</shape>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?snackbar_background"/>
<corners android:radius="4dp"/>
</shape>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColor">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/cardBackground"/>
</item>
<item android:state_activated="true">
<color android:color="@color/dialogBackground"/>
</item>
<item>
<color android:color="@color/dialogBackground"/>
</item>
</selector>
</item>
</ripple>

View File

@ -2,7 +2,8 @@
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0"
android:tint="?attr/actionBarTintColor">
<path <path
android:fillColor="#FFFFFFFF" android:fillColor="#FFFFFFFF"
android:pathData="M20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69L23.31,12 20,8.69zM12,18c-0.89,0 -1.74,-0.2 -2.5,-0.55C11.56,16.5 13,14.42 13,12s-1.44,-4.5 -3.5,-5.45C10.26,6.2 11.11,6 12,6c3.31,0 6,2.69 6,6s-2.69,6 -6,6z"/> android:pathData="M20,8.69V4h-4.69L12,0.69 8.69,4H4v4.69L0.69,12 4,15.31V20h4.69L12,23.31 15.31,20H20v-4.69L23.31,12 20,8.69zM12,18c-0.89,0 -1.74,-0.2 -2.5,-0.55C11.56,16.5 13,14.42 13,12s-1.44,-4.5 -3.5,-5.45C10.26,6.2 11.11,6 12,6c3.31,0 6,2.69 6,6s-2.69,6 -6,6z"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" /> <solid android:color="@android:color/white" />
<stroke android:width="1dp" android:color="@color/snackbarBackground" /> <stroke android:width="1dp" android:color="?android:textColorPrimary" />
<padding android:left="1dp" android:top="1dp" android:right="1dp" <padding android:left="1dp" android:top="1dp" android:right="1dp"
android:bottom="1dp" /> android:bottom="1dp" />
</shape> </shape>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/selectorColor">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColor" />
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColor" />
</item>
<item>
<color android:color="@color/md_black_1000" />
</item>
</selector>
</item>
</ripple>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccent">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColor" />
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColor" />
</item>
<item>
<color android:color="@color/background" />
</item>
</selector>
</item>
</ripple>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccent">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColor" />
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColor" />
</item>
<item>
<color android:color="@color/background" />
</item>
</selector>
</item>
</ripple>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp" />
<solid android:color="@color/divider" />
</shape>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColor">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/rippleColor" />
</item>
<item
android:drawable="@color/rippleColor"
android:state_focused="true" />
<item
android:drawable="@color/rippleColor"
android:state_pressed="true" />
<item
android:drawable="@color/rippleColor"
android:state_activated="true" />
</selector>
</item>
</ripple>

View File

@ -5,5 +5,5 @@
<size <size
android:height="25dp" android:height="25dp"
android:width="25dp" /> android:width="25dp" />
<solid android:color="@color/drawerPrimary"/> <solid android:color="@color/md_grey_800_85"/>
</shape> </shape>

View File

@ -16,7 +16,7 @@
android:height="32dp" android:height="32dp"
android:width="32dp" /> android:width="32dp" />
<solid android:color="@android:color/transparent"/> <solid android:color="@android:color/transparent"/>
<stroke android:width="1dp" android:color="@color/drawerPrimary" /> <stroke android:width="1dp" android:color="@color/bluePrimary" />
</shape> </shape>
</item> </item>
</ripple> </ripple>

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/display_bottom_sheet" android:id="@+id/display_bottom_sheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView

View File

@ -15,7 +15,7 @@
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="12dp" android:paddingTop="12dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

View File

@ -6,7 +6,7 @@
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?android:attr/colorBackground" android:backgroundTint="?android:attr/colorBackground"
android:orientation="vertical" android:orientation="vertical"
app:behavior_peekHeight="48sp" app:behavior_peekHeight="48sp"
@ -17,7 +17,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?attr/colorPrimaryVariant" android:backgroundTint="?attr/colorPrimaryVariant"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_decrease_10"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/dialog_selector"
android:padding="8dp"
android:tint="?colorAccent"
app:srcCompat="@drawable/ic_chevron_left_double_black_24dp" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_decrease"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/dialog_selector"
android:tint="?colorAccent"
android:padding="8dp"
app:srcCompat="@drawable/ic_chevron_left_black_24dp" />
<EditText
android:id="@+id/myNumber"
android:digits="0123456789"
android:inputType="number"
android:layout_height="wrap_content"
android:textStyle="bold"
android:padding="8dp"
android:layout_width="wrap_content" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_increase"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/dialog_selector"
android:tint="?colorAccent"
android:padding="8dp"
app:srcCompat="@drawable/ic_chevron_right_black_24dp" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btn_increase_10"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/dialog_selector"
android:tint="?colorAccent"
android:padding="8dp"
app:srcCompat="@drawable/ic_chevron_right_double_black_24dp" />
</LinearLayout>

View File

@ -67,6 +67,7 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/ext_button" android:id="@+id/ext_button"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:textAllCaps="false"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"

View File

@ -6,7 +6,7 @@
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?android:attr/colorBackground" android:backgroundTint="?android:attr/colorBackground"
android:orientation="vertical" android:orientation="vertical"
app:behavior_peekHeight="48sp" app:behavior_peekHeight="48sp"
@ -17,7 +17,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?attr/colorPrimaryVariant" android:backgroundTint="?attr/colorPrimaryVariant"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -5,7 +5,7 @@
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:orientation="vertical" android:orientation="vertical"
app:behavior_peekHeight="60dp" app:behavior_peekHeight="60dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

View File

@ -55,7 +55,6 @@
tools:alpha="1" tools:alpha="1"
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"
android:background="@drawable/round_textview_background" android:background="@drawable/round_textview_background"
android:backgroundTint="@color/md_grey_800_85"
android:padding="10dp" android:padding="10dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
app:layout_constraintEnd_toStartOf="@id/fast_scroller" app:layout_constraintEnd_toStartOf="@id/fast_scroller"

View File

@ -59,7 +59,6 @@
android:layout_marginEnd="50dp" android:layout_marginEnd="50dp"
android:alpha="0" android:alpha="0"
android:background="@drawable/round_textview_background" android:background="@drawable/round_textview_background"
android:backgroundTint="@color/md_grey_800_85"
android:padding="8dp" android:padding="8dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
app:layout_constraintEnd_toStartOf="@id/fast_scroller" app:layout_constraintEnd_toStartOf="@id/fast_scroller"

View File

@ -16,7 +16,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -38,7 +38,7 @@
android:id="@+id/reader_menu" android:id="@+id/reader_menu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:theme="?attr/actionBarTheme" android:background="@android:color/transparent"
android:visibility="invisible" android:visibility="invisible"
tools:visibility="visible"> tools:visibility="visible">
@ -46,7 +46,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?colorPrimary" /> android:background="?colorSecondary" />
<include layout="@layout/reader_chapters_sheet"/> <include layout="@layout/reader_chapters_sheet"/>

View File

@ -5,8 +5,8 @@
android:id="@+id/chapters_bottom_sheet" android:id="@+id/chapters_bottom_sheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp" android:layout_height="300dp"
android:background="@drawable/bg_bottom_sheet_black" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="@color/darkPrimaryTranslucent" android:backgroundTint="?colorSecondary"
android:orientation="vertical" android:orientation="vertical"
app:behavior_peekHeight="?attr/actionBarSize" app:behavior_peekHeight="?attr/actionBarSize"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"> app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

View File

@ -3,7 +3,7 @@
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:clipToPadding="false" android:clipToPadding="false"
android:orientation="vertical"> android:orientation="vertical">

View File

@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/BottomSheetDialogTheme" style="@style/BottomSheetDialogTheme"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">

View File

@ -5,7 +5,7 @@
android:id="@+id/bottom_sheet" android:id="@+id/bottom_sheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:forceDarkAllowed="false"> android:forceDarkAllowed="false">
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_bottom_sheet_primary" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?android:attr/colorBackground" android:backgroundTint="?android:attr/colorBackground"
android:orientation="vertical"> android:orientation="vertical">
@ -21,7 +21,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_gravity="top" android:layout_gravity="top"
android:background="@drawable/bg_bottom_sheet_primary" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?attr/colorSecondary" android:backgroundTint="?attr/colorSecondary"
android:clickable="true" android:clickable="true"
android:elevation="0dp" android:elevation="0dp"

View File

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/display_bottom_sheet" android:id="@+id/display_bottom_sheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@drawable/bg_bottom_sheet_dialog_fragment" android:background="@drawable/bottom_sheet_rounded_background"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView

View File

@ -5,10 +5,6 @@
<color name="colorPrimaryDark">#212121</color> <color name="colorPrimaryDark">#212121</color>
<color name="colorPrimaryInactive">@color/md_white_1000_76</color> <color name="colorPrimaryInactive">@color/md_white_1000_76</color>
<color name="drawerHighlight">@color/md_white_1000_12</color>
<color name="drawerPrimary">#3399FF</color>
<color name="snackbarBackground">#FFFFFF</color>
<color name="cardBackground">#212121</color>
<color name="rippleColor">@color/md_white_1000_20</color> <color name="rippleColor">@color/md_white_1000_20</color>
<color name="fullRippleColor">#707070</color> <color name="fullRippleColor">#707070</color>
<color name="dialogBackground">#171717</color> <color name="dialogBackground">#171717</color>
@ -28,8 +24,5 @@
<color name="background">#1C1C1D</color> <color name="background">#1C1C1D</color>
<color name="dialog">#212121</color> <color name="dialog">#212121</color>
<color name="selectorColor">@color/md_blue_A200_50</color>
<color name="iconColor">@color/md_white_1000_54</color>
<color name="gray_button">#BFBFBF</color> <color name="gray_button">#BFBFBF</color>
</resources> </resources>

View File

@ -6,16 +6,6 @@
<item name="android:windowLightNavigationBar" tools:targetApi="27">false</item> <item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
</style> </style>
<style name="Theme.Base.Reader" parent="Theme.Base">
<item name="colorPrimary">@color/darkPrimaryTranslucent</item>
<item name="android:enforceNavigationBarContrast" tools:targetApi="29">false</item>
<item name="colorPrimaryDark">@color/darkPrimaryTranslucent</item>
<item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item>
<item name="android:colorBackground">@color/readerDarkBackground</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<!--==============--> <!--==============-->
<!-- Amoled Theme --> <!-- Amoled Theme -->
<!--==============--> <!--==============-->
@ -27,12 +17,9 @@
<item name="colorPrimaryDark">@color/colorAmoledPrimary</item> <item name="colorPrimaryDark">@color/colorAmoledPrimary</item>
<item name="android:colorBackground">@color/md_black_1000</item> <item name="android:colorBackground">@color/md_black_1000</item>
<item name="android:statusBarColor">@color/blackStatus</item> <item name="android:statusBarColor">@color/blackStatus</item>
<item name="snackbar_background">@color/trueSnackbarBackground</item>
<item name="snackbar_text">@color/textColorPrimary</item>
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="selectable_list_drawable">@drawable/list_item_selector</item> <item name="selectable_list_drawable">@drawable/list_item_selector</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_amoled</item>
<item name="background_card">@color/colorAmoledPrimary</item> <item name="background_card">@color/colorAmoledPrimary</item>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="darkPrimaryTranslucent">#BF212121</color>
</resources>

View File

@ -20,16 +20,9 @@
<attr name="max_seek" format="integer"/> <attr name="max_seek" format="integer"/>
</declare-styleable> </declare-styleable>
<attr name="navigation_view_theme" format="reference"/>
<attr name="actionBarTintColor" format="color"/> <attr name="actionBarTintColor" format="color"/>
<attr name="tabBarIconColor" format="reference|integer"/> <attr name="tabBarIconColor" format="reference|integer"/>
<attr name="tabBarIconInactive" format="reference|integer"/> <attr name="tabBarIconInactive" format="reference|integer"/>
<attr name="selectable_list_drawable" format="reference|integer" /> <attr name="selectable_list_drawable" format="reference|integer" />
<attr name="selectable_library_drawable" format="reference|integer"/>
<attr name="text_color_primary" format="reference|integer"/>
<attr name="background_card" format="reference|integer"/> <attr name="background_card" format="reference|integer"/>
<attr name="icon_color" format="reference|integer"/>
<attr name="snackbar_background" format="reference|integer"/>
<attr name="snackbar_text" format="reference|integer"/>
<attr name="badgeColor" format="reference|integer"/>
</resources> </resources>

View File

@ -4,26 +4,19 @@
<color name="colorPrimary">@color/md_white_1000</color> <color name="colorPrimary">@color/md_white_1000</color>
<color name="colorPrimaryInactive">#C2424242</color> <color name="colorPrimaryInactive">#C2424242</color>
<color name="colorPrimaryDark">@color/md_white_1000</color> <color name="colorPrimaryDark">@color/md_white_1000</color>
<color name="drawerHighlight">@color/md_black_1000_12</color>
<color name="drawerPrimary">@color/bluePrimary</color>
<color name="bluePrimary">#54759E</color> <color name="bluePrimary">#54759E</color>
<color name="mainStatus">#AFFAFAFA</color> <color name="mainStatus">#AFFAFAFA</color>
<color name="blueStatus">#AF54759E</color> <color name="blueStatus">#AF54759E</color>
<color name="blackStatus">#AF000000</color> <color name="blackStatus">#AF000000</color>
<color name="cardBackground">#FFFFFF</color>
<color name="splashBackground">@color/bluePrimary</color> <color name="splashBackground">@color/bluePrimary</color>
<color name="snackbarBackground">#323232</color>
<color name="trueSnackbarBackground">#323232</color>
<color name="dialogBackground">@color/md_white_1000</color> <color name="dialogBackground">@color/md_white_1000</color>
<color name="fullRippleColor">#C2C2C2</color> <color name="fullRippleColor">#C2C2C2</color>
<color name="rippleColor">@color/md_black_1000_12</color> <color name="rippleColor">@color/md_black_1000_12</color>
<color name="colorAccent">@color/md_blue_A400</color> <color name="colorAccent">@color/md_blue_A400</color>
<color name="actionModeShadow">@color/md_black_1000_38</color> <color name="actionModeShadow">@color/md_black_1000_38</color>
<!-- Dark Application Colors -->
<color name="colorAmoledPrimary">@color/md_black_1000</color>
<color name="readerDarkBackground">#1C1C1D</color>
<color name="gray_button">#404040</color> <color name="gray_button">#404040</color>
<color name="darkPrimaryTranslucent">@color/darkPrimaryColor</color>
<color name="colorAmoledPrimary">@color/md_black_1000</color>
<color name="textColorPrimary">@color/md_black_1000_87</color> <color name="textColorPrimary">@color/md_black_1000_87</color>
<color name="textColorSecondary">@color/md_black_1000_54</color> <color name="textColorSecondary">@color/md_black_1000_54</color>
@ -35,17 +28,9 @@
<color name="badgeColor">@color/material_red_accent_700</color> <color name="badgeColor">@color/material_red_accent_700</color>
<color name="download">@color/material_green_800</color> <color name="download">@color/material_green_800</color>
<color name="preference_fallback_accent_color">@color/colorAccent</color>
<color name="darkPrimaryColor">#212121</color>
<color name="background">@color/md_grey_50</color> <color name="background">@color/md_grey_50</color>
<color name="dialog">@color/md_white_1000</color> <color name="dialog">@color/md_white_1000</color>
<color name="selectorColor">@color/md_blue_A400_38</color>
<color name="iconColor">@color/md_black_1000_54</color>
<!-- Reader Theme -->
<!-- Text Colors --> <!-- Text Colors -->
<color name="md_black_1000_87">#DE000000</color> <color name="md_black_1000_87">#DE000000</color>
<color name="md_black_1000_54">#8A000000</color> <color name="md_black_1000_54">#8A000000</color>

View File

@ -30,15 +30,6 @@
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
</style> </style>
<!--==============-->
<!--NavigationView-->
<!--==============-->
<style name="Theme.Widget.NavigationView">
<item name="colorControlHighlight">@color/drawerHighlight</item>
<item name="colorPrimary">@color/drawerPrimary</item>
</style>
<!--===============--> <!--===============-->
<!--Text Appearance--> <!--Text Appearance-->
<!--===============--> <!--===============-->
@ -186,7 +177,7 @@
<style name="Theme.Widget.SpinnerItem" parent="Widget.AppCompat.DropDownItem.Spinner"> <style name="Theme.Widget.SpinnerItem" parent="Widget.AppCompat.DropDownItem.Spinner">
<item name="android:textColor">?attr/text_color_primary</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:background">?attr/selectable_list_drawable</item> <item name="android:background">?attr/selectable_list_drawable</item>
</style> </style>

View File

@ -24,7 +24,7 @@
<item name="android:colorBackground">@color/background</item> <item name="android:colorBackground">@color/background</item>
<item name="android:listSelector">?colorAccent</item> <item name="android:listSelector">?colorAccent</item>
<item name="android:divider">@color/divider</item> <item name="android:divider">@color/divider</item>
<item name="android:listDivider">@drawable/line_divider_light</item> <item name="android:listDivider">@drawable/line_divider</item>
<item name="actionModeStyle">@style/CustomActionModeStyle</item> <item name="actionModeStyle">@style/CustomActionModeStyle</item>
<item name="tabBarIconColor">?colorAccent</item> <item name="tabBarIconColor">?colorAccent</item>
<item name="tabBarIconInactive">@color/colorPrimaryInactive</item> <item name="tabBarIconInactive">@color/colorPrimaryInactive</item>
@ -34,20 +34,10 @@
<item name="windowActionModeOverlay">true</item> <item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.DayNight.ActionBar</item> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.DayNight.ActionBar</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.DayNight</item>
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView</item>
<item name="selectable_list_drawable">@drawable/list_item_selector</item> <item name="selectable_list_drawable">@drawable/list_item_selector</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
<item name="text_color_primary">@color/textColorPrimary</item>
<item name="background_card">@color/cardBackground</item>
<item name="icon_color">@color/iconColor</item>
<item name="snackbar_background">@color/snackbarBackground</item>
<item name="snackbar_text">@color/textColorPrimaryInverse</item>
<item name="actionBarTintColor">@color/textColorPrimary</item> <item name="actionBarTintColor">@color/textColorPrimary</item>
<item name="badgeColor">@color/badgeColor</item>
<item name="android:statusBarColor">@color/mainStatus</item> <item name="android:statusBarColor">@color/mainStatus</item>
<item name="android:navigationBarColor">#B3000000</item> <item name="android:navigationBarColor">#B3000000</item>
@ -77,101 +67,6 @@
<item name="android:windowLightNavigationBar" tools:targetApi="27">false</item> <item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
</style> </style>
<style name="Theme.Tachiyomi.Amoled" parent="Theme.Tachiyomi"/> <style name="Theme.Tachiyomi.Amoled" parent="Theme.Tachiyomi"/>
<!--==============-->
<!-- Reader Theme -->
<!--==============-->
<style name="Theme.Base.Reader" parent="Theme.Base">
<item name="android:forceDarkAllowed" tools:targetApi="29">false</item>
<item name="android:enforceNavigationBarContrast" tools:targetApi="29">false</item>
<item name="colorPrimary">@color/darkPrimaryTranslucent</item>
<item name="colorPrimaryDark">@color/darkPrimaryTranslucent</item>
<item name="android:colorBackground">@android:color/white</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="actionBarTintColor">@color/md_white_1000</item>
<item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
</style>
<style name="Theme.Base.Reader.Dark" parent="Theme.MaterialComponents.NoActionBar">
<item name="android:forceDarkAllowed" tools:targetApi="29">false</item>
<item name="android:enforceNavigationBarContrast" tools:targetApi="29">false</item>
<item name="colorPrimary">@color/darkPrimaryTranslucent</item>
<item name="colorPrimaryDark">@color/darkPrimaryTranslucent</item>
<item name="android:colorBackground">@android:color/black</item>
<item name="colorAccent">#3399FF</item>
<item name="android:textColorPrimary">@color/md_white_1000</item>
<item name="android:textColorSecondary">@color/md_white_1000_70</item>
<item name="android:textColorHint">@color/md_white_1000_50</item>
<item name="android:textColorPrimaryInverse">@color/md_black_1000_87</item>
<item name="android:textColorSecondaryInverse">@color/md_black_1000_54</item>
<item name="android:textColorHintInverse">@color/md_black_1000_38</item>
<item name="android:listSelector">?colorAccent</item>
<item name="android:divider">@android:color/transparent</item>
<item name="android:listDivider">@drawable/line_divider_dark</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">@color/darkPrimaryColor</item>
<item name="actionBarTintColor">@color/md_white_1000</item>
<!-- Themes -->
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="md_background_color">@android:color/transparent</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.DayNight</item>
<!-- Custom Attributes-->
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView</item>
<item name="selectable_list_drawable">@drawable/list_item_selector_dark</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_dark</item>
<item name="text_color_primary">@color/md_white_1000</item>
<item name="background_card">@android:color/transparent</item>
<item name="icon_color">@color/iconColor</item>
</style>
<style name="Theme.Base.Reader.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:forceDarkAllowed" tools:targetApi="29">false</item>
<item name="android:enforceNavigationBarContrast" tools:targetApi="29">false</item>
<item name="colorPrimary">@color/darkPrimaryTranslucent</item>
<item name="colorPrimaryDark">@color/darkPrimaryTranslucent</item>
<item name="android:colorBackground">@android:color/white</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/md_black_1000_87</item>
<item name="android:textColorSecondary">@color/md_black_1000_54</item>
<item name="android:textColorHint">@color/md_white_1000</item>
<item name="android:textColorPrimaryInverse">@color/md_white_1000</item>
<item name="android:textColorSecondaryInverse">@color/md_white_1000_70</item>
<item name="android:textColorHintInverse">@color/md_white_1000_50</item>
<item name="android:listSelector">?colorAccent</item>
<item name="android:divider">@color/md_white_1000_50</item>
<item name="android:listDivider">@drawable/line_divider_light</item>
<!-- Themes -->
<item name="windowActionModeOverlay">true</item>
<item name="actionBarTheme">@style/Theme.ActionBar.Dark.DayNight</item>
<item name="actionBarTintColor">@color/md_white_1000</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.DayNight</item>
<!-- Custom Attributes-->
<item name="navigation_view_theme">@style/Theme.Widget.NavigationView</item>
<item name="selectable_list_drawable">@drawable/list_item_selector</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
<item name="text_color_primary">@color/md_black_1000_87</item>
<item name="background_card">@color/md_white_1000_50</item>
<item name="icon_color">@color/md_black_1000_54</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item>
</style>
<!--===============--> <!--===============-->
<!-- Launch Screen --> <!-- Launch Screen -->