commit
c3f5a820e4
23 changed files with 164 additions and 51 deletions
2
.github/workflows/beta.yml
vendored
2
.github/workflows/beta.yml
vendored
|
@ -54,7 +54,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" )
|
contentbody=$( jq -Rsa . <<< "${{ github.event.head_commit.message }}" )
|
||||||
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 }}
|
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 }}
|
||||||
|
|
||||||
- name: Delete Old Pre-Releases
|
- name: Delete Old Pre-Releases
|
||||||
id: delete-pre-releases
|
id: delete-pre-releases
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.content.res.Configuration
|
||||||
import android.content.res.Resources.getSystem
|
import android.content.res.Resources.getSystem
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.media.MediaScannerConnection
|
import android.media.MediaScannerConnection
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.NetworkCapabilities.*
|
import android.net.NetworkCapabilities.*
|
||||||
|
@ -25,6 +26,7 @@ import android.telephony.TelephonyManager
|
||||||
import android.text.InputFilter
|
import android.text.InputFilter
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
import android.view.animation.*
|
import android.view.animation.*
|
||||||
|
@ -48,6 +50,7 @@ import ani.dantotsu.media.Media
|
||||||
import ani.dantotsu.parsers.ShowResponse
|
import ani.dantotsu.parsers.ShowResponse
|
||||||
import ani.dantotsu.settings.UserInterfaceSettings
|
import ani.dantotsu.settings.UserInterfaceSettings
|
||||||
import ani.dantotsu.subcriptions.NotificationClickReceiver
|
import ani.dantotsu.subcriptions.NotificationClickReceiver
|
||||||
|
import ani.dantotsu.themes.ThemeManager
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
|
||||||
|
@ -211,6 +214,10 @@ open class BottomSheetDialogFragment : BottomSheetDialogFragment() {
|
||||||
val behavior = BottomSheetBehavior.from(requireView().parent as View)
|
val behavior = BottomSheetBehavior.from(requireView().parent as View)
|
||||||
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
}
|
}
|
||||||
|
val typedValue = TypedValue()
|
||||||
|
val theme = requireContext().theme
|
||||||
|
theme.resolveAttribute(com.google.android.material.R.attr.colorOnSurfaceInverse, typedValue, true)
|
||||||
|
window.navigationBarColor = typedValue.data
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun show(manager: FragmentManager, tag: String?) {
|
override fun show(manager: FragmentManager, tag: String?) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.AnticipateInterpolator
|
import android.view.animation.AnticipateInterpolator
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.activity.addCallback
|
import androidx.activity.addCallback
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.annotation.OptIn
|
import androidx.annotation.OptIn
|
||||||
|
@ -46,9 +47,13 @@ import ani.dantotsu.media.MediaDetailsActivity
|
||||||
import ani.dantotsu.others.CustomBottomDialog
|
import ani.dantotsu.others.CustomBottomDialog
|
||||||
import ani.dantotsu.others.LangSet
|
import ani.dantotsu.others.LangSet
|
||||||
import ani.dantotsu.others.SharedPreferenceBooleanLiveData
|
import ani.dantotsu.others.SharedPreferenceBooleanLiveData
|
||||||
|
import ani.dantotsu.parsers.novel.NovelExtensionManager
|
||||||
import ani.dantotsu.settings.UserInterfaceSettings
|
import ani.dantotsu.settings.UserInterfaceSettings
|
||||||
import ani.dantotsu.subcriptions.Subscription.Companion.startSubscription
|
import ani.dantotsu.subcriptions.Subscription.Companion.startSubscription
|
||||||
import ani.dantotsu.themes.ThemeManager
|
import ani.dantotsu.themes.ThemeManager
|
||||||
|
import eu.kanade.domain.source.service.SourcePreferences
|
||||||
|
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
|
||||||
|
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
|
||||||
import io.noties.markwon.Markwon
|
import io.noties.markwon.Markwon
|
||||||
import io.noties.markwon.SoftBreakAddsNewLinePlugin
|
import io.noties.markwon.SoftBreakAddsNewLinePlugin
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -57,6 +62,8 @@ import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import nl.joery.animatedbottombar.AnimatedBottomBar
|
import nl.joery.animatedbottombar.AnimatedBottomBar
|
||||||
|
import uy.kohesive.injekt.Injekt
|
||||||
|
import uy.kohesive.injekt.api.get
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,6 +161,15 @@ 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()
|
||||||
|
}
|
||||||
|
|
||||||
binding.root.isMotionEventSplittingEnabled = false
|
binding.root.isMotionEventSplittingEnabled = false
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
|
@ -213,13 +229,13 @@ class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
val offlineMode = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
.getBoolean("offlineMode", false)
|
.getBoolean("offlineMode", false)
|
||||||
if (!isOnline(this)) {
|
if (!isOnline(this)) {
|
||||||
snackString(this@MainActivity.getString(R.string.no_internet_connection))
|
snackString(this@MainActivity.getString(R.string.no_internet_connection))
|
||||||
startActivity(Intent(this, NoInternet::class.java))
|
startActivity(Intent(this, NoInternet::class.java))
|
||||||
} else {
|
} else {
|
||||||
if (offline) {
|
if (offlineMode) {
|
||||||
snackString(this@MainActivity.getString(R.string.no_internet_connection))
|
snackString(this@MainActivity.getString(R.string.no_internet_connection))
|
||||||
startActivity(Intent(this, NoInternet::class.java))
|
startActivity(Intent(this, NoInternet::class.java))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,6 +25,10 @@ import android.widget.TextView
|
||||||
import androidx.annotation.OptIn
|
import androidx.annotation.OptIn
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.cardview.widget.CardView
|
import androidx.cardview.widget.CardView
|
||||||
|
import androidx.core.app.ActivityOptionsCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.util.Pair
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.marginBottom
|
import androidx.core.view.marginBottom
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.media3.common.util.UnstableApi
|
import androidx.media3.common.util.UnstableApi
|
||||||
|
@ -187,9 +191,17 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
return@let
|
return@let
|
||||||
}
|
}
|
||||||
MediaDetailsActivity.mediaSingleton = mediaModel
|
MediaDetailsActivity.mediaSingleton = mediaModel
|
||||||
startActivity(
|
ContextCompat.startActivity(
|
||||||
|
requireActivity(),
|
||||||
Intent(requireContext(), MediaDetailsActivity::class.java)
|
Intent(requireContext(), MediaDetailsActivity::class.java)
|
||||||
.putExtra("download", true)
|
.putExtra("download", true),
|
||||||
|
ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||||
|
requireActivity(),
|
||||||
|
Pair.create(
|
||||||
|
requireActivity().findViewById<ImageView>(R.id.itemCompactImage),
|
||||||
|
ViewCompat.getTransitionName(requireActivity().findViewById(R.id.itemCompactImage))
|
||||||
|
),
|
||||||
|
).toBundle()
|
||||||
)
|
)
|
||||||
} ?: run {
|
} ?: run {
|
||||||
snackString("no media found")
|
snackString("no media found")
|
||||||
|
|
|
@ -51,8 +51,8 @@ class OfflineMangaAdapter(
|
||||||
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
|
val itemScore = view.findViewById<TextView>(R.id.itemCompactScore)
|
||||||
val itemScoreBG = view.findViewById<View>(R.id.itemCompactScoreBG)
|
val itemScoreBG = view.findViewById<View>(R.id.itemCompactScoreBG)
|
||||||
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
|
val ongoing = view.findViewById<CardView>(R.id.itemCompactOngoing)
|
||||||
val totalchapter = view.findViewById<TextView>(R.id.itemCompactTotal)
|
val totalChapter = view.findViewById<TextView>(R.id.itemCompactTotal)
|
||||||
val typeimage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
val typeImage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
||||||
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
|
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
|
||||||
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
|
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
|
||||||
|
|
||||||
|
@ -61,16 +61,16 @@ class OfflineMangaAdapter(
|
||||||
val chapters = view.findViewById<TextView>(R.id.itemTotal)
|
val chapters = view.findViewById<TextView>(R.id.itemTotal)
|
||||||
chapters.text = " Chapters"
|
chapters.text = " Chapters"
|
||||||
bannerView.setImageURI(item.banner)
|
bannerView.setImageURI(item.banner)
|
||||||
totalchapter.text = item.totalChapter
|
totalChapter.text = item.totalChapter
|
||||||
} else if (style == 1) {
|
} else if (style == 1) {
|
||||||
val readchapter =
|
val readChapter =
|
||||||
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
||||||
readchapter.text = item.readChapter
|
readChapter.text = item.readChapter
|
||||||
totalchapter.text = " | " + item.totalChapter
|
totalChapter.text = " | " + item.totalChapter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind item data to the views
|
// Bind item data to the views
|
||||||
typeimage.setImageResource(if (item.type == "Novel") R.drawable.ic_round_book_24 else R.drawable.ic_round_import_contacts_24)
|
typeImage.setImageResource(if (item.type == "Novel") R.drawable.ic_round_book_24 else R.drawable.ic_round_import_contacts_24)
|
||||||
type.text = item.type
|
type.text = item.type
|
||||||
typeView.visibility = View.VISIBLE
|
typeView.visibility = View.VISIBLE
|
||||||
imageView.setImageURI(item.image)
|
imageView.setImageURI(item.image)
|
||||||
|
|
|
@ -23,6 +23,10 @@ import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.cardview.widget.CardView
|
import androidx.cardview.widget.CardView
|
||||||
|
import androidx.core.app.ActivityOptionsCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.util.Pair
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.marginBottom
|
import androidx.core.view.marginBottom
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
|
@ -62,7 +66,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
private var downloads: List<OfflineMangaModel> = listOf()
|
private var downloads: List<OfflineMangaModel> = listOf()
|
||||||
private lateinit var gridView: GridView
|
private lateinit var gridView: GridView
|
||||||
private lateinit var adapter: OfflineMangaAdapter
|
private lateinit var adapter: OfflineMangaAdapter
|
||||||
private lateinit var total : TextView
|
private lateinit var total: TextView
|
||||||
private var uiSettings: UserInterfaceSettings =
|
private var uiSettings: UserInterfaceSettings =
|
||||||
loadData("ui_settings") ?: UserInterfaceSettings()
|
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||||
|
|
||||||
|
@ -132,7 +136,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
layoutList.setOnClickListener {
|
layoutList.setOnClickListener {
|
||||||
selected(it as ImageView)
|
selected(it as ImageView)
|
||||||
style = 0
|
style = 0
|
||||||
requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit().putInt("offline_view", style!!).apply()
|
requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
|
||||||
|
.putInt("offline_view", style!!).apply()
|
||||||
gridView.visibility = View.GONE
|
gridView.visibility = View.GONE
|
||||||
gridView = view.findViewById(R.id.gridView)
|
gridView = view.findViewById(R.id.gridView)
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
|
@ -143,13 +148,15 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
layoutcompact.setOnClickListener {
|
layoutcompact.setOnClickListener {
|
||||||
selected(it as ImageView)
|
selected(it as ImageView)
|
||||||
style = 1
|
style = 1
|
||||||
requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit().putInt("offline_view", style!!).apply()
|
requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
|
||||||
|
.putInt("offline_view", style!!).apply()
|
||||||
gridView.visibility = View.GONE
|
gridView.visibility = View.GONE
|
||||||
gridView = view.findViewById(R.id.gridView1)
|
gridView = view.findViewById(R.id.gridView1)
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
grid()
|
grid()
|
||||||
}
|
}
|
||||||
gridView = if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
gridView =
|
||||||
|
if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
||||||
total = view.findViewById(R.id.total)
|
total = view.findViewById(R.id.total)
|
||||||
grid()
|
grid()
|
||||||
return view
|
return view
|
||||||
|
@ -164,7 +171,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
adapter = OfflineMangaAdapter(requireContext(), downloads, this)
|
adapter = OfflineMangaAdapter(requireContext(), downloads, this)
|
||||||
gridView.adapter = adapter
|
gridView.adapter = adapter
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
total.text = if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
total.text =
|
||||||
|
if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
||||||
gridView.setOnItemClickListener { _, _, position, _ ->
|
gridView.setOnItemClickListener { _, _, position, _ ->
|
||||||
// Get the OfflineMangaModel that was clicked
|
// Get the OfflineMangaModel that was clicked
|
||||||
val item = adapter.getItem(position) as OfflineMangaModel
|
val item = adapter.getItem(position) as OfflineMangaModel
|
||||||
|
@ -172,10 +180,19 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
downloadManager.mangaDownloadedTypes.firstOrNull { it.title == item.title }
|
downloadManager.mangaDownloadedTypes.firstOrNull { it.title == item.title }
|
||||||
?: downloadManager.novelDownloadedTypes.firstOrNull { it.title == item.title }
|
?: downloadManager.novelDownloadedTypes.firstOrNull { it.title == item.title }
|
||||||
media?.let {
|
media?.let {
|
||||||
startActivity(
|
ContextCompat.startActivity(
|
||||||
|
requireActivity(),
|
||||||
Intent(requireContext(), MediaDetailsActivity::class.java)
|
Intent(requireContext(), MediaDetailsActivity::class.java)
|
||||||
.putExtra("media", getMedia(it))
|
.putExtra("media", getMedia(it))
|
||||||
.putExtra("download", true)
|
.putExtra("download", true),
|
||||||
|
ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||||
|
requireActivity(),
|
||||||
|
Pair.create(
|
||||||
|
gridView.getChildAt(position)
|
||||||
|
.findViewById<ImageView>(R.id.itemCompactImage),
|
||||||
|
ViewCompat.getTransitionName(requireActivity().findViewById(R.id.itemCompactImage))
|
||||||
|
)
|
||||||
|
).toBundle()
|
||||||
)
|
)
|
||||||
} ?: run {
|
} ?: run {
|
||||||
snackString("no media found")
|
snackString("no media found")
|
||||||
|
@ -200,7 +217,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
downloadManager.removeMedia(item.title, type)
|
downloadManager.removeMedia(item.title, type)
|
||||||
getDownloads()
|
getDownloads()
|
||||||
adapter.setItems(downloads)
|
adapter.setItems(downloads)
|
||||||
total.text = if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
total.text =
|
||||||
|
if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
||||||
}
|
}
|
||||||
builder.setNegativeButton("No") { _, _ ->
|
builder.setNegativeButton("No") { _, _ ->
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|
|
@ -2,6 +2,7 @@ package ani.dantotsu.home
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -267,7 +268,8 @@ class AnimeFragment : Fragment() {
|
||||||
model.loaded = true
|
model.loaded = true
|
||||||
model.loadTrending(1)
|
model.loadTrending(1)
|
||||||
model.loadUpdated()
|
model.loadUpdated()
|
||||||
model.loadPopular("ANIME", sort = Anilist.sortBy[1])
|
model.loadPopular("ANIME", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
.getBoolean("popular_list", false))
|
||||||
}
|
}
|
||||||
live.postValue(false)
|
live.postValue(false)
|
||||||
_binding?.animeRefresh?.isRefreshing = false
|
_binding?.animeRefresh?.isRefreshing = false
|
||||||
|
|
|
@ -132,8 +132,15 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||||
|
|
||||||
binding.animeIncludeList.visibility =
|
binding.animeIncludeList.visibility =
|
||||||
if (Anilist.userid != null) View.VISIBLE else View.GONE
|
if (Anilist.userid != null) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
|
binding.animeIncludeList.isChecked = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
?.getBoolean("popular_list", true) ?: true
|
||||||
|
|
||||||
binding.animeIncludeList.setOnCheckedChangeListener { _, isChecked ->
|
binding.animeIncludeList.setOnCheckedChangeListener { _, isChecked ->
|
||||||
onIncludeListClick.invoke(isChecked)
|
onIncludeListClick.invoke(isChecked)
|
||||||
|
|
||||||
|
currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
||||||
|
?.putBoolean("popular_list", isChecked)?.apply()
|
||||||
}
|
}
|
||||||
if (ready.value == false)
|
if (ready.value == false)
|
||||||
ready.postValue(true)
|
ready.postValue(true)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package ani.dantotsu.home
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -241,7 +242,8 @@ class MangaFragment : Fragment() {
|
||||||
model.loaded = true
|
model.loaded = true
|
||||||
model.loadTrending()
|
model.loadTrending()
|
||||||
model.loadTrendingNovel()
|
model.loadTrendingNovel()
|
||||||
model.loadPopular("MANGA", sort = Anilist.sortBy[1])
|
model.loadPopular("MANGA", sort = Anilist.sortBy[1], onList = requireContext().getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
.getBoolean("popular_list", false) )
|
||||||
}
|
}
|
||||||
live.postValue(false)
|
live.postValue(false)
|
||||||
_binding?.mangaRefresh?.isRefreshing = false
|
_binding?.mangaRefresh?.isRefreshing = false
|
||||||
|
|
|
@ -125,10 +125,16 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||||
|
|
||||||
binding.mangaIncludeList.visibility =
|
binding.mangaIncludeList.visibility =
|
||||||
if (Anilist.userid != null) View.VISIBLE else View.GONE
|
if (Anilist.userid != null) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
|
binding.mangaIncludeList.isChecked = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
?.getBoolean("popular_list", true) ?: true
|
||||||
|
|
||||||
binding.mangaIncludeList.setOnCheckedChangeListener { _, isChecked ->
|
binding.mangaIncludeList.setOnCheckedChangeListener { _, isChecked ->
|
||||||
onIncludeListClick.invoke(isChecked)
|
onIncludeListClick.invoke(isChecked)
|
||||||
}
|
|
||||||
|
|
||||||
|
currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
|
||||||
|
?.putBoolean("popular_list", isChecked)?.apply()
|
||||||
|
}
|
||||||
if (ready.value == false)
|
if (ready.value == false)
|
||||||
ready.postValue(true)
|
ready.postValue(true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,17 +392,23 @@ class MediaAdaptor(
|
||||||
Intent(activity, MediaDetailsActivity::class.java).putExtra(
|
Intent(activity, MediaDetailsActivity::class.java).putExtra(
|
||||||
"media",
|
"media",
|
||||||
media as Serializable
|
media as Serializable
|
||||||
), ActivityOptionsCompat.makeSceneTransitionAnimation(
|
),
|
||||||
activity,
|
if (itemCompactImage != null) {
|
||||||
Pair.create(
|
ActivityOptionsCompat.makeSceneTransitionAnimation(
|
||||||
itemCompactImage,
|
activity,
|
||||||
ViewCompat.getTransitionName(activity.findViewById(R.id.itemCompactImage))!!
|
Pair.create(
|
||||||
),
|
itemCompactImage,
|
||||||
).toBundle()
|
ViewCompat.getTransitionName(activity.findViewById(R.id.itemCompactImage))!!
|
||||||
|
),
|
||||||
|
).toBundle()
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun longClicked(position: Int): Boolean {
|
fun longClicked(position: Int): Boolean {
|
||||||
if ((mediaList?.size ?: 0) > position && position != -1) {
|
if ((mediaList?.size ?: 0) > position && position != -1) {
|
||||||
val media = mediaList?.get(position) ?: return false
|
val media = mediaList?.get(position) ?: return false
|
||||||
|
|
|
@ -492,6 +492,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
init {
|
init {
|
||||||
enabled(true)
|
enabled(true)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
delay(100) //TODO: a listener would be better
|
||||||
clicked()
|
clicked()
|
||||||
}
|
}
|
||||||
image.setOnClickListener {
|
image.setOnClickListener {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ani.dantotsu.media.anime
|
package ani.dantotsu.media.anime
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.AlertDialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -125,10 +126,10 @@ class EpisodeAdapter(
|
||||||
binding.itemEpisodeFiller.visibility = View.GONE
|
binding.itemEpisodeFiller.visibility = View.GONE
|
||||||
binding.itemEpisodeFillerView.visibility = View.GONE
|
binding.itemEpisodeFillerView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
holder.bind(ep.number, ep.downloadProgress)
|
|
||||||
binding.itemEpisodeDesc.visibility =
|
binding.itemEpisodeDesc.visibility =
|
||||||
if (ep.desc != null && ep.desc?.trim(' ') != "") View.VISIBLE else View.GONE
|
if (ep.desc != null && ep.desc?.trim(' ') != "") View.VISIBLE else View.GONE
|
||||||
binding.itemEpisodeDesc.text = ep.desc ?: ""
|
binding.itemEpisodeDesc.text = ep.desc ?: ""
|
||||||
|
holder.bind(ep.number, ep.downloadProgress , ep.desc)
|
||||||
|
|
||||||
if (media.userProgress != null) {
|
if (media.userProgress != null) {
|
||||||
if ((ep.number.toFloatOrNull() ?: 9999f) <= media.userProgress!!.toFloat()) {
|
if ((ep.number.toFloatOrNull() ?: 9999f) <= media.userProgress!!.toFloat()) {
|
||||||
|
@ -339,7 +340,16 @@ class EpisodeAdapter(
|
||||||
fragment.onAnimeEpisodeStopDownloadClick(episodeNumber)
|
fragment.onAnimeEpisodeStopDownloadClick(episodeNumber)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
} else if (downloadedEpisodes.contains(episodeNumber)) {
|
} else if (downloadedEpisodes.contains(episodeNumber)) {
|
||||||
fragment.onAnimeEpisodeRemoveDownloadClick(episodeNumber)
|
val builder = AlertDialog.Builder(currContext(), R.style.MyPopup)
|
||||||
|
builder.setTitle("Delete Episode")
|
||||||
|
builder.setMessage("Are you sure you want to delete Episode ${episodeNumber}?")
|
||||||
|
builder.setPositiveButton("Yes") { _, _ ->
|
||||||
|
fragment.onAnimeEpisodeRemoveDownloadClick(episodeNumber)
|
||||||
|
}
|
||||||
|
builder.setNegativeButton("No") { _, _ ->
|
||||||
|
}
|
||||||
|
val dialog = builder.show()
|
||||||
|
dialog.window?.setDimAmount(0.8f)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
} else {
|
} else {
|
||||||
fragment.onAnimeEpisodeDownloadClick(episodeNumber)
|
fragment.onAnimeEpisodeDownloadClick(episodeNumber)
|
||||||
|
@ -354,8 +364,9 @@ class EpisodeAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bind(episodeNumber: String, progress: String?) {
|
fun bind(episodeNumber: String, progress: String?, desc: String?) {
|
||||||
if (progress != null) {
|
if (progress != null) {
|
||||||
|
binding.itemEpisodeDesc.visibility = View.GONE
|
||||||
binding.itemDownloadStatus.visibility = View.VISIBLE
|
binding.itemDownloadStatus.visibility = View.VISIBLE
|
||||||
binding.itemDownloadStatus.text = progress
|
binding.itemDownloadStatus.text = progress
|
||||||
} else {
|
} else {
|
||||||
|
@ -366,7 +377,9 @@ class EpisodeAdapter(
|
||||||
// Show spinner
|
// Show spinner
|
||||||
binding.itemDownload.setImageResource(R.drawable.ic_sync)
|
binding.itemDownload.setImageResource(R.drawable.ic_sync)
|
||||||
startOrContinueRotation(episodeNumber)
|
startOrContinueRotation(episodeNumber)
|
||||||
|
binding.itemEpisodeDesc.visibility = View.GONE
|
||||||
} else if (downloadedEpisodes.contains(episodeNumber)) {
|
} else if (downloadedEpisodes.contains(episodeNumber)) {
|
||||||
|
binding.itemEpisodeDesc.visibility = View.GONE
|
||||||
binding.itemDownloadStatus.visibility = View.VISIBLE
|
binding.itemDownloadStatus.visibility = View.VISIBLE
|
||||||
// Show checkmark
|
// Show checkmark
|
||||||
binding.itemDownload.setImageResource(R.drawable.ic_circle_check)
|
binding.itemDownload.setImageResource(R.drawable.ic_circle_check)
|
||||||
|
@ -378,6 +391,7 @@ class EpisodeAdapter(
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
binding.itemDownloadStatus.visibility = View.GONE
|
binding.itemDownloadStatus.visibility = View.GONE
|
||||||
|
binding.itemEpisodeDesc.visibility = if (desc != null && desc.trim(' ') != "") View.VISIBLE else View.GONE
|
||||||
// Show download icon
|
// Show download icon
|
||||||
binding.itemDownload.setImageResource(R.drawable.ic_circle_add)
|
binding.itemDownload.setImageResource(R.drawable.ic_circle_add)
|
||||||
binding.itemDownload.rotation = 0f
|
binding.itemDownload.rotation = 0f
|
||||||
|
|
|
@ -969,6 +969,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
exoPlayer.currentPosition,
|
exoPlayer.currentPosition,
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
exoPlayer.seekTo(0)
|
||||||
val prev = episodeArr[currentEpisodeIndex]
|
val prev = episodeArr[currentEpisodeIndex]
|
||||||
isTimeStampsLoaded = false
|
isTimeStampsLoaded = false
|
||||||
episodeLength = 0f
|
episodeLength = 0f
|
||||||
|
@ -1472,7 +1473,10 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mediaSession = MediaSession.Builder(this, exoPlayer).build()
|
val rightNow = Calendar.getInstance()
|
||||||
|
mediaSession = MediaSession.Builder(this, exoPlayer)
|
||||||
|
.setId(rightNow.timeInMillis.toString())
|
||||||
|
.build()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
toast(e.toString())
|
toast(e.toString())
|
||||||
}
|
}
|
||||||
|
@ -1556,11 +1560,13 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
if (castPlayer?.isPlaying == false) {
|
if (castPlayer?.isPlaying == false) {
|
||||||
playerView.player?.pause()
|
playerView.player?.pause()
|
||||||
}
|
}
|
||||||
saveData(
|
if (exoPlayer.currentPosition > 5000) {
|
||||||
"${media.id}_${media.anime!!.selectedEpisode}",
|
saveData(
|
||||||
exoPlayer.currentPosition,
|
"${media.id}_${media.anime!!.selectedEpisode}",
|
||||||
this
|
exoPlayer.currentPosition,
|
||||||
)
|
this
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,16 @@ class MangaChapterAdapter(
|
||||||
fragment.onMangaChapterStopDownloadClick(chapterNumber)
|
fragment.onMangaChapterStopDownloadClick(chapterNumber)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
} else if (downloadedChapters.contains(chapterNumber)) {
|
} else if (downloadedChapters.contains(chapterNumber)) {
|
||||||
fragment.onMangaChapterRemoveDownloadClick(chapterNumber)
|
val builder = AlertDialog.Builder(currContext(), R.style.MyPopup)
|
||||||
|
builder.setTitle("Delete Chapter")
|
||||||
|
builder.setMessage("Are you sure you want to delete ${chapterNumber}?")
|
||||||
|
builder.setPositiveButton("Yes") { _, _ ->
|
||||||
|
fragment.onMangaChapterRemoveDownloadClick(chapterNumber)
|
||||||
|
}
|
||||||
|
builder.setNegativeButton("No") { _, _ ->
|
||||||
|
}
|
||||||
|
val dialog = builder.show()
|
||||||
|
dialog.window?.setDimAmount(0.8f)
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
} else {
|
} else {
|
||||||
fragment.onMangaChapterDownloadClick(chapterNumber)
|
fragment.onMangaChapterDownloadClick(chapterNumber)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import ani.dantotsu.BottomSheetDialogFragment
|
import ani.dantotsu.BottomSheetDialogFragment
|
||||||
|
import ani.dantotsu.R
|
||||||
import ani.dantotsu.databinding.BottomSheetCustomBinding
|
import ani.dantotsu.databinding.BottomSheetCustomBinding
|
||||||
|
|
||||||
open class CustomBottomDialog : BottomSheetDialogFragment() {
|
open class CustomBottomDialog : BottomSheetDialogFragment() {
|
||||||
|
@ -55,10 +56,6 @@ open class CustomBottomDialog : BottomSheetDialogFragment() {
|
||||||
_binding = BottomSheetCustomBinding.inflate(inflater, container, false)
|
_binding = BottomSheetCustomBinding.inflate(inflater, container, false)
|
||||||
val window = dialog?.window
|
val window = dialog?.window
|
||||||
window?.statusBarColor = Color.TRANSPARENT
|
window?.statusBarColor = Color.TRANSPARENT
|
||||||
val typedValue = TypedValue()
|
|
||||||
val theme = requireContext().theme
|
|
||||||
theme.resolveAttribute(com.google.android.material.R.attr.colorSurface, typedValue, true)
|
|
||||||
window?.navigationBarColor = typedValue.data
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,11 +308,13 @@
|
||||||
android:text="@string/popular_anime"
|
android:text="@string/popular_anime"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
android:id="@+id/animeIncludeList"
|
android:id="@+id/animeIncludeList"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:checked="true"
|
android:checked="true"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:text="@string/include_media_in_list" />
|
android:text="@string/include_media_in_list" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
android:id="@+id/listAppBar"
|
android:id="@+id/listAppBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorSurface"
|
android:background="?attr/colorSurfaceVariant"
|
||||||
android:theme="@style/Theme.Dantotsu.AppBarOverlay">
|
android:theme="@style/Theme.Dantotsu.AppBarOverlay">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
android:background="@drawable/card_outline"
|
android:background="@drawable/card_outline"
|
||||||
app:cardCornerRadius="16dp">
|
app:cardCornerRadius="16dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorSurfaceVariant"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/itemEpisodeProgressCont"
|
android:id="@+id/itemEpisodeProgressCont"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorSurfaceVariant"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -264,12 +264,14 @@
|
||||||
android:text="@string/popular_manga"
|
android:text="@string/popular_manga"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
android:id="@+id/mangaIncludeList"
|
android:id="@+id/mangaIncludeList"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/include_media_in_list"
|
android:checked="true"
|
||||||
android:checked="true"/>
|
android:textSize="12sp"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:text="@string/include_media_in_list" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
<item name="colorSurfaceVariant">@color/md_theme_dark_5_surfaceVariant</item>
|
<item name="colorSurfaceVariant">@color/md_theme_dark_5_surfaceVariant</item>
|
||||||
<item name="colorOnSurfaceVariant">@color/md_theme_dark_5_onSurfaceVariant</item>
|
<item name="colorOnSurfaceVariant">@color/md_theme_dark_5_onSurfaceVariant</item>
|
||||||
<item name="colorOutline">@color/md_theme_dark_5_outline</item>
|
<item name="colorOutline">@color/md_theme_dark_5_outline</item>
|
||||||
<item name="colorOnSurfaceInverse">@color/md_theme_dark_5_inverseOnSurface</item>
|
<item name="colorOnSurfaceInverse">@color/md_theme_dark_5_surface</item>
|
||||||
<item name="colorSurfaceInverse">@color/md_theme_dark_5_inverseSurface</item>
|
<item name="colorSurfaceInverse">@color/md_theme_dark_5_inverseSurface</item>
|
||||||
<item name="colorPrimaryInverse">@color/md_theme_dark_5_inversePrimary</item>
|
<item name="colorPrimaryInverse">@color/md_theme_dark_5_inversePrimary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -223,7 +223,7 @@
|
||||||
<item name="colorSurfaceVariant">@color/md_theme_light_5_surfaceVariant</item>
|
<item name="colorSurfaceVariant">@color/md_theme_light_5_surfaceVariant</item>
|
||||||
<item name="colorOnSurfaceVariant">@color/md_theme_light_5_onSurfaceVariant</item>
|
<item name="colorOnSurfaceVariant">@color/md_theme_light_5_onSurfaceVariant</item>
|
||||||
<item name="colorOutline">@color/md_theme_light_5_outline</item>
|
<item name="colorOutline">@color/md_theme_light_5_outline</item>
|
||||||
<item name="colorOnSurfaceInverse">@color/md_theme_light_5_inverseOnSurface</item>
|
<item name="colorOnSurfaceInverse">@color/md_theme_light_5_surface</item>
|
||||||
<item name="colorSurfaceInverse">@color/md_theme_light_5_inverseSurface</item>
|
<item name="colorSurfaceInverse">@color/md_theme_light_5_inverseSurface</item>
|
||||||
<item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item>
|
<item name="colorPrimaryInverse">@color/md_theme_light_5_inversePrimary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue