fix for SettingsDialogFragment.<init> []
This commit is contained in:
parent
9fc80d6397
commit
876304065d
5 changed files with 43 additions and 27 deletions
|
@ -69,10 +69,14 @@ 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 {
|
||||||
(it.context as AppCompatActivity).supportFragmentManager,
|
val dialogFragment = SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.HOME)
|
||||||
"dialog"
|
dialogFragment.show(
|
||||||
)
|
(it.context as AppCompatActivity).supportFragmentManager,
|
||||||
|
"dialog"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
val colorOverflow = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
|
||||||
|
|
|
@ -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,19 +129,17 @@ 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
|
bottomBar.animate().translationZ(0f).setDuration(duration).start()
|
||||||
bottomBar.animate().translationZ(0f).setDuration(duration).start()
|
ObjectAnimator.ofFloat(bottomBar, "elevation", 4f, 0f).setDuration(duration)
|
||||||
ObjectAnimator.ofFloat(bottomBar, "elevation", 4f, 0f).setDuration(duration)
|
.start()
|
||||||
|
} else {
|
||||||
|
if (reached) {
|
||||||
|
bottomBar.animate().translationZ(12f).setDuration(duration).start()
|
||||||
|
ObjectAnimator.ofFloat(bottomBar, "elevation", 0f, 4f).setDuration(duration)
|
||||||
.start()
|
.start()
|
||||||
} else {
|
|
||||||
if (reached) {
|
|
||||||
bottomBar.animate().translationZ(12f).setDuration(duration).start()
|
|
||||||
ObjectAnimator.ofFloat(bottomBar, "elevation", 0f, 4f).setDuration(duration)
|
|
||||||
.start()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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