navbar fix (#135)
* navbar fix * fixed can uninstall after changing grid view * removes server selector in offline mode shows amount of Scanlator present
This commit is contained in:
parent
61150066bd
commit
aa972c916a
9 changed files with 107 additions and 59 deletions
|
@ -152,6 +152,11 @@ class MainActivity : AppCompatActivity() {
|
||||||
initActivity(this)
|
initActivity(this)
|
||||||
uiSettings = loadData("ui_settings") ?: uiSettings
|
uiSettings = loadData("ui_settings") ?: uiSettings
|
||||||
selectedOption = uiSettings.defaultStartUpTab
|
selectedOption = uiSettings.defaultStartUpTab
|
||||||
|
if (!uiSettings.immersiveMode) {
|
||||||
|
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
|
bottomMargin = navBarHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
val offline = getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
.getBoolean("offlineMode", false)
|
.getBoolean("offlineMode", false)
|
||||||
|
|
|
@ -72,7 +72,7 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
private var uiSettings: UserInterfaceSettings =
|
private var uiSettings: UserInterfaceSettings =
|
||||||
loadData("ui_settings") ?: UserInterfaceSettings()
|
loadData("ui_settings") ?: UserInterfaceSettings()
|
||||||
|
|
||||||
@OptIn(UnstableApi::class) override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
|
@ -167,19 +167,35 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
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
|
||||||
getDownloads()
|
getDownloads()
|
||||||
|
|
||||||
val fadeIn = AlphaAnimation(0f, 1f)
|
val fadeIn = AlphaAnimation(0f, 1f)
|
||||||
fadeIn.duration = 200 // animations pog
|
fadeIn.duration = 200 // animations pog
|
||||||
val animation = LayoutAnimationController(fadeIn)
|
val animation = LayoutAnimationController(fadeIn)
|
||||||
|
|
||||||
gridView.layoutAnimation = animation
|
gridView.layoutAnimation = animation
|
||||||
adapter = OfflineAnimeAdapter(requireContext(), downloads, this)
|
adapter = OfflineAnimeAdapter(requireContext(), downloads, this)
|
||||||
gridView.adapter = adapter
|
gridView.adapter = adapter
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
grid()
|
grid()
|
||||||
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"
|
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
@OptIn(UnstableApi::class) 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")
|
||||||
|
}
|
||||||
|
}
|
||||||
gridView.setOnItemLongClickListener { parent, view, position, id ->
|
gridView.setOnItemLongClickListener { parent, view, position, id ->
|
||||||
// Get the OfflineAnimeModel that was clicked
|
// Get the OfflineAnimeModel that was clicked
|
||||||
val item = adapter.getItem(position) as OfflineAnimeModel
|
val item = adapter.getItem(position) as OfflineAnimeModel
|
||||||
|
@ -209,25 +225,6 @@ class OfflineAnimeFragment : Fragment(), OfflineAnimeSearchListener {
|
||||||
dialog.window?.setDimAmount(0.8f)
|
dialog.window?.setDimAmount(0.8f)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -171,8 +171,28 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
gridView.scheduleLayoutAnimation()
|
gridView.scheduleLayoutAnimation()
|
||||||
grid()
|
grid()
|
||||||
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"
|
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gridView.setOnItemLongClickListener { parent, view, position, id ->
|
gridView.setOnItemLongClickListener { parent, view, position, id ->
|
||||||
// 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
|
||||||
|
@ -199,25 +219,6 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
dialog.window?.setDimAmount(0.8f)
|
dialog.window?.setDimAmount(0.8f)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
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)
|
||||||
|
@ -243,7 +244,7 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
}
|
}
|
||||||
val scrollTop = view.findViewById<CardView>(R.id.mangaPageScrollTop)
|
val scrollTop = view.findViewById<CardView>(R.id.mangaPageScrollTop)
|
||||||
scrollTop.translationY = -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat()
|
scrollTop.translationY = -(navBarHeight + bottomBar.height + bottomBar.marginBottom).toFloat()
|
||||||
var visible = false
|
val visible = false
|
||||||
|
|
||||||
fun animate() {
|
fun animate() {
|
||||||
val start = if (visible) 0f else 1f
|
val start = if (visible) 0f else 1f
|
||||||
|
|
|
@ -7,10 +7,12 @@ import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
import androidx.activity.addCallback
|
import androidx.activity.addCallback
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.doOnAttach
|
import androidx.core.view.doOnAttach
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
|
@ -22,6 +24,7 @@ import ani.dantotsu.download.anime.OfflineAnimeFragment
|
||||||
import ani.dantotsu.download.manga.OfflineMangaFragment
|
import ani.dantotsu.download.manga.OfflineMangaFragment
|
||||||
import ani.dantotsu.initActivity
|
import ani.dantotsu.initActivity
|
||||||
import ani.dantotsu.loadData
|
import ani.dantotsu.loadData
|
||||||
|
import ani.dantotsu.navBarHeight
|
||||||
import ani.dantotsu.offline.OfflineFragment
|
import ani.dantotsu.offline.OfflineFragment
|
||||||
import ani.dantotsu.others.LangSet
|
import ani.dantotsu.others.LangSet
|
||||||
import ani.dantotsu.selectedOption
|
import ani.dantotsu.selectedOption
|
||||||
|
@ -75,6 +78,11 @@ class NoInternet : AppCompatActivity() {
|
||||||
initActivity(this)
|
initActivity(this)
|
||||||
uiSettings = loadData("ui_settings") ?: uiSettings
|
uiSettings = loadData("ui_settings") ?: uiSettings
|
||||||
selectedOption = uiSettings.defaultStartUpTab
|
selectedOption = uiSettings.defaultStartUpTab
|
||||||
|
if (!uiSettings.immersiveMode) {
|
||||||
|
binding.includedNavbar.navbarContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
|
bottomMargin = navBarHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val navbar = binding.includedNavbar.navbar
|
val navbar = binding.includedNavbar.navbar
|
||||||
ani.dantotsu.bottomBar = navbar
|
ani.dantotsu.bottomBar = navbar
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ani.dantotsu.media.anime
|
package ani.dantotsu.media.anime
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -85,6 +86,13 @@ class AnimeWatchAdapter(
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
val offline = if (!isOnline(binding.root.context) || currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
?.getBoolean("offlineMode", false) == true) View.GONE else View.VISIBLE
|
||||||
|
|
||||||
|
binding.animeSourceNameContainer.visibility = offline
|
||||||
|
binding.animeSourceSettings.visibility = offline
|
||||||
|
binding.animeSourceSearch.visibility = offline
|
||||||
|
binding.animeSourceTitle.visibility = offline
|
||||||
|
|
||||||
//Source Selection
|
//Source Selection
|
||||||
var source =
|
var source =
|
||||||
|
@ -401,9 +409,8 @@ class AnimeWatchAdapter(
|
||||||
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||||
)
|
)
|
||||||
val items = adapter.count
|
val items = adapter.count
|
||||||
if (items > 1) binding?.animeSourceLanguageContainer?.visibility =
|
|
||||||
View.VISIBLE else binding?.animeSourceLanguageContainer?.visibility = View.GONE
|
|
||||||
|
|
||||||
|
binding?.animeSourceLanguageContainer?.visibility = if (items > 1) View.VISIBLE else View.GONE
|
||||||
binding?.animeSourceLanguage?.setAdapter(adapter)
|
binding?.animeSourceLanguage?.setAdapter(adapter)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package ani.dantotsu.media.manga
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -64,7 +65,13 @@ class MangaReadAdapter(
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
val offline = if (!isOnline(binding.root.context) || currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
?.getBoolean("offlineMode", false) == true) View.GONE else View.VISIBLE
|
||||||
|
|
||||||
|
binding.animeSourceNameContainer.visibility = offline
|
||||||
|
binding.animeSourceSettings.visibility = offline
|
||||||
|
binding.animeSourceSearch.visibility = offline
|
||||||
|
binding.animeSourceTitle.visibility = offline
|
||||||
//Source Selection
|
//Source Selection
|
||||||
var source =
|
var source =
|
||||||
media.selected!!.sourceIndex.let { if (it >= mangaReadSources.names.size) 0 else it }
|
media.selected!!.sourceIndex.let { if (it >= mangaReadSources.names.size) 0 else it }
|
||||||
|
@ -142,8 +149,7 @@ class MangaReadAdapter(
|
||||||
|
|
||||||
binding.animeNestedButton.setOnClickListener {
|
binding.animeNestedButton.setOnClickListener {
|
||||||
|
|
||||||
val dialogView =
|
val dialogView = LayoutInflater.from(fragment.requireContext()).inflate(R.layout.dialog_layout, null)
|
||||||
LayoutInflater.from(fragment.requireContext()).inflate(R.layout.dialog_layout, null)
|
|
||||||
val dialogBinding = DialogLayoutBinding.bind(dialogView)
|
val dialogBinding = DialogLayoutBinding.bind(dialogView)
|
||||||
|
|
||||||
var run = false
|
var run = false
|
||||||
|
@ -210,6 +216,8 @@ class MangaReadAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
//Scanlator
|
//Scanlator
|
||||||
|
dialogBinding.animeScanlatorContainer.visibility = if (options.count() > 1) View.VISIBLE else View.GONE
|
||||||
|
dialogBinding.scanlatorNo.text = "${options.count()}"
|
||||||
dialogBinding.animeScanlatorTop.setOnClickListener {
|
dialogBinding.animeScanlatorTop.setOnClickListener {
|
||||||
val dialogView2 =
|
val dialogView2 =
|
||||||
LayoutInflater.from(currContext()).inflate(R.layout.custom_dialog_layout, null)
|
LayoutInflater.from(currContext()).inflate(R.layout.custom_dialog_layout, null)
|
||||||
|
@ -429,8 +437,7 @@ class MangaReadAdapter(
|
||||||
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
parser.extension.sources.map { LanguageMapper.mapLanguageCodeToName(it.lang) }
|
||||||
)
|
)
|
||||||
val items = adapter.count
|
val items = adapter.count
|
||||||
if (items > 1) binding?.animeSourceLanguageContainer?.visibility =
|
binding?.animeSourceLanguageContainer?.visibility = if (items > 1) View.VISIBLE else View.GONE
|
||||||
View.VISIBLE else binding?.animeSourceLanguageContainer?.visibility = View.GONE
|
|
||||||
|
|
||||||
binding?.animeSourceLanguage?.setAdapter(adapter)
|
binding?.animeSourceLanguage?.setAdapter(adapter)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,16 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="265dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?attr/colorOnBackground"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text="Scanlators" />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
|
@ -198,13 +198,27 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:id="@+id/animeScanlatorContainer">
|
android:id="@+id/animeScanlatorContainer">
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="265dp"
|
android:layout_width="265dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:orientation="vertical">
|
||||||
android:alpha="0.58"
|
|
||||||
android:text="Scanlator"
|
<TextView
|
||||||
android:gravity="center_vertical"/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:alpha="0.58"
|
||||||
|
android:text="Scanlator" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/scanlatorNo"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:textColor="?attr/colorSecondary"
|
||||||
|
tools:ignore="TextContrastCheck"
|
||||||
|
tools:text="number" />
|
||||||
|
</LinearLayout>
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -57,8 +57,8 @@
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:id="@+id/animeSourceNameContainer"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
||||||
android:layout_height="56dp"
|
android:layout_height="56dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:hint="@string/source"
|
android:hint="@string/source"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue