commit
3a3857e9eb
19 changed files with 181 additions and 95 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -23,9 +23,6 @@ output.json
|
|||
*.jks
|
||||
*.keystore
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
google-services.json
|
||||
|
||||
# Android Profiling
|
||||
*.hprof
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ android {
|
|||
minSdk 23
|
||||
targetSdk 34
|
||||
versionCode ((System.currentTimeMillis() / 60000).toInteger())
|
||||
versionName "2.0.0"
|
||||
versionName "2.0.0-beta00-i"
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
|
||||
|
|
67
app/google-services.json
Normal file
67
app/google-services.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "1039200814590",
|
||||
"project_id": "dantotsu-1e50f",
|
||||
"storage_bucket": "dantotsu-1e50f.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:1039200814590:android:c372b8c1b92b825f1aacaf",
|
||||
"android_client_info": {
|
||||
"package_name": "ani.Dantotsu"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCiXo_q4S2ofA5oCztsoLnlDqJi3GtTJjY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:1039200814590:android:40e14720ee97917e1aacaf",
|
||||
"android_client_info": {
|
||||
"package_name": "ani.dantotsu.beta"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCiXo_q4S2ofA5oCztsoLnlDqJi3GtTJjY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:1039200814590:android:40e14720ee97917e1aacaf",
|
||||
"android_client_info": {
|
||||
"package_name": "ani.dantotsu"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCiXo_q4S2ofA5oCztsoLnlDqJi3GtTJjY"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -69,12 +69,16 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
|||
|
||||
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
||||
animeUserAvatar.setSafeOnClickListener {
|
||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.HOME).show(
|
||||
animeUserAvatar.setSafeOnClickListener {
|
||||
val dialogFragment = SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.HOME)
|
||||
dialogFragment.show(
|
||||
(it.context as AppCompatActivity).supportFragmentManager,
|
||||
"dialog"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||
?.getBoolean("colorOverflow", false) ?: false
|
||||
if (!colorOverflow) {
|
||||
|
|
|
@ -98,10 +98,9 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
|||
}
|
||||
|
||||
binding.animeUserAvatar.setSafeOnClickListener {
|
||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.ANIME).show(
|
||||
(it.context as AppCompatActivity).supportFragmentManager,
|
||||
"dialog"
|
||||
)
|
||||
val dialogFragment =
|
||||
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.ANIME)
|
||||
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||
}
|
||||
|
||||
listOf(
|
||||
|
|
|
@ -113,8 +113,10 @@ class HomeFragment : Fragment() {
|
|||
}
|
||||
|
||||
binding.homeUserAvatarContainer.setSafeOnClickListener {
|
||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.HOME).show(
|
||||
parentFragmentManager,
|
||||
val dialogFragment =
|
||||
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.HOME)
|
||||
dialogFragment.show(
|
||||
(it.context as androidx.appcompat.app.AppCompatActivity).supportFragmentManager,
|
||||
"dialog"
|
||||
)
|
||||
}
|
||||
|
@ -127,7 +129,6 @@ class HomeFragment : Fragment() {
|
|||
|
||||
var reached = false
|
||||
val duration = (uiSettings.animationSpeed * 200).toLong()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
binding.homeScroll.setOnScrollChangeListener { _, _, _, _, _ ->
|
||||
if (!binding.homeScroll.canScrollVertically(1)) {
|
||||
reached = true
|
||||
|
@ -142,7 +143,6 @@ class HomeFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var height = statusBarHeight
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
val displayCutout = activity?.window?.decorView?.rootWindowInsets?.displayCutout
|
||||
|
|
|
@ -93,10 +93,9 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
|||
}
|
||||
|
||||
binding.mangaUserAvatar.setSafeOnClickListener {
|
||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.MANGA).show(
|
||||
(it.context as AppCompatActivity).supportFragmentManager,
|
||||
"dialog"
|
||||
)
|
||||
val dialogFragment =
|
||||
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.MANGA)
|
||||
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||
}
|
||||
|
||||
binding.mangaSearchBar.setEndIconOnClickListener {
|
||||
|
|
|
@ -300,17 +300,16 @@ class MediaAdaptor(
|
|||
return type
|
||||
}
|
||||
|
||||
fun randomOptionClick() { //used for user list
|
||||
val media = mediaList?.random()
|
||||
if (media != null) {
|
||||
mediaList?.let {
|
||||
clicked(
|
||||
it.indexOf(media),
|
||||
fun randomOptionClick() {
|
||||
val media = if (!mediaList.isNullOrEmpty()) {
|
||||
mediaList.random()
|
||||
} else {
|
||||
null
|
||||
)
|
||||
}
|
||||
media?.let {
|
||||
val index = mediaList?.indexOf(it) ?: -1
|
||||
clicked(index, null)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inner class MediaViewHolder(val binding: ItemMediaCompactBinding) :
|
||||
|
|
|
@ -298,7 +298,8 @@ class AnimeWatchFragment : Fragment() {
|
|||
|
||||
fun openSettings(pkg: AnimeExtension.Installed) {
|
||||
val changeUIVisibility: (Boolean) -> Unit = { show ->
|
||||
val activity = requireActivity() as MediaDetailsActivity
|
||||
val activity = activity
|
||||
if (activity is MediaDetailsActivity && isAdded) {
|
||||
val visibility = if (show) View.VISIBLE else View.GONE
|
||||
activity.findViewById<AppBarLayout>(R.id.mediaAppBar).visibility = visibility
|
||||
activity.findViewById<ViewPager2>(R.id.mediaViewPager).visibility = visibility
|
||||
|
@ -312,6 +313,7 @@ class AnimeWatchFragment : Fragment() {
|
|||
activity.findViewById<FrameLayout>(R.id.fragmentExtensionsContainer).visibility =
|
||||
if (show) View.GONE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
val allSettings = pkg.sources.filterIsInstance<ConfigurableAnimeSource>()
|
||||
if (allSettings.isNotEmpty()) {
|
||||
var selectedSetting = allSettings[0]
|
||||
|
|
|
@ -120,6 +120,7 @@ class MangaChapterAdapter(
|
|||
|
||||
fun downloadNChaptersFrom(position: Int, n: Int) {
|
||||
//download next n chapters
|
||||
if (position < 0 || position >= arr.size) return
|
||||
for (i in 0..<n) {
|
||||
if (position + i < arr.size) {
|
||||
val chapterNumber = arr[position + i].number
|
||||
|
@ -160,6 +161,7 @@ class MangaChapterAdapter(
|
|||
//binding.itemDownload.setColorFilter(typedValue2.data) //TODO: colors go to wrong places
|
||||
binding.itemDownload.postDelayed({
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_round_delete_24)
|
||||
binding.itemDownload.rotation = 0f
|
||||
//binding.itemDownload.setColorFilter(typedValue2.data)
|
||||
}, 1000)
|
||||
} else {
|
||||
|
|
|
@ -203,6 +203,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
val chapters = media.manga?.chapters?.values?.toList()
|
||||
//filter by selected language
|
||||
val progressChapterIndex = chapters?.indexOfFirst { MangaNameAdapter.findChapterNumber(it.number)?.toInt() == selected }?:0
|
||||
if (progressChapterIndex < 0 || n < 1) return
|
||||
val chaptersToDownload = chapters?.subList(
|
||||
progressChapterIndex + 1,
|
||||
progressChapterIndex + n + 1
|
||||
|
@ -338,7 +339,8 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
|
||||
fun openSettings(pkg: MangaExtension.Installed) {
|
||||
val changeUIVisibility: (Boolean) -> Unit = { show ->
|
||||
val activity = requireActivity() as MediaDetailsActivity
|
||||
val activity = activity
|
||||
if (activity is MediaDetailsActivity && isAdded) {
|
||||
val visibility = if (show) View.VISIBLE else View.GONE
|
||||
activity.findViewById<AppBarLayout>(R.id.mediaAppBar).visibility = visibility
|
||||
activity.findViewById<ViewPager2>(R.id.mediaViewPager).visibility = visibility
|
||||
|
@ -352,6 +354,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
activity.findViewById<FrameLayout>(R.id.fragmentExtensionsContainer).visibility =
|
||||
if (show) View.GONE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
val allSettings = pkg.sources.filterIsInstance<ConfigurableSource>()
|
||||
if (allSettings.isNotEmpty()) {
|
||||
var selectedSetting = allSettings[0]
|
||||
|
|
|
@ -81,7 +81,8 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
|
||||
private var isContVisible = false
|
||||
private var showProgressDialog = true
|
||||
private var progressDialog: AlertDialog.Builder? = null
|
||||
|
||||
//private var progressDialog: AlertDialog.Builder? = null
|
||||
private var maxChapterPage = 0L
|
||||
private var currentChapterPage = 0L
|
||||
|
||||
|
@ -253,23 +254,6 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
|
||||
showProgressDialog =
|
||||
if (settings.askIndividual) loadData<Boolean>("${media.id}_progressDialog") != true else false
|
||||
progressDialog =
|
||||
if (showProgressDialog && Anilist.userid != null && if (media.isAdult) settings.updateForH else true) {
|
||||
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
|
||||
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
|
||||
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
|
||||
checkbox.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) progressDialog = null
|
||||
saveData("${media.id}_progressDialog", isChecked)
|
||||
showProgressDialog = isChecked
|
||||
}
|
||||
AlertDialog.Builder(this, R.style.MyPopup)
|
||||
.setTitle(getString(R.string.title_update_progress))
|
||||
.setView(dialogView)
|
||||
.apply {
|
||||
setOnCancelListener { hideBars() }
|
||||
}
|
||||
} else null
|
||||
|
||||
//Chapter Change
|
||||
fun change(index: Int) {
|
||||
|
@ -811,9 +795,20 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
|
||||
private fun progress(runnable: Runnable) {
|
||||
if (maxChapterPage - currentChapterPage <= 1 && Anilist.userid != null) {
|
||||
if (showProgressDialog && progressDialog != null) {
|
||||
progressDialog?.setCancelable(false)
|
||||
?.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
if (showProgressDialog) {
|
||||
val dialogView = layoutInflater.inflate(R.layout.item_custom_dialog, null)
|
||||
val checkbox = dialogView.findViewById<CheckBox>(R.id.dialog_checkbox)
|
||||
checkbox.text = getString(R.string.dont_ask_again, media.userPreferredName)
|
||||
checkbox.setOnCheckedChangeListener { _, isChecked ->
|
||||
saveData("${media.id}_progressDialog", isChecked)
|
||||
showProgressDialog = !isChecked
|
||||
}
|
||||
|
||||
AlertDialog.Builder(this, R.style.MyPopup)
|
||||
.setTitle(getString(R.string.title_update_progress))
|
||||
.setView(dialogView)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
saveData("${media.id}_save_progress", true)
|
||||
updateProgress(
|
||||
media,
|
||||
|
@ -823,12 +818,14 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
dialog.dismiss()
|
||||
runnable.run()
|
||||
}
|
||||
?.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
||||
.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
||||
saveData("${media.id}_save_progress", false)
|
||||
dialog.dismiss()
|
||||
runnable.run()
|
||||
}
|
||||
progressDialog?.show()
|
||||
.setOnCancelListener { hideBars() }
|
||||
.create()
|
||||
.show()
|
||||
} else {
|
||||
if (loadData<Boolean>("${media.id}_save_progress") != false && if (media.isAdult) settings.updateForH else true)
|
||||
updateProgress(
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
DisabledReports.kt
|
4
app/src/main/java/ani/dantotsu/others/DisabledReports.kt
Normal file
4
app/src/main/java/ani/dantotsu/others/DisabledReports.kt
Normal file
|
@ -0,0 +1,4 @@
|
|||
package ani.dantotsu.others
|
||||
|
||||
const val DisabledReports = false
|
||||
//Setting this to false, will allow sending crash reports to Dantotsu's Firebase Crashlytics
|
|
@ -16,6 +16,7 @@ import ani.dantotsu.logger
|
|||
import ani.dantotsu.media.anime.AnimeNameAdapter
|
||||
import ani.dantotsu.media.manga.ImageData
|
||||
import ani.dantotsu.media.manga.MangaCache
|
||||
import ani.dantotsu.snackString
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
||||
|
@ -327,8 +328,7 @@ class DynamicMangaParser(extension: MangaExtension.Installed) : MangaParser() {
|
|||
|
||||
} catch (e: Exception) {
|
||||
logger("loadImages Exception: $e")
|
||||
Toast.makeText(currContext(), "Failed to load images: $e", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
snackString("Failed to load images: $e")
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,16 @@ import ani.dantotsu.startMainActivity
|
|||
import ani.dantotsu.toast
|
||||
|
||||
|
||||
class SettingsDialogFragment(val pageType: PageType) : BottomSheetDialogFragment() {
|
||||
class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
||||
private var _binding: BottomSheetSettingsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var pageType: PageType
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
pageType = arguments?.getSerializable("pageType") as? PageType ?: PageType.HOME
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
@ -136,5 +142,13 @@ class SettingsDialogFragment(val pageType: PageType) : BottomSheetDialogFragment
|
|||
enum class PageType {
|
||||
MANGA, ANIME, HOME
|
||||
}
|
||||
|
||||
fun newInstance(pageType: PageType): SettingsDialogFragment {
|
||||
val fragment = SettingsDialogFragment()
|
||||
val args = Bundle()
|
||||
args.putSerializable("pageType", pageType)
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
android:id="@+id/mangaReaderRecyclerContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:gest_doubleTapZoom="2"
|
||||
app:gest_doubleTapZoom="1.5"
|
||||
app:gest_maxZoom="6"
|
||||
app:gest_restrictRotation="true"
|
||||
app:gest_rotationEnabled="true">
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
<item name="android:layout_marginRight">16dp</item>
|
||||
<item name="android:background">@drawable/round_corner</item>
|
||||
</style>
|
||||
<string name="MySnackBarText" parent="Widget.MaterialComponents.Snackbar.TextView">
|
||||
<item name="android:textColor">?attr/colorOnBackground</item>
|
||||
<string name="MySnackBarText" parent="Widget.MaterialComponents.Snackbar.TextView" translatable="false">
|
||||
<item name="android:textColor">@color/bg_opp</item>
|
||||
</string>
|
||||
|
||||
<style name="fontTooltip" parent="Widget.Material3.Tooltip">
|
||||
|
|
|
@ -12,7 +12,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.1.4'
|
||||
classpath 'com.android.tools.build:gradle:8.2.0'
|
||||
classpath 'com.google.gms:google-services:4.4.0'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue