fix: clean up some warnings
This commit is contained in:
parent
ab7bc15573
commit
1b50ffcf11
32 changed files with 50 additions and 301 deletions
|
@ -367,7 +367,7 @@ class DatePickerFragment(activity: Activity, var date: FuzzyDate = FuzzyDate().g
|
||||||
dialog.setButton(
|
dialog.setButton(
|
||||||
DialogInterface.BUTTON_NEUTRAL,
|
DialogInterface.BUTTON_NEUTRAL,
|
||||||
activity.getString(R.string.remove)
|
activity.getString(R.string.remove)
|
||||||
) { dialog, which ->
|
) { _, which ->
|
||||||
if (which == DialogInterface.BUTTON_NEUTRAL) {
|
if (which == DialogInterface.BUTTON_NEUTRAL) {
|
||||||
date = FuzzyDate()
|
date = FuzzyDate()
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ class EmptyAdapter(private val count: Int) : RecyclerView.Adapter<RecyclerView.V
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAppString(res: Int): String {
|
fun getAppString(res: Int): String {
|
||||||
return currContext()!!.getString(res) ?: ""
|
return currContext()?.getString(res) ?: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toast(string: String?) {
|
fun toast(string: String?) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
|
||||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||||
import eu.kanade.tachiyomi.source.anime.AndroidAnimeSourceManager
|
import eu.kanade.tachiyomi.source.anime.AndroidAnimeSourceManager
|
||||||
import eu.kanade.tachiyomi.source.manga.AndroidMangaSourceManager
|
import eu.kanade.tachiyomi.source.manga.AndroidMangaSourceManager
|
||||||
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import tachiyomi.core.preference.PreferenceStore
|
import tachiyomi.core.preference.PreferenceStore
|
||||||
import tachiyomi.domain.source.anime.service.AnimeSourceManager
|
import tachiyomi.domain.source.anime.service.AnimeSourceManager
|
||||||
|
@ -29,6 +30,7 @@ import uy.kohesive.injekt.api.addSingletonFactory
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
class AppModule(val app: Application) : InjektModule {
|
class AppModule(val app: Application) : InjektModule {
|
||||||
|
@kotlin.OptIn(ExperimentalSerializationApi::class)
|
||||||
@OptIn(UnstableApi::class)
|
@OptIn(UnstableApi::class)
|
||||||
override fun InjektRegistrar.registerInjectables() {
|
override fun InjektRegistrar.registerInjectables() {
|
||||||
addSingleton(app)
|
addSingleton(app)
|
||||||
|
|
|
@ -44,6 +44,7 @@ class DiscordService : Service() {
|
||||||
private lateinit var heartbeatThread: Thread
|
private lateinit var heartbeatThread: Thread
|
||||||
private lateinit var client: OkHttpClient
|
private lateinit var client: OkHttpClient
|
||||||
private lateinit var wakeLock: PowerManager.WakeLock
|
private lateinit var wakeLock: PowerManager.WakeLock
|
||||||
|
private val shouldLog = false
|
||||||
var presenceStore = ""
|
var presenceStore = ""
|
||||||
val json = Json {
|
val json = Json {
|
||||||
encodeDefaults = true
|
encodeDefaults = true
|
||||||
|
@ -62,7 +63,7 @@ class DiscordService : Service() {
|
||||||
PowerManager.PARTIAL_WAKE_LOCK,
|
PowerManager.PARTIAL_WAKE_LOCK,
|
||||||
"discordRPC:backgroundPresence"
|
"discordRPC:backgroundPresence"
|
||||||
)
|
)
|
||||||
wakeLock.acquire()
|
wakeLock.acquire(30*60*1000L /*30 minutes*/)
|
||||||
log("WakeLock Acquired")
|
log("WakeLock Acquired")
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val serviceChannel = NotificationChannel(
|
val serviceChannel = NotificationChannel(
|
||||||
|
@ -265,7 +266,7 @@ class DiscordService : Service() {
|
||||||
retryAttempts++
|
retryAttempts++
|
||||||
if (retryAttempts >= maxRetryAttempts) {
|
if (retryAttempts >= maxRetryAttempts) {
|
||||||
log("WebSocket: Error, onFailure() reason: Max Retry Attempts")
|
log("WebSocket: Error, onFailure() reason: Max Retry Attempts")
|
||||||
errorNotification("Could not set the presence", "Max Retry Attempts")
|
errorNotification("Timeout setting presence", "Max Retry Attempts")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,13 +345,13 @@ class DiscordService : Service() {
|
||||||
Manifest.permission.POST_NOTIFICATIONS
|
Manifest.permission.POST_NOTIFICATIONS
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
//TODO: Request permission
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
notificationManager.notify(2, builder.build())
|
notificationManager.notify(2, builder.build())
|
||||||
log("Error Notified")
|
log("Error Notified")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun saveSimpleTestPresence() {
|
fun saveSimpleTestPresence() {
|
||||||
val file = File(baseContext.cacheDir, "payload")
|
val file = File(baseContext.cacheDir, "payload")
|
||||||
//fill with test payload
|
//fill with test payload
|
||||||
|
@ -377,7 +378,9 @@ class DiscordService : Service() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun log(string: String) {
|
fun log(string: String) {
|
||||||
//Logger.log(string)
|
if (shouldLog) {
|
||||||
|
Logger.log(string)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resume() {
|
fun resume() {
|
||||||
|
|
|
@ -357,6 +357,7 @@ class AnimeDownloaderService : Service() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
private fun saveMediaInfo(task: AnimeDownloadTask) {
|
private fun saveMediaInfo(task: AnimeDownloadTask) {
|
||||||
launchIO {
|
launchIO {
|
||||||
val directory = File(
|
val directory = File(
|
||||||
|
|
|
@ -49,10 +49,9 @@ class OfflineAnimeAdapter(
|
||||||
val imageView = view.findViewById<ImageView>(R.id.itemCompactImage)
|
val imageView = view.findViewById<ImageView>(R.id.itemCompactImage)
|
||||||
val titleTextView = view.findViewById<TextView>(R.id.itemCompactTitle)
|
val titleTextView = view.findViewById<TextView>(R.id.itemCompactTitle)
|
||||||
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
|
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
|
||||||
val itemScoreBG = view.findViewById<View>(R.id.itemCompactScoreBG)
|
|
||||||
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
|
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
|
||||||
val totalepisodes = view.findViewById<TextView>(R.id.itemCompactTotal)
|
val totalEpisodes = view.findViewById<TextView>(R.id.itemCompactTotal)
|
||||||
val typeimage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
val typeImage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
||||||
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
|
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
|
||||||
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
|
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
|
||||||
|
|
||||||
|
@ -61,16 +60,16 @@ class OfflineAnimeAdapter(
|
||||||
val episodes = view.findViewById<TextView>(R.id.itemTotal)
|
val episodes = view.findViewById<TextView>(R.id.itemTotal)
|
||||||
episodes.text = context.getString(R.string.episodes)
|
episodes.text = context.getString(R.string.episodes)
|
||||||
bannerView.setImageURI(item.banner ?: item.image)
|
bannerView.setImageURI(item.banner ?: item.image)
|
||||||
totalepisodes.text = item.totalEpisodeList
|
totalEpisodes.text = item.totalEpisodeList
|
||||||
} else if (style == 1) {
|
} else if (style == 1) {
|
||||||
val watchedEpisodes =
|
val watchedEpisodes =
|
||||||
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
||||||
watchedEpisodes.text = item.watchedEpisode
|
watchedEpisodes.text = item.watchedEpisode
|
||||||
totalepisodes.text = context.getString(R.string.total_divider, item.totalEpisode)
|
totalEpisodes.text = context.getString(R.string.total_divider, item.totalEpisode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind item data to the views
|
// Bind item data to the views
|
||||||
typeimage.setImageResource(R.drawable.ic_round_movie_filter_24)
|
typeImage.setImageResource(R.drawable.ic_round_movie_filter_24)
|
||||||
type.text = item.type
|
type.text = item.type
|
||||||
typeView.visibility = View.VISIBLE
|
typeView.visibility = View.VISIBLE
|
||||||
imageView.setImageURI(item.image)
|
imageView.setImageURI(item.image)
|
||||||
|
|
|
@ -49,7 +49,6 @@ class OfflineMangaAdapter(
|
||||||
val imageView = view.findViewById<ImageView>(R.id.itemCompactImage)
|
val imageView = view.findViewById<ImageView>(R.id.itemCompactImage)
|
||||||
val titleTextView = view.findViewById<TextView>(R.id.itemCompactTitle)
|
val titleTextView = view.findViewById<TextView>(R.id.itemCompactTitle)
|
||||||
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
|
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
|
||||||
val itemScoreBG = view.findViewById<View>(R.id.itemCompactScoreBG)
|
|
||||||
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
|
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
|
||||||
val totalChapter = view.findViewById<TextView>(R.id.itemCompactTotal)
|
val totalChapter = view.findViewById<TextView>(R.id.itemCompactTotal)
|
||||||
val typeImage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
val typeImage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
||||||
|
|
|
@ -34,7 +34,6 @@ import eu.kanade.tachiyomi.source.model.SChapterImpl
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -65,7 +64,7 @@ class NovelDownloaderService : Service() {
|
||||||
private val mutex = Mutex()
|
private val mutex = Mutex()
|
||||||
private var isCurrentlyProcessing = false
|
private var isCurrentlyProcessing = false
|
||||||
|
|
||||||
val networkHelper = Injekt.get<NetworkHelper>()
|
private val networkHelper = Injekt.get<NetworkHelper>()
|
||||||
|
|
||||||
override fun onBind(intent: Intent?): IBinder? {
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
// This is only required for bound services.
|
// This is only required for bound services.
|
||||||
|
@ -248,7 +247,7 @@ class NovelDownloaderService : Service() {
|
||||||
|
|
||||||
networkHelper.downloadClient.newCall(request).execute().use { response ->
|
networkHelper.downloadClient.newCall(request).execute().use { response ->
|
||||||
// Ensure the response is successful and has a body
|
// Ensure the response is successful and has a body
|
||||||
if (!response.isSuccessful || response.body == null) {
|
if (!response.isSuccessful) {
|
||||||
throw IOException("Failed to download file: ${response.message}")
|
throw IOException("Failed to download file: ${response.message}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +473,6 @@ class NovelDownloaderService : Service() {
|
||||||
}
|
}
|
||||||
|
|
||||||
object NovelServiceDataSingleton {
|
object NovelServiceDataSingleton {
|
||||||
var sourceMedia: Media? = null
|
|
||||||
var downloadQueue: Queue<NovelDownloaderService.DownloadTask> = ConcurrentLinkedQueue()
|
var downloadQueue: Queue<NovelDownloaderService.DownloadTask> = ConcurrentLinkedQueue()
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
|
|
|
@ -126,7 +126,6 @@ object Helper {
|
||||||
fun downloadManager(context: Context): DownloadManager {
|
fun downloadManager(context: Context): DownloadManager {
|
||||||
return download ?: let {
|
return download ?: let {
|
||||||
val database = Injekt.get<StandaloneDatabaseProvider>()
|
val database = Injekt.get<StandaloneDatabaseProvider>()
|
||||||
val downloadDirectory = File(getDownloadDirectory(context), DOWNLOAD_CONTENT_DIRECTORY)
|
|
||||||
val dataSourceFactory = DataSource.Factory {
|
val dataSourceFactory = DataSource.Factory {
|
||||||
//val dataSource: HttpDataSource = OkHttpDataSource.Factory(okHttpClient).createDataSource()
|
//val dataSource: HttpDataSource = OkHttpDataSource.Factory(okHttpClient).createDataSource()
|
||||||
val networkHelper = Injekt.get<NetworkHelper>()
|
val networkHelper = Injekt.get<NetworkHelper>()
|
||||||
|
|
|
@ -43,13 +43,6 @@ class CalendarActivity : AppCompatActivity() {
|
||||||
val typedValue = TypedValue()
|
val typedValue = TypedValue()
|
||||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
||||||
val primaryColor = typedValue.data
|
val primaryColor = typedValue.data
|
||||||
val typedValue2 = TypedValue()
|
|
||||||
theme.resolveAttribute(
|
|
||||||
com.google.android.material.R.attr.colorOnBackground,
|
|
||||||
typedValue2,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
val titleTextColor = typedValue2.data
|
|
||||||
val typedValue3 = TypedValue()
|
val typedValue3 = TypedValue()
|
||||||
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue3, true)
|
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue3, true)
|
||||||
val primaryTextColor = typedValue3.data
|
val primaryTextColor = typedValue3.data
|
||||||
|
|
|
@ -3,7 +3,6 @@ package ani.dantotsu.media
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Rect
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
|
@ -220,20 +219,6 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
R.drawable.ic_round_favorite_24
|
R.drawable.ic_round_favorite_24
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val typedValue = TypedValue()
|
|
||||||
this.theme.resolveAttribute(
|
|
||||||
com.google.android.material.R.attr.colorSecondary,
|
|
||||||
typedValue,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
val color = typedValue.data
|
|
||||||
val typedValue2 = TypedValue()
|
|
||||||
this.theme.resolveAttribute(
|
|
||||||
com.google.android.material.R.attr.colorSecondary,
|
|
||||||
typedValue2,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
val color2 = typedValue.data
|
|
||||||
|
|
||||||
PopImageButton(
|
PopImageButton(
|
||||||
scope,
|
scope,
|
||||||
|
@ -241,7 +226,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
R.drawable.ic_round_favorite_24,
|
R.drawable.ic_round_favorite_24,
|
||||||
R.drawable.ic_round_favorite_border_24,
|
R.drawable.ic_round_favorite_border_24,
|
||||||
R.color.bg_opp,
|
R.color.bg_opp,
|
||||||
R.color.violet_400,//TODO: Change to colorSecondary
|
R.color.violet_400,
|
||||||
media.isFav
|
media.isFav
|
||||||
) {
|
) {
|
||||||
media.isFav = it
|
media.isFav = it
|
||||||
|
@ -487,13 +472,6 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
binding.mediaCover.visibility =
|
binding.mediaCover.visibility =
|
||||||
if (binding.mediaCover.scaleX == 0f) View.GONE else View.VISIBLE
|
if (binding.mediaCover.scaleX == 0f) View.GONE else View.VISIBLE
|
||||||
val duration = (200 * (PrefManager.getVal(PrefName.AnimationSpeed) as Float)).toLong()
|
val duration = (200 * (PrefManager.getVal(PrefName.AnimationSpeed) as Float)).toLong()
|
||||||
val typedValue = TypedValue()
|
|
||||||
this@MediaDetailsActivity.theme.resolveAttribute(
|
|
||||||
com.google.android.material.R.attr.colorSecondary,
|
|
||||||
typedValue,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
val color = typedValue.data
|
|
||||||
if (percentage >= percent && !isCollapsed) {
|
if (percentage >= percent && !isCollapsed) {
|
||||||
isCollapsed = true
|
isCollapsed = true
|
||||||
ObjectAnimator.ofFloat(binding.mediaTitle, "translationX", 0f).setDuration(duration)
|
ObjectAnimator.ofFloat(binding.mediaTitle, "translationX", 0f).setDuration(duration)
|
||||||
|
|
|
@ -67,15 +67,6 @@ class MediaDetailsViewModel : ViewModel() {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadSelectedStringLocation(sourceName: String): Int {
|
|
||||||
//find the location of the source in the list
|
|
||||||
var location = watchSources?.list?.indexOfFirst { it.name == sourceName } ?: 0
|
|
||||||
if (location == -1) {
|
|
||||||
location = 0
|
|
||||||
}
|
|
||||||
return location
|
|
||||||
}
|
|
||||||
|
|
||||||
var continueMedia: Boolean? = null
|
var continueMedia: Boolean? = null
|
||||||
private var loading = false
|
private var loading = false
|
||||||
|
|
||||||
|
@ -295,7 +286,6 @@ class MediaDetailsViewModel : ViewModel() {
|
||||||
suspend fun loadMangaChapterImages(
|
suspend fun loadMangaChapterImages(
|
||||||
chapter: MangaChapter,
|
chapter: MangaChapter,
|
||||||
selected: Selected,
|
selected: Selected,
|
||||||
series: String,
|
|
||||||
post: Boolean = true
|
post: Boolean = true
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.core.math.MathUtils.clamp
|
import androidx.core.math.MathUtils.clamp
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.WindowCompat
|
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.media3.cast.CastPlayer
|
import androidx.media3.cast.CastPlayer
|
||||||
|
@ -226,7 +225,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
private var extractor: VideoExtractor? = null
|
private var extractor: VideoExtractor? = null
|
||||||
private var video: Video? = null
|
private var video: Video? = null
|
||||||
private var subtitle: Subtitle? = null
|
private var subtitle: Subtitle? = null
|
||||||
private val player = "player_settings"
|
|
||||||
|
|
||||||
private var notchHeight: Int = 0
|
private var notchHeight: Int = 0
|
||||||
private var currentWindow = 0
|
private var currentWindow = 0
|
||||||
|
@ -1398,7 +1396,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
ext.onVideoPlayed(video)
|
ext.onVideoPlayed(video)
|
||||||
}
|
}
|
||||||
|
|
||||||
val simpleCache = VideoCache.getInstance(this)
|
|
||||||
val httpClient = okHttpClient.newBuilder().apply {
|
val httpClient = okHttpClient.newBuilder().apply {
|
||||||
ignoreAllSSLErrors()
|
ignoreAllSSLErrors()
|
||||||
followRedirects(true)
|
followRedirects(true)
|
||||||
|
@ -1814,7 +1811,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
}
|
}
|
||||||
if (PrefManager.getVal(PrefName.ShowTimeStampButton)) {
|
if (PrefManager.getVal(PrefName.ShowTimeStampButton)) {
|
||||||
|
|
||||||
if (!functionstarted && !disappeared && PrefManager.getVal<Boolean>(PrefName.AutoHideTimeStamps)) {
|
if (!functionstarted && !disappeared && PrefManager.getVal(PrefName.AutoHideTimeStamps)) {
|
||||||
disappearSkip()
|
disappearSkip()
|
||||||
} else if (!PrefManager.getVal<Boolean>(PrefName.AutoHideTimeStamps)){
|
} else if (!PrefManager.getVal<Boolean>(PrefName.AutoHideTimeStamps)){
|
||||||
skipTimeButton.visibility = View.VISIBLE
|
skipTimeButton.visibility = View.VISIBLE
|
||||||
|
@ -2161,11 +2158,6 @@ class CustomCastButton : MediaRouteButton {
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, castCallback: () -> Unit) : super(context, attrs) {
|
|
||||||
this.castCallback = castCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun performClick(): Boolean {
|
override fun performClick(): Boolean {
|
||||||
return if (PrefManager.getVal(PrefName.UseInternalCast)) {
|
return if (PrefManager.getVal(PrefName.UseInternalCast)) {
|
||||||
super.performClick()
|
super.performClick()
|
||||||
|
|
|
@ -336,7 +336,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||||
.setSingleChoiceItems(
|
.setSingleChoiceItems(
|
||||||
subtitleNames.toTypedArray(),
|
subtitleNames.toTypedArray(),
|
||||||
-1
|
-1
|
||||||
) { dialog, which ->
|
) { _, which ->
|
||||||
subtitleToDownload = subtitles[which]
|
subtitleToDownload = subtitles[which]
|
||||||
}
|
}
|
||||||
.setPositiveButton("Download") { _, _ ->
|
.setPositiveButton("Download") { _, _ ->
|
||||||
|
|
|
@ -113,7 +113,6 @@ class SubtitleDialogFragment : BottomSheetDialogFragment() {
|
||||||
binding.root.setCardBackgroundColor(TRANSPARENT)
|
binding.root.setCardBackgroundColor(TRANSPARENT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val activity: Activity = requireActivity() as ExoplayerView
|
|
||||||
binding.root.setOnClickListener {
|
binding.root.setOnClickListener {
|
||||||
episode.selectedSubtitle = position - 1
|
episode.selectedSubtitle = position - 1
|
||||||
model.setEpisode(episode, "Subtitle")
|
model.setEpisode(episode, "Subtitle")
|
||||||
|
|
|
@ -449,7 +449,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||||
model.mangaReadSources?.get(media.selected!!.sourceIndex) as? DynamicMangaParser
|
model.mangaReadSources?.get(media.selected!!.sourceIndex) as? DynamicMangaParser
|
||||||
parser?.let {
|
parser?.let {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
val images = parser.imageList("", chapter.sChapter)
|
val images = parser.imageList(chapter.sChapter)
|
||||||
|
|
||||||
// Create a download task
|
// Create a download task
|
||||||
val downloadTask = MangaDownloaderService.DownloadTask(
|
val downloadTask = MangaDownloaderService.DownloadTask(
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.net.Uri
|
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -26,7 +25,6 @@ import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
@ -162,7 +160,6 @@ abstract class BaseImageAdapter(
|
||||||
Glide.with(this@loadBitmap)
|
Glide.with(this@loadBitmap)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.let {
|
.let {
|
||||||
val fileUri = Uri.fromFile(File(link.url)).toString()
|
|
||||||
val localFile = File(link.url)
|
val localFile = File(link.url)
|
||||||
if (localFile.exists()) {
|
if (localFile.exists()) {
|
||||||
it.load(localFile.absoluteFile)
|
it.load(localFile.absoluteFile)
|
||||||
|
@ -211,8 +208,4 @@ abstract class BaseImageAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ImageFetcher {
|
|
||||||
suspend fun fetchImage(page: Page): Bitmap?
|
|
||||||
}
|
}
|
|
@ -49,8 +49,7 @@ class ChapterLoaderDialog : BottomSheetDialogFragment() {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
if (model.loadMangaChapterImages(
|
if (model.loadMangaChapterImages(
|
||||||
chp,
|
chp,
|
||||||
m.selected!!,
|
m.selected!!
|
||||||
m.mainName()
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
val activity = currActivity()
|
val activity = currActivity()
|
||||||
|
|
|
@ -415,8 +415,7 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
model.loadMangaChapterImages(
|
model.loadMangaChapterImages(
|
||||||
chapter,
|
chapter,
|
||||||
media.selected!!,
|
media.selected!!
|
||||||
media.mainName()
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -938,7 +937,6 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
model.loadMangaChapterImages(
|
model.loadMangaChapterImages(
|
||||||
chapters[chaptersArr.getOrNull(currentChapterIndex + 1) ?: return@launch]!!,
|
chapters[chaptersArr.getOrNull(currentChapterIndex + 1) ?: return@launch]!!,
|
||||||
media.selected!!,
|
media.selected!!,
|
||||||
media.mainName(),
|
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
loading = false
|
loading = false
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ani.dantotsu.media.user
|
package ani.dantotsu.media.user
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -41,13 +40,6 @@ class ListActivity : AppCompatActivity() {
|
||||||
val typedValue = TypedValue()
|
val typedValue = TypedValue()
|
||||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
||||||
val primaryColor = typedValue.data
|
val primaryColor = typedValue.data
|
||||||
val typedValue2 = TypedValue()
|
|
||||||
theme.resolveAttribute(
|
|
||||||
com.google.android.material.R.attr.colorOnBackground,
|
|
||||||
typedValue2,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
val titleTextColor = typedValue2.data
|
|
||||||
val typedValue3 = TypedValue()
|
val typedValue3 = TypedValue()
|
||||||
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue3, true)
|
theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue3, true)
|
||||||
val primaryTextColor = typedValue3.data
|
val primaryTextColor = typedValue3.data
|
||||||
|
@ -184,7 +176,6 @@ class ListActivity : AppCompatActivity() {
|
||||||
//get the current tab
|
//get the current tab
|
||||||
val currentTab =
|
val currentTab =
|
||||||
binding.listTabLayout.getTabAt(binding.listTabLayout.selectedTabPosition)
|
binding.listTabLayout.getTabAt(binding.listTabLayout.selectedTabPosition)
|
||||||
val currentViewePager = binding.listViewPager.getChildAt(0)
|
|
||||||
val currentFragment =
|
val currentFragment =
|
||||||
supportFragmentManager.findFragmentByTag("f" + currentTab?.position.toString()) as? ListFragment
|
supportFragmentManager.findFragmentByTag("f" + currentTab?.position.toString()) as? ListFragment
|
||||||
currentFragment?.randomOptionClick()
|
currentFragment?.randomOptionClick()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ani.dantotsu.notifications
|
package ani.dantotsu.notifications
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.work.OutOfQuotaPolicy
|
|
||||||
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
|
import ani.dantotsu.notifications.anilist.AnilistNotificationWorker
|
||||||
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
import ani.dantotsu.notifications.comment.CommentNotificationWorker
|
||||||
import ani.dantotsu.notifications.subscription.SubscriptionNotificationWorker
|
import ani.dantotsu.notifications.subscription.SubscriptionNotificationWorker
|
||||||
|
|
|
@ -57,8 +57,7 @@ class CommentNotificationTask : Task {
|
||||||
if (notifications.isNullOrEmpty()) return@withContext
|
if (notifications.isNullOrEmpty()) return@withContext
|
||||||
PrefManager.setVal(
|
PrefManager.setVal(
|
||||||
PrefName.UnreadCommentNotifications,
|
PrefName.UnreadCommentNotifications,
|
||||||
PrefManager.getVal<Int>(PrefName.UnreadCommentNotifications) + (notifications.size
|
PrefManager.getVal<Int>(PrefName.UnreadCommentNotifications) + (notifications.size)
|
||||||
?: 0)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
notifications.forEach {
|
notifications.forEach {
|
||||||
|
@ -293,6 +292,7 @@ class CommentNotificationTask : Task {
|
||||||
return notification
|
return notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
private fun getBitmapFromVectorDrawable(context: Context, drawableId: Int): Bitmap? {
|
private fun getBitmapFromVectorDrawable(context: Context, drawableId: Int): Bitmap? {
|
||||||
val drawable = ContextCompat.getDrawable(context, drawableId) ?: return null
|
val drawable = ContextCompat.getDrawable(context, drawableId) ?: return null
|
||||||
val bitmap = Bitmap.createBitmap(
|
val bitmap = Bitmap.createBitmap(
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
package ani.dantotsu.parsers
|
package ani.dantotsu.parsers
|
||||||
|
|
||||||
import android.content.ContentResolver
|
|
||||||
import android.content.ContentValues
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Environment
|
|
||||||
import android.provider.MediaStore
|
|
||||||
import ani.dantotsu.FileUrl
|
import ani.dantotsu.FileUrl
|
||||||
import ani.dantotsu.currContext
|
import ani.dantotsu.currContext
|
||||||
import ani.dantotsu.media.anime.AnimeNameAdapter
|
import ani.dantotsu.media.anime.AnimeNameAdapter
|
||||||
|
@ -35,12 +27,10 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.util.lang.awaitSingle
|
import eu.kanade.tachiyomi.util.lang.awaitSingle
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.coroutines.coroutineScope
|
import kotlinx.coroutines.coroutineScope
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.sync.Semaphore
|
import kotlinx.coroutines.sync.Semaphore
|
||||||
import kotlinx.coroutines.sync.withPermit
|
import kotlinx.coroutines.sync.withPermit
|
||||||
|
@ -48,18 +38,9 @@ import kotlinx.coroutines.withContext
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.io.File
|
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.io.UnsupportedEncodingException
|
import java.io.UnsupportedEncodingException
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.util.regex.Pattern
|
|
||||||
|
|
||||||
class AniyomiAdapter {
|
|
||||||
fun aniyomiToAnimeParser(extension: AnimeExtension.Installed): DynamicAnimeParser {
|
|
||||||
return DynamicAnimeParser(extension)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DynamicAnimeParser(extension: AnimeExtension.Installed) : AnimeParser() {
|
class DynamicAnimeParser(extension: AnimeExtension.Installed) : AnimeParser() {
|
||||||
val extension: AnimeExtension.Installed
|
val extension: AnimeExtension.Installed
|
||||||
|
@ -103,7 +84,7 @@ class DynamicAnimeParser(extension: AnimeExtension.Installed) : AnimeParser() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDub(setDub: Boolean) {
|
private fun setDub(setDub: Boolean) {
|
||||||
if (sourceLanguage >= extension.sources.size) {
|
if (sourceLanguage >= extension.sources.size) {
|
||||||
sourceLanguage = extension.sources.size - 1
|
sourceLanguage = extension.sources.size - 1
|
||||||
}
|
}
|
||||||
|
@ -285,9 +266,6 @@ class DynamicAnimeParser(extension: AnimeExtension.Installed) : AnimeParser() {
|
||||||
val name = sAnime.title
|
val name = sAnime.title
|
||||||
val link = sAnime.url
|
val link = sAnime.url
|
||||||
val coverUrl = sAnime.thumbnail_url ?: ""
|
val coverUrl = sAnime.thumbnail_url ?: ""
|
||||||
val otherNames = emptyList<String>() // Populate as needed
|
|
||||||
val total = 1
|
|
||||||
val extra: Map<String, String>? = null // Populate as needed
|
|
||||||
|
|
||||||
// Create a new ShowResponse
|
// Create a new ShowResponse
|
||||||
ShowResponse(name, link, coverUrl, sAnime)
|
ShowResponse(name, link, coverUrl, sAnime)
|
||||||
|
@ -333,7 +311,7 @@ class DynamicAnimeParser(extension: AnimeExtension.Installed) : AnimeParser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||||
val mangaCache = Injekt.get<MangaCache>()
|
private val mangaCache = Injekt.get<MangaCache>()
|
||||||
val extension: MangaExtension.Installed
|
val extension: MangaExtension.Installed
|
||||||
var sourceLanguage = 0
|
var sourceLanguage = 0
|
||||||
|
|
||||||
|
@ -408,7 +386,7 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun imageList(chapterLink: String, sChapter: SChapter): List<ImageData> {
|
suspend fun imageList(sChapter: SChapter): List<ImageData> {
|
||||||
val source = try {
|
val source = try {
|
||||||
extension.sources[sourceLanguage]
|
extension.sources[sourceLanguage]
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -441,121 +419,6 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun fetchAndProcessImage(
|
|
||||||
page: Page,
|
|
||||||
httpSource: HttpSource,
|
|
||||||
context: Context
|
|
||||||
): Bitmap? {
|
|
||||||
return withContext(Dispatchers.IO) {
|
|
||||||
try {
|
|
||||||
// Fetch the image
|
|
||||||
val response = httpSource.getImage(page)
|
|
||||||
Logger.log("Response: ${response.code}")
|
|
||||||
Logger.log("Response: ${response.message}")
|
|
||||||
|
|
||||||
// Convert the Response to an InputStream
|
|
||||||
val inputStream = response.body.byteStream()
|
|
||||||
|
|
||||||
// Convert InputStream to Bitmap
|
|
||||||
val bitmap = BitmapFactory.decodeStream(inputStream)
|
|
||||||
|
|
||||||
inputStream.close()
|
|
||||||
ani.dantotsu.media.manga.saveImage(
|
|
||||||
bitmap,
|
|
||||||
context.contentResolver,
|
|
||||||
page.imageUrl!!,
|
|
||||||
Bitmap.CompressFormat.JPEG,
|
|
||||||
100
|
|
||||||
)
|
|
||||||
|
|
||||||
return@withContext bitmap
|
|
||||||
} catch (e: Exception) {
|
|
||||||
// Handle any exceptions
|
|
||||||
Logger.log("An error occurred: ${e.message}")
|
|
||||||
return@withContext null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun fetchAndSaveImage(page: Page, httpSource: HttpSource, contentResolver: ContentResolver) {
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
|
||||||
try {
|
|
||||||
// Fetch the image
|
|
||||||
val response = httpSource.getImage(page)
|
|
||||||
|
|
||||||
// Convert the Response to an InputStream
|
|
||||||
val inputStream = response.body.byteStream()
|
|
||||||
|
|
||||||
// Convert InputStream to Bitmap
|
|
||||||
val bitmap = BitmapFactory.decodeStream(inputStream)
|
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
// Save the Bitmap using MediaStore API
|
|
||||||
saveImage(
|
|
||||||
bitmap,
|
|
||||||
contentResolver,
|
|
||||||
"image_${System.currentTimeMillis()}.jpg",
|
|
||||||
Bitmap.CompressFormat.JPEG,
|
|
||||||
100
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
inputStream.close()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
// Handle any exceptions
|
|
||||||
Logger.log("An error occurred: ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun saveImage(
|
|
||||||
bitmap: Bitmap,
|
|
||||||
contentResolver: ContentResolver,
|
|
||||||
filename: String,
|
|
||||||
format: Bitmap.CompressFormat,
|
|
||||||
quality: Int
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
||||||
val contentValues = ContentValues().apply {
|
|
||||||
put(MediaStore.MediaColumns.DISPLAY_NAME, filename)
|
|
||||||
put(MediaStore.MediaColumns.MIME_TYPE, "image/${format.name.lowercase()}")
|
|
||||||
put(
|
|
||||||
MediaStore.MediaColumns.RELATIVE_PATH,
|
|
||||||
"${Environment.DIRECTORY_DOWNLOADS}/Dantotsu/Anime"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val uri: Uri? = contentResolver.insert(
|
|
||||||
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
|
||||||
contentValues
|
|
||||||
)
|
|
||||||
|
|
||||||
uri?.let {
|
|
||||||
contentResolver.openOutputStream(it)?.use { os ->
|
|
||||||
bitmap.compress(format, quality, os)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
val directory =
|
|
||||||
File("${Environment.getExternalStorageDirectory()}${File.separator}Dantotsu${File.separator}Anime")
|
|
||||||
if (!directory.exists()) {
|
|
||||||
directory.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
val file = File(directory, filename)
|
|
||||||
FileOutputStream(file).use { outputStream ->
|
|
||||||
bitmap.compress(format, quality, outputStream)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
// Handle exception here
|
|
||||||
Logger.log("Exception while saving image: ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override suspend fun search(query: String): List<ShowResponse> {
|
override suspend fun search(query: String): List<ShowResponse> {
|
||||||
val source = try {
|
val source = try {
|
||||||
extension.sources[sourceLanguage]
|
extension.sources[sourceLanguage]
|
||||||
|
@ -587,9 +450,6 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||||
val name = sManga.title
|
val name = sManga.title
|
||||||
val link = sManga.url
|
val link = sManga.url
|
||||||
val coverUrl = sManga.thumbnail_url ?: ""
|
val coverUrl = sManga.thumbnail_url ?: ""
|
||||||
val otherNames = emptyList<String>() // Populate as needed
|
|
||||||
val total = 1
|
|
||||||
val extra: Map<String, String>? = null // Populate as needed
|
|
||||||
|
|
||||||
// Create a new ShowResponse
|
// Create a new ShowResponse
|
||||||
ShowResponse(name, link, coverUrl, sManga)
|
ShowResponse(name, link, coverUrl, sManga)
|
||||||
|
@ -598,12 +458,10 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||||
|
|
||||||
private fun pageToMangaImage(page: Page): MangaImage {
|
private fun pageToMangaImage(page: Page): MangaImage {
|
||||||
var headersMap = mapOf<String, String>()
|
var headersMap = mapOf<String, String>()
|
||||||
var urlWithoutHeaders = ""
|
|
||||||
var url = ""
|
var url = ""
|
||||||
|
|
||||||
page.imageUrl?.let {
|
page.imageUrl?.let {
|
||||||
val splitUrl = it.split("&")
|
val splitUrl = it.split("&")
|
||||||
urlWithoutHeaders = splitUrl.getOrNull(0) ?: ""
|
|
||||||
url = it
|
url = it
|
||||||
|
|
||||||
headersMap = splitUrl.mapNotNull { part ->
|
headersMap = splitUrl.mapNotNull { part ->
|
||||||
|
@ -641,35 +499,9 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
||||||
sChapter.date_upload
|
sChapter.date_upload
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseChapterTitle(title: String): Triple<String?, String?, String> {
|
|
||||||
val volumePattern =
|
|
||||||
Pattern.compile("(?:vol\\.?|v|volume\\s?)(\\d+)", Pattern.CASE_INSENSITIVE)
|
|
||||||
val chapterPattern =
|
|
||||||
Pattern.compile("(?:ch\\.?|chapter\\s?)(\\d+)", Pattern.CASE_INSENSITIVE)
|
|
||||||
|
|
||||||
val volumeMatcher = volumePattern.matcher(title)
|
|
||||||
val chapterMatcher = chapterPattern.matcher(title)
|
|
||||||
|
|
||||||
val volumeNumber = if (volumeMatcher.find()) volumeMatcher.group(1) else null
|
|
||||||
val chapterNumber = if (chapterMatcher.find()) chapterMatcher.group(1) else null
|
|
||||||
|
|
||||||
var remainingTitle = title
|
|
||||||
if (volumeNumber != null) {
|
|
||||||
remainingTitle =
|
|
||||||
volumeMatcher.group(0)?.let { remainingTitle.replace(it, "") }.toString()
|
|
||||||
}
|
|
||||||
if (chapterNumber != null) {
|
|
||||||
remainingTitle =
|
|
||||||
chapterMatcher.group(0)?.let { remainingTitle.replace(it, "") }.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
return Triple(volumeNumber, chapterNumber, remainingTitle.trim())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class VideoServerPassthrough(val videoServer: VideoServer) : VideoExtractor() {
|
class VideoServerPassthrough(private val videoServer: VideoServer) : VideoExtractor() {
|
||||||
override val server: VideoServer
|
override val server: VideoServer
|
||||||
get() = videoServer
|
get() = videoServer
|
||||||
|
|
||||||
|
@ -748,6 +580,7 @@ class VideoServerPassthrough(val videoServer: VideoServer) : VideoExtractor() {
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
private fun headRequest(fileName: String, networkHelper: NetworkHelper): VideoType? {
|
private fun headRequest(fileName: String, networkHelper: NetworkHelper): VideoType? {
|
||||||
return try {
|
return try {
|
||||||
Logger.log("attempting head request for $fileName")
|
Logger.log("attempting head request for $fileName")
|
||||||
|
|
|
@ -45,15 +45,6 @@ class NovelExtensionFileObserver(private val listener: Listener, private val pat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the extension from the file.
|
|
||||||
*
|
|
||||||
* @param file The file name of the extension.
|
|
||||||
*/
|
|
||||||
//private suspend fun loadExtensionFromFile(file: String): String {
|
|
||||||
// return file
|
|
||||||
//}
|
|
||||||
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
fun onExtensionFileCreated(file: File)
|
fun onExtensionFileCreated(file: File)
|
||||||
fun onExtensionFileDeleted(file: File)
|
fun onExtensionFileDeleted(file: File)
|
||||||
|
|
|
@ -152,13 +152,8 @@ internal class NovelExtensionInstaller(private val context: Context) {
|
||||||
val destinationPath =
|
val destinationPath =
|
||||||
context.getExternalFilesDir(null)?.absolutePath + "/extensions/novel/$pkgName.apk"
|
context.getExternalFilesDir(null)?.absolutePath + "/extensions/novel/$pkgName.apk"
|
||||||
|
|
||||||
val destinationPathDirectory =
|
|
||||||
context.getExternalFilesDir(null)?.absolutePath + "/extensions/novel/"
|
|
||||||
val destinationPathDirectoryFile = File(destinationPathDirectory)
|
|
||||||
|
|
||||||
|
|
||||||
// Check if source path is obtained correctly
|
// Check if source path is obtained correctly
|
||||||
if (sourcePath == null) {
|
if (!sourcePath.startsWith(FILE_SCHEME)) {
|
||||||
Logger.log("Source APK path not found.")
|
Logger.log("Source APK path not found.")
|
||||||
downloadsRelay.call(downloadId to InstallStep.Error)
|
downloadsRelay.call(downloadId to InstallStep.Error)
|
||||||
return InstallStep.Error
|
return InstallStep.Error
|
||||||
|
@ -263,6 +258,7 @@ internal class NovelExtensionInstaller(private val context: Context) {
|
||||||
Logger.log("File copied to internal storage.")
|
Logger.log("File copied to internal storage.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
private fun getRealPathFromURI(context: Context, contentUri: Uri): String? {
|
private fun getRealPathFromURI(context: Context, contentUri: Uri): String? {
|
||||||
var cursor: Cursor? = null
|
var cursor: Cursor? = null
|
||||||
try {
|
try {
|
||||||
|
@ -376,7 +372,6 @@ internal class NovelExtensionInstaller(private val context: Context) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val APK_MIME = "application/vnd.android.package-archive"
|
const val APK_MIME = "application/vnd.android.package-archive"
|
||||||
const val EXTRA_DOWNLOAD_ID = "NovelExtensionInstaller.extra.DOWNLOAD_ID"
|
|
||||||
const val FILE_SCHEME = "file://"
|
const val FILE_SCHEME = "file://"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ internal object NovelExtensionLoader {
|
||||||
* Attempts to load an extension from the given package name. It checks if the extension
|
* Attempts to load an extension from the given package name. It checks if the extension
|
||||||
* contains the required feature flag before trying to load it.
|
* contains the required feature flag before trying to load it.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("unused")
|
||||||
fun loadExtensionFromPkgName(context: Context, pkgName: String): NovelLoadResult {
|
fun loadExtensionFromPkgName(context: Context, pkgName: String): NovelLoadResult {
|
||||||
val path =
|
val path =
|
||||||
context.getExternalFilesDir(null)?.absolutePath + "/extensions/novel/$pkgName.apk"
|
context.getExternalFilesDir(null)?.absolutePath + "/extensions/novel/$pkgName.apk"
|
||||||
|
@ -56,7 +57,7 @@ internal object NovelExtensionLoader {
|
||||||
File(it).setWritable(false)
|
File(it).setWritable(false)
|
||||||
File(it).setReadable(true)
|
File(it).setReadable(true)
|
||||||
}
|
}
|
||||||
val pkgInfo = try {
|
try {
|
||||||
context.packageManager.getPackageArchiveInfo(path, 0)
|
context.packageManager.getPackageArchiveInfo(path, 0)
|
||||||
} catch (error: Exception) {
|
} catch (error: Exception) {
|
||||||
// Unlikely, but the package may have been uninstalled at this point
|
// Unlikely, but the package may have been uninstalled at this point
|
||||||
|
|
|
@ -235,7 +235,7 @@ class ChartBuilder {
|
||||||
aaYaxis.tickInterval(tickInterval)
|
aaYaxis.tickInterval(tickInterval)
|
||||||
aaOptions.yAxis(aaYaxis)
|
aaOptions.yAxis(aaYaxis)
|
||||||
|
|
||||||
setColors(aaOptions, context, primaryColor)
|
setColors(aaOptions, context)
|
||||||
|
|
||||||
return aaOptions
|
return aaOptions
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ class ChartBuilder {
|
||||||
return data.map { (it.toDouble() / max) * 100 }
|
return data.map { (it.toDouble() / max) * 100 }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setColors(aaOptions: AAOptions, context: Context, primaryColor: Int) {
|
private fun setColors(aaOptions: AAOptions, context: Context) {
|
||||||
val backgroundColor = TypedValue()
|
val backgroundColor = TypedValue()
|
||||||
context.theme.resolveAttribute(
|
context.theme.resolveAttribute(
|
||||||
com.google.android.material.R.attr.colorSurfaceVariant,
|
com.google.android.material.R.attr.colorSurfaceVariant,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package ani.dantotsu.profile
|
package ani.dantotsu.profile
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.TypedValue
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
|
@ -267,13 +265,6 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
|
||||||
binding.profileUserAvatarContainer.visibility =
|
binding.profileUserAvatarContainer.visibility =
|
||||||
if (binding.profileUserAvatarContainer.scaleX == 0f) View.GONE else View.VISIBLE
|
if (binding.profileUserAvatarContainer.scaleX == 0f) View.GONE else View.VISIBLE
|
||||||
val duration = (200 * (PrefManager.getVal(PrefName.AnimationSpeed) as Float)).toLong()
|
val duration = (200 * (PrefManager.getVal(PrefName.AnimationSpeed) as Float)).toLong()
|
||||||
val typedValue = TypedValue()
|
|
||||||
this@ProfileActivity.theme.resolveAttribute(
|
|
||||||
com.google.android.material.R.attr.colorSecondary,
|
|
||||||
typedValue,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
val color = typedValue.data
|
|
||||||
if (percentage >= percent && !isCollapsed) {
|
if (percentage >= percent && !isCollapsed) {
|
||||||
isCollapsed = true
|
isCollapsed = true
|
||||||
ObjectAnimator.ofFloat(binding.profileUserDataContainer, "translationX", screenWidth)
|
ObjectAnimator.ofFloat(binding.profileUserDataContainer, "translationX", screenWidth)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ani.dantotsu.settings.paging
|
package ani.dantotsu.settings.paging
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.LinearInterpolator
|
import android.view.animation.LinearInterpolator
|
||||||
|
@ -38,7 +37,7 @@ import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
class AnimeExtensionsViewModelFactory(
|
class AnimeExtensionsViewModelFactory(
|
||||||
private val animeExtensionManager: AnimeExtensionManager
|
private val animeExtensionManager: AnimeExtensionManager
|
||||||
) : ViewModelProvider.Factory {
|
) : ViewModelProvider.Factory {
|
||||||
|
@ -49,7 +48,7 @@ class AnimeExtensionsViewModelFactory(
|
||||||
|
|
||||||
|
|
||||||
class AnimeExtensionsViewModel(
|
class AnimeExtensionsViewModel(
|
||||||
private val animeExtensionManager: AnimeExtensionManager
|
animeExtensionManager: AnimeExtensionManager
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
private val searchQuery = MutableStateFlow("")
|
private val searchQuery = MutableStateFlow("")
|
||||||
private var currentPagingSource: AnimeExtensionPagingSource? = null
|
private var currentPagingSource: AnimeExtensionPagingSource? = null
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ani.dantotsu.settings.paging
|
package ani.dantotsu.settings.paging
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.LinearInterpolator
|
import android.view.animation.LinearInterpolator
|
||||||
|
@ -38,6 +37,7 @@ import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
class MangaExtensionsViewModelFactory(
|
class MangaExtensionsViewModelFactory(
|
||||||
private val mangaExtensionManager: MangaExtensionManager
|
private val mangaExtensionManager: MangaExtensionManager
|
||||||
) : ViewModelProvider.Factory {
|
) : ViewModelProvider.Factory {
|
||||||
|
@ -47,7 +47,7 @@ class MangaExtensionsViewModelFactory(
|
||||||
}
|
}
|
||||||
|
|
||||||
class MangaExtensionsViewModel(
|
class MangaExtensionsViewModel(
|
||||||
private val mangaExtensionManager: MangaExtensionManager
|
mangaExtensionManager: MangaExtensionManager
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
private val searchQuery = MutableStateFlow("")
|
private val searchQuery = MutableStateFlow("")
|
||||||
private var currentPagingSource: MangaExtensionPagingSource? = null
|
private var currentPagingSource: MangaExtensionPagingSource? = null
|
||||||
|
|
|
@ -97,7 +97,6 @@ class NovelExtensionPagingSource(
|
||||||
val availableExtensions =
|
val availableExtensions =
|
||||||
availableExtensionsFlow.filterNot { it.pkgName in installedExtensions }
|
availableExtensionsFlow.filterNot { it.pkgName in installedExtensions }
|
||||||
val query = searchQuery
|
val query = searchQuery
|
||||||
val isNsfwEnabled: Boolean = PrefManager.getVal(PrefName.NSFWExtension)
|
|
||||||
val filteredExtensions = if (query.isEmpty()) {
|
val filteredExtensions = if (query.isEmpty()) {
|
||||||
availableExtensions
|
availableExtensions
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,7 +10,7 @@ abstract class SharedPreferenceLiveData<T>(
|
||||||
) : LiveData<T>() {
|
) : LiveData<T>() {
|
||||||
|
|
||||||
private val preferenceChangeListener =
|
private val preferenceChangeListener =
|
||||||
SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key ->
|
SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||||
if (key == this.key) {
|
if (key == this.key) {
|
||||||
value = getValueFromPreferences(key, defValue)
|
value = getValueFromPreferences(key, defValue)
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,11 @@ class SharedPreferenceStringSetLiveData(
|
||||||
sharedPrefs.getStringSet(key, defValue)?.toSet() ?: defValue
|
sharedPrefs.getStringSet(key, defValue)?.toSet() ?: defValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun SharedPreferences.intLiveData(key: String, defValue: Int): SharedPreferenceLiveData<Int> {
|
fun SharedPreferences.intLiveData(key: String, defValue: Int): SharedPreferenceLiveData<Int> {
|
||||||
return SharedPreferenceIntLiveData(this, key, defValue)
|
return SharedPreferenceIntLiveData(this, key, defValue)
|
||||||
}
|
}
|
||||||
|
@Suppress("unused")
|
||||||
|
|
||||||
fun SharedPreferences.stringLiveData(
|
fun SharedPreferences.stringLiveData(
|
||||||
key: String,
|
key: String,
|
||||||
|
@ -89,6 +91,7 @@ fun SharedPreferences.stringLiveData(
|
||||||
return SharedPreferenceStringLiveData(this, key, defValue)
|
return SharedPreferenceStringLiveData(this, key, defValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun SharedPreferences.booleanLiveData(
|
fun SharedPreferences.booleanLiveData(
|
||||||
key: String,
|
key: String,
|
||||||
defValue: Boolean
|
defValue: Boolean
|
||||||
|
@ -96,14 +99,17 @@ fun SharedPreferences.booleanLiveData(
|
||||||
return SharedPreferenceBooleanLiveData(this, key, defValue)
|
return SharedPreferenceBooleanLiveData(this, key, defValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun SharedPreferences.floatLiveData(key: String, defValue: Float): SharedPreferenceLiveData<Float> {
|
fun SharedPreferences.floatLiveData(key: String, defValue: Float): SharedPreferenceLiveData<Float> {
|
||||||
return SharedPreferenceFloatLiveData(this, key, defValue)
|
return SharedPreferenceFloatLiveData(this, key, defValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun SharedPreferences.longLiveData(key: String, defValue: Long): SharedPreferenceLiveData<Long> {
|
fun SharedPreferences.longLiveData(key: String, defValue: Long): SharedPreferenceLiveData<Long> {
|
||||||
return SharedPreferenceLongLiveData(this, key, defValue)
|
return SharedPreferenceLongLiveData(this, key, defValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
fun SharedPreferences.stringSetLiveData(
|
fun SharedPreferences.stringSetLiveData(
|
||||||
key: String,
|
key: String,
|
||||||
defValue: Set<String>
|
defValue: Set<String>
|
||||||
|
|
|
@ -101,6 +101,7 @@ open class Video(
|
||||||
out.writeObject(headersMap)
|
out.writeObject(headersMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
@Throws(IOException::class, ClassNotFoundException::class)
|
@Throws(IOException::class, ClassNotFoundException::class)
|
||||||
private fun readObject(input: ObjectInputStream) {
|
private fun readObject(input: ObjectInputStream) {
|
||||||
input.defaultReadObject()
|
input.defaultReadObject()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue