Various fixes
parent
dce877a139
commit
0e746091b8
@ -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()
|
||||
}
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
Loading…
Reference in New Issue