mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-28 06:01:01 +00:00
feat: optimize activity page
This commit is contained in:
@@ -15,6 +15,7 @@ import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.profile.notification.NotificationFragment.Companion.NotificationType
|
||||
import nl.joery.animatedbottombar.AnimatedBottomBar
|
||||
|
||||
class NotificationActivity : AppCompatActivity() {
|
||||
@@ -84,11 +85,11 @@ class NotificationActivity : AppCompatActivity() {
|
||||
override fun getItemCount(): Int = 4
|
||||
|
||||
override fun createFragment(position: Int): Fragment = when (position) {
|
||||
0 -> NotificationFragment(if (id != -1) "getOne" else "media", id)
|
||||
1 -> NotificationFragment("user")
|
||||
2 -> NotificationFragment("subscription")
|
||||
3 -> NotificationFragment("comment")
|
||||
else -> NotificationFragment("media")
|
||||
0 -> NotificationFragment(if (id != -1) NotificationType.ONE else NotificationType.MEDIA, id)
|
||||
1 -> NotificationFragment(NotificationType.USER)
|
||||
2 -> NotificationFragment(NotificationType.SUBSCRIPTION)
|
||||
3 -> NotificationFragment(NotificationType.COMMENT)
|
||||
else -> NotificationFragment(NotificationType.MEDIA)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.webkit.internal.ApiFeature.N
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.api.Notification
|
||||
@@ -28,7 +29,10 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class NotificationFragment(val type: String, private val getID: Int = -1) : Fragment() {
|
||||
class NotificationFragment(
|
||||
val type: NotificationType,
|
||||
val getID: Int = -1
|
||||
) : Fragment() {
|
||||
private lateinit var binding: FragmentNotificationsBinding
|
||||
private var adapter: GroupieAdapter = GroupieAdapter()
|
||||
private var currentPage = 1
|
||||
@@ -233,6 +237,10 @@ class NotificationFragment(val type: String, private val getID: Int = -1) : Frag
|
||||
enum class NotificationClickType {
|
||||
USER, MEDIA, ACTIVITY, COMMENT, UNDEFINED
|
||||
}
|
||||
|
||||
enum class NotificationType {
|
||||
MEDIA, USER, SUBSCRIPTION, COMMENT, ONE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user