From 78b7d07500b50c5960e05c9a7ed445ff50da029a Mon Sep 17 00:00:00 2001 From: rebelonion <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 01:58:43 -0600 Subject: [PATCH 001/117] version bump --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index df3a7889326..6d2aa130a75 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ android { minSdk 23 targetSdk 34 versionCode ((System.currentTimeMillis() / 60000).toInteger()) - versionName "2.0.0-beta01-iv1" + versionName "2.1.0-beta00-iv0" signingConfig signingConfigs.debug } From 3ec488675f85c459eb33f31d569e46d232191e55 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 23 Jan 2024 15:53:41 +0530 Subject: [PATCH 002/117] 20% Chance of getting Update extension --- app/src/main/java/ani/dantotsu/MainActivity.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/MainActivity.kt b/app/src/main/java/ani/dantotsu/MainActivity.kt index 2e8cfccee4b..1fa86909344 100644 --- a/app/src/main/java/ani/dantotsu/MainActivity.kt +++ b/app/src/main/java/ani/dantotsu/MainActivity.kt @@ -65,6 +65,7 @@ import nl.joery.animatedbottombar.AnimatedBottomBar import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.io.Serializable +import kotlin.random.Random class MainActivity : AppCompatActivity() { @@ -163,11 +164,13 @@ class MainActivity : AppCompatActivity() { val preferences: SourcePreferences = Injekt.get() if (preferences.animeExtensionUpdatesCount().get() > 0 || preferences.mangaExtensionUpdatesCount().get() > 0) { - Toast.makeText( - this, - "You have extension updates available!", - Toast.LENGTH_LONG - ).show() + if (Random.nextInt(0, 4) == 1){ + Toast.makeText( + this, + "You have extension updates available!", + Toast.LENGTH_LONG + ).show() + } } binding.root.isMotionEventSplittingEnabled = false From 9fa422ebf347684f88b4ecd7f7047d3170481ede Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 23 Jan 2024 16:18:20 +0530 Subject: [PATCH 003/117] fixed anime/chapter list theme for OLED --- app/src/main/res/layout/item_chapter_list.xml | 3 +-- app/src/main/res/values-night/themes.xml | 9 +++++++++ app/src/main/res/values/style.xml | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/item_chapter_list.xml b/app/src/main/res/layout/item_chapter_list.xml index 7588bcd4b43..24609e85e0c 100644 --- a/app/src/main/res/layout/item_chapter_list.xml +++ b/app/src/main/res/layout/item_chapter_list.xml @@ -12,8 +12,7 @@ android:id="@+id/listAppBar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/colorSurfaceVariant" - android:theme="@style/Theme.Dantotsu.AppBarOverlay"> + android:background="?attr/colorSurfaceVariant"> @color/darkest_Black @color/darkest_Black + @color/nav_bg diff --git a/app/src/main/res/values/style.xml b/app/src/main/res/values/style.xml index e2c009eecae..39fc626017e 100644 --- a/app/src/main/res/values/style.xml +++ b/app/src/main/res/values/style.xml @@ -12,6 +12,7 @@ @color/darkest_Black @color/darkest_Black + @color/nav_bg From 4218d81c49b0142e9c3686fa0d4a81e9abb87177 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 23 Jan 2024 17:38:11 +0530 Subject: [PATCH 004/117] Download manager fixed now no need to long tap download button to download externally (select external downloader to download from external app) --- .../media/anime/SelectorDialogFragment.kt | 153 ++++++++---------- app/src/main/res/layout/activity_settings.xml | 8 - app/src/main/res/values/strings.xml | 1 - 3 files changed, 71 insertions(+), 91 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/SelectorDialogFragment.kt b/app/src/main/java/ani/dantotsu/media/anime/SelectorDialogFragment.kt index 688222c5859..ec8a1234df2 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/SelectorDialogFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/SelectorDialogFragment.kt @@ -300,96 +300,85 @@ class SelectorDialogFragment : BottomSheetDialogFragment() { extractor.server.name media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedVideo = position - binding.urlDownload.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) - val episode = media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!! - val selectedVideo = - if (extractor.videos.size > episode.selectedVideo) extractor.videos[episode.selectedVideo] else null - - val subtitles = extractor.subtitles - val subtitleNames = subtitles.map { it.language } - var subtitleToDownload: Subtitle? = null - if (subtitles.isNotEmpty()) { - val alertDialog = AlertDialog.Builder(context, R.style.MyPopup) - .setTitle("Download Subtitle") - .setSingleChoiceItems( - subtitleNames.toTypedArray(), - -1 - ) { dialog, which -> - subtitleToDownload = subtitles[which] - } - .setPositiveButton("Download") { _, _ -> - dialog?.dismiss() - if (selectedVideo != null) { - Helper.startAnimeDownloadService( - currActivity()!!, - media!!.mainName(), - episode.number, - selectedVideo, - subtitleToDownload, - media, - episode.thumb?.url ?: media!!.banner ?: media!!.cover - ) - } else { - snackString("No Video Selected") - } - } - .setNegativeButton("Skip") { dialog, _ -> - subtitleToDownload = null - if (selectedVideo != null) { - Helper.startAnimeDownloadService( - currActivity()!!, - media!!.mainName(), - episode.number, - selectedVideo, - subtitleToDownload, - media, - episode.thumb?.url ?: media!!.banner ?: media!!.cover - ) - } else { - snackString("No Video Selected") - } - dialog.dismiss() - } - .setNeutralButton("Cancel") { dialog, _ -> - subtitleToDownload = null - dialog.dismiss() - } - .show() - alertDialog.window?.setDimAmount(0.8f) - - } else { - if (selectedVideo != null) { - Helper.startAnimeDownloadService( - requireActivity(), - media!!.mainName(), - episode.number, - selectedVideo, - subtitleToDownload, - media, - episode.thumb?.url ?: media!!.banner ?: media!!.cover - ) - } else { - snackString("No Video Selected") - } - } - dismiss() - } - binding.urlDownload.setOnLongClickListener { - binding.urlDownload.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) if ((loadData("settings_download_manager") ?: 0) != 0) { - media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedExtractor = - extractor.server.name - media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedVideo = - position download( requireActivity(), media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!, media!!.userPreferredName ) } else { - snackString("No Download Manager Selected") + val episode = media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!! + val selectedVideo = + if (extractor.videos.size > episode.selectedVideo) extractor.videos[episode.selectedVideo] else null + val subtitles = extractor.subtitles + val subtitleNames = subtitles.map { it.language } + var subtitleToDownload: Subtitle? = null + if (subtitles.isNotEmpty()) { + val alertDialog = AlertDialog.Builder(context, R.style.MyPopup) + .setTitle("Download Subtitle") + .setSingleChoiceItems( + subtitleNames.toTypedArray(), + -1 + ) { dialog, which -> + subtitleToDownload = subtitles[which] + } + .setPositiveButton("Download") { _, _ -> + dialog?.dismiss() + if (selectedVideo != null) { + Helper.startAnimeDownloadService( + currActivity()!!, + media!!.mainName(), + episode.number, + selectedVideo, + subtitleToDownload, + media, + episode.thumb?.url ?: media!!.banner ?: media!!.cover + ) + } else { + snackString("No Video Selected") + } + } + .setNegativeButton("Skip") { dialog, _ -> + subtitleToDownload = null + if (selectedVideo != null) { + Helper.startAnimeDownloadService( + currActivity()!!, + media!!.mainName(), + episode.number, + selectedVideo, + subtitleToDownload, + media, + episode.thumb?.url ?: media!!.banner ?: media!!.cover + ) + } else { + snackString("No Video Selected") + } + dialog.dismiss() + } + .setNeutralButton("Cancel") { dialog, _ -> + subtitleToDownload = null + dialog.dismiss() + } + .show() + alertDialog.window?.setDimAmount(0.8f) + + } else { + if (selectedVideo != null) { + Helper.startAnimeDownloadService( + requireActivity(), + media!!.mainName(), + episode.number, + selectedVideo, + subtitleToDownload, + media, + episode.thumb?.url ?: media!!.banner ?: media!!.cover + ) + } else { + snackString("No Video Selected") + } + } } - true + dismiss() } if (video.format == VideoType.CONTAINER) { binding.urlSize.visibility = if (video.size != null) View.VISIBLE else View.GONE diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 1c3d5f805b2..8a8fa7c4dfc 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -719,14 +719,6 @@ app:iconPadding="16dp" app:iconSize="24dp" /> - This is an app widget description Airing Image animeDownloads - Long press the download button to download using the selected download manager Delete all anime downloads Delete all Manga Downloads Delete all Novel Downloads From e5f0b71cf03fc1045ad3d28f7166e115025c0675 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 23 Jan 2024 18:38:30 +0530 Subject: [PATCH 005/117] fixed broken transition in offline anime page --- .../download/anime/OfflineAnimeFragment.kt | 40 ++----------------- .../download/manga/OfflineMangaFragment.kt | 39 ++---------------- 2 files changed, 8 insertions(+), 71 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt b/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt index e52647e250e..921335babcc 100644 --- a/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt +++ b/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeFragment.kt @@ -198,7 +198,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener { ActivityOptionsCompat.makeSceneTransitionAnimation( requireActivity(), Pair.create( - requireActivity().findViewById(R.id.itemCompactImage), + gridView.getChildAt(position).findViewById(R.id.itemCompactImage), ViewCompat.getTransitionName(requireActivity().findViewById(R.id.itemCompactImage)) ), ).toBundle() @@ -252,41 +252,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - var height = statusBarHeight - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - val displayCutout = activity?.window?.decorView?.rootWindowInsets?.displayCutout - if (displayCutout != null) { - if (displayCutout.boundingRects.size > 0) { - height = max( - statusBarHeight, - min( - displayCutout.boundingRects[0].width(), - displayCutout.boundingRects[0].height() - ) - ) - } - } - } val scrollTop = view.findViewById(R.id.mangaPageScrollTop) - scrollTop.translationY = - -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat() - val visible = false - - fun animate() { - val start = if (visible) 0f else 1f - val end = if (!visible) 0f else 1f - ObjectAnimator.ofFloat(scrollTop, "scaleX", start, end).apply { - duration = 300 - interpolator = OvershootInterpolator(2f) - start() - } - ObjectAnimator.ofFloat(scrollTop, "scaleY", start, end).apply { - duration = 300 - interpolator = OvershootInterpolator(2f) - start() - } - } - scrollTop.setOnClickListener { gridView.smoothScrollToPositionFromTop(0, 0) } @@ -306,7 +272,9 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener { totalItemCount: Int ) { val first = view.getChildAt(0) - val visibility = first != null && first.top < -height + val visibility = first != null && first.top < 0 + scrollTop.translationY = + -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat() scrollTop.visibility = if (visibility) View.VISIBLE else View.GONE } }) diff --git a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt index 3c3b5e62a37..0134d3d1c62 100644 --- a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt +++ b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaFragment.kt @@ -236,41 +236,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initActivity(requireActivity()) - var height = statusBarHeight - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - val displayCutout = activity?.window?.decorView?.rootWindowInsets?.displayCutout - if (displayCutout != null) { - if (displayCutout.boundingRects.size > 0) { - height = max( - statusBarHeight, - min( - displayCutout.boundingRects[0].width(), - displayCutout.boundingRects[0].height() - ) - ) - } - } - } - val scrollTop = view.findViewById(R.id.mangaPageScrollTop) - scrollTop.translationY = - -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat() - val visible = false - - fun animate() { - val start = if (visible) 0f else 1f - val end = if (!visible) 0f else 1f - ObjectAnimator.ofFloat(scrollTop, "scaleX", start, end).apply { - duration = 300 - interpolator = OvershootInterpolator(2f) - start() - } - ObjectAnimator.ofFloat(scrollTop, "scaleY", start, end).apply { - duration = 300 - interpolator = OvershootInterpolator(2f) - start() - } - } + val scrollTop = view.findViewById(R.id.mangaPageScrollTop) scrollTop.setOnClickListener { gridView.smoothScrollToPositionFromTop(0, 0) } @@ -290,8 +257,10 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener { totalItemCount: Int ) { val first = view.getChildAt(0) - val visibility = first != null && first.top < -height + val visibility = first != null && first.top < 0 scrollTop.visibility = if (visibility) View.VISIBLE else View.GONE + scrollTop.translationY = + -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat() } }) From cb8ebfccb6c639a361eaf48770353f5247b05d0d Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 23 Jan 2024 22:32:08 +0530 Subject: [PATCH 006/117] Removed useless Quality selector in exoplayer --- .../ani/dantotsu/media/anime/ExoplayerView.kt | 23 ------------------- .../res/layout/exo_player_control_view.xml | 11 --------- 2 files changed, 34 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 29aae29fb71..26ef8e3ee07 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -132,7 +132,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL private lateinit var exoSubtitle: ImageButton private lateinit var exoSubtitleView: SubtitleView private lateinit var exoRotate: ImageButton - private lateinit var exoQuality: ImageButton private lateinit var exoSpeed: ImageButton private lateinit var exoScreen: ImageButton private lateinit var exoNext: ImageButton @@ -371,7 +370,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL } playerView = findViewById(R.id.player_view) - exoQuality = playerView.findViewById(R.id.exo_quality) exoPlay = playerView.findViewById(androidx.media3.ui.R.id.exo_play) exoSource = playerView.findViewById(R.id.exo_source) exoSettings = playerView.findViewById(R.id.exo_settings) @@ -1736,13 +1734,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL } } println("Track: ${tracks.groups.size}") - if (tracks.groups.size <= 2) exoQuality.visibility = View.GONE - else { - exoQuality.visibility = View.VISIBLE - exoQuality.setOnClickListener { - initPopupQuality().show() - } - } } override fun onPlayerError(error: PlaybackException) { @@ -1830,20 +1821,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL finishAndRemoveTask() } - // QUALITY SELECTOR - private fun initPopupQuality(): Dialog { - - val trackSelectionDialogBuilder = - TrackSelectionDialogBuilder(this, "Available Qualities", exoPlayer, TRACK_TYPE_VIDEO) - trackSelectionDialogBuilder.setTheme(R.style.DialogTheme) - trackSelectionDialogBuilder.setTrackNameProvider { - if (it.frameRate > 0f) it.height.toString() + "p" else it.height.toString() + "p (fps : N/A)" - } - val trackDialog = trackSelectionDialogBuilder.build() - trackDialog.setOnDismissListener { hideSystemBars() } - return trackDialog - } - // Cast private fun cast() { val videoURL = video?.file?.url ?: return diff --git a/app/src/main/res/layout/exo_player_control_view.xml b/app/src/main/res/layout/exo_player_control_view.xml index 0b351231595..cccc11a0bb7 100644 --- a/app/src/main/res/layout/exo_player_control_view.xml +++ b/app/src/main/res/layout/exo_player_control_view.xml @@ -127,17 +127,6 @@ app:layout_constraintEnd_toEndOf="parent" tools:ignore="ContentDescription,SpeakableTextPresentCheck" /> - - Date: Tue, 23 Jan 2024 23:42:11 +0530 Subject: [PATCH 007/117] removed sub dub toggle(useless) --- .../dantotsu/media/MediaDetailsViewModel.kt | 1 - .../ani/dantotsu/settings/SettingsActivity.kt | 5 ----- .../subcriptions/SubscriptionHelper.kt | 1 - app/src/main/res/layout/activity_settings.xml | 18 ------------------ 4 files changed, 25 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt b/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt index cb5304726a7..3b37713175d 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt @@ -53,7 +53,6 @@ class MediaDetailsViewModel : ViewModel() { true -> sharedPreferences.getInt("settings_def_anime_source_s_r", 0) else -> sharedPreferences.getInt(("settings_def_manga_source_s_r"), 0) } - it.preferDub = loadData("settings_prefer_dub") ?: false saveSelected(media.id, it) it } diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index d140224b8e7..bb43dada542 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -436,11 +436,6 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene ).edit().putBoolean("shared_user_id", isChecked).apply() } - binding.settingsPreferDub.isChecked = loadData("settings_prefer_dub") ?: false - binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked -> - saveData("settings_prefer_dub", isChecked) - } - //val mangaSource = loadData("settings_def_manga_source_s")?.let { if (it >= MangaSources.names.size) 0 else it } ?: 0 val mangaSource = getSharedPreferences( "Dantotsu", diff --git a/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt b/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt index 14ee72b084a..269eb0e59cc 100644 --- a/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt +++ b/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt @@ -36,7 +36,6 @@ class SubscriptionHelper { } else { sharedPreferences.getInt("settings_def_manga_source_s_r", 0) } - it.preferDub = loadData("settings_prefer_dub", context) ?: false it } return data diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 8a8fa7c4dfc..0a087d1d96d 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1208,24 +1208,6 @@ android:layout_marginBottom="8dp" android:background="?android:attr/listDivider" /> - - Date: Tue, 23 Jan 2024 13:35:28 -0600 Subject: [PATCH 008/117] Revert "removed sub dub toggle(useless)" This reverts commit 60981ba224b020aefa732c02488c70418f82bac0. --- .../dantotsu/media/MediaDetailsViewModel.kt | 1 + .../ani/dantotsu/settings/SettingsActivity.kt | 5 +++++ .../subcriptions/SubscriptionHelper.kt | 1 + app/src/main/res/layout/activity_settings.xml | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+) diff --git a/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt b/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt index 3b37713175d..cb5304726a7 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaDetailsViewModel.kt @@ -53,6 +53,7 @@ class MediaDetailsViewModel : ViewModel() { true -> sharedPreferences.getInt("settings_def_anime_source_s_r", 0) else -> sharedPreferences.getInt(("settings_def_manga_source_s_r"), 0) } + it.preferDub = loadData("settings_prefer_dub") ?: false saveSelected(media.id, it) it } diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index bb43dada542..d140224b8e7 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -436,6 +436,11 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene ).edit().putBoolean("shared_user_id", isChecked).apply() } + binding.settingsPreferDub.isChecked = loadData("settings_prefer_dub") ?: false + binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked -> + saveData("settings_prefer_dub", isChecked) + } + //val mangaSource = loadData("settings_def_manga_source_s")?.let { if (it >= MangaSources.names.size) 0 else it } ?: 0 val mangaSource = getSharedPreferences( "Dantotsu", diff --git a/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt b/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt index 269eb0e59cc..14ee72b084a 100644 --- a/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt +++ b/app/src/main/java/ani/dantotsu/subcriptions/SubscriptionHelper.kt @@ -36,6 +36,7 @@ class SubscriptionHelper { } else { sharedPreferences.getInt("settings_def_manga_source_s_r", 0) } + it.preferDub = loadData("settings_prefer_dub", context) ?: false it } return data diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 0a087d1d96d..8a8fa7c4dfc 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1208,6 +1208,24 @@ android:layout_marginBottom="8dp" android:background="?android:attr/listDivider" /> + + Date: Tue, 23 Jan 2024 13:37:52 -0600 Subject: [PATCH 009/117] 20% bleh --- app/src/main/java/ani/dantotsu/MainActivity.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/MainActivity.kt b/app/src/main/java/ani/dantotsu/MainActivity.kt index 1fa86909344..c375add684a 100644 --- a/app/src/main/java/ani/dantotsu/MainActivity.kt +++ b/app/src/main/java/ani/dantotsu/MainActivity.kt @@ -163,14 +163,14 @@ class MainActivity : AppCompatActivity() { } val preferences: SourcePreferences = Injekt.get() - if (preferences.animeExtensionUpdatesCount().get() > 0 || preferences.mangaExtensionUpdatesCount().get() > 0) { - if (Random.nextInt(0, 4) == 1){ - Toast.makeText( - this, - "You have extension updates available!", - Toast.LENGTH_LONG - ).show() - } + if (preferences.animeExtensionUpdatesCount() + .get() > 0 || preferences.mangaExtensionUpdatesCount().get() > 0 + ) { + Toast.makeText( + this, + "You have extension updates available!", + Toast.LENGTH_LONG + ).show() } binding.root.isMotionEventSplittingEnabled = false From 4c797c5eb10e25abcbc7b3b0184d7468bd12f5f8 Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:54:15 -0600 Subject: [PATCH 010/117] index fix --- .../main/java/ani/dantotsu/settings/SettingsActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index d140224b8e7..d602b857cd4 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -240,12 +240,12 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene "Dantotsu", Context.MODE_PRIVATE ).getInt("settings_def_anime_source_s_r", 0) - val oldName = AnimeSources.names[oldDefaultSourceIndex] + val oldName = if (oldDefaultSourceIndex >= AnimeSources.names.size) "" else AnimeSources.names[oldDefaultSourceIndex] getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit() .putStringSet("pinned_anime_sources", pinnedSources).apply() AnimeSources.pinnedAnimeSources = pinnedSources AnimeSources.performReorderAnimeSources() - val newDefaultSourceIndex = AnimeSources.names.indexOf(oldName) + val newDefaultSourceIndex = if (oldName == "") 0 else AnimeSources.names.indexOf(oldName) getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit() .putInt("settings_def_anime_source_s_r", newDefaultSourceIndex).apply() dialog.dismiss() @@ -493,12 +493,12 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene "Dantotsu", Context.MODE_PRIVATE ).getInt("settings_def_manga_source_s_r", 0) - val oldName = MangaSources.names[oldDefaultSourceIndex] + val oldName = if (oldDefaultSourceIndex >= MangaSources.names.size) "" else MangaSources.names[oldDefaultSourceIndex] getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit() .putStringSet("pinned_manga_sources", pinnedSources).apply() MangaSources.pinnedMangaSources = pinnedSources MangaSources.performReorderMangaSources() - val newDefaultSourceIndex = MangaSources.names.indexOf(oldName) + val newDefaultSourceIndex = if (oldName == "") 0 else MangaSources.names.indexOf(oldName) getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit() .putInt("settings_def_manga_source_s_r", newDefaultSourceIndex).apply() dialog.dismiss() From d02d5422077890da3eaa2a69ca40929bb5081982 Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:56:59 -0600 Subject: [PATCH 011/117] cast fix --- app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 26ef8e3ee07..85b0996f8b0 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -1965,7 +1965,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL } override fun onCastSessionAvailable() { - if (isCastApiAvailable) { + if (isCastApiAvailable && !this.isDestroyed) { startCastPlayer() } } From 8a9668bc79b01a1ee2759e0a9a99f92439126562 Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:06:12 -0600 Subject: [PATCH 012/117] switch icon in service --- .../extension/anime/util/AnimeExtensionInstallService.kt | 2 +- .../extension/manga/util/MangaExtensionInstallService.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/anime/util/AnimeExtensionInstallService.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/anime/util/AnimeExtensionInstallService.kt index e70cd5e5bb7..33b093520d8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/anime/util/AnimeExtensionInstallService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/anime/util/AnimeExtensionInstallService.kt @@ -24,7 +24,7 @@ class AnimeExtensionInstallService : Service() { override fun onCreate() { val notification = notificationBuilder(Notifications.CHANNEL_EXTENSIONS_UPDATE) { - setSmallIcon(R.drawable.spinner_icon) + setSmallIcon(R.drawable.ic_round_download_24) setAutoCancel(false) setOngoing(true) setShowWhen(false) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/manga/util/MangaExtensionInstallService.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/manga/util/MangaExtensionInstallService.kt index bab18930696..eb9118a76e6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/manga/util/MangaExtensionInstallService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/manga/util/MangaExtensionInstallService.kt @@ -24,7 +24,7 @@ class MangaExtensionInstallService : Service() { override fun onCreate() { val notification = notificationBuilder(Notifications.CHANNEL_EXTENSIONS_UPDATE) { - setSmallIcon(R.drawable.spinner_icon) + setSmallIcon(R.drawable.ic_round_download_24) setAutoCancel(false) setOngoing(true) setShowWhen(false) From b8fbeed785f0ba183bd6d16cdebc11562247dc73 Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:15:04 -0600 Subject: [PATCH 013/117] check for activity context --- .../main/java/ani/dantotsu/home/AnimeFragment.kt | 13 +++++++++---- .../main/java/ani/dantotsu/home/MangaFragment.kt | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt b/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt index 53e917487f7..afc004844bd 100644 --- a/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt +++ b/app/src/main/java/ani/dantotsu/home/AnimeFragment.kt @@ -268,14 +268,19 @@ class AnimeFragment : Fragment() { model.loaded = true model.loadTrending(1) model.loadUpdated() - model.loadPopular("ANIME", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) - .getBoolean("popular_list", false)) } - live.postValue(false) - _binding?.animeRefresh?.isRefreshing = false + withContext(Dispatchers.Main) { + if (isAdded) { // Check if the fragment is still attached + model.loadPopular("ANIME", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) + .getBoolean("popular_list", false)) + } + live.postValue(false) + _binding?.animeRefresh?.isRefreshing = false + } } } } + } override fun onResume() { diff --git a/app/src/main/java/ani/dantotsu/home/MangaFragment.kt b/app/src/main/java/ani/dantotsu/home/MangaFragment.kt index 8fc18f9c8c3..24bb992f233 100644 --- a/app/src/main/java/ani/dantotsu/home/MangaFragment.kt +++ b/app/src/main/java/ani/dantotsu/home/MangaFragment.kt @@ -242,11 +242,16 @@ class MangaFragment : Fragment() { model.loaded = true model.loadTrending() model.loadTrendingNovel() - model.loadPopular("MANGA", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) - .getBoolean("popular_list", false) ) } - live.postValue(false) - _binding?.mangaRefresh?.isRefreshing = false + withContext(Dispatchers.Main) { + if (isAdded) { + val sharedPrefs = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) + val isPopularList = sharedPrefs.getBoolean("popular_list", false) + model.loadPopular("MANGA", sort = Anilist.sortBy[1], onList = isPopularList) + } + live.postValue(false) + _binding?.mangaRefresh?.isRefreshing = false + } } } } From 4893cd0b0360c5d0e8f3c83ff462352c2613b32e Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:18:36 -0600 Subject: [PATCH 014/117] check for initialization --- app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt b/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt index 432daa5e4ec..dfffe38be93 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt @@ -395,7 +395,9 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi } override fun onResume() { - tabLayout.selectedItemId = idFromSelect() + if (this::tabLayout.isInitialized) { + tabLayout.selectedItemId = idFromSelect() + } super.onResume() } From 79cff1ec9d9cbd52a98180ce193212e40c0deba0 Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:44:50 -0600 Subject: [PATCH 015/117] fix heart thing --- app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt b/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt index dfffe38be93..3c5c86b5c47 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaDetailsActivity.kt @@ -493,10 +493,6 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi init { enabled(true) - scope.launch { - delay(100) //TODO: a listener would be better - clicked() - } image.setOnClickListener { if (pressable && !disabled) { pressable = false From ab038983e5e372b9137dd2b13b8f26eb12d8e13f Mon Sep 17 00:00:00 2001 From: Finnley Somdahl <87634197+rebelonion@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:26:37 -0600 Subject: [PATCH 016/117] sub/dub regex --- app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt index f072a549b51..272464ac232 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt @@ -10,6 +10,7 @@ class AnimeNameAdapter { const val failedEpisodeNumberRegex = "(? Date: Tue, 23 Jan 2024 16:20:50 -0600 Subject: [PATCH 017/117] subdub regex function --- .../dantotsu/media/anime/AnimeNameAdapter.kt | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt index 272464ac232..ccc44eeca47 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeNameAdapter.kt @@ -1,5 +1,6 @@ package ani.dantotsu.media.anime +import java.util.Locale import java.util.regex.Matcher import java.util.regex.Pattern @@ -10,7 +11,39 @@ class AnimeNameAdapter { const val failedEpisodeNumberRegex = "(? "sub" + SubDubType.DUB -> "dub" + } + val toggledCasePreserved = + if (subdub?.get(0)?.isUpperCase() == true || soft?.get(0) + ?.isUpperCase() == true + ) toggled.replaceFirstChar { + if (it.isLowerCase()) it.titlecase( + Locale.ROOT + ) else it.toString() + } else toggled + + subdubMatcher.replaceFirst(toggledCasePreserved + bed) + } else { + null + } + } + + enum class SubDubType { + SUB, DUB + } fun findSeasonNumber(text: String): Int? { val seasonPattern: Pattern = Pattern.compile(seasonRegex, Pattern.CASE_INSENSITIVE) From 7b9450807b0e217e3bc5219410046da66631f13c Mon Sep 17 00:00:00 2001 From: Yutatsu <126276749+Yutatsu0@users.noreply.github.com> Date: Wed, 24 Jan 2024 20:24:42 +0600 Subject: [PATCH 018/117] let jerry sleep in peace --- .github/workflows/beta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index e6b3672ceaf..14e28c5e6a4 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -54,7 +54,7 @@ jobs: shell: bash run: | contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" ) - curl -F "payload_json={\"content\":\" Debug-Build: <@719439449423085569> **${{ env.VERSION }}**\n\n${contentbody:1:-1}\"}" -F "dantotsu_debug=@app/build/outputs/apk/debug/app-debug.apk" ${{ secrets.DISCORD_WEBHOOK }} + curl -F "payload_json={\"content\":\" Debug-Build **${{ env.VERSION }}**\n\n${contentbody:1:-1}\"}" -F "dantotsu_debug=@app/build/outputs/apk/debug/app-debug.apk" ${{ secrets.DISCORD_WEBHOOK }} - name: Delete Old Pre-Releases id: delete-pre-releases From 513ed31b0808b3db0e309f856f8099d1a083cfcb Mon Sep 17 00:00:00 2001 From: aayush262 Date: Thu, 25 Jan 2024 00:20:19 +0530 Subject: [PATCH 019/117] filler fix --- app/src/main/res/layout/item_episode_list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/item_episode_list.xml b/app/src/main/res/layout/item_episode_list.xml index 8e77f355e01..3cd7e0e4f6b 100644 --- a/app/src/main/res/layout/item_episode_list.xml +++ b/app/src/main/res/layout/item_episode_list.xml @@ -9,6 +9,7 @@ android:backgroundTintMode="src_atop" android:longClickable="true" android:background="@drawable/card_outline" + android:backgroundTint="?attr/colorSurfaceVariant" app:cardCornerRadius="16dp"> Date: Thu, 25 Jan 2024 00:23:19 +0530 Subject: [PATCH 020/117] scroll to top --- .../dantotsu/media/anime/AnimeWatchFragment.kt | 17 +++++++++++++++++ .../dantotsu/media/manga/MangaReadFragment.kt | 17 +++++++++++++++++ .../main/res/layout/fragment_anime_watch.xml | 18 ++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt index 487bf207185..6a4954adb1c 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt @@ -25,6 +25,7 @@ import androidx.media3.common.util.UnstableApi import androidx.media3.exoplayer.offline.DownloadService import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2 import ani.dantotsu.* import ani.dantotsu.databinding.FragmentAnimeWatchBinding @@ -144,6 +145,22 @@ class AnimeWatchFragment : Fragment() { binding.animeSourceRecycler.layoutManager = gridLayoutManager + binding.ScrollTop.setOnClickListener { + binding.animeSourceRecycler.scrollToPosition(10) + binding.animeSourceRecycler.smoothScrollToPosition(0) + } + binding.animeSourceRecycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { + override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { + super.onScrolled(recyclerView, dx, dy) + + val position = gridLayoutManager.findFirstVisibleItemPosition() + if (position > 2) { + binding.ScrollTop.visibility = View.VISIBLE + } else { + binding.ScrollTop.visibility = View.GONE + } + } + }) model.scrolledToTop.observe(viewLifecycleOwner) { if (it) binding.animeSourceRecycler.scrollToPosition(0) } diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt index 3153bb6a72e..f1e766ff368 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt @@ -26,6 +26,7 @@ import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.ConcatAdapter import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.widget.ViewPager2 import ani.dantotsu.* import ani.dantotsu.databinding.FragmentAnimeWatchBinding @@ -139,6 +140,22 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener { binding.animeSourceRecycler.layoutManager = gridLayoutManager + binding.ScrollTop.setOnClickListener { + binding.animeSourceRecycler.scrollToPosition(10) + binding.animeSourceRecycler.smoothScrollToPosition(0) + } + binding.animeSourceRecycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { + override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { + super.onScrolled(recyclerView, dx, dy) + + val position = gridLayoutManager.findFirstVisibleItemPosition() + if (position > 2) { + binding.ScrollTop.visibility = View.VISIBLE + } else { + binding.ScrollTop.visibility = View.GONE + } + } + }) model.scrolledToTop.observe(viewLifecycleOwner) { if (it) binding.animeSourceRecycler.scrollToPosition(0) } diff --git a/app/src/main/res/layout/fragment_anime_watch.xml b/app/src/main/res/layout/fragment_anime_watch.xml index 2a65e1eae20..e4e2c9eac70 100644 --- a/app/src/main/res/layout/fragment_anime_watch.xml +++ b/app/src/main/res/layout/fragment_anime_watch.xml @@ -1,6 +1,7 @@ @@ -40,5 +41,22 @@ tools:itemCount="1" tools:listitem="@layout/item_anime_watch" /> + + + \ No newline at end of file From 97eacb58a66c10c7095bd14a0e51e93a5d01c0e0 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Thu, 25 Jan 2024 00:30:28 +0530 Subject: [PATCH 021/117] wont show progress window if incognito is on --- .../ani/dantotsu/media/anime/ExoplayerView.kt | 9 ++++----- .../manga/mangareader/MangaReaderActivity.kt | 16 +++++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 85b0996f8b0..10420f2164d 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -1210,13 +1210,10 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL val showProgressDialog = if (settings.askIndividual) loadData("${media.id}_progressDialog") ?: true else false - if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true) + if (!incognito && showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true) AlertDialog.Builder(this, R.style.MyPopup) .setTitle(getString(R.string.auto_update, media.userPreferredName)) .apply { - if (incognito) { - setMessage(getString(R.string.incognito_will_not_update)) - } setOnCancelListener { hideSystemBars() } setCancelable(false) setPositiveButton(getString(R.string.yes)) { dialog, _ -> @@ -1771,7 +1768,9 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL } private fun updateAniProgress() { - if (exoPlayer.currentPosition / episodeLength > settings.watchPercentage && Anilist.userid != null) + val incognito = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) + ?.getBoolean("incognito", false) ?: false + if (!incognito && exoPlayer.currentPosition / episodeLength > settings.watchPercentage && Anilist.userid != null) if (loadData("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true) { media.anime!!.selectedEpisode?.apply { updateProgress(media, this) diff --git a/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt b/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt index c396088de2d..600d9305f20 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt @@ -142,7 +142,6 @@ class MangaReaderActivity : AppCompatActivity() { ThemeManager(this).applyTheme() binding = ActivityMangaReaderBinding.inflate(layoutInflater) setContentView(binding.root) - binding.mangaReaderBack.setOnClickListener { onBackPressedDispatcher.onBackPressed() } @@ -853,7 +852,10 @@ class MangaReaderActivity : AppCompatActivity() { showProgressDialog = if (settings.askIndividual) loadData("${media.id}_progressDialog") ?: true else false - if (showProgressDialog) { + val incognito = + currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) + ?.getBoolean("incognito", false) ?: false + if (showProgressDialog && !incognito) { val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null) val checkbox = dialogView.findViewById(R.id.dialog_checkbox) @@ -862,16 +864,8 @@ class MangaReaderActivity : AppCompatActivity() { saveData("${media.id}_progressDialog", !isChecked) showProgressDialog = !isChecked } - val incognito = - currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE) - ?.getBoolean("incognito", false) ?: false AlertDialog.Builder(this, R.style.MyPopup) .setTitle(getString(R.string.title_update_progress)) - .apply { - if (incognito) { - setMessage(getString(R.string.incognito_will_not_update)) - } - } .setView(dialogView) .setCancelable(false) .setPositiveButton(getString(R.string.yes)) { dialog, _ -> @@ -893,7 +887,7 @@ class MangaReaderActivity : AppCompatActivity() { .create() .show() } else { - if (loadData("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true) + if (!incognito && loadData("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true) updateProgress( media, MangaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!) From 3fdec074c6cc283f78bb9a50792c47f96f8195d6 Mon Sep 17 00:00:00 2001 From: Adolar0042 <39769465+Adolar0042@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:24:48 +0100 Subject: [PATCH 022/117] feat: made year filter dynamic (#159) * feat: made year filter dynamic --- .../main/java/ani/dantotsu/media/SearchFilterBottomDialog.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ani/dantotsu/media/SearchFilterBottomDialog.kt b/app/src/main/java/ani/dantotsu/media/SearchFilterBottomDialog.kt index 79fd87126a1..6134a616b38 100644 --- a/app/src/main/java/ani/dantotsu/media/SearchFilterBottomDialog.kt +++ b/app/src/main/java/ani/dantotsu/media/SearchFilterBottomDialog.kt @@ -17,6 +17,7 @@ import ani.dantotsu.connections.anilist.Anilist import ani.dantotsu.databinding.BottomSheetSearchFilterBinding import ani.dantotsu.databinding.ItemChipBinding import com.google.android.material.chip.Chip +import java.util.* class SearchFilterBottomDialog : BottomSheetDialogFragment() { private var _binding: BottomSheetSearchFilterBinding? = null @@ -103,7 +104,7 @@ class SearchFilterBottomDialog : BottomSheetDialogFragment() { ArrayAdapter( binding.root.context, R.layout.item_dropdown, - (1970 until 2025).map { it.toString() }.reversed().toTypedArray() + (1970 until Calendar.getInstance().get(Calendar.YEAR) + 2).map { it.toString() }.reversed().toTypedArray() ) ) } From 0aa95889aabb76b98591b751af29e72cd56ac849 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Fri, 26 Jan 2024 09:29:12 +0530 Subject: [PATCH 023/117] scroll to top padding fixed --- app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt | 1 + app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt index 6a4954adb1c..1a2f882770c 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt @@ -155,6 +155,7 @@ class AnimeWatchFragment : Fragment() { val position = gridLayoutManager.findFirstVisibleItemPosition() if (position > 2) { + binding.ScrollTop.translationY = -navBarHeight.toFloat() binding.ScrollTop.visibility = View.VISIBLE } else { binding.ScrollTop.visibility = View.GONE diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt index f1e766ff368..e13828bb20a 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt @@ -150,6 +150,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener { val position = gridLayoutManager.findFirstVisibleItemPosition() if (position > 2) { + binding.ScrollTop.translationY = -navBarHeight.toFloat() binding.ScrollTop.visibility = View.VISIBLE } else { binding.ScrollTop.visibility = View.GONE From 4a5eab13c9ac50d7308e2db78bffdd0a44af9e76 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Fri, 26 Jan 2024 10:32:02 +0530 Subject: [PATCH 024/117] removed quality selector --- .../ani/dantotsu/media/anime/ExoplayerView.kt | 24 ---- .../ani/dantotsu/settings/PlayerSettings.kt | 2 - .../settings/PlayerSettingsActivity.kt | 21 --- .../res/layout/activity_player_settings.xml | 128 ------------------ .../res/layout/exo_player_control_view.xml | 28 ---- 5 files changed, 203 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 10420f2164d..f38442467c7 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -147,9 +147,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL private lateinit var skipTimeText: TextView private lateinit var timeStampText: TextView private lateinit var animeTitle: TextView - private lateinit var videoName: TextView private lateinit var videoInfo: TextView - private lateinit var serverInfo: TextView private lateinit var episodeTitle: Spinner private var orientationListener: OrientationEventListener? = null @@ -924,21 +922,9 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL title = media.userPreferredName episodes = media.anime?.episodes ?: return startMainActivity(this) - videoName = playerView.findViewById(R.id.exo_video_name) videoInfo = playerView.findViewById(R.id.exo_video_info) - serverInfo = playerView.findViewById(R.id.exo_server_info) - - if (!settings.videoInfo) { - videoName.visibility = View.GONE - videoInfo.visibility = View.GONE - serverInfo.visibility = View.GONE - } else { - videoName.isSelected = true - } model.watchSources = if (media.isAdult) HAnimeSources else AnimeSources - serverInfo.text = model.watchSources!!.names.getOrNull(media.selected!!.sourceIndex) - ?: model.watchSources!!.names[0] model.epChanged.observe(this) { epChanging = !it @@ -1408,10 +1394,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL .setRendererDisabled(TRACK_TYPE_VIDEO, false) .setRendererDisabled(C.TRACK_TYPE_AUDIO, false) .setRendererDisabled(C.TRACK_TYPE_TEXT, false) - .setMinVideoSize( - loadData("maxWidth", this) ?: 720, - loadData("maxHeight", this) ?: 480 - ) .setMaxVideoSize(1, 1) //.setOverrideForType( // TrackSelectionOverride(trackSelector, 2)) @@ -1613,14 +1595,8 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL val height = (exoPlayer.videoFormat ?: return).height val width = (exoPlayer.videoFormat ?: return).width - if (video?.format != VideoType.CONTAINER) { - saveData("maxHeight", height) - saveData("maxWidth", width) - } - aspectRatio = Rational(width, height) - videoName.text = episode.selectedExtractor videoInfo.text = "$width x $height" if (exoPlayer.duration < playbackPosition) diff --git a/app/src/main/java/ani/dantotsu/settings/PlayerSettings.kt b/app/src/main/java/ani/dantotsu/settings/PlayerSettings.kt index 83037c4c420..21d7a3b6754 100644 --- a/app/src/main/java/ani/dantotsu/settings/PlayerSettings.kt +++ b/app/src/main/java/ani/dantotsu/settings/PlayerSettings.kt @@ -3,8 +3,6 @@ package ani.dantotsu.settings import java.io.Serializable data class PlayerSettings( - //Video - var videoInfo: Boolean = true, var defaultSpeed: Int = 5, var cursedSpeeds: Boolean = false, var resize: Int = 0, diff --git a/app/src/main/java/ani/dantotsu/settings/PlayerSettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/PlayerSettingsActivity.kt index 88167079093..10130ee1366 100644 --- a/app/src/main/java/ani/dantotsu/settings/PlayerSettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/PlayerSettingsActivity.kt @@ -74,27 +74,6 @@ class PlayerSettingsActivity : AppCompatActivity() { } //Video - binding.playerSettingsVideoInfo.isChecked = settings.videoInfo - binding.playerSettingsVideoInfo.setOnCheckedChangeListener { _, isChecked -> - settings.videoInfo = isChecked - saveData(player, settings) - } - - binding.playerSettingsQualityHeight.setText( - (loadData("maxHeight", toast = false) ?: 480).toString() - ) - binding.playerSettingsQualityHeight.addTextChangedListener { - val height = binding.playerSettingsQualityHeight.text.toString().toIntOrNull() - saveData("maxHeight", height) - } - binding.playerSettingsQualityWidth.setText( - (loadData("maxWidth", toast = false) ?: 720).toString() - ) - binding.playerSettingsQualityWidth.addTextChangedListener { - val height = binding.playerSettingsQualityWidth.text.toString().toIntOrNull() - saveData("maxWidth", height) - } - val speeds = arrayOf( diff --git a/app/src/main/res/layout/activity_player_settings.xml b/app/src/main/res/layout/activity_player_settings.xml index 5a5da5485a4..7c3eb8407dd 100644 --- a/app/src/main/res/layout/activity_player_settings.xml +++ b/app/src/main/res/layout/activity_player_settings.xml @@ -90,134 +90,6 @@ android:paddingEnd="32dp" android:text="@string/video" /> - - - - - - - - - - - - - - - - - - - - - - - - - - -