downloaded anime page bug fixes (#132)
* after changing grid style items are not accessible fixed * added total ep released no * padding fix * fixed scroll to top coinciding with navbar * small change
This commit is contained in:
parent
98cb11e841
commit
bd6197031a
5 changed files with 80 additions and 82 deletions
|
@ -12,8 +12,6 @@ import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.cardview.widget.CardView
|
import androidx.cardview.widget.CardView
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
import ani.dantotsu.download.anime.OfflineAnimeModel
|
|
||||||
import ani.dantotsu.download.anime.OfflineAnimeSearchListener
|
|
||||||
|
|
||||||
|
|
||||||
class OfflineAnimeAdapter(
|
class OfflineAnimeAdapter(
|
||||||
|
@ -54,22 +52,22 @@ class OfflineAnimeAdapter(
|
||||||
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 totalepisodes = view.findViewById<TextView>(R.id.itemCompactTotal)
|
||||||
val typeimage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
val typeimage = view.findViewById<ImageView>(R.id.itemCompactTypeImage)
|
||||||
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
|
val type = view.findViewById<TextView>(R.id.itemCompactRelation)
|
||||||
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
|
val typeView = view.findViewById<LinearLayout>(R.id.itemCompactType)
|
||||||
|
|
||||||
if (style == 0) {
|
if (style == 0) {
|
||||||
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
||||||
val chapters = view.findViewById<TextView>(R.id.itemTotal)
|
val episodes = view.findViewById<TextView>(R.id.itemTotal)
|
||||||
chapters.text = " Chapters"
|
episodes.text = " Episodes"
|
||||||
bannerView.setImageURI(item.banner)
|
bannerView.setImageURI(item.banner)
|
||||||
totalchapter.text = item.totalEpisode
|
totalepisodes.text = item.totalEpisodeList
|
||||||
} else if (style == 1) {
|
} else if (style == 1) {
|
||||||
val readchapter =
|
val watchedEpisodes =
|
||||||
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
||||||
readchapter.text = item.watchedEpisode
|
watchedEpisodes.text = item.watchedEpisode
|
||||||
totalchapter.text = " | " + item.totalEpisode
|
totalepisodes.text = " | " + item.totalEpisode
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind item data to the views
|
// Bind item data to the views
|
||||||
|
|
|
@ -19,32 +19,30 @@ import android.view.animation.LayoutAnimationController
|
||||||
import android.view.animation.OvershootInterpolator
|
import android.view.animation.OvershootInterpolator
|
||||||
import android.widget.AbsListView
|
import android.widget.AbsListView
|
||||||
import android.widget.AutoCompleteTextView
|
import android.widget.AutoCompleteTextView
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.GridView
|
import android.widget.GridView
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.OptIn
|
import androidx.annotation.OptIn
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.widget.ThemedSpinnerAdapter.Helper
|
|
||||||
import androidx.cardview.widget.CardView
|
import androidx.cardview.widget.CardView
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.marginBottom
|
||||||
import androidx.core.view.updatePaddingRelative
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.media3.common.util.UnstableApi
|
import androidx.media3.common.util.UnstableApi
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
|
import ani.dantotsu.bottomBar
|
||||||
import ani.dantotsu.currActivity
|
import ani.dantotsu.currActivity
|
||||||
import ani.dantotsu.currContext
|
import ani.dantotsu.currContext
|
||||||
import ani.dantotsu.download.DownloadedType
|
import ani.dantotsu.download.DownloadedType
|
||||||
import ani.dantotsu.download.DownloadsManager
|
import ani.dantotsu.download.DownloadsManager
|
||||||
import ani.dantotsu.initActivity
|
import ani.dantotsu.initActivity
|
||||||
|
import ani.dantotsu.loadData
|
||||||
import ani.dantotsu.logger
|
import ani.dantotsu.logger
|
||||||
import ani.dantotsu.media.Media
|
import ani.dantotsu.media.Media
|
||||||
import ani.dantotsu.media.MediaDetailsActivity
|
import ani.dantotsu.media.MediaDetailsActivity
|
||||||
import ani.dantotsu.navBarHeight
|
import ani.dantotsu.navBarHeight
|
||||||
import ani.dantotsu.px
|
|
||||||
import ani.dantotsu.setSafeOnClickListener
|
import ani.dantotsu.setSafeOnClickListener
|
||||||
import ani.dantotsu.settings.SettingsDialogFragment
|
import ani.dantotsu.settings.SettingsDialogFragment
|
||||||
|
import ani.dantotsu.settings.UserInterfaceSettings
|
||||||
import ani.dantotsu.snackString
|
import ani.dantotsu.snackString
|
||||||
import ani.dantotsu.statusBarHeight
|
import ani.dantotsu.statusBarHeight
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
|
@ -71,13 +69,15 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
private var downloads: List<OfflineAnimeModel> = listOf()
|
private var downloads: List<OfflineAnimeModel> = listOf()
|
||||||
private lateinit var gridView: GridView
|
private lateinit var gridView: GridView
|
||||||
private lateinit var adapter: OfflineAnimeAdapter
|
private lateinit var adapter: OfflineAnimeAdapter
|
||||||
|
private var uiSettings: UserInterfaceSettings =
|
||||||
|
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||||
|
|
||||||
@OptIn(UnstableApi::class) override fun onCreateView(
|
@OptIn(UnstableApi::class) override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val view = inflater.inflate(R.layout.fragment_manga_offline, container, false)
|
val view = inflater.inflate(R.layout.fragment_offline_page, container, false)
|
||||||
|
|
||||||
val textInputLayout = view.findViewById<TextInputLayout>(R.id.offlineMangaSearchBar)
|
val textInputLayout = view.findViewById<TextInputLayout>(R.id.offlineMangaSearchBar)
|
||||||
textInputLayout.hint = "Anime"
|
textInputLayout.hint = "Anime"
|
||||||
|
@ -90,16 +90,15 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
requireContext().theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
requireContext().theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||||
val color = typedValue.data
|
val color = typedValue.data
|
||||||
|
|
||||||
val animeTitleContainer = view.findViewById<LinearLayout>(R.id.animeTitleContainer)
|
|
||||||
animeTitleContainer.updatePadding(top = statusBarHeight)
|
|
||||||
|
|
||||||
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
||||||
animeUserAvatar.setSafeOnClickListener {
|
animeUserAvatar.setSafeOnClickListener {
|
||||||
val dialogFragment =
|
val dialogFragment =
|
||||||
SettingsDialogFragment.newInstance2(SettingsDialogFragment.Companion.PageType2.OfflineANIME)
|
SettingsDialogFragment.newInstance2(SettingsDialogFragment.Companion.PageType2.OfflineANIME)
|
||||||
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||||
}
|
}
|
||||||
|
if (!uiSettings.immersiveMode) {
|
||||||
|
view.rootView.fitsSystemWindows = true
|
||||||
|
}
|
||||||
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
?.getBoolean("colorOverflow", false) ?: false
|
?.getBoolean("colorOverflow", false) ?: false
|
||||||
if (!colorOverflow) {
|
if (!colorOverflow) {
|
||||||
|
@ -147,7 +146,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
gridView.visibility = View.VISIBLE
|
gridView.visibility = View.VISIBLE
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
|
grid()
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutcompact.setOnClickListener {
|
layoutcompact.setOnClickListener {
|
||||||
|
@ -161,6 +160,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
gridView.visibility = View.VISIBLE
|
gridView.visibility = View.VISIBLE
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
|
grid()
|
||||||
}
|
}
|
||||||
|
|
||||||
gridView =
|
gridView =
|
||||||
|
@ -176,22 +176,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
adapter = OfflineAnimeAdapter(requireContext(), downloads, this)
|
adapter = OfflineAnimeAdapter(requireContext(), downloads, this)
|
||||||
gridView.adapter = adapter
|
gridView.adapter = adapter
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
gridView.setOnItemClickListener { parent, view, position, id ->
|
grid()
|
||||||
// Get the OfflineAnimeModel that was clicked
|
|
||||||
val item = adapter.getItem(position) as OfflineAnimeModel
|
|
||||||
val media =
|
|
||||||
downloadManager.animeDownloadedTypes.firstOrNull { it.title == item.title }
|
|
||||||
media?.let {
|
|
||||||
startActivity(
|
|
||||||
Intent(requireContext(), MediaDetailsActivity::class.java)
|
|
||||||
.putExtra("media", getMedia(it))
|
|
||||||
.putExtra("download", true)
|
|
||||||
)
|
|
||||||
} ?: run {
|
|
||||||
snackString("no media found")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val total = view.findViewById<TextView>(R.id.total)
|
val total = view.findViewById<TextView>(R.id.total)
|
||||||
total.text =
|
total.text =
|
||||||
if (gridView.count > 0) "Anime (${gridView.count})" else "Empty List"
|
if (gridView.count > 0) "Anime (${gridView.count})" else "Empty List"
|
||||||
|
@ -224,11 +209,26 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
dialog.window?.setDimAmount(0.8f)
|
dialog.window?.setDimAmount(0.8f)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
view.rootView.fitsSystemWindows = true
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
private fun grid(){
|
||||||
|
gridView.setOnItemClickListener { parent, view, position, id ->
|
||||||
|
// Get the OfflineAnimeModel that was clicked
|
||||||
|
val item = adapter.getItem(position) as OfflineAnimeModel
|
||||||
|
val media =
|
||||||
|
downloadManager.animeDownloadedTypes.firstOrNull { it.title == item.title }
|
||||||
|
media?.let {
|
||||||
|
startActivity(
|
||||||
|
Intent(requireContext(), MediaDetailsActivity::class.java)
|
||||||
|
.putExtra("media", getMedia(it))
|
||||||
|
.putExtra("download", true)
|
||||||
|
)
|
||||||
|
} ?: run {
|
||||||
|
snackString("no media found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
override fun onSearchQuery(query: String) {
|
override fun onSearchQuery(query: String) {
|
||||||
adapter.onSearchQuery(query)
|
adapter.onSearchQuery(query)
|
||||||
}
|
}
|
||||||
|
@ -251,9 +251,8 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val mangaRefresh = view.findViewById<FrameLayout>(R.id.mangaRefresh)
|
|
||||||
mangaRefresh.updatePaddingRelative(bottom = navBarHeight + 160f.px)
|
|
||||||
val scrollTop = view.findViewById<CardView>(R.id.mangaPageScrollTop)
|
val scrollTop = view.findViewById<CardView>(R.id.mangaPageScrollTop)
|
||||||
|
scrollTop.translationY = -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat()
|
||||||
val visible = false
|
val visible = false
|
||||||
|
|
||||||
fun animate() {
|
fun animate() {
|
||||||
|
@ -399,14 +398,16 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
val isOngoing =
|
val isOngoing =
|
||||||
mediaModel.status == currActivity()!!.getString(R.string.status_releasing)
|
mediaModel.status == currActivity()!!.getString(R.string.status_releasing)
|
||||||
val isUserScored = mediaModel.userScore != 0
|
val isUserScored = mediaModel.userScore != 0
|
||||||
val readEpisode = (mediaModel.userProgress ?: "~").toString()
|
val watchedEpisodes = (mediaModel.userProgress ?: "~").toString()
|
||||||
val totalEpisode = "${mediaModel.anime?.totalEpisodes ?: "??"}"
|
val totalEpisode = if (mediaModel.anime?.nextAiringEpisode != null) (mediaModel.anime.nextAiringEpisode.toString() + " | " + (mediaModel.anime.totalEpisodes ?: "~").toString()) else (mediaModel.anime?.totalEpisodes ?: "~").toString()
|
||||||
val chapters = " Chapters"
|
val chapters = " Chapters"
|
||||||
|
val totalEpisodesList = if (mediaModel.anime?.nextAiringEpisode != null) (mediaModel.anime.nextAiringEpisode.toString()) else (mediaModel.anime?.totalEpisodes ?: "~").toString()
|
||||||
return OfflineAnimeModel(
|
return OfflineAnimeModel(
|
||||||
title,
|
title,
|
||||||
score,
|
score,
|
||||||
totalEpisode,
|
totalEpisode,
|
||||||
readEpisode,
|
totalEpisodesList,
|
||||||
|
watchedEpisodes,
|
||||||
type,
|
type,
|
||||||
chapters,
|
chapters,
|
||||||
isOngoing,
|
isOngoing,
|
||||||
|
@ -423,6 +424,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
"0",
|
"0",
|
||||||
"??",
|
"??",
|
||||||
"??",
|
"??",
|
||||||
|
"??",
|
||||||
"movie",
|
"movie",
|
||||||
"hmm",
|
"hmm",
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -5,6 +5,7 @@ data class OfflineAnimeModel (
|
||||||
val title: String,
|
val title: String,
|
||||||
val score: String,
|
val score: String,
|
||||||
val totalEpisode: String,
|
val totalEpisode: String,
|
||||||
|
val totalEpisodeList: String,
|
||||||
val watchedEpisode: String,
|
val watchedEpisode: String,
|
||||||
val type: String,
|
val type: String,
|
||||||
val episodes: String,
|
val episodes: String,
|
||||||
|
|
|
@ -18,29 +18,28 @@ import android.view.animation.LayoutAnimationController
|
||||||
import android.view.animation.OvershootInterpolator
|
import android.view.animation.OvershootInterpolator
|
||||||
import android.widget.AbsListView
|
import android.widget.AbsListView
|
||||||
import android.widget.AutoCompleteTextView
|
import android.widget.AutoCompleteTextView
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.GridView
|
import android.widget.GridView
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
|
||||||
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.view.updatePadding
|
import androidx.core.view.marginBottom
|
||||||
import androidx.core.view.updatePaddingRelative
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
|
import ani.dantotsu.bottomBar
|
||||||
import ani.dantotsu.currActivity
|
import ani.dantotsu.currActivity
|
||||||
import ani.dantotsu.currContext
|
import ani.dantotsu.currContext
|
||||||
import ani.dantotsu.download.DownloadedType
|
import ani.dantotsu.download.DownloadedType
|
||||||
import ani.dantotsu.download.DownloadsManager
|
import ani.dantotsu.download.DownloadsManager
|
||||||
import ani.dantotsu.initActivity
|
import ani.dantotsu.initActivity
|
||||||
|
import ani.dantotsu.loadData
|
||||||
import ani.dantotsu.logger
|
import ani.dantotsu.logger
|
||||||
import ani.dantotsu.media.Media
|
import ani.dantotsu.media.Media
|
||||||
import ani.dantotsu.media.MediaDetailsActivity
|
import ani.dantotsu.media.MediaDetailsActivity
|
||||||
import ani.dantotsu.navBarHeight
|
import ani.dantotsu.navBarHeight
|
||||||
import ani.dantotsu.px
|
|
||||||
import ani.dantotsu.setSafeOnClickListener
|
import ani.dantotsu.setSafeOnClickListener
|
||||||
import ani.dantotsu.settings.SettingsDialogFragment
|
import ani.dantotsu.settings.SettingsDialogFragment
|
||||||
|
import ani.dantotsu.settings.UserInterfaceSettings
|
||||||
import ani.dantotsu.snackString
|
import ani.dantotsu.snackString
|
||||||
import ani.dantotsu.statusBarHeight
|
import ani.dantotsu.statusBarHeight
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
|
@ -63,15 +62,18 @@ 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 var uiSettings: UserInterfaceSettings =
|
||||||
|
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val view = inflater.inflate(R.layout.fragment_manga_offline, container, false)
|
val view = inflater.inflate(R.layout.fragment_offline_page, container, false)
|
||||||
|
|
||||||
val textInputLayout = view.findViewById<TextInputLayout>(R.id.offlineMangaSearchBar)
|
val textInputLayout = view.findViewById<TextInputLayout>(R.id.offlineMangaSearchBar)
|
||||||
|
textInputLayout.hint = "Manga"
|
||||||
val currentColor = textInputLayout.boxBackgroundColor
|
val currentColor = textInputLayout.boxBackgroundColor
|
||||||
val semiTransparentColor = (currentColor and 0x00FFFFFF) or 0xA8000000.toInt()
|
val semiTransparentColor = (currentColor and 0x00FFFFFF) or 0xA8000000.toInt()
|
||||||
textInputLayout.boxBackgroundColor = semiTransparentColor
|
textInputLayout.boxBackgroundColor = semiTransparentColor
|
||||||
|
@ -81,16 +83,15 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
requireContext().theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
requireContext().theme?.resolveAttribute(android.R.attr.windowBackground, typedValue, true)
|
||||||
val color = typedValue.data
|
val color = typedValue.data
|
||||||
|
|
||||||
val animeTitleContainer = view.findViewById<LinearLayout>(R.id.animeTitleContainer)
|
|
||||||
animeTitleContainer.updatePadding(top = statusBarHeight)
|
|
||||||
|
|
||||||
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
||||||
animeUserAvatar.setSafeOnClickListener {
|
animeUserAvatar.setSafeOnClickListener {
|
||||||
val dialogFragment =
|
val dialogFragment =
|
||||||
SettingsDialogFragment.newInstance2(SettingsDialogFragment.Companion.PageType2.OfflineMANGA)
|
SettingsDialogFragment.newInstance2(SettingsDialogFragment.Companion.PageType2.OfflineMANGA)
|
||||||
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||||
}
|
}
|
||||||
|
if (!uiSettings.immersiveMode) {
|
||||||
|
view.rootView.fitsSystemWindows = true
|
||||||
|
}
|
||||||
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
?.getBoolean("colorOverflow", false) ?: false
|
?.getBoolean("colorOverflow", false) ?: false
|
||||||
if (!colorOverflow) {
|
if (!colorOverflow) {
|
||||||
|
@ -138,6 +139,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
gridView.visibility = View.VISIBLE
|
gridView.visibility = View.VISIBLE
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
|
grid()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +154,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
gridView.visibility = View.VISIBLE
|
gridView.visibility = View.VISIBLE
|
||||||
adapter.notifyNewGrid()
|
adapter.notifyNewGrid()
|
||||||
|
grid()
|
||||||
}
|
}
|
||||||
|
|
||||||
gridView =
|
gridView =
|
||||||
if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
if (style == 0) view.findViewById(R.id.gridView) else view.findViewById(R.id.gridView1)
|
||||||
gridView.visibility = View.VISIBLE
|
gridView.visibility = View.VISIBLE
|
||||||
|
@ -167,23 +169,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
adapter = OfflineMangaAdapter(requireContext(), downloads, this)
|
adapter = OfflineMangaAdapter(requireContext(), downloads, this)
|
||||||
gridView.adapter = adapter
|
gridView.adapter = adapter
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
gridView.setOnItemClickListener { parent, view, position, id ->
|
grid()
|
||||||
// Get the OfflineMangaModel that was clicked
|
|
||||||
val item = adapter.getItem(position) as OfflineMangaModel
|
|
||||||
val media =
|
|
||||||
downloadManager.mangaDownloadedTypes.firstOrNull { it.title == item.title }
|
|
||||||
?: downloadManager.novelDownloadedTypes.firstOrNull { it.title == item.title }
|
|
||||||
media?.let {
|
|
||||||
startActivity(
|
|
||||||
Intent(requireContext(), MediaDetailsActivity::class.java)
|
|
||||||
.putExtra("media", getMedia(it))
|
|
||||||
.putExtra("download", true)
|
|
||||||
)
|
|
||||||
} ?: run {
|
|
||||||
snackString("no media found")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val total = view.findViewById<TextView>(R.id.total)
|
val total = view.findViewById<TextView>(R.id.total)
|
||||||
total.text =
|
total.text =
|
||||||
if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
if (gridView.count > 0) "Manga and Novels (${gridView.count})" else "Empty List"
|
||||||
|
@ -213,11 +199,26 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
dialog.window?.setDimAmount(0.8f)
|
dialog.window?.setDimAmount(0.8f)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
view.rootView.fitsSystemWindows = true
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
private fun grid(){
|
||||||
|
gridView.setOnItemClickListener { parent, view, position, id ->
|
||||||
|
// Get the OfflineMangaModel that was clicked
|
||||||
|
val item = adapter.getItem(position) as OfflineMangaModel
|
||||||
|
val media =
|
||||||
|
downloadManager.mangaDownloadedTypes.firstOrNull { it.title == item.title }
|
||||||
|
?: downloadManager.novelDownloadedTypes.firstOrNull { it.title == item.title }
|
||||||
|
media?.let {
|
||||||
|
startActivity(
|
||||||
|
Intent(requireContext(), MediaDetailsActivity::class.java)
|
||||||
|
.putExtra("media", getMedia(it))
|
||||||
|
.putExtra("download", true)
|
||||||
|
)
|
||||||
|
} ?: run {
|
||||||
|
snackString("no media found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
override fun onSearchQuery(query: String) {
|
override fun onSearchQuery(query: String) {
|
||||||
adapter.onSearchQuery(query)
|
adapter.onSearchQuery(query)
|
||||||
}
|
}
|
||||||
|
@ -240,9 +241,8 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val mangaRefresh = view.findViewById<FrameLayout>(R.id.mangaRefresh)
|
|
||||||
mangaRefresh.updatePaddingRelative(bottom = navBarHeight + 160f.px)
|
|
||||||
val scrollTop = view.findViewById<CardView>(R.id.mangaPageScrollTop)
|
val scrollTop = view.findViewById<CardView>(R.id.mangaPageScrollTop)
|
||||||
|
scrollTop.translationY = -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat()
|
||||||
var visible = false
|
var visible = false
|
||||||
|
|
||||||
fun animate() {
|
fun animate() {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
tools:context=".home.MangaFragment">
|
tools:context=".home.MangaFragment">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/mangaRefresh"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
|
@ -17,8 +16,6 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipChildren="false"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -35,7 +32,7 @@
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:hint="@string/manga"
|
android:hint="Something"
|
||||||
android:textColorHint="@color/bg_opp"
|
android:textColorHint="@color/bg_opp"
|
||||||
android:transitionName="@string/search"
|
android:transitionName="@string/search"
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
@ -97,7 +94,7 @@
|
||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:hint="Manga and Novels"
|
android:hint="Type"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue