chore: cleanup pt2
This commit is contained in:
parent
24147e746a
commit
70a50ece43
52 changed files with 501 additions and 294 deletions
|
@ -5,12 +5,12 @@ import com.google.firebase.FirebaseApp
|
|||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.ktx.app
|
||||
|
||||
class FirebaseCrashlytics : CrashlyticsInterface {
|
||||
override fun initialize(context: Context) {
|
||||
FirebaseApp.initializeApp(context)
|
||||
}
|
||||
|
||||
override fun logException(e: Throwable) {
|
||||
FirebaseCrashlytics.getInstance().recordException(e)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -88,7 +87,11 @@ object AppUpdater {
|
|||
try {
|
||||
val apks =
|
||||
client.get("https://api.github.com/repos/$repo/releases/tags/v$version")
|
||||
.parsed<GithubResponse>().assets?.filter { it.browserDownloadURL.endsWith(".apk") }
|
||||
.parsed<GithubResponse>().assets?.filter {
|
||||
it.browserDownloadURL.endsWith(
|
||||
".apk"
|
||||
)
|
||||
}
|
||||
val apkToDownload = apks?.first()
|
||||
apkToDownload?.browserDownloadURL.apply {
|
||||
if (this != null) activity.downloadUpdate(version, this)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-sdk tools:overrideLibrary="go.server.gojni" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
|
@ -42,7 +44,9 @@
|
|||
<uses-feature
|
||||
android:name="android.hardware.bluetooth"
|
||||
android:required="false" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH"
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.BLUETOOTH"
|
||||
android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<!-- ExoPlayer: Bluetooth Headsets -->
|
||||
|
@ -430,10 +434,11 @@
|
|||
android:name="androidx.media3.exoplayer.scheduler.PlatformScheduler$PlatformSchedulerService"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
<service android:name=".addons.torrent.ServerService"
|
||||
<service
|
||||
android:name=".addons.torrent.ServerService"
|
||||
android:exported="false"
|
||||
android:stopWithTask="true"
|
||||
android:foregroundServiceType="dataSync" />
|
||||
android:foregroundServiceType="dataSync"
|
||||
android:stopWithTask="true" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.content.DialogInterface
|
|||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.content.res.Resources.getSystem
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
|
@ -68,12 +67,9 @@ import android.widget.FrameLayout
|
|||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.math.MathUtils.clamp
|
||||
|
@ -189,7 +185,8 @@ fun currActivity(): Activity? {
|
|||
var loadMedia: Int? = null
|
||||
var loadIsMAL = false
|
||||
|
||||
val Int.toPx get() = TypedValue.applyDimension(
|
||||
val Int.toPx
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), getSystem().displayMetrics
|
||||
).toInt()
|
||||
|
||||
|
@ -220,7 +217,8 @@ fun initActivity(a: Activity) {
|
|||
window.decorView
|
||||
).hide(WindowInsetsCompat.Type.statusBars())
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && statusBarHeight == 0
|
||||
&& a.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
&& a.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
) {
|
||||
window.decorView.rootWindowInsets?.displayCutout?.apply {
|
||||
if (boundingRects.size > 0) {
|
||||
statusBarHeight = min(boundingRects[0].width(), boundingRects[0].height())
|
||||
|
@ -296,7 +294,12 @@ fun ViewGroup.setBaseline(navBar: AnimatedBottomBar, overlayView: View) {
|
|||
navBar.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||
overlayView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||
clipToPadding = false
|
||||
setPadding(paddingLeft, paddingTop, paddingRight, navBarHeight + navBar.measuredHeight + overlayView.measuredHeight)
|
||||
setPadding(
|
||||
paddingLeft,
|
||||
paddingTop,
|
||||
paddingRight,
|
||||
navBarHeight + navBar.measuredHeight + overlayView.measuredHeight
|
||||
)
|
||||
}
|
||||
|
||||
fun Activity.reloadActivity() {
|
||||
|
@ -310,7 +313,8 @@ fun Activity.restartApp() {
|
|||
val mainIntent = Intent.makeRestartActivityTask(
|
||||
packageManager.getLaunchIntentForPackage(this.packageName)!!.component
|
||||
)
|
||||
val component = ComponentName(this@restartApp.packageName, this@restartApp::class.qualifiedName!!)
|
||||
val component =
|
||||
ComponentName(this@restartApp.packageName, this@restartApp::class.qualifiedName!!)
|
||||
try {
|
||||
startActivity(Intent().setComponent(component))
|
||||
} catch (e: Exception) {
|
||||
|
@ -953,7 +957,8 @@ fun copyToClipboard(string: String, toast: Boolean = true) {
|
|||
|
||||
fun countDown(media: Media, view: ViewGroup) {
|
||||
if (media.anime?.nextAiringEpisode != null && media.anime.nextAiringEpisodeTime != null
|
||||
&& (media.anime.nextAiringEpisodeTime!! - System.currentTimeMillis() / 1000) <= 86400 * 28.toLong()) {
|
||||
&& (media.anime.nextAiringEpisodeTime!! - System.currentTimeMillis() / 1000) <= 86400 * 28.toLong()
|
||||
) {
|
||||
val v = ItemCountDownBinding.inflate(LayoutInflater.from(view.context), view, false)
|
||||
view.addView(v.root, 0)
|
||||
v.mediaCountdownText.text =
|
||||
|
|
|
@ -35,12 +35,12 @@ import androidx.lifecycle.lifecycleScope
|
|||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.work.OneTimeWorkRequest
|
||||
import ani.dantotsu.addons.torrent.ServerService
|
||||
import ani.dantotsu.addons.torrent.TorrentAddonManager
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.AnilistHomeViewModel
|
||||
import ani.dantotsu.databinding.ActivityMainBinding
|
||||
import ani.dantotsu.databinding.SplashScreenBinding
|
||||
import ani.dantotsu.addons.torrent.ServerService
|
||||
import ani.dantotsu.addons.torrent.TorrentAddonManager
|
||||
import ani.dantotsu.home.AnimeFragment
|
||||
import ani.dantotsu.home.HomeFragment
|
||||
import ani.dantotsu.home.LoginFragment
|
||||
|
|
|
@ -3,7 +3,6 @@ package ani.dantotsu.connections.anilist
|
|||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.client
|
||||
|
@ -14,7 +13,6 @@ import ani.dantotsu.settings.saving.PrefManager
|
|||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
import ani.dantotsu.util.Logger
|
||||
import java.util.Calendar
|
||||
|
||||
|
@ -201,7 +199,9 @@ object Anilist {
|
|||
toast("Rate limited. Try after $retry seconds")
|
||||
throw Exception("Rate limited after $retry seconds")
|
||||
}
|
||||
if (!json.text.startsWith("{")) {throw Exception(currContext()?.getString(R.string.anilist_down))}
|
||||
if (!json.text.startsWith("{")) {
|
||||
throw Exception(currContext()?.getString(R.string.anilist_down))
|
||||
}
|
||||
if (show) Logger.log("Anilist Response: ${json.text}")
|
||||
json.parsed()
|
||||
} else null
|
||||
|
|
|
@ -1061,20 +1061,31 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
|||
}
|
||||
return null
|
||||
}
|
||||
private val onListAnime = (if(PrefManager.getVal(PrefName.IncludeAnimeList)) "" else "onList:false").replace("\"", "")
|
||||
private val isAdult = (if (PrefManager.getVal(PrefName.AdultOnly)) "isAdult:true" else "").replace("\"", "")
|
||||
|
||||
private val onListAnime =
|
||||
(if (PrefManager.getVal(PrefName.IncludeAnimeList)) "" else "onList:false").replace(
|
||||
"\"",
|
||||
""
|
||||
)
|
||||
private val isAdult =
|
||||
(if (PrefManager.getVal(PrefName.AdultOnly)) "isAdult:true" else "").replace("\"", "")
|
||||
|
||||
private fun recentAnimeUpdates(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}airingSchedules(airingAt_greater:0 airingAt_lesser:${System.currentTimeMillis() / 1000 - 10000} sort:TIME_DESC){episode airingAt media{id idMal status chapters episodes nextAiringEpisode{episode} isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large} title{english romaji userPreferred} mediaListEntry{progress private score(format:POINT_100) status}}}}"""
|
||||
}
|
||||
|
||||
private fun trendingMovies(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort:POPULARITY_DESC, type: ANIME, format: MOVIE, $onListAnime, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
private fun topRatedAnime(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort: SCORE_DESC, type: ANIME, $onListAnime, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
private fun mostFavAnime(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort:FAVOURITES_DESC,type: ANIME, $onListAnime, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
suspend fun loadAnimeList(): Map<String, ArrayList<Media>> {
|
||||
val list = mutableMapOf<String, ArrayList<Media>>()
|
||||
fun query(): String {
|
||||
|
@ -1136,22 +1147,33 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
|||
}
|
||||
return list
|
||||
}
|
||||
private val onListManga = (if(PrefManager.getVal(PrefName.IncludeMangaList)) "" else "onList:false").replace("\"", "")
|
||||
|
||||
private val onListManga =
|
||||
(if (PrefManager.getVal(PrefName.IncludeMangaList)) "" else "onList:false").replace(
|
||||
"\"",
|
||||
""
|
||||
)
|
||||
|
||||
private fun trendingManga(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort:POPULARITY_DESC, type: MANGA,countryOfOrigin:JP, $onListManga, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
private fun trendingManhwa(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort:POPULARITY_DESC, type: MANGA, countryOfOrigin:KR, $onListManga, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
private fun trendingNovel(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort:POPULARITY_DESC, type: MANGA, format: NOVEL, countryOfOrigin:JP, $onListManga, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
private fun topRatedManga(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort: SCORE_DESC, type: MANGA, $onListManga, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
private fun mostFavManga(page: Int): String {
|
||||
return """Page(page:$page,perPage:50){pageInfo{hasNextPage total}media(sort:FAVOURITES_DESC,type: MANGA, $onListManga, $isAdult){id idMal status chapters episodes nextAiringEpisode{episode}isAdult type meanScore isFavourite format bannerImage countryOfOrigin coverImage{large}title{english romaji userPreferred}mediaListEntry{progress private score(format:POINT_100)status}}}"""
|
||||
}
|
||||
|
||||
suspend fun loadMangaList(): Map<String, ArrayList<Media>> {
|
||||
val list = mutableMapOf<String, ArrayList<Media>>()
|
||||
fun query(): String {
|
||||
|
@ -1185,6 +1207,7 @@ query (${"$"}page: Int = 1, ${"$"}id: Int, ${"$"}type: MediaType, ${"$"}isAdult:
|
|||
|
||||
return list
|
||||
}
|
||||
|
||||
suspend fun recentlyUpdated(
|
||||
greater: Long = 0,
|
||||
lesser: Long = System.currentTimeMillis() / 1000 - 10000
|
||||
|
@ -1235,6 +1258,7 @@ Page(page:$page,perPage:50) {
|
|||
}""".replace("\n", " ").replace(""" """, "")
|
||||
return executeQuery<Query.Page>(query, force = true)?.data?.page
|
||||
}
|
||||
|
||||
var i = 1
|
||||
val list = mutableListOf<Media>()
|
||||
var res: Page? = null
|
||||
|
@ -1468,7 +1492,8 @@ Page(page:$page,perPage:50) {
|
|||
val characters = arrayListOf<Character>()
|
||||
while (hasNextPage) {
|
||||
page++
|
||||
val query = executeQuery<Query.Author>(query(page), force = true
|
||||
val query = executeQuery<Query.Author>(
|
||||
query(page), force = true
|
||||
)?.data?.author
|
||||
hasNextPage = query?.staffMedia?.let {
|
||||
it.edges?.forEach { i ->
|
||||
|
@ -1487,7 +1512,16 @@ Page(page:$page,perPage:50) {
|
|||
} ?: false
|
||||
query?.characters?.let {
|
||||
it.nodes?.forEach { i ->
|
||||
characters.add(Character(i.id, i.name?.userPreferred, i.image?.large, i.image?.medium, "", false))
|
||||
characters.add(
|
||||
Character(
|
||||
i.id,
|
||||
i.name?.userPreferred,
|
||||
i.image?.large,
|
||||
i.image?.medium,
|
||||
"",
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1501,6 +1535,7 @@ Page(page:$page,perPage:50) {
|
|||
author.yearMedia = yearMedia
|
||||
return author
|
||||
}
|
||||
|
||||
suspend fun toggleFollow(id: Int): Query.ToggleFollow? {
|
||||
return executeQuery<Query.ToggleFollow>(
|
||||
"""mutation{ToggleFollow(userId:$id){id, isFollowing, isFollower}}"""
|
||||
|
@ -1568,7 +1603,11 @@ Page(page:$page,perPage:50) {
|
|||
}
|
||||
|
||||
|
||||
suspend fun getNotifications(id: Int, page: Int = 1, resetNotification: Boolean = true): NotificationResponse? {
|
||||
suspend fun getNotifications(
|
||||
id: Int,
|
||||
page: Int = 1,
|
||||
resetNotification: Boolean = true
|
||||
): NotificationResponse? {
|
||||
val reset = if (resetNotification) "true" else "false"
|
||||
val res = executeQuery<NotificationResponse>(
|
||||
"""{User(id:$id){unreadNotificationCount}Page(page:$page,perPage:$ITEMS_PER_PAGE){pageInfo{currentPage,hasNextPage}notifications(resetNotificationCount:$reset){__typename...on AiringNotification{id,type,animeId,episode,contexts,createdAt,media{id,title{romaji,english,native,userPreferred}bannerImage,coverImage{medium,large}},}...on FollowingNotification{id,userId,type,context,createdAt,user{id,name,bannerImage,avatar{medium,large,}}}...on ActivityMessageNotification{id,userId,type,activityId,context,createdAt,message{id}user{id,name,bannerImage,avatar{medium,large,}}}...on ActivityMentionNotification{id,userId,type,activityId,context,createdAt,activity{__typename}user{id,name,bannerImage,avatar{medium,large,}}}...on ActivityReplyNotification{id,userId,type,activityId,context,createdAt,activity{__typename}user{id,name,bannerImage,avatar{medium,large,}}}...on ActivityReplySubscribedNotification{id,userId,type,activityId,context,createdAt,activity{__typename}user{id,name,bannerImage,avatar{medium,large,}}}...on ActivityLikeNotification{id,userId,type,activityId,context,createdAt,activity{__typename}user{id,name,bannerImage,avatar{medium,large,}}}...on ActivityReplyLikeNotification{id,userId,type,activityId,context,createdAt,activity{__typename}user{id,name,bannerImage,avatar{medium,large,}}}...on ThreadCommentMentionNotification{id,userId,type,commentId,context,createdAt,thread{id}comment{id}user{id,name,bannerImage,avatar{medium,large,}}}...on ThreadCommentReplyNotification{id,userId,type,commentId,context,createdAt,thread{id}comment{id}user{id,name,bannerImage,avatar{medium,large,}}}...on ThreadCommentSubscribedNotification{id,userId,type,commentId,context,createdAt,thread{id}comment{id}user{id,name,bannerImage,avatar{medium,large,}}}...on ThreadCommentLikeNotification{id,userId,type,commentId,context,createdAt,thread{id}comment{id}user{id,name,bannerImage,avatar{medium,large,}}}...on ThreadLikeNotification{id,userId,type,threadId,context,createdAt,thread{id}comment{id}user{id,name,bannerImage,avatar{medium,large,}}}...on RelatedMediaAdditionNotification{id,type,context,createdAt,media{id,title{romaji,english,native,userPreferred}bannerImage,coverImage{medium,large}}}...on MediaDataChangeNotification{id,type,mediaId,context,reason,createdAt,media{id,title{romaji,english,native,userPreferred}bannerImage,coverImage{medium,large}}}...on MediaMergeNotification{id,type,mediaId,deletedMediaTitles,context,reason,createdAt,media{id,title{romaji,english,native,userPreferred}bannerImage,coverImage{medium,large}}}...on MediaDeletionNotification{id,type,deletedMediaTitle,context,reason,createdAt,}}}}""",
|
||||
|
@ -1583,7 +1622,12 @@ Page(page:$page,perPage:50) {
|
|||
return res
|
||||
}
|
||||
|
||||
suspend fun getFeed(userId: Int?, global: Boolean = false, page: Int = 1, activityId: Int? = null): FeedResponse? {
|
||||
suspend fun getFeed(
|
||||
userId: Int?,
|
||||
global: Boolean = false,
|
||||
page: Int = 1,
|
||||
activityId: Int? = null
|
||||
): FeedResponse? {
|
||||
val filter = if (activityId != null) "id:$activityId,"
|
||||
else if (userId != null) "userId:$userId,"
|
||||
else if (global) "isFollowing:false,hasRepliesOrTypeText:true,"
|
||||
|
@ -1612,14 +1656,26 @@ Page(page:$page,perPage:50) {
|
|||
.filter { it.timeUntilAiring != null }
|
||||
}
|
||||
|
||||
suspend fun isUserFav(favType: AnilistMutations.FavType, id: Int): Boolean { //anilist isFavourite is broken, so we need to check it manually
|
||||
suspend fun isUserFav(
|
||||
favType: AnilistMutations.FavType,
|
||||
id: Int
|
||||
): Boolean { //anilist isFavourite is broken, so we need to check it manually
|
||||
val res = getUserProfile(Anilist.userid ?: return false)
|
||||
return when (favType) {
|
||||
AnilistMutations.FavType.ANIME -> res?.data?.user?.favourites?.anime?.nodes?.any { it.id == id } ?: false
|
||||
AnilistMutations.FavType.MANGA -> res?.data?.user?.favourites?.manga?.nodes?.any { it.id == id } ?: false
|
||||
AnilistMutations.FavType.CHARACTER -> res?.data?.user?.favourites?.characters?.nodes?.any { it.id == id } ?: false
|
||||
AnilistMutations.FavType.STAFF -> res?.data?.user?.favourites?.staff?.nodes?.any { it.id == id } ?: false
|
||||
AnilistMutations.FavType.STUDIO -> res?.data?.user?.favourites?.studios?.nodes?.any { it.id == id } ?: false
|
||||
AnilistMutations.FavType.ANIME -> res?.data?.user?.favourites?.anime?.nodes?.any { it.id == id }
|
||||
?: false
|
||||
|
||||
AnilistMutations.FavType.MANGA -> res?.data?.user?.favourites?.manga?.nodes?.any { it.id == id }
|
||||
?: false
|
||||
|
||||
AnilistMutations.FavType.CHARACTER -> res?.data?.user?.favourites?.characters?.nodes?.any { it.id == id }
|
||||
?: false
|
||||
|
||||
AnilistMutations.FavType.STAFF -> res?.data?.user?.favourites?.staff?.nodes?.any { it.id == id }
|
||||
?: false
|
||||
|
||||
AnilistMutations.FavType.STUDIO -> res?.data?.user?.favourites?.studios?.nodes?.any { it.id == id }
|
||||
?: false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,6 @@ import androidx.fragment.app.FragmentActivity
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.webkit.internal.ApiFeature.M
|
||||
import androidx.webkit.internal.ApiFeature.P
|
||||
import androidx.webkit.internal.StartupApiFeature
|
||||
import ani.dantotsu.BuildConfig
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.discord.Discord
|
||||
|
@ -190,18 +187,22 @@ class AnilistAnimeViewModel : ViewModel() {
|
|||
var loaded: Boolean = false
|
||||
private val updated: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getUpdated(): LiveData<MutableList<Media>> = updated
|
||||
|
||||
private val popularMovies: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getMovies(): LiveData<MutableList<Media>> = popularMovies
|
||||
|
||||
private val topRatedAnime: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getTopRated(): LiveData<MutableList<Media>> = topRatedAnime
|
||||
|
||||
private val mostFavAnime: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getMostFav(): LiveData<MutableList<Media>> = mostFavAnime
|
||||
suspend fun loadAll() {
|
||||
val list = Anilist.query.loadAnimeList()
|
||||
|
@ -283,22 +284,27 @@ class AnilistMangaViewModel : ViewModel() {
|
|||
|
||||
private val popularManga: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getPopularManga(): LiveData<MutableList<Media>> = popularManga
|
||||
|
||||
private val popularManhwa: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getPopularManhwa(): LiveData<MutableList<Media>> = popularManhwa
|
||||
|
||||
private val popularNovel: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getPopularNovel(): LiveData<MutableList<Media>> = popularNovel
|
||||
|
||||
private val topRatedManga: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getTopRated(): LiveData<MutableList<Media>> = topRatedManga
|
||||
|
||||
private val mostFavManga: MutableLiveData<MutableList<Media>> =
|
||||
MutableLiveData<MutableList<Media>>(null)
|
||||
|
||||
fun getMostFav(): LiveData<MutableList<Media>> = mostFavManga
|
||||
suspend fun loadAll() {
|
||||
val list = Anilist.query.loadMangaList()
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.net.Uri
|
|||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import ani.dantotsu.logError
|
||||
import ani.dantotsu.util.Logger
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.startMainActivity
|
||||
|
|
|
@ -149,8 +149,10 @@ class Query {
|
|||
@Serializable
|
||||
data class Data(
|
||||
@SerialName("favoriteAnime") val favoriteAnime: ani.dantotsu.connections.anilist.api.User?,
|
||||
@SerialName("favoriteManga") val favoriteManga: ani.dantotsu.connections.anilist.api.User?)
|
||||
@SerialName("favoriteManga") val favoriteManga: ani.dantotsu.connections.anilist.api.User?
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class AnimeList(
|
||||
@SerialName("data")
|
||||
|
@ -168,6 +170,7 @@ class Query {
|
|||
@SerialName("mostFav2") val mostFav2: ani.dantotsu.connections.anilist.api.Page?,
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class MangaList(
|
||||
@SerialName("data")
|
||||
|
@ -187,6 +190,7 @@ class Query {
|
|||
@SerialName("mostFav2") val mostFav2: ani.dantotsu.connections.anilist.api.Page?,
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ToggleFollow(
|
||||
@SerialName("data")
|
||||
|
|
|
@ -21,6 +21,7 @@ enum class NotificationType(val value: String) {
|
|||
MEDIA_DATA_CHANGE("MEDIA_DATA_CHANGE"),
|
||||
MEDIA_MERGE("MEDIA_MERGE"),
|
||||
MEDIA_DELETION("MEDIA_DELETION"),
|
||||
|
||||
//custom
|
||||
COMMENT_REPLY("COMMENT_REPLY"),
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ data class StaffConnection(
|
|||
// The pagination information
|
||||
// @SerialName("pageInfo") var pageInfo: PageInfo?,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class StaffImage(
|
||||
// The character's image of media at its largest size
|
||||
|
@ -101,6 +102,7 @@ data class StaffImage(
|
|||
// The character's image of media at medium size
|
||||
@SerialName("medium") var medium: String?,
|
||||
) : java.io.Serializable
|
||||
|
||||
@Serializable
|
||||
data class StaffEdge(
|
||||
var role: String?,
|
||||
|
|
|
@ -96,6 +96,7 @@ class MangaUpdates {
|
|||
@SerialName("release_date")
|
||||
val releaseDate: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class MetaData(
|
||||
val series: Series
|
||||
|
|
|
@ -32,7 +32,12 @@ object CommentsAPI {
|
|||
var isMod: Boolean = false
|
||||
var totalVotes: Int = 0
|
||||
|
||||
suspend fun getCommentsForId(id: Int, page: Int = 1, tag: Int?, sort: String?): CommentResponse? {
|
||||
suspend fun getCommentsForId(
|
||||
id: Int,
|
||||
page: Int = 1,
|
||||
tag: Int?,
|
||||
sort: String?
|
||||
): CommentResponse? {
|
||||
var url = "$ADDRESS/comments/$id/$page"
|
||||
val request = requestBuilder()
|
||||
tag?.let {
|
||||
|
|
|
@ -7,6 +7,7 @@ class CrashlyticsStub : CrashlyticsInterface {
|
|||
override fun initialize(context: Context) {
|
||||
//no-op
|
||||
}
|
||||
|
||||
override fun logException(e: Throwable) {
|
||||
Logger.log(e)
|
||||
}
|
||||
|
|
|
@ -402,7 +402,8 @@ class DiscordService : Service() {
|
|||
Thread.sleep(heartbeat.toLong())
|
||||
heartbeatSend(webSocket, sequence)
|
||||
log("WebSocket: Heartbeat Sent")
|
||||
} catch (ignored: InterruptedException) { }
|
||||
} catch (ignored: InterruptedException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package ani.dantotsu.connections.github
|
||||
|
||||
import ani.dantotsu.Mapper
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.client
|
||||
import ani.dantotsu.getAppString
|
||||
import ani.dantotsu.settings.Developer
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
@ -17,7 +15,8 @@ class Forks {
|
|||
fun getForks(): Array<Developer> {
|
||||
var forks = arrayOf<Developer>()
|
||||
runBlocking(Dispatchers.IO) {
|
||||
val res = client.get("https://api.github.com/repos/rebelonion/Dantotsu/forks?sort=stargazers")
|
||||
val res =
|
||||
client.get("https://api.github.com/repos/rebelonion/Dantotsu/forks?sort=stargazers")
|
||||
.parsed<JsonArray>().map {
|
||||
Mapper.json.decodeFromJsonElement<GithubResponse>(it)
|
||||
}
|
||||
|
|
|
@ -53,7 +53,11 @@ class DownloadsManager(private val context: Context) {
|
|||
saveDownloads()
|
||||
}
|
||||
|
||||
fun removeDownload(downloadedType: DownloadedType, toast: Boolean = true, onFinished: () -> Unit) {
|
||||
fun removeDownload(
|
||||
downloadedType: DownloadedType,
|
||||
toast: Boolean = true,
|
||||
onFinished: () -> Unit
|
||||
) {
|
||||
downloadsList.remove(downloadedType)
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
removeDirectory(downloadedType, toast)
|
||||
|
|
|
@ -244,7 +244,8 @@ class AnimeDownloaderService : Service() {
|
|||
headersStringBuilder.append("\"").append("User-Agent: ")
|
||||
.append(defaultHeaders["User-Agent"]).append("\"\'\r\n\'")
|
||||
}
|
||||
val probeRequest = "-headers $headersStringBuilder -i ${task.video.file.url} -show_entries format=duration -v quiet -of csv=\"p=0\""
|
||||
val probeRequest =
|
||||
"-headers $headersStringBuilder -i ${task.video.file.url} -show_entries format=duration -v quiet -of csv=\"p=0\""
|
||||
ffExtension.executeFFProbe(
|
||||
probeRequest
|
||||
) {
|
||||
|
|
|
@ -267,7 +267,9 @@ class NovelDownloaderService : Service() {
|
|||
task.coverUrl?.let {
|
||||
file.parentFile?.let { it1 -> downloadImage(it, it1, "cover.jpg") }
|
||||
}
|
||||
val outputStream = this@NovelDownloaderService.contentResolver.openOutputStream(file.uri) ?: throw Exception("Could not open OutputStream")
|
||||
val outputStream =
|
||||
this@NovelDownloaderService.contentResolver.openOutputStream(file.uri)
|
||||
?: throw Exception("Could not open OutputStream")
|
||||
|
||||
val sink = outputStream.sink().buffer()
|
||||
val responseBody = response.body
|
||||
|
|
|
@ -5,9 +5,9 @@ import android.app.PendingIntent
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.notifications.anilist.AnilistNotificationReceiver
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationReceiver
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.notifications.subscription.SubscriptionNotificationReceiver
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
|
|
|
@ -5,9 +5,9 @@ import android.content.BroadcastReceiver
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
|
||||
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
||||
import ani.dantotsu.notifications.TaskScheduler.TaskType
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.util.Logger
|
||||
|
|
|
@ -21,11 +21,16 @@ interface TaskScheduler {
|
|||
for (taskType in TaskType.entries) {
|
||||
val interval = when (taskType) {
|
||||
TaskType.COMMENT_NOTIFICATION -> CommentNotificationWorker.checkIntervals[PrefManager.getVal(
|
||||
PrefName.CommentNotificationInterval)]
|
||||
PrefName.CommentNotificationInterval
|
||||
)]
|
||||
|
||||
TaskType.ANILIST_NOTIFICATION -> AnilistNotificationWorker.checkIntervals[PrefManager.getVal(
|
||||
PrefName.AnilistNotificationInterval)]
|
||||
PrefName.AnilistNotificationInterval
|
||||
)]
|
||||
|
||||
TaskType.SUBSCRIPTION_NOTIFICATION -> SubscriptionNotificationWorker.checkIntervals[PrefManager.getVal(
|
||||
PrefName.SubscriptionNotificationInterval)]
|
||||
PrefName.SubscriptionNotificationInterval
|
||||
)]
|
||||
}
|
||||
scheduleRepeatingTask(taskType, interval)
|
||||
}
|
||||
|
@ -62,6 +67,7 @@ interface TaskScheduler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class TaskType {
|
||||
COMMENT_NOTIFICATION,
|
||||
ANILIST_NOTIFICATION,
|
||||
|
|
|
@ -66,6 +66,7 @@ class MediaNameFetch {
|
|||
val type = object : TypeToken<MediaResponse>() {}.type
|
||||
return gson.fromJson(response, type)
|
||||
}
|
||||
|
||||
data class ReturnedData(val title: String, val coverImage: String, val color: String)
|
||||
|
||||
data class MediaResponse(val data: Map<String, MediaItem>)
|
||||
|
|
|
@ -6,20 +6,15 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.databinding.FragmentExtensionsBinding
|
||||
import ani.dantotsu.settings.paging.AnimeExtensionAdapter
|
||||
import ani.dantotsu.settings.paging.AnimeExtensionsViewModel
|
||||
import ani.dantotsu.settings.paging.AnimeExtensionsViewModelFactory
|
||||
import ani.dantotsu.settings.paging.OnAnimeInstallClickListener
|
||||
import ani.dantotsu.snackString
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
|
|
|
@ -22,6 +22,7 @@ class DiscordDialogFragment: BottomSheetDialogFragment() {
|
|||
_binding = BottomSheetDiscordRpcBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
|
@ -35,7 +36,8 @@ class DiscordDialogFragment: BottomSheetDialogFragment() {
|
|||
binding.showIcon.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.ShowAniListIcon, isChecked)
|
||||
}
|
||||
binding.anilistLinkPreview.text = getString(R.string.anilist_link, PrefManager.getVal<String>(PrefName.AnilistUserName))
|
||||
binding.anilistLinkPreview.text =
|
||||
getString(R.string.anilist_link, PrefManager.getVal<String>(PrefName.AnilistUserName))
|
||||
|
||||
binding.radioGroup.setOnCheckedChangeListener { _, checkedId ->
|
||||
val mode = when (checkedId) {
|
||||
|
|
|
@ -213,9 +213,17 @@ class ExtensionsActivity : AppCompatActivity() {
|
|||
private fun getSavedRepositories(repoInventory: ViewGroup, type: MediaType) {
|
||||
repoInventory.removeAllViews()
|
||||
val prefName: PrefName? = when (type) {
|
||||
MediaType.ANIME -> { PrefName.AnimeExtensionRepos }
|
||||
MediaType.MANGA -> { PrefName.MangaExtensionRepos }
|
||||
else -> { null }
|
||||
MediaType.ANIME -> {
|
||||
PrefName.AnimeExtensionRepos
|
||||
}
|
||||
|
||||
MediaType.MANGA -> {
|
||||
PrefName.MangaExtensionRepos
|
||||
}
|
||||
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
prefName?.let { repoList ->
|
||||
PrefManager.getVal<Set<String>>(repoList).forEach { item ->
|
||||
|
@ -233,8 +241,14 @@ class ExtensionsActivity : AppCompatActivity() {
|
|||
repoInventory.removeView(view.root)
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
when (type) {
|
||||
MediaType.ANIME -> { animeExtensionManager.findAvailableExtensions() }
|
||||
MediaType.MANGA -> { mangaExtensionManager.findAvailableExtensions() }
|
||||
MediaType.ANIME -> {
|
||||
animeExtensionManager.findAvailableExtensions()
|
||||
}
|
||||
|
||||
MediaType.MANGA -> {
|
||||
mangaExtensionManager.findAvailableExtensions()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
@ -274,9 +288,17 @@ class ExtensionsActivity : AppCompatActivity() {
|
|||
|
||||
private fun generateRepositoryButton(type: MediaType) {
|
||||
val hintResource: Int? = when (type) {
|
||||
MediaType.ANIME -> { R.string.anime_add_repository }
|
||||
MediaType.MANGA -> { R.string.manga_add_repository }
|
||||
else -> { null }
|
||||
MediaType.ANIME -> {
|
||||
R.string.anime_add_repository
|
||||
}
|
||||
|
||||
MediaType.MANGA -> {
|
||||
R.string.manga_add_repository
|
||||
}
|
||||
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
hintResource?.let { res ->
|
||||
binding.openSettingsButton.setOnClickListener {
|
||||
|
|
|
@ -11,7 +11,10 @@ import eu.kanade.tachiyomi.extension.InstallStep
|
|||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class InstallerSteps(private val notificationManager: NotificationManager, private val context: Context) {
|
||||
class InstallerSteps(
|
||||
private val notificationManager: NotificationManager,
|
||||
private val context: Context
|
||||
) {
|
||||
|
||||
fun onInstallStep(installStep: InstallStep, extra: () -> Unit) {
|
||||
val builder = NotificationCompat.Builder(
|
||||
|
|
|
@ -6,20 +6,15 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.databinding.FragmentExtensionsBinding
|
||||
import ani.dantotsu.settings.paging.MangaExtensionAdapter
|
||||
import ani.dantotsu.settings.paging.MangaExtensionsViewModel
|
||||
import ani.dantotsu.settings.paging.MangaExtensionsViewModelFactory
|
||||
import ani.dantotsu.settings.paging.OnMangaInstallClickListener
|
||||
import ani.dantotsu.snackString
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.manga.model.MangaExtension
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
|
|
|
@ -24,7 +24,6 @@ import ani.dantotsu.others.getSerialized
|
|||
import ani.dantotsu.parsers.Subtitle
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.internal.Pref
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
|
@ -40,7 +39,8 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
var media: Media? = null
|
||||
var subtitle: Subtitle? = null
|
||||
|
||||
private val Int.toSP get() = TypedValue.applyDimension(
|
||||
private val Int.toSP
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP, this.toFloat(), Resources.getSystem().displayMetrics
|
||||
)
|
||||
|
||||
|
@ -151,8 +151,10 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
binding.playerSettingsTimeStampsAutoHide.isEnabled = isChecked
|
||||
}
|
||||
|
||||
binding.playerSettingsTimeStampsAutoHide.isChecked = PrefManager.getVal(PrefName.AutoHideTimeStamps)
|
||||
binding.playerSettingsTimeStampsAutoHide.isEnabled = binding.playerSettingsShowTimeStamp.isChecked
|
||||
binding.playerSettingsTimeStampsAutoHide.isChecked =
|
||||
PrefManager.getVal(PrefName.AutoHideTimeStamps)
|
||||
binding.playerSettingsTimeStampsAutoHide.isEnabled =
|
||||
binding.playerSettingsShowTimeStamp.isChecked
|
||||
binding.playerSettingsTimeStampsAutoHide.setOnCheckedChangeListener { _, isChecked ->
|
||||
PrefManager.setVal(PrefName.AutoHideTimeStamps, isChecked)
|
||||
}
|
||||
|
@ -488,6 +490,7 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
override fun onExpand() {
|
||||
updateSubPreview()
|
||||
}
|
||||
|
||||
override fun onRetract() {}
|
||||
})
|
||||
updateSubPreview()
|
||||
|
@ -496,7 +499,8 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
private fun updateSubPreview() {
|
||||
binding.subtitleTestWindow.run {
|
||||
alpha = PrefManager.getVal(PrefName.SubAlpha)
|
||||
setBackgroundColor(when (PrefManager.getVal<Int>(PrefName.SubWindow)) {
|
||||
setBackgroundColor(
|
||||
when (PrefManager.getVal<Int>(PrefName.SubWindow)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
|
@ -510,7 +514,8 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
binding.subtitleTestText.run {
|
||||
textSize = PrefManager.getVal<Int>(PrefName.FontSize).toSP
|
||||
|
@ -524,7 +529,8 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
6 -> ResourcesCompat.getFont(this.context, R.font.blocky)
|
||||
else -> ResourcesCompat.getFont(this.context, R.font.poppins_semi_bold)
|
||||
}
|
||||
setTextColor(when (PrefManager.getVal<Int>(PrefName.PrimaryColor)) {
|
||||
setTextColor(
|
||||
when (PrefManager.getVal<Int>(PrefName.PrimaryColor)) {
|
||||
0 -> Color.BLACK
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.GRAY
|
||||
|
@ -538,8 +544,10 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
10 -> Color.MAGENTA
|
||||
11 -> Color.TRANSPARENT
|
||||
else -> Color.WHITE
|
||||
})
|
||||
setBackgroundColor(when (PrefManager.getVal<Int>(PrefName.SubBackground)) {
|
||||
}
|
||||
)
|
||||
setBackgroundColor(
|
||||
when (PrefManager.getVal<Int>(PrefName.SubBackground)) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> Color.BLACK
|
||||
2 -> Color.DKGRAY
|
||||
|
@ -553,7 +561,8 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
|||
10 -> Color.BLUE
|
||||
11 -> Color.MAGENTA
|
||||
else -> Color.TRANSPARENT
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,8 @@ class SettingsAboutActivity : AppCompatActivity() {
|
|||
),
|
||||
)
|
||||
)
|
||||
binding.settingsRecyclerView.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
binding.settingsRecyclerView.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@ import ani.dantotsu.R
|
|||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.discord.Discord
|
||||
import ani.dantotsu.connections.mal.MAL
|
||||
import ani.dantotsu.databinding.ActivitySettingsAboutBinding
|
||||
import ani.dantotsu.databinding.ActivitySettingsAccountsBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.loadImage
|
||||
|
@ -33,6 +32,7 @@ class SettingsAccountActivity : AppCompatActivity() {
|
|||
private val restartMainActivity = object : OnBackPressedCallback(false) {
|
||||
override fun handleOnBackPressed() = startMainActivity(this@SettingsAccountActivity)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ThemeManager(this).applyTheme()
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.os.Bundle
|
|||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
@ -278,6 +277,7 @@ class SettingsActivity : AppCompatActivity() {
|
|||
?: "Unknown Architecture"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
ThemeManager(this).applyTheme()
|
||||
super.onResume()
|
||||
|
|
|
@ -2,19 +2,14 @@ package ani.dantotsu.settings
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.addons.AddonDownloader
|
||||
import ani.dantotsu.addons.AddonListener
|
||||
import ani.dantotsu.addons.download.DownloadAddonManager
|
||||
import ani.dantotsu.addons.torrent.ServerService
|
||||
import ani.dantotsu.addons.torrent.TorrentAddonManager
|
||||
|
@ -27,15 +22,12 @@ import ani.dantotsu.settings.saving.PrefName
|
|||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.util.Logger
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.job
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import tachiyomi.core.util.lang.launchIO
|
||||
|
|
|
@ -59,7 +59,12 @@ class SettingsAnimeActivity: AppCompatActivity(){
|
|||
onClick = {
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.purge_anime_downloads)
|
||||
.setMessage(getString(R.string.purge_confirm, getString(R.string.anime)))
|
||||
.setMessage(
|
||||
getString(
|
||||
R.string.purge_confirm,
|
||||
getString(R.string.anime)
|
||||
)
|
||||
)
|
||||
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||
downloadsManager.purgeDownloads(MediaType.ANIME)
|
||||
|
|
|
@ -44,6 +44,7 @@ import uy.kohesive.injekt.api.get
|
|||
class SettingsCommonActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivitySettingsCommonBinding
|
||||
private lateinit var launcher: LauncherWrapper
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -138,7 +139,12 @@ class SettingsCommonActivity: AppCompatActivity(){
|
|||
desc = getString(R.string.ui_settings),
|
||||
icon = R.drawable.ic_round_auto_awesome_24,
|
||||
onClick = {
|
||||
startActivity(Intent(context, UserInterfaceSettingsActivity::class.java))
|
||||
startActivity(
|
||||
Intent(
|
||||
context,
|
||||
UserInterfaceSettingsActivity::class.java
|
||||
)
|
||||
)
|
||||
},
|
||||
isActivity = true
|
||||
),
|
||||
|
@ -150,7 +156,8 @@ class SettingsCommonActivity: AppCompatActivity(){
|
|||
onClick = {
|
||||
val managers = arrayOf("Default", "1DM", "ADM")
|
||||
val downloadManagerDialog =
|
||||
AlertDialog.Builder(context, R.style.MyPopup).setTitle(R.string.download_manager)
|
||||
AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.download_manager)
|
||||
var downloadManager: Int = PrefManager.getVal(PrefName.DownloadManager)
|
||||
val dialog = downloadManagerDialog.setSingleChoiceItems(
|
||||
managers, downloadManager
|
||||
|
@ -231,7 +238,8 @@ class SettingsCommonActivity: AppCompatActivity(){
|
|||
launcher.registerForCallback { success ->
|
||||
if (success) {
|
||||
toast(getString(R.string.please_wait))
|
||||
val newUri = PrefManager.getVal<String>(PrefName.DownloadsDir)
|
||||
val newUri =
|
||||
PrefManager.getVal<String>(PrefName.DownloadsDir)
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
Injekt.get<DownloadsManager>().moveDownloadsDir(
|
||||
context, Uri.parse(oldUri), Uri.parse(newUri)
|
||||
|
@ -334,6 +342,7 @@ class SettingsCommonActivity: AppCompatActivity(){
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
private fun passwordAlertDialog(isExporting: Boolean, callback: (CharArray?) -> Unit) {
|
||||
val password = CharArray(16).apply { fill('0') }
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import ani.dantotsu.settings.saving.PrefManager
|
|||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
|
||||
|
@ -139,7 +138,12 @@ class SettingsExtensionsActivity: AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
fun processEditorAction(dialog: AlertDialog, editText: EditText, mediaType: MediaType, view: ViewGroup) {
|
||||
fun processEditorAction(
|
||||
dialog: AlertDialog,
|
||||
editText: EditText,
|
||||
mediaType: MediaType,
|
||||
view: ViewGroup
|
||||
) {
|
||||
editText.setOnEditorActionListener { textView, action, keyEvent ->
|
||||
if (action == EditorInfo.IME_ACTION_SEARCH || action == EditorInfo.IME_ACTION_DONE || (keyEvent?.action == KeyEvent.ACTION_UP && keyEvent.keyCode == KeyEvent.KEYCODE_ENTER)) {
|
||||
return@setOnEditorActionListener if (textView.text.isNullOrBlank()) {
|
||||
|
@ -178,7 +182,12 @@ class SettingsExtensionsActivity: AppCompatActivity() {
|
|||
dialog.dismiss()
|
||||
}.create()
|
||||
|
||||
processEditorAction(alertDialog, editText, MediaType.ANIME, it.attachView)
|
||||
processEditorAction(
|
||||
alertDialog,
|
||||
editText,
|
||||
MediaType.ANIME,
|
||||
it.attachView
|
||||
)
|
||||
alertDialog.show()
|
||||
alertDialog.window?.setDimAmount(0.8f)
|
||||
},
|
||||
|
@ -209,7 +218,12 @@ class SettingsExtensionsActivity: AppCompatActivity() {
|
|||
dialog.dismiss()
|
||||
}.create()
|
||||
|
||||
processEditorAction(alertDialog, editText, MediaType.MANGA, it.attachView)
|
||||
processEditorAction(
|
||||
alertDialog,
|
||||
editText,
|
||||
MediaType.MANGA,
|
||||
it.attachView
|
||||
)
|
||||
alertDialog.show()
|
||||
alertDialog.window?.setDimAmount(0.8f)
|
||||
},
|
||||
|
@ -229,7 +243,10 @@ class SettingsExtensionsActivity: AppCompatActivity() {
|
|||
val alertDialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.user_agent).setView(dialogView.root)
|
||||
.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
|
||||
PrefManager.setVal(PrefName.DefaultUserAgent, editText.text.toString())
|
||||
PrefManager.setVal(
|
||||
PrefName.DefaultUserAgent,
|
||||
editText.text.toString()
|
||||
)
|
||||
dialog.dismiss()
|
||||
}.setNeutralButton(getString(R.string.reset)) { dialog, _ ->
|
||||
PrefManager.removeVal(PrefName.DefaultUserAgent)
|
||||
|
|
|
@ -82,7 +82,12 @@ class SettingsMangaActivity: AppCompatActivity(){
|
|||
onClick = {
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.purge_manga_downloads)
|
||||
.setMessage(getString(R.string.purge_confirm, getString(R.string.manga)))
|
||||
.setMessage(
|
||||
getString(
|
||||
R.string.purge_confirm,
|
||||
getString(R.string.manga)
|
||||
)
|
||||
)
|
||||
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||
downloadsManager.purgeDownloads(MediaType.MANGA)
|
||||
|
@ -103,7 +108,12 @@ class SettingsMangaActivity: AppCompatActivity(){
|
|||
onClick = {
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.purge_novel_downloads)
|
||||
.setMessage(getString(R.string.purge_confirm, getString(R.string.novels)))
|
||||
.setMessage(
|
||||
getString(
|
||||
R.string.purge_confirm,
|
||||
getString(R.string.novels)
|
||||
)
|
||||
)
|
||||
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||
downloadsManager.purgeDownloads(MediaType.NOVEL)
|
||||
|
|
|
@ -68,17 +68,27 @@ class SettingsNotificationActivity: AppCompatActivity(){
|
|||
arrayListOf(
|
||||
Settings(
|
||||
type = 1,
|
||||
name = getString(R.string.subscriptions_checking_time_s, timeNames[curTime]),
|
||||
name = getString(
|
||||
R.string.subscriptions_checking_time_s,
|
||||
timeNames[curTime]
|
||||
),
|
||||
desc = getString(R.string.subscriptions_info),
|
||||
icon = R.drawable.ic_round_notifications_none_24,
|
||||
onClick = {
|
||||
val speedDialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.subscriptions_checking_time)
|
||||
val dialog = speedDialog.setSingleChoiceItems(timeNames, curTime) { dialog, i ->
|
||||
val dialog =
|
||||
speedDialog.setSingleChoiceItems(timeNames, curTime) { dialog, i ->
|
||||
curTime = i
|
||||
it.settingsTitle.text =
|
||||
getString(R.string.subscriptions_checking_time_s, timeNames[i])
|
||||
PrefManager.setVal(PrefName.SubscriptionNotificationInterval, curTime)
|
||||
getString(
|
||||
R.string.subscriptions_checking_time_s,
|
||||
timeNames[i]
|
||||
)
|
||||
PrefManager.setVal(
|
||||
PrefName.SubscriptionNotificationInterval,
|
||||
curTime
|
||||
)
|
||||
dialog.dismiss()
|
||||
TaskScheduler.create(
|
||||
context, PrefManager.getVal(PrefName.UseAlarmManager)
|
||||
|
@ -100,11 +110,15 @@ class SettingsNotificationActivity: AppCompatActivity(){
|
|||
onClick = {
|
||||
val types = NotificationType.entries.map { it.name }
|
||||
val filteredTypes =
|
||||
PrefManager.getVal<Set<String>>(PrefName.AnilistFilteredTypes).toMutableSet()
|
||||
PrefManager.getVal<Set<String>>(PrefName.AnilistFilteredTypes)
|
||||
.toMutableSet()
|
||||
val selected = types.map { filteredTypes.contains(it) }.toBooleanArray()
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.anilist_notification_filters)
|
||||
.setMultiChoiceItems(types.toTypedArray(), selected) { _, which, isChecked ->
|
||||
.setMultiChoiceItems(
|
||||
types.toTypedArray(),
|
||||
selected
|
||||
) { _, which, isChecked ->
|
||||
val type = types[which]
|
||||
if (isChecked) {
|
||||
filteredTypes.add(type)
|
||||
|
@ -130,13 +144,20 @@ class SettingsNotificationActivity: AppCompatActivity(){
|
|||
),
|
||||
icon = R.drawable.ic_round_notifications_none_24,
|
||||
onClick = {
|
||||
val selected = PrefManager.getVal<Int>(PrefName.AnilistNotificationInterval)
|
||||
val selected =
|
||||
PrefManager.getVal<Int>(PrefName.AnilistNotificationInterval)
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.subscriptions_checking_time)
|
||||
.setSingleChoiceItems(aItems.toTypedArray(), selected) { dialog, i ->
|
||||
.setSingleChoiceItems(
|
||||
aItems.toTypedArray(),
|
||||
selected
|
||||
) { dialog, i ->
|
||||
PrefManager.setVal(PrefName.AnilistNotificationInterval, i)
|
||||
it.settingsTitle.text =
|
||||
getString(R.string.anilist_notifications_checking_time, aItems[i])
|
||||
getString(
|
||||
R.string.anilist_notifications_checking_time,
|
||||
aItems[i]
|
||||
)
|
||||
dialog.dismiss()
|
||||
TaskScheduler.create(
|
||||
context, PrefManager.getVal(PrefName.UseAlarmManager)
|
||||
|
@ -158,13 +179,20 @@ class SettingsNotificationActivity: AppCompatActivity(){
|
|||
),
|
||||
icon = R.drawable.ic_round_notifications_none_24,
|
||||
onClick = {
|
||||
val selected = PrefManager.getVal<Int>(PrefName.CommentNotificationInterval)
|
||||
val selected =
|
||||
PrefManager.getVal<Int>(PrefName.CommentNotificationInterval)
|
||||
val dialog = AlertDialog.Builder(context, R.style.MyPopup)
|
||||
.setTitle(R.string.subscriptions_checking_time)
|
||||
.setSingleChoiceItems(cItems.toTypedArray(), selected) { dialog, i ->
|
||||
.setSingleChoiceItems(
|
||||
cItems.toTypedArray(),
|
||||
selected
|
||||
) { dialog, i ->
|
||||
PrefManager.setVal(PrefName.CommentNotificationInterval, i)
|
||||
it.settingsTitle.text =
|
||||
getString(R.string.comment_notification_checking_time, cItems[i])
|
||||
getString(
|
||||
R.string.comment_notification_checking_time,
|
||||
cItems[i]
|
||||
)
|
||||
dialog.dismiss()
|
||||
TaskScheduler.create(
|
||||
context, PrefManager.getVal(PrefName.UseAlarmManager)
|
||||
|
@ -181,7 +209,10 @@ class SettingsNotificationActivity: AppCompatActivity(){
|
|||
icon = R.drawable.ic_round_smart_button_24,
|
||||
isChecked = PrefManager.getVal(PrefName.SubscriptionCheckingNotifications),
|
||||
switch = { isChecked, _ ->
|
||||
PrefManager.setVal(PrefName.SubscriptionCheckingNotifications, isChecked)
|
||||
PrefManager.setVal(
|
||||
PrefName.SubscriptionCheckingNotifications,
|
||||
isChecked
|
||||
)
|
||||
},
|
||||
onLongClick = {
|
||||
openSettings(context, null)
|
||||
|
|
|
@ -164,14 +164,17 @@ class SettingsThemeActivity : AppCompatActivity(), SimpleDialog.OnDialogResultLi
|
|||
icon = R.drawable.ic_palette,
|
||||
onClick = {
|
||||
val originalColor: Int = PrefManager.getVal(PrefName.CustomThemeInt)
|
||||
|
||||
class CustomColorDialog : SimpleColorDialog() {
|
||||
override fun onPositiveButtonClick() {
|
||||
reload()
|
||||
super.onPositiveButtonClick()
|
||||
}
|
||||
}
|
||||
|
||||
val tag = "colorPicker"
|
||||
CustomColorDialog().title(R.string.custom_theme).colorPreset(originalColor)
|
||||
CustomColorDialog().title(R.string.custom_theme)
|
||||
.colorPreset(originalColor)
|
||||
.colors(context, SimpleColorDialog.MATERIAL_COLOR_PALLET)
|
||||
.allowCustom(true).showOutline(0x46000000).gridNumColumn(5)
|
||||
.choiceMode(SimpleColorDialog.SINGLE_CHOICE).neg()
|
||||
|
@ -198,6 +201,7 @@ class SettingsThemeActivity : AppCompatActivity(), SimpleDialog.OnDialogResultLi
|
|||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun reload() {
|
||||
PrefManager.setCustomVal("reload", true)
|
||||
restartApp()
|
||||
|
|
|
@ -82,6 +82,7 @@ class SharedPreferenceStringSetLiveData(
|
|||
fun SharedPreferences.intLiveData(key: String, defValue: Int): SharedPreferenceLiveData<Int> {
|
||||
return SharedPreferenceIntLiveData(this, key, defValue)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
|
||||
fun SharedPreferences.stringLiveData(
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ani.dantotsu.widgets.statistics
|
||||
|
||||
import android.app.Activity
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
|
@ -12,9 +11,7 @@ import android.view.View
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.StatisticsWidgetConfigureBinding
|
||||
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.widgets.upcoming.UpcomingWidget
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import eltos.simpledialogfragment.SimpleDialog
|
||||
import eltos.simpledialogfragment.color.SimpleColorDialog
|
||||
|
@ -64,9 +61,12 @@ class ProfileStatsConfigure : AppCompatActivity(),
|
|||
AppWidgetManager.EXTRA_APPWIDGET_ID,
|
||||
AppWidgetManager.INVALID_APPWIDGET_ID
|
||||
)
|
||||
val prefs = getSharedPreferences(ProfileStatsWidget.getPrefsName(appWidgetId), Context.MODE_PRIVATE)
|
||||
val topBackground = prefs.getInt(ProfileStatsWidget.PREF_BACKGROUND_COLOR, Color.parseColor("#80000000"))
|
||||
(binding.topBackgroundButton as MaterialButton).iconTint = ColorStateList.valueOf(topBackground)
|
||||
val prefs =
|
||||
getSharedPreferences(ProfileStatsWidget.getPrefsName(appWidgetId), Context.MODE_PRIVATE)
|
||||
val topBackground =
|
||||
prefs.getInt(ProfileStatsWidget.PREF_BACKGROUND_COLOR, Color.parseColor("#80000000"))
|
||||
(binding.topBackgroundButton as MaterialButton).iconTint =
|
||||
ColorStateList.valueOf(topBackground)
|
||||
binding.topBackgroundButton.setOnClickListener {
|
||||
val tag = ProfileStatsWidget.PREF_BACKGROUND_COLOR
|
||||
SimpleColorDialog().title(R.string.custom_theme)
|
||||
|
@ -83,8 +83,10 @@ class ProfileStatsConfigure : AppCompatActivity(),
|
|||
.neg()
|
||||
.show(this@ProfileStatsConfigure, tag)
|
||||
}
|
||||
val bottomBackground = prefs.getInt(ProfileStatsWidget.PREF_BACKGROUND_FADE, Color.parseColor("#00000000"))
|
||||
(binding.bottomBackgroundButton as MaterialButton).iconTint = ColorStateList.valueOf(bottomBackground)
|
||||
val bottomBackground =
|
||||
prefs.getInt(ProfileStatsWidget.PREF_BACKGROUND_FADE, Color.parseColor("#00000000"))
|
||||
(binding.bottomBackgroundButton as MaterialButton).iconTint =
|
||||
ColorStateList.valueOf(bottomBackground)
|
||||
binding.bottomBackgroundButton.setOnClickListener {
|
||||
val tag = ProfileStatsWidget.PREF_BACKGROUND_FADE
|
||||
SimpleColorDialog().title(R.string.custom_theme)
|
||||
|
@ -196,7 +198,10 @@ class ProfileStatsConfigure : AppCompatActivity(),
|
|||
)
|
||||
val subTextColor = typedValueOutline.data
|
||||
|
||||
getSharedPreferences(ProfileStatsWidget.getPrefsName(appWidgetId), Context.MODE_PRIVATE).edit().apply {
|
||||
getSharedPreferences(
|
||||
ProfileStatsWidget.getPrefsName(appWidgetId),
|
||||
Context.MODE_PRIVATE
|
||||
).edit().apply {
|
||||
putInt(ProfileStatsWidget.PREF_BACKGROUND_COLOR, backgroundColor)
|
||||
putInt(ProfileStatsWidget.PREF_BACKGROUND_FADE, backgroundColor)
|
||||
putInt(ProfileStatsWidget.PREF_TITLE_TEXT_COLOR, textColor)
|
||||
|
|
|
@ -41,13 +41,17 @@ class LocalAnimeSource(
|
|||
override suspend fun getLatestUpdates(page: Int) = getSearchAnime(page, "", LATEST_FILTERS)
|
||||
|
||||
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getPopularAnime"))
|
||||
override fun fetchPopularAnime(page: Int) = getSearchAnime
|
||||
override fun fetchPopularAnime(page: Int) = fetchSearchAnime(page, "", POPULAR_FILTERS)
|
||||
|
||||
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getLatestUpdates"))
|
||||
override fun fetchLatestUpdates(page: Int) = getSearchAnime
|
||||
override fun fetchLatestUpdates(page: Int) = fetchSearchAnime(page, "", LATEST_FILTERS)
|
||||
|
||||
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getSearchAnime"))
|
||||
override fun fetchSearchAnime(page: Int, query: String, filters: AnimeFilterList): Observable<AnimesPage> {
|
||||
override fun fetchSearchAnime(
|
||||
page: Int,
|
||||
query: String,
|
||||
filters: AnimeFilterList
|
||||
): Observable<AnimesPage> {
|
||||
return runBlocking {
|
||||
Observable.just(getSearchAnime(page, query, filters))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue