chore: code refactor
This commit is contained in:
parent
8d7b86a667
commit
a2e44da99d
334 changed files with 3550 additions and 3092 deletions
|
@ -35,7 +35,7 @@ class AuthorActivity : AppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityAuthorBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
|
|
@ -18,8 +18,8 @@ import ani.dantotsu.Refresh
|
|||
import ani.dantotsu.databinding.ActivityListBinding
|
||||
import ani.dantotsu.media.user.ListViewPagerAdapter
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
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.tabs.TabLayout
|
||||
|
@ -37,7 +37,7 @@ class CalendarActivity : AppCompatActivity() {
|
|||
@SuppressLint("SetTextI18n")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityListBinding.inflate(layoutInflater)
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import ani.dantotsu.navBarHeight
|
|||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.others.getSerialized
|
||||
import ani.dantotsu.px
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
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.appbar.AppBarLayout
|
||||
|
@ -40,7 +40,7 @@ class CharacterDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChang
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityCharacterBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
|
|
@ -13,8 +13,8 @@ import ani.dantotsu.connections.anilist.GenresViewModel
|
|||
import ani.dantotsu.databinding.ActivityGenreBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -27,7 +27,7 @@ class GenreActivity : AppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityGenreBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
@ -54,8 +54,9 @@ class GenreActivity : AppCompatActivity() {
|
|||
GridLayoutManager(this, (screenWidth / 156f).toInt())
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
model.loadGenres(Anilist.genres ?:
|
||||
loadLocalGenres() ?: arrayListOf()) {
|
||||
model.loadGenres(
|
||||
Anilist.genres ?: loadLocalGenres() ?: arrayListOf()
|
||||
) {
|
||||
MainScope().launch {
|
||||
adapter.addGenre(it)
|
||||
}
|
||||
|
@ -65,7 +66,8 @@ class GenreActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
private fun loadLocalGenres(): ArrayList<String>? {
|
||||
val genres = PrefManager.getVal<Set<String>>(PrefName.GenresList).toMutableList() as ArrayList<String>?
|
||||
val genres = PrefManager.getVal<Set<String>>(PrefName.GenresList)
|
||||
.toMutableList() as ArrayList<String>?
|
||||
return if (genres.isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
|
|
|
@ -26,8 +26,8 @@ import ani.dantotsu.databinding.ItemMediaCompactBinding
|
|||
import ani.dantotsu.databinding.ItemMediaLargeBinding
|
||||
import ani.dantotsu.databinding.ItemMediaPageBinding
|
||||
import ani.dantotsu.databinding.ItemMediaPageSmallBinding
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
|
|
|
@ -42,8 +42,8 @@ import ani.dantotsu.navBarHeight
|
|||
import ani.dantotsu.openLinkInBrowser
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.others.getSerialized
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
|
|
|
@ -25,8 +25,8 @@ import ani.dantotsu.parsers.NovelSources
|
|||
import ani.dantotsu.parsers.ShowResponse
|
||||
import ani.dantotsu.parsers.VideoExtractor
|
||||
import ani.dantotsu.parsers.WatchSources
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||
|
@ -43,13 +43,14 @@ class MediaDetailsViewModel : ViewModel() {
|
|||
|
||||
|
||||
fun loadSelected(media: Media, isDownload: Boolean = false): Selected {
|
||||
val data = PrefManager.getNullableCustomVal("Selected-${media.id}", null, Selected::class.java)
|
||||
?: Selected().let {
|
||||
it.sourceIndex = 0
|
||||
it.preferDub = PrefManager.getVal(PrefName.SettingsPreferDub)
|
||||
saveSelected(media.id, it)
|
||||
it
|
||||
}
|
||||
val data =
|
||||
PrefManager.getNullableCustomVal("Selected-${media.id}", null, Selected::class.java)
|
||||
?: Selected().let {
|
||||
it.sourceIndex = 0
|
||||
it.preferDub = PrefManager.getVal(PrefName.SettingsPreferDub)
|
||||
saveSelected(media.id, it)
|
||||
it
|
||||
}
|
||||
if (isDownload) {
|
||||
data.sourceIndex = if (media.anime != null) {
|
||||
AnimeSources.list.size - 1
|
||||
|
|
|
@ -25,8 +25,8 @@ import ani.dantotsu.*
|
|||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.GenresViewModel
|
||||
import ani.dantotsu.databinding.*
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import io.noties.markwon.Markwon
|
||||
import io.noties.markwon.SoftBreakAddsNewLinePlugin
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -97,28 +97,29 @@ class MediaInfoFragment : Fragment() {
|
|||
if (media.anime != null) {
|
||||
val episodeDuration = media.anime.episodeDuration
|
||||
|
||||
binding.mediaInfoDuration.text = when {
|
||||
episodeDuration != null -> {
|
||||
val hours = episodeDuration / 60
|
||||
val minutes = episodeDuration % 60
|
||||
binding.mediaInfoDuration.text = when {
|
||||
episodeDuration != null -> {
|
||||
val hours = episodeDuration / 60
|
||||
val minutes = episodeDuration % 60
|
||||
|
||||
val formattedDuration = buildString {
|
||||
if (hours > 0) {
|
||||
append("$hours hour")
|
||||
if (hours > 1) append("s")
|
||||
}
|
||||
val formattedDuration = buildString {
|
||||
if (hours > 0) {
|
||||
append("$hours hour")
|
||||
if (hours > 1) append("s")
|
||||
}
|
||||
|
||||
if (minutes > 0) {
|
||||
if (hours > 0) append(", ")
|
||||
append("$minutes min")
|
||||
if (minutes > 1) append("s")
|
||||
}
|
||||
}
|
||||
if (minutes > 0) {
|
||||
if (hours > 0) append(", ")
|
||||
append("$minutes min")
|
||||
if (minutes > 1) append("s")
|
||||
}
|
||||
}
|
||||
|
||||
formattedDuration
|
||||
}
|
||||
else -> "??"
|
||||
}
|
||||
formattedDuration
|
||||
}
|
||||
|
||||
else -> "??"
|
||||
}
|
||||
binding.mediaInfoDurationContainer.visibility = View.VISIBLE
|
||||
binding.mediaInfoSeasonContainer.visibility = View.VISIBLE
|
||||
binding.mediaInfoSeason.text =
|
||||
|
|
|
@ -16,8 +16,8 @@ import ani.dantotsu.connections.anilist.Anilist
|
|||
import ani.dantotsu.connections.anilist.AnilistSearch
|
||||
import ani.dantotsu.connections.anilist.SearchResults
|
||||
import ani.dantotsu.databinding.ActivitySearchBinding
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -41,7 +41,7 @@ class SearchActivity : AppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivitySearchBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
|
|
@ -22,8 +22,8 @@ import ani.dantotsu.R
|
|||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.databinding.ItemChipBinding
|
||||
import ani.dantotsu.databinding.ItemSearchHeaderBinding
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import com.google.android.material.checkbox.MaterialCheckBox.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
|
|
@ -8,15 +8,16 @@ import androidx.recyclerview.widget.ListAdapter
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ItemSearchHistoryBinding
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefManager.asLiveStringSet
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.SharedPreferenceStringSetLiveData
|
||||
import java.util.Locale
|
||||
|
||||
class SearchHistoryAdapter(private val type: String, private val searchClicked: (String) -> Unit) : ListAdapter<String, SearchHistoryAdapter.SearchHistoryViewHolder>(
|
||||
DIFF_CALLBACK_INSTALLED
|
||||
) {
|
||||
class SearchHistoryAdapter(private val type: String, private val searchClicked: (String) -> Unit) :
|
||||
ListAdapter<String, SearchHistoryAdapter.SearchHistoryViewHolder>(
|
||||
DIFF_CALLBACK_INSTALLED
|
||||
) {
|
||||
private var searchHistoryLiveData: SharedPreferenceStringSetLiveData? = null
|
||||
private var searchHistory: MutableSet<String>? = null
|
||||
private var historyType: PrefName = when (type.lowercase(Locale.ROOT)) {
|
||||
|
@ -26,7 +27,8 @@ class SearchHistoryAdapter(private val type: String, private val searchClicked:
|
|||
}
|
||||
|
||||
init {
|
||||
searchHistoryLiveData = PrefManager.getLiveVal(historyType, mutableSetOf<String>()).asLiveStringSet()
|
||||
searchHistoryLiveData =
|
||||
PrefManager.getLiveVal(historyType, mutableSetOf<String>()).asLiveStringSet()
|
||||
searchHistoryLiveData?.observeForever {
|
||||
searchHistory = it.toMutableSet()
|
||||
submitList(searchHistory?.reversed())
|
||||
|
|
|
@ -35,7 +35,7 @@ class StudioActivity : AppCompatActivity() {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityStudioBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
|
|
@ -26,8 +26,8 @@ import ani.dantotsu.others.webview.CookieCatcher
|
|||
import ani.dantotsu.parsers.AnimeSources
|
||||
import ani.dantotsu.parsers.DynamicAnimeParser
|
||||
import ani.dantotsu.parsers.WatchSources
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.subcriptions.Notifications.Companion.openSettings
|
||||
import ani.dantotsu.subcriptions.Subscription.Companion.getChannelId
|
||||
import com.google.android.material.chip.Chip
|
||||
|
@ -198,7 +198,8 @@ class AnimeWatchAdapter(
|
|||
var refresh = false
|
||||
var run = false
|
||||
var reversed = media.selected!!.recyclerReversed
|
||||
var style = media.selected!!.recyclerStyle ?: PrefManager.getVal(PrefName.AnimeDefaultView)
|
||||
var style =
|
||||
media.selected!!.recyclerStyle ?: PrefManager.getVal(PrefName.AnimeDefaultView)
|
||||
dialogBinding.animeSourceTop.rotation = if (reversed) -90f else 90f
|
||||
dialogBinding.sortText.text = if (reversed) "Down to Up" else "Up to Down"
|
||||
dialogBinding.animeSourceTop.setOnClickListener {
|
||||
|
@ -356,7 +357,9 @@ class AnimeWatchAdapter(
|
|||
val episodes = media.anime.episodes!!.keys.toTypedArray()
|
||||
|
||||
val anilistEp = (media.userProgress ?: 0).plus(1)
|
||||
val appEp = PrefManager.getCustomVal<String?>("${media.id}_current_ep", "")?.toIntOrNull() ?: 1
|
||||
val appEp =
|
||||
PrefManager.getCustomVal<String?>("${media.id}_current_ep", "")?.toIntOrNull()
|
||||
?: 1
|
||||
|
||||
var continueEp = (if (anilistEp > appEp) anilistEp else appEp).toString()
|
||||
if (episodes.contains(continueEp)) {
|
||||
|
@ -368,7 +371,10 @@ class AnimeWatchAdapter(
|
|||
media.id,
|
||||
continueEp
|
||||
)
|
||||
if ((binding.itemEpisodeProgress.layoutParams as LinearLayout.LayoutParams).weight > PrefManager.getVal<Float>(PrefName.WatchPercentage)) {
|
||||
if ((binding.itemEpisodeProgress.layoutParams as LinearLayout.LayoutParams).weight > PrefManager.getVal<Float>(
|
||||
PrefName.WatchPercentage
|
||||
)
|
||||
) {
|
||||
val e = episodes.indexOf(continueEp)
|
||||
if (e != -1 && e + 1 < episodes.size) {
|
||||
continueEp = episodes[e + 1]
|
||||
|
@ -395,7 +401,10 @@ class AnimeWatchAdapter(
|
|||
fragment.onEpisodeClick(continueEp)
|
||||
}
|
||||
if (fragment.continueEp) {
|
||||
if ((binding.itemEpisodeProgress.layoutParams as LinearLayout.LayoutParams).weight < PrefManager.getVal<Float>(PrefName.WatchPercentage)) {
|
||||
if ((binding.itemEpisodeProgress.layoutParams as LinearLayout.LayoutParams).weight < PrefManager.getVal<Float>(
|
||||
PrefName.WatchPercentage
|
||||
)
|
||||
) {
|
||||
binding.animeSourceContinue.performClick()
|
||||
fragment.continueEp = false
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ import ani.dantotsu.parsers.AnimeParser
|
|||
import ani.dantotsu.parsers.AnimeSources
|
||||
import ani.dantotsu.parsers.HAnimeSources
|
||||
import ani.dantotsu.settings.extensionprefs.AnimeSourcePreferencesFragment
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.subcriptions.Notifications
|
||||
import ani.dantotsu.subcriptions.Notifications.Group.ANIME_GROUP
|
||||
import ani.dantotsu.subcriptions.Subscription.Companion.getChannelId
|
||||
|
|
|
@ -28,8 +28,8 @@ import ani.dantotsu.others.Download.download
|
|||
import ani.dantotsu.parsers.Subtitle
|
||||
import ani.dantotsu.parsers.VideoExtractor
|
||||
import ani.dantotsu.parsers.VideoType
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -303,7 +303,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
|||
extractor.server.name
|
||||
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedVideo =
|
||||
position
|
||||
if ((PrefManager.getVal(PrefName.DownloadManager) as Int) != 0) {
|
||||
if ((PrefManager.getVal(PrefName.DownloadManager) as Int) != 0) {
|
||||
download(
|
||||
requireActivity(),
|
||||
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!,
|
||||
|
|
|
@ -107,7 +107,8 @@ class SubtitleDialogFragment : BottomSheetDialogFragment() {
|
|||
}
|
||||
model.getMedia().observe(viewLifecycleOwner) { media ->
|
||||
val mediaID: Int = media.id
|
||||
val selSubs: String? = PrefManager.getCustomVal<String?>("subLang_${mediaID}", null)
|
||||
val selSubs: String? =
|
||||
PrefManager.getCustomVal<String?>("subLang_${mediaID}", null)
|
||||
if (episode.selectedSubtitle != position - 1 && selSubs != subtitles[position - 1].language) {
|
||||
binding.root.setCardBackgroundColor(TRANSPARENT)
|
||||
}
|
||||
|
@ -118,7 +119,10 @@ class SubtitleDialogFragment : BottomSheetDialogFragment() {
|
|||
model.setEpisode(episode, "Subtitle")
|
||||
model.getMedia().observe(viewLifecycleOwner) { media ->
|
||||
val mediaID: Int = media.id
|
||||
PrefManager.setCustomVal("subLang_${mediaID}", subtitles[position - 1].language)
|
||||
PrefManager.setCustomVal(
|
||||
"subLang_${mediaID}",
|
||||
subtitles[position - 1].language
|
||||
)
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ import ani.dantotsu.others.webview.CookieCatcher
|
|||
import ani.dantotsu.parsers.DynamicMangaParser
|
||||
import ani.dantotsu.parsers.MangaReadSources
|
||||
import ani.dantotsu.parsers.MangaSources
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.subcriptions.Notifications.Companion.openSettings
|
||||
import ani.dantotsu.subcriptions.Subscription.Companion.getChannelId
|
||||
import com.google.android.material.chip.Chip
|
||||
|
@ -70,8 +70,9 @@ class MangaReadAdapter(
|
|||
null
|
||||
)
|
||||
}
|
||||
val offline = if (!isOnline(binding.root.context) || PrefManager.getVal(PrefName.OfflineMode)
|
||||
) View.GONE else View.VISIBLE
|
||||
val offline =
|
||||
if (!isOnline(binding.root.context) || PrefManager.getVal(PrefName.OfflineMode)
|
||||
) View.GONE else View.VISIBLE
|
||||
|
||||
binding.animeSourceNameContainer.visibility = offline
|
||||
binding.animeSourceSettings.visibility = offline
|
||||
|
@ -160,7 +161,8 @@ class MangaReadAdapter(
|
|||
var refresh = false
|
||||
var run = false
|
||||
var reversed = media.selected!!.recyclerReversed
|
||||
var style = media.selected!!.recyclerStyle ?: PrefManager.getVal(PrefName.MangaDefaultView)
|
||||
var style =
|
||||
media.selected!!.recyclerStyle ?: PrefManager.getVal(PrefName.MangaDefaultView)
|
||||
dialogBinding.animeSourceTop.rotation = if (reversed) -90f else 90f
|
||||
dialogBinding.sortText.text = if (reversed) "Down to Up" else "Up to Down"
|
||||
dialogBinding.animeSourceTop.setOnClickListener {
|
||||
|
@ -389,7 +391,8 @@ class MangaReadAdapter(
|
|||
if (media.manga?.chapters != null) {
|
||||
val chapters = media.manga.chapters!!.keys.toTypedArray()
|
||||
val anilistEp = (media.userProgress ?: 0).plus(1)
|
||||
val appEp = PrefManager.getCustomVal<String?>("${media.id}_current_chp", null)?.toIntOrNull() ?: 1
|
||||
val appEp = PrefManager.getCustomVal<String?>("${media.id}_current_chp", null)
|
||||
?.toIntOrNull() ?: 1
|
||||
var continueEp = (if (anilistEp > appEp) anilistEp else appEp).toString()
|
||||
val filteredChapters = chapters.filter { chapterKey ->
|
||||
val chapter = media.manga.chapters!![chapterKey]!!
|
||||
|
|
|
@ -44,8 +44,8 @@ import ani.dantotsu.parsers.HMangaSources
|
|||
import ani.dantotsu.parsers.MangaParser
|
||||
import ani.dantotsu.parsers.MangaSources
|
||||
import ani.dantotsu.settings.extensionprefs.MangaSourcePreferencesFragment
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.subcriptions.Notifications
|
||||
import ani.dantotsu.subcriptions.Notifications.Group.MANGA_GROUP
|
||||
import ani.dantotsu.subcriptions.Subscription.Companion.getChannelId
|
||||
|
@ -181,7 +181,9 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
headerAdapter = MangaReadAdapter(it, this, model.mangaReadSources!!)
|
||||
headerAdapter.scanlatorSelectionListener = this
|
||||
chapterAdapter =
|
||||
MangaChapterAdapter(style ?: PrefManager.getVal(PrefName.MangaDefaultView), media, this)
|
||||
MangaChapterAdapter(
|
||||
style ?: PrefManager.getVal(PrefName.MangaDefaultView), media, this
|
||||
)
|
||||
|
||||
for (download in downloadManager.mangaDownloadedTypes) {
|
||||
if (download.title == media.mainName()) {
|
||||
|
|
|
@ -14,8 +14,8 @@ import ani.dantotsu.media.manga.MangaChapter
|
|||
import ani.dantotsu.settings.CurrentReaderSettings.Directions.LEFT_TO_RIGHT
|
||||
import ani.dantotsu.settings.CurrentReaderSettings.Directions.RIGHT_TO_LEFT
|
||||
import ani.dantotsu.settings.CurrentReaderSettings.Layouts.PAGED
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||
import com.davemorrissey.labs.subscaleview.ImageSource
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
|
|
|
@ -37,8 +37,8 @@ import ani.dantotsu.others.ImageViewDialog
|
|||
import ani.dantotsu.setSafeOnClickListener
|
||||
import ani.dantotsu.settings.CurrentNovelReaderSettings
|
||||
import ani.dantotsu.settings.CurrentReaderSettings
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.tryWith
|
||||
|
@ -175,7 +175,7 @@ class NovelReaderActivity : AppCompatActivity(), EbookReaderEventListener {
|
|||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityNovelReaderBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
@ -286,7 +286,8 @@ class NovelReaderActivity : AppCompatActivity(), EbookReaderEventListener {
|
|||
binding.bookReader.getAppearance {
|
||||
currentTheme = it
|
||||
themes.add(0, it)
|
||||
defaultSettings = loadReaderSettings("${sanitizedBookId}_current_settings") ?: defaultSettings
|
||||
defaultSettings =
|
||||
loadReaderSettings("${sanitizedBookId}_current_settings") ?: defaultSettings
|
||||
applySettings()
|
||||
}
|
||||
|
||||
|
@ -486,7 +487,11 @@ class NovelReaderActivity : AppCompatActivity(), EbookReaderEventListener {
|
|||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun <T> loadReaderSettings(fileName: String, context: Context? = null, toast: Boolean = true): T? {
|
||||
private fun <T> loadReaderSettings(
|
||||
fileName: String,
|
||||
context: Context? = null,
|
||||
toast: Boolean = true
|
||||
): T? {
|
||||
val a = context ?: currContext()
|
||||
try {
|
||||
if (a?.fileList() != null)
|
||||
|
|
|
@ -18,8 +18,8 @@ import ani.dantotsu.R
|
|||
import ani.dantotsu.Refresh
|
||||
import ani.dantotsu.databinding.ActivityListBinding
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
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.tabs.TabLayout
|
||||
|
@ -36,7 +36,7 @@ class ListActivity : AppCompatActivity() {
|
|||
@SuppressLint("SetTextI18n")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
ThemeManager(this).applyTheme()
|
||||
binding = ActivityListBinding.inflate(layoutInflater)
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.ViewModel
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.tryWithSuspend
|
||||
|
||||
class ListViewModel : ViewModel() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue