fix for SettingsDialogFragment.<init> []
This commit is contained in:
parent
9fc80d6397
commit
876304065d
5 changed files with 43 additions and 27 deletions
|
@ -69,12 +69,16 @@ class OfflineMangaFragment : Fragment(), OfflineMangaSearchListener {
|
||||||
|
|
||||||
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
val animeUserAvatar = view.findViewById<ShapeableImageView>(R.id.offlineMangaUserAvatar)
|
||||||
animeUserAvatar.setSafeOnClickListener {
|
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,
|
(it.context as AppCompatActivity).supportFragmentManager,
|
||||||
"dialog"
|
"dialog"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
|
|
@ -98,10 +98,9 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.animeUserAvatar.setSafeOnClickListener {
|
binding.animeUserAvatar.setSafeOnClickListener {
|
||||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.ANIME).show(
|
val dialogFragment =
|
||||||
(it.context as AppCompatActivity).supportFragmentManager,
|
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.ANIME)
|
||||||
"dialog"
|
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listOf(
|
listOf(
|
||||||
|
|
|
@ -113,8 +113,10 @@ class HomeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.homeUserAvatarContainer.setSafeOnClickListener {
|
binding.homeUserAvatarContainer.setSafeOnClickListener {
|
||||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.HOME).show(
|
val dialogFragment =
|
||||||
parentFragmentManager,
|
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.HOME)
|
||||||
|
dialogFragment.show(
|
||||||
|
(it.context as androidx.appcompat.app.AppCompatActivity).supportFragmentManager,
|
||||||
"dialog"
|
"dialog"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -127,7 +129,6 @@ class HomeFragment : Fragment() {
|
||||||
|
|
||||||
var reached = false
|
var reached = false
|
||||||
val duration = (uiSettings.animationSpeed * 200).toLong()
|
val duration = (uiSettings.animationSpeed * 200).toLong()
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
binding.homeScroll.setOnScrollChangeListener { _, _, _, _, _ ->
|
binding.homeScroll.setOnScrollChangeListener { _, _, _, _, _ ->
|
||||||
if (!binding.homeScroll.canScrollVertically(1)) {
|
if (!binding.homeScroll.canScrollVertically(1)) {
|
||||||
reached = true
|
reached = true
|
||||||
|
@ -142,7 +143,6 @@ class HomeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
var height = statusBarHeight
|
var height = statusBarHeight
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
val displayCutout = activity?.window?.decorView?.rootWindowInsets?.displayCutout
|
val displayCutout = activity?.window?.decorView?.rootWindowInsets?.displayCutout
|
||||||
|
|
|
@ -93,10 +93,9 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.mangaUserAvatar.setSafeOnClickListener {
|
binding.mangaUserAvatar.setSafeOnClickListener {
|
||||||
SettingsDialogFragment(SettingsDialogFragment.Companion.PageType.MANGA).show(
|
val dialogFragment =
|
||||||
(it.context as AppCompatActivity).supportFragmentManager,
|
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.MANGA)
|
||||||
"dialog"
|
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.mangaSearchBar.setEndIconOnClickListener {
|
binding.mangaSearchBar.setEndIconOnClickListener {
|
||||||
|
|
|
@ -26,10 +26,16 @@ import ani.dantotsu.startMainActivity
|
||||||
import ani.dantotsu.toast
|
import ani.dantotsu.toast
|
||||||
|
|
||||||
|
|
||||||
class SettingsDialogFragment(val pageType: PageType) : BottomSheetDialogFragment() {
|
class SettingsDialogFragment() : BottomSheetDialogFragment() {
|
||||||
private var _binding: BottomSheetSettingsBinding? = null
|
private var _binding: BottomSheetSettingsBinding? = null
|
||||||
private val binding get() = _binding!!
|
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(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
|
@ -136,5 +142,13 @@ class SettingsDialogFragment(val pageType: PageType) : BottomSheetDialogFragment
|
||||||
enum class PageType {
|
enum class PageType {
|
||||||
MANGA, ANIME, HOME
|
MANGA, ANIME, HOME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun newInstance(pageType: PageType): SettingsDialogFragment {
|
||||||
|
val fragment = SettingsDialogFragment()
|
||||||
|
val args = Bundle()
|
||||||
|
args.putSerializable("pageType", pageType)
|
||||||
|
fragment.arguments = args
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue