Various fixes
This commit is contained in:
@@ -6,10 +6,15 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.net.toFile
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.android.synthetic.main.activity_details.*
|
||||
import kotlinx.coroutines.launch
|
||||
import moxy.MvpDelegate
|
||||
import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.BuildConfig
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
@@ -18,6 +23,7 @@ import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.ui.common.BaseActivity
|
||||
import org.koitharu.kotatsu.ui.download.DownloadService
|
||||
import org.koitharu.kotatsu.utils.ShareHelper
|
||||
import org.koitharu.kotatsu.utils.ShortcutUtils
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
|
||||
class MangaDetailsActivity : BaseActivity(), MangaDetailsView {
|
||||
@@ -33,7 +39,10 @@ class MangaDetailsActivity : BaseActivity(), MangaDetailsView {
|
||||
pager.adapter = MangaDetailsAdapter(resources, supportFragmentManager)
|
||||
tabs.setupWithViewPager(pager)
|
||||
intent?.getParcelableExtra<Manga>(EXTRA_MANGA)?.let {
|
||||
presenter.loadDetails(it)
|
||||
presenter.loadDetails(
|
||||
manga = it,
|
||||
force = savedInstanceState?.containsKey(MvpDelegate.MOXY_DELEGATE_TAGS_KEY) != true
|
||||
)
|
||||
} ?: finish()
|
||||
}
|
||||
|
||||
@@ -61,6 +70,8 @@ class MangaDetailsActivity : BaseActivity(), MangaDetailsView {
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
menu.findItem(R.id.action_save).isEnabled =
|
||||
manga?.source != null && manga?.source != MangaSource.LOCAL
|
||||
menu.findItem(R.id.action_shortcut).isVisible = BuildConfig.DEBUG ||
|
||||
ShortcutManagerCompat.isRequestPinShortcutSupported(this)
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
@@ -81,6 +92,25 @@ class MangaDetailsActivity : BaseActivity(), MangaDetailsView {
|
||||
}
|
||||
true
|
||||
}
|
||||
R.id.action_shortcut -> {
|
||||
manga?.let {
|
||||
lifecycleScope.launch {
|
||||
if (!ShortcutManagerCompat.requestPinShortcut(
|
||||
this@MangaDetailsActivity,
|
||||
ShortcutUtils.createShortcutInfo(this@MangaDetailsActivity, it),
|
||||
null
|
||||
)
|
||||
) {
|
||||
Snackbar.make(
|
||||
pager,
|
||||
R.string.operation_not_supported,
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.ui.details
|
||||
|
||||
import android.text.Spanned
|
||||
import androidx.core.text.parseAsHtml
|
||||
import androidx.core.view.isVisible
|
||||
import coil.api.load
|
||||
@@ -25,10 +26,14 @@ class MangaDetailsFragment : BaseFragment(R.layout.fragment_details), MangaDetai
|
||||
|
||||
override fun onMangaUpdated(manga: Manga) {
|
||||
this.manga = manga
|
||||
imageView_cover.load(manga.largeCoverUrl ?: manga.coverUrl)
|
||||
imageView_cover.load(manga.largeCoverUrl ?: manga.coverUrl) {
|
||||
fallback(R.drawable.ic_placeholder)
|
||||
crossfade(true)
|
||||
}
|
||||
textView_title.text = manga.title
|
||||
textView_subtitle.text = manga.altTitle
|
||||
textView_description.text = manga.description?.parseAsHtml()
|
||||
textView_description.text = manga.description?.parseAsHtml()?.takeUnless(Spanned::isBlank)
|
||||
?: getString(R.string.no_description)
|
||||
if (manga.rating == Manga.NO_RATING) {
|
||||
ratingBar.isVisible = false
|
||||
} else {
|
||||
|
||||
@@ -17,6 +17,9 @@ class MangaGridHolder(parent: ViewGroup) : BaseViewHolder<Manga, MangaHistory?>(
|
||||
coverRequest?.dispose()
|
||||
textView_title.text = data.title
|
||||
coverRequest = imageView_cover.load(data.coverUrl) {
|
||||
placeholder(R.drawable.ic_placeholder)
|
||||
fallback(R.drawable.ic_placeholder)
|
||||
error(R.drawable.ic_placeholder)
|
||||
crossfade(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ class MangaListDetailsHolder(parent: ViewGroup) : BaseViewHolder<Manga, MangaHis
|
||||
textView_title.text = data.title
|
||||
textView_subtitle.textAndVisible = data.altTitle
|
||||
coverRequest = imageView_cover.load(data.coverUrl) {
|
||||
placeholder(R.drawable.ic_placeholder)
|
||||
fallback(R.drawable.ic_placeholder)
|
||||
error(R.drawable.ic_placeholder)
|
||||
crossfade(true)
|
||||
}
|
||||
if(data.rating == Manga.NO_RATING) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.android.synthetic.main.fragment_list.*
|
||||
import moxy.MvpDelegate
|
||||
import org.koin.android.ext.android.inject
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
@@ -31,6 +32,7 @@ import org.koitharu.kotatsu.ui.common.list.decor.SpacingItemDecoration
|
||||
import org.koitharu.kotatsu.ui.details.MangaDetailsActivity
|
||||
import org.koitharu.kotatsu.ui.main.list.filter.FilterAdapter
|
||||
import org.koitharu.kotatsu.ui.main.list.filter.OnFilterChangedListener
|
||||
import org.koitharu.kotatsu.utils.UiUtils
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
|
||||
abstract class MangaListFragment<E> : BaseFragment(R.layout.fragment_list), MangaListView<E>,
|
||||
@@ -70,7 +72,7 @@ abstract class MangaListFragment<E> : BaseFragment(R.layout.fragment_list), Mang
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
if (savedInstanceState?.containsKey("MoxyDelegateBundle") != true) {
|
||||
if (savedInstanceState?.containsKey(MvpDelegate.MOXY_DELEGATE_TAGS_KEY) != true) {
|
||||
onRequestMoreItems(0)
|
||||
}
|
||||
}
|
||||
@@ -210,7 +212,7 @@ abstract class MangaListFragment<E> : BaseFragment(R.layout.fragment_list), Mang
|
||||
recyclerView.clearItemDecorations()
|
||||
adapter?.listMode = mode
|
||||
recyclerView.layoutManager = when (mode) {
|
||||
ListMode.GRID -> GridLayoutManager(ctx, 3)
|
||||
ListMode.GRID -> GridLayoutManager(ctx, UiUtils.resolveGridSpanCount(ctx))
|
||||
else -> LinearLayoutManager(ctx)
|
||||
}
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
@@ -20,6 +20,9 @@ class MangaListHolder(parent: ViewGroup) :
|
||||
textView_title.text = data.title
|
||||
textView_subtitle.textAndVisible = data.tags.joinToString(", ") { it.title }
|
||||
coverRequest = imageView_cover.load(data.coverUrl) {
|
||||
placeholder(R.drawable.ic_placeholder)
|
||||
fallback(R.drawable.ic_placeholder)
|
||||
error(R.drawable.ic_placeholder)
|
||||
crossfade(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.core.view.isVisible
|
||||
import androidx.core.view.updatePadding
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.android.synthetic.main.activity_reader.*
|
||||
import moxy.MvpDelegate
|
||||
import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
@@ -69,7 +70,10 @@ class ReaderActivity : BaseFullscreenActivity(), ReaderView, ChaptersDialog.OnCh
|
||||
loader = PageLoader()
|
||||
adapter = PagesAdapter(loader)
|
||||
pager.adapter = adapter
|
||||
presenter.loadChapter(state)
|
||||
pager.offscreenPageLimit = 2
|
||||
if (savedInstanceState?.containsKey(MvpDelegate.MOXY_DELEGATE_TAGS_KEY) != true) {
|
||||
presenter.loadChapter(state)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -3,23 +3,30 @@ package org.koitharu.kotatsu.ui.reader.thumbnails
|
||||
import android.view.ViewGroup
|
||||
import coil.Coil
|
||||
import coil.api.get
|
||||
import coil.size.PixelSize
|
||||
import coil.size.Size
|
||||
import kotlinx.android.synthetic.main.item_page_thumb.*
|
||||
import kotlinx.coroutines.*
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.MangaPage
|
||||
import org.koitharu.kotatsu.domain.MangaProviderFactory
|
||||
import org.koitharu.kotatsu.ui.common.list.BaseViewHolder
|
||||
import org.koitharu.kotatsu.utils.DrawUtils
|
||||
import org.koitharu.kotatsu.utils.ext.resolveDp
|
||||
|
||||
class PageThumbnailHolder(parent: ViewGroup, private val scope: CoroutineScope) :
|
||||
BaseViewHolder<MangaPage, Unit>(parent, R.layout.item_page_thumb) {
|
||||
|
||||
private var job: Job? = null
|
||||
private val thumbSize: Size
|
||||
|
||||
init {
|
||||
val color = DrawUtils.invertColor(textView_number.currentTextColor)
|
||||
textView_number.setShadowLayer(parent.resources.resolveDp(26f), 0f, 0f, color)
|
||||
// FIXME
|
||||
// val color = DrawUtils.invertColor(textView_number.currentTextColor)
|
||||
// textView_number.setShadowLayer(parent.resources.resolveDp(26f), 0f, 0f, color)
|
||||
val width = itemView.context.resources.getDimensionPixelSize(R.dimen.preferred_grid_width)
|
||||
thumbSize = PixelSize(
|
||||
width = width,
|
||||
height = (width * 13f / 18f).toInt()
|
||||
)
|
||||
}
|
||||
|
||||
override fun onBind(data: MangaPage, extra: Unit) {
|
||||
@@ -32,7 +39,7 @@ class PageThumbnailHolder(parent: ViewGroup, private val scope: CoroutineScope)
|
||||
MangaProviderFactory.create(data.source).getPageFullUrl(data)
|
||||
}
|
||||
val drawable = Coil.get(url) {
|
||||
|
||||
size(thumbSize)
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
imageView_thumb.setImageDrawable(drawable)
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import kotlinx.android.synthetic.main.sheet_pages.*
|
||||
@@ -13,6 +14,7 @@ import org.koitharu.kotatsu.core.model.MangaPage
|
||||
import org.koitharu.kotatsu.ui.common.BaseBottomSheet
|
||||
import org.koitharu.kotatsu.ui.common.list.OnRecyclerItemClickListener
|
||||
import org.koitharu.kotatsu.ui.common.list.decor.SpacingItemDecoration
|
||||
import org.koitharu.kotatsu.utils.UiUtils
|
||||
import org.koitharu.kotatsu.utils.ext.resolveDp
|
||||
import org.koitharu.kotatsu.utils.ext.withArgs
|
||||
|
||||
@@ -31,6 +33,7 @@ class PagesThumbnailsSheet : BaseBottomSheet(R.layout.sheet_pages),
|
||||
dismissAllowingStateLoss()
|
||||
return
|
||||
}
|
||||
(recyclerView.layoutManager as? GridLayoutManager)?.spanCount = UiUtils.resolveGridSpanCount(view.context)
|
||||
val title = arguments?.getString(ARG_TITLE)
|
||||
toolbar.title = title
|
||||
toolbar.setNavigationOnClickListener { dismiss() }
|
||||
@@ -56,8 +59,8 @@ class PagesThumbnailsSheet : BaseBottomSheet(R.layout.sheet_pages),
|
||||
}
|
||||
}
|
||||
})
|
||||
behavior.peekHeight = BottomSheetBehavior.PEEK_HEIGHT_AUTO
|
||||
behavior.isFitToContents = false
|
||||
// behavior.peekHeight = BottomSheetBehavior.PEEK_HEIGHT_AUTO
|
||||
// behavior.isFitToContents = false
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package org.koitharu.kotatsu.utils
|
||||
|
||||
import android.graphics.Color
|
||||
import androidx.annotation.ColorInt
|
||||
|
||||
object DrawUtils {
|
||||
|
||||
@JvmStatic
|
||||
@ColorInt
|
||||
fun invertColor(@ColorInt color: Int): Int {
|
||||
val red = Color.red(color)
|
||||
val green = Color.green(color)
|
||||
val blue = Color.blue(color)
|
||||
val alpha = Color.alpha(color)
|
||||
return Color.argb(alpha, 255 - red, 255 - green, 255 - blue)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.koitharu.kotatsu.utils
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.content.pm.ShortcutInfoCompat
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import coil.Coil
|
||||
import coil.api.get
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.ui.details.MangaDetailsActivity
|
||||
|
||||
object ShortcutUtils {
|
||||
|
||||
@JvmStatic
|
||||
suspend fun createShortcutInfo(context: Context, manga: Manga): ShortcutInfoCompat {
|
||||
// val icon = withContext(Dispatchers.IO) {
|
||||
// Coil.loader().get(manga.coverUrl) {
|
||||
// context.getSystemService<ActivityManager>()?.let {
|
||||
// size(it.launcherLargeIconSize)
|
||||
// }
|
||||
// }.toBitmap()
|
||||
// }
|
||||
return ShortcutInfoCompat.Builder(context, manga.id.toString())
|
||||
.setShortLabel(manga.title)
|
||||
.setLongLabel(manga.title)
|
||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_launcher_foreground))
|
||||
.setIntent(MangaDetailsActivity.newIntent(context, manga))
|
||||
.build()
|
||||
}
|
||||
}
|
||||
28
app/src/main/java/org/koitharu/kotatsu/utils/UiUtils.kt
Normal file
28
app/src/main/java/org/koitharu/kotatsu/utils/UiUtils.kt
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.koitharu.kotatsu.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import androidx.annotation.ColorInt
|
||||
import org.koitharu.kotatsu.R
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
object UiUtils {
|
||||
|
||||
@JvmStatic
|
||||
@ColorInt
|
||||
fun invertColor(@ColorInt color: Int): Int {
|
||||
val red = Color.red(color)
|
||||
val green = Color.green(color)
|
||||
val blue = Color.blue(color)
|
||||
val alpha = Color.alpha(color)
|
||||
return Color.argb(alpha, 255 - red, 255 - green, 255 - blue)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun resolveGridSpanCount(context: Context): Int {
|
||||
val cellWidth = context.resources.getDimensionPixelSize(R.dimen.preferred_grid_width)
|
||||
val screenWidth = context.resources.displayMetrics.widthPixels.toDouble()
|
||||
val estimatedCount = (screenWidth / cellWidth).roundToInt()
|
||||
return estimatedCount.coerceAtLeast(2)
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ suspend inline fun <T, R> T.retryUntilSuccess(maxAttempts: Int, action: T.() ->
|
||||
}
|
||||
|
||||
fun Throwable.getDisplayMessage(resources: Resources) = when (this) {
|
||||
is UnsupportedOperationException -> resources.getString(R.string.operation_not_supported)
|
||||
is UnsupportedFileException -> resources.getString(R.string.text_file_not_supported)
|
||||
is IOException -> resources.getString(R.string.network_error)
|
||||
else -> if (BuildConfig.DEBUG) {
|
||||
|
||||
11
app/src/main/res/drawable/ic_placeholder.xml
Normal file
11
app/src/main/res/drawable/ic_placeholder.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_placeholder_raw"
|
||||
android:top="20dp"
|
||||
android:bottom="20dp"
|
||||
android:left="20dp"
|
||||
android:right="20dp"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
||||
14
app/src/main/res/drawable/ic_placeholder_raw.xml
Normal file
14
app/src/main/res/drawable/ic_placeholder_raw.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:tint="?android:textColorTertiary"
|
||||
android:viewportWidth="489.4"
|
||||
android:viewportHeight="489.4">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M0,437.8c0,28.5 23.2,51.6 51.6,51.6h386.2c28.5,0 51.6,-23.2 51.6,-51.6V51.6c0,-28.5 -23.2,-51.6 -51.6,-51.6H51.6C23.1,0 0,23.2 0,51.6C0,51.6 0,437.8 0,437.8zM437.8,464.9H51.6c-14.9,0 -27.1,-12.2 -27.1,-27.1v-64.5l92.8,-92.8l79.3,79.3c4.8,4.8 12.5,4.8 17.3,0l143.2,-143.2l107.8,107.8v113.4C464.9,452.7 452.7,464.9 437.8,464.9zM51.6,24.5h386.2c14.9,0 27.1,12.2 27.1,27.1v238.1l-99.2,-99.1c-4.8,-4.8 -12.5,-4.8 -17.3,0L205.2,333.8l-79.3,-79.3c-4.8,-4.8 -12.5,-4.8 -17.3,0l-84.1,84.1v-287C24.5,36.7 36.7,24.5 51.6,24.5z" />
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M151.7,196.1c34.4,0 62.3,-28 62.3,-62.3s-28,-62.3 -62.3,-62.3s-62.3,28 -62.3,62.3S117.3,196.1 151.7,196.1zM151.7,96c20.9,0 37.8,17 37.8,37.8s-17,37.8 -37.8,37.8s-37.8,-17 -37.8,-37.8S130.8,96 151.7,96z" />
|
||||
</vector>
|
||||
@@ -1,4 +1,5 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
@@ -6,5 +7,5 @@
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" />
|
||||
android:pathData="M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z" />
|
||||
</vector>
|
||||
@@ -9,6 +9,7 @@
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
@@ -16,7 +17,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light" />
|
||||
app:popupTheme="@style/AppPopupTheme" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
@@ -24,7 +25,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light" />
|
||||
app:popupTheme="@style/AppPopupTheme" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:id="@id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light" />
|
||||
app:popupTheme="@style/AppPopupTheme" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light" />
|
||||
app:popupTheme="@style/AppPopupTheme" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="?colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
@@ -17,7 +18,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light" />
|
||||
app:popupTheme="@style/AppPopupTheme" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
@@ -16,7 +17,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light" />
|
||||
app:popupTheme="@style/AppPopupTheme" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@
|
||||
android:contentDescription="@string/add_to_favourites"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_tag_heart_outline"
|
||||
app:tint="?colorAccent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/button_read"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_read"
|
||||
app:layout_constraintTop_toTopOf="@id/button_read" />
|
||||
app:layout_constraintTop_toTopOf="@id/button_read"
|
||||
app:tint="?colorAccent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrier_title"
|
||||
@@ -98,6 +98,16 @@
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="imageView_cover, button_read" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_top"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:listDivider"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_title" />
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/chips_tags"
|
||||
android:layout_width="0dp"
|
||||
@@ -106,7 +116,7 @@
|
||||
android:padding="6dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrier_title" />
|
||||
app:layout_constraintTop_toBottomOf="@id/divider_top" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_description"
|
||||
@@ -127,10 +137,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/chips_tags"
|
||||
app:layout_constraintBottom_toBottomOf="@id/divider_top"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/chips_tags"
|
||||
app:layout_constraintTop_toBottomOf="@id/divider_top"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<org.koitharu.kotatsu.ui.common.widgets.CoverImageView
|
||||
android:id="@+id/imageView_thumb"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/ic_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
@@ -44,8 +45,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
||||
app:spanCount="3"
|
||||
tools:listitem="@layout/item_page_thumb" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</LinearLayout>
|
||||
8
app/src/main/res/values-night/colors.xml
Normal file
8
app/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="blue_primary">#1565C0</color>
|
||||
<color name="blue_primary_dark">#283593</color>
|
||||
<color name="red_accent">#FF8A65</color>
|
||||
<color name="dim">#99000000</color>
|
||||
<color name="error">#E57373</color>
|
||||
</resources>
|
||||
4
app/src/main/res/values-night/styles.xml
Normal file
4
app/src/main/res/values-night/styles.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="AppPopupTheme" parent="ThemeOverlay.MaterialComponents.Dark" />
|
||||
</resources>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="primary">#0288D1</color>
|
||||
<color name="primary_dark">#0D47A1</color>
|
||||
<color name="accent">#F4511E</color>
|
||||
<color name="blue_primary">#0288D1</color>
|
||||
<color name="blue_primary_dark">#0D47A1</color>
|
||||
<color name="red_accent">#F4511E</color>
|
||||
<color name="dim">#99000000</color>
|
||||
<color name="error">#D32F2F</color>
|
||||
</resources>
|
||||
@@ -74,4 +74,5 @@
|
||||
<string name="delete">Delete</string>
|
||||
<string name="operation_not_supported">This operation is not supported</string>
|
||||
<string name="text_file_not_supported">Invalid file. Only ZIP and CBZ are supported.</string>
|
||||
<string name="no_description">No description</string>
|
||||
</resources>
|
||||
@@ -8,4 +8,6 @@
|
||||
<item name="android:paddingBottom">10dp</item>
|
||||
</style>
|
||||
|
||||
<style name="AppPopupTheme" parent="ThemeOverlay.MaterialComponents.Light" />
|
||||
|
||||
</resources>
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
<item name="colorPrimary">@color/blue_primary</item>
|
||||
<item name="colorPrimaryDark">@color/blue_primary_dark</item>
|
||||
<item name="colorAccent">@color/red_accent</item>
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user