fix: activity crash
This commit is contained in:
parent
b1210570d1
commit
ff72f9dbdf
2 changed files with 13 additions and 3 deletions
|
@ -21,7 +21,7 @@ import nl.joery.animatedbottombar.AnimatedBottomBar
|
||||||
class FeedActivity : AppCompatActivity() {
|
class FeedActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivityFeedBinding
|
private lateinit var binding: ActivityFeedBinding
|
||||||
private var selected: Int = 0
|
private var selected: Int = 0
|
||||||
private lateinit var navBar: AnimatedBottomBar
|
lateinit var navBar: AnimatedBottomBar
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class FeedFragment : Fragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
activity = requireActivity()
|
activity = requireActivity()
|
||||||
|
|
||||||
binding.listRecyclerView.setBaseline((activity as ProfileActivity).navBar)
|
|
||||||
|
|
||||||
binding.listRecyclerView.adapter = adapter
|
binding.listRecyclerView.adapter = adapter
|
||||||
binding.listRecyclerView.layoutManager =
|
binding.listRecyclerView.layoutManager =
|
||||||
|
@ -60,6 +60,12 @@ class FeedFragment : Fragment() {
|
||||||
activityId = arguments?.getInt("activityId", -1) ?: -1
|
activityId = arguments?.getInt("activityId", -1) ?: -1
|
||||||
if (userId == -1) userId = null
|
if (userId == -1) userId = null
|
||||||
global = arguments?.getBoolean("global", false) ?: false
|
global = arguments?.getBoolean("global", false) ?: false
|
||||||
|
|
||||||
|
if (userId != null) {
|
||||||
|
binding.listRecyclerView.setBaseline((activity as ProfileActivity).navBar)
|
||||||
|
}else{
|
||||||
|
binding.listRecyclerView.setBaseline((activity as FeedActivity).navBar)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
@ -67,7 +73,11 @@ class FeedFragment : Fragment() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (this::binding.isInitialized) {
|
if (this::binding.isInitialized) {
|
||||||
binding.root.requestLayout()
|
binding.root.requestLayout()
|
||||||
binding.listRecyclerView.setBaseline((activity as ProfileActivity).navBar)
|
if (userId != null) {
|
||||||
|
binding.listRecyclerView.setBaseline((activity as ProfileActivity).navBar)
|
||||||
|
}else{
|
||||||
|
binding.listRecyclerView.setBaseline((activity as FeedActivity).navBar)
|
||||||
|
}
|
||||||
if (!loadedFirstTime) {
|
if (!loadedFirstTime) {
|
||||||
activity.lifecycleScope.launch(Dispatchers.IO) {
|
activity.lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val nulledId = if (activityId == -1) null else activityId
|
val nulledId = if (activityId == -1) null else activityId
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue