forked from github/wulkanowy-mirror
Add notifications debug screen (#1370)
This commit is contained in:
@ -10,7 +10,7 @@ import io.github.wulkanowy.databinding.FragmentAboutBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.about.contributor.ContributorFragment
|
||||
import io.github.wulkanowy.ui.modules.about.license.LicenseFragment
|
||||
import io.github.wulkanowy.ui.modules.about.logviewer.LogViewerFragment
|
||||
import io.github.wulkanowy.ui.modules.debug.DebugFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
@ -37,34 +37,60 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(R.layout.fragment_about
|
||||
|
||||
override val versionRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
val buildTimestamp = appInfo.buildTimestamp.toLocalDateTime().toFormattedString("yyyy-MM-dd")
|
||||
val versionSignature = "${appInfo.versionName}-${appInfo.buildFlavor} (${appInfo.versionCode}), $buildTimestamp"
|
||||
Triple(getString(R.string.about_version), versionSignature, getCompatDrawable(R.drawable.ic_all_about))
|
||||
val buildTimestamp =
|
||||
appInfo.buildTimestamp.toLocalDateTime().toFormattedString("yyyy-MM-dd")
|
||||
val versionSignature =
|
||||
"${appInfo.versionName}-${appInfo.buildFlavor} (${appInfo.versionCode}), $buildTimestamp"
|
||||
Triple(
|
||||
getString(R.string.about_version),
|
||||
versionSignature,
|
||||
getCompatDrawable(R.drawable.ic_all_about)
|
||||
)
|
||||
}
|
||||
|
||||
override val creatorsRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_contributor), getString(R.string.about_contributor_summary), getCompatDrawable(R.drawable.ic_about_creator))
|
||||
Triple(
|
||||
getString(R.string.about_contributor),
|
||||
getString(R.string.about_contributor_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_creator)
|
||||
)
|
||||
}
|
||||
|
||||
override val feedbackRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_feedback), getString(R.string.about_feedback_summary), getCompatDrawable(R.drawable.ic_about_feedback))
|
||||
Triple(
|
||||
getString(R.string.about_feedback),
|
||||
getString(R.string.about_feedback_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_feedback)
|
||||
)
|
||||
}
|
||||
|
||||
override val faqRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_faq), getString(R.string.about_faq_summary), getCompatDrawable(R.drawable.ic_about_faq))
|
||||
Triple(
|
||||
getString(R.string.about_faq),
|
||||
getString(R.string.about_faq_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_faq)
|
||||
)
|
||||
}
|
||||
|
||||
override val discordRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_discord), getString(R.string.about_discord_summary), getCompatDrawable(R.drawable.ic_about_discord))
|
||||
Triple(
|
||||
getString(R.string.about_discord),
|
||||
getString(R.string.about_discord_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_discord)
|
||||
)
|
||||
}
|
||||
|
||||
override val facebookRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_facebook), getString(R.string.about_facebook_summary), getCompatDrawable(R.drawable.ic_about_facebook))
|
||||
Triple(
|
||||
getString(R.string.about_facebook),
|
||||
getString(R.string.about_facebook_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_facebook)
|
||||
)
|
||||
}
|
||||
|
||||
override val homepageRes: Triple<String, String, Drawable?>?
|
||||
@ -78,12 +104,20 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(R.layout.fragment_about
|
||||
|
||||
override val licensesRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_licenses), getString(R.string.about_licenses_summary), getCompatDrawable(R.drawable.ic_about_licenses))
|
||||
Triple(
|
||||
getString(R.string.about_licenses),
|
||||
getString(R.string.about_licenses_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_licenses)
|
||||
)
|
||||
}
|
||||
|
||||
override val privacyRes: Triple<String, String, Drawable?>?
|
||||
get() = context?.run {
|
||||
Triple(getString(R.string.about_privacy), getString(R.string.about_privacy_summary), getCompatDrawable(R.drawable.ic_about_privacy))
|
||||
Triple(
|
||||
getString(R.string.about_privacy),
|
||||
getString(R.string.about_privacy_summary),
|
||||
getCompatDrawable(R.drawable.ic_about_privacy)
|
||||
)
|
||||
}
|
||||
|
||||
override val titleStringId get() = R.string.about_title
|
||||
@ -118,8 +152,8 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(R.layout.fragment_about
|
||||
context?.openAppInMarket(::showMessage)
|
||||
}
|
||||
|
||||
override fun openLogViewer() {
|
||||
(activity as? MainActivity)?.pushView(LogViewerFragment.newInstance())
|
||||
override fun openDebugScreen() {
|
||||
(activity as? MainActivity)?.pushView(DebugFragment.newInstance())
|
||||
}
|
||||
|
||||
override fun openDiscordInvite() {
|
||||
@ -155,7 +189,10 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(R.layout.fragment_about
|
||||
}
|
||||
|
||||
override fun openFaqPage() {
|
||||
context?.openInternetBrowser("https://wulkanowy.github.io/czesto-zadawane-pytania", ::showMessage)
|
||||
context?.openInternetBrowser(
|
||||
"https://wulkanowy.github.io/czesto-zadawane-pytania",
|
||||
::showMessage
|
||||
)
|
||||
}
|
||||
|
||||
override fun openLicenses() {
|
||||
@ -167,7 +204,10 @@ class AboutFragment : BaseFragment<FragmentAboutBinding>(R.layout.fragment_about
|
||||
}
|
||||
|
||||
override fun openPrivacyPolicy() {
|
||||
context?.openInternetBrowser("https://wulkanowy.github.io/polityka-prywatnosci.html", ::showMessage)
|
||||
context?.openInternetBrowser(
|
||||
"https://wulkanowy.github.io/polityka-prywatnosci.html",
|
||||
::showMessage
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -26,10 +26,10 @@ class AboutPresenter @Inject constructor(
|
||||
view?.run {
|
||||
when (name) {
|
||||
versionRes?.first -> {
|
||||
Timber.i("Opening log viewer")
|
||||
if (appInfo.isDebug) openLogViewer()
|
||||
Timber.i("Opening debug screen")
|
||||
if (appInfo.isDebug) openDebugScreen()
|
||||
else openAppInMarket()
|
||||
analytics.logEvent("about_open", "name" to "log_viewer")
|
||||
analytics.logEvent("about_open", "name" to "debug_screen")
|
||||
}
|
||||
feedbackRes?.first -> {
|
||||
Timber.i("Opening email client")
|
||||
|
@ -29,7 +29,7 @@ interface AboutView : BaseView {
|
||||
|
||||
fun openAppInMarket()
|
||||
|
||||
fun openLogViewer()
|
||||
fun openDebugScreen()
|
||||
|
||||
fun openDiscordInvite()
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
package io.github.wulkanowy.ui.modules.debug
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.github.wulkanowy.databinding.ItemDebugBinding
|
||||
|
||||
class DebugAdapter : RecyclerView.Adapter<DebugAdapter.ItemViewHolder>() {
|
||||
|
||||
var items = emptyList<DebugItem>()
|
||||
|
||||
var onItemClickListener: (DebugItem) -> Unit = {}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder(
|
||||
ItemDebugBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
|
||||
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
|
||||
val item = items[position]
|
||||
with(holder.binding) {
|
||||
debugItemName.setText(item.title)
|
||||
|
||||
root.setOnClickListener {
|
||||
onItemClickListener(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ItemViewHolder(val binding: ItemDebugBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package io.github.wulkanowy.ui.modules.debug
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentDebugBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.debug.logviewer.LogViewerFragment
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.NotificationDebugFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class DebugFragment : BaseFragment<FragmentDebugBinding>(R.layout.fragment_debug), DebugView,
|
||||
MainView.TitledView {
|
||||
|
||||
@Inject
|
||||
lateinit var presenter: DebugPresenter
|
||||
|
||||
private val debugAdapter = DebugAdapter()
|
||||
|
||||
override val titleStringId: Int
|
||||
get() = R.string.debug_title
|
||||
|
||||
companion object {
|
||||
fun newInstance() = DebugFragment()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding = FragmentDebugBinding.bind(view)
|
||||
presenter.onAttachView(this)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
debugAdapter.onItemClickListener = presenter::onItemSelect
|
||||
with(binding.debugRecycler) {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
adapter = debugAdapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun setItems(itemList: List<DebugItem>) {
|
||||
with(debugAdapter) {
|
||||
items = itemList
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
override fun openLogViewer() {
|
||||
(activity as? MainActivity)?.pushView(LogViewerFragment.newInstance())
|
||||
}
|
||||
|
||||
override fun openNotificationsDebug() {
|
||||
(activity as? MainActivity)?.pushView(NotificationDebugFragment.newInstance())
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
presenter.onDetachView()
|
||||
super.onDestroyView()
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package io.github.wulkanowy.ui.modules.debug
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
data class DebugItem(
|
||||
@StringRes val title: Int,
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
package io.github.wulkanowy.ui.modules.debug
|
||||
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.ui.base.BasePresenter
|
||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class DebugPresenter @Inject constructor(
|
||||
errorHandler: ErrorHandler,
|
||||
studentRepository: StudentRepository,
|
||||
) : BasePresenter<DebugView>(errorHandler, studentRepository) {
|
||||
|
||||
val items = listOf(
|
||||
DebugItem(R.string.logviewer_title),
|
||||
DebugItem(R.string.notification_debug_title),
|
||||
)
|
||||
|
||||
override fun onAttachView(view: DebugView) {
|
||||
super.onAttachView(view)
|
||||
Timber.i("Debug view was initialized")
|
||||
|
||||
with(view) {
|
||||
initView()
|
||||
setItems(items)
|
||||
}
|
||||
}
|
||||
|
||||
fun onItemSelect(item: DebugItem) {
|
||||
when (item.title) {
|
||||
R.string.logviewer_title -> view?.openLogViewer()
|
||||
R.string.notification_debug_title -> view?.openNotificationsDebug()
|
||||
else -> Timber.d("Unknown debug item: $item")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package io.github.wulkanowy.ui.modules.debug
|
||||
|
||||
import io.github.wulkanowy.ui.base.BaseView
|
||||
|
||||
interface DebugView : BaseView {
|
||||
|
||||
fun initView()
|
||||
|
||||
fun setItems(itemList: List<DebugItem>)
|
||||
|
||||
fun openLogViewer()
|
||||
|
||||
fun openNotificationsDebug()
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.github.wulkanowy.ui.modules.about.logviewer
|
||||
package io.github.wulkanowy.ui.modules.debug.logviewer
|
||||
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
@ -1,4 +1,4 @@
|
||||
package io.github.wulkanowy.ui.modules.about.logviewer
|
||||
package io.github.wulkanowy.ui.modules.debug.logviewer
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.Intent.EXTRA_EMAIL
|
@ -1,4 +1,4 @@
|
||||
package io.github.wulkanowy.ui.modules.about.logviewer
|
||||
package io.github.wulkanowy.ui.modules.debug.logviewer
|
||||
|
||||
import io.github.wulkanowy.data.Status
|
||||
import io.github.wulkanowy.data.repositories.LoggerRepository
|
@ -1,4 +1,4 @@
|
||||
package io.github.wulkanowy.ui.modules.about.logviewer
|
||||
package io.github.wulkanowy.ui.modules.debug.logviewer
|
||||
|
||||
import io.github.wulkanowy.ui.base.BaseView
|
||||
import java.io.File
|
@ -0,0 +1,31 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.github.wulkanowy.databinding.ItemDebugNotificationsBinding
|
||||
|
||||
class NotificationDebugAdapter : RecyclerView.Adapter<NotificationDebugAdapter.ItemViewHolder>() {
|
||||
|
||||
var items = emptyList<NotificationDebugItem>()
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ItemViewHolder(
|
||||
ItemDebugNotificationsBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
|
||||
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
|
||||
val item = items[position]
|
||||
|
||||
with(holder.binding) {
|
||||
title.setText(item.title)
|
||||
button1.setOnClickListener { item.onClickCallback(1) }
|
||||
button2.setOnClickListener { item.onClickCallback(3) }
|
||||
button3.setOnClickListener { item.onClickCallback(10) }
|
||||
}
|
||||
}
|
||||
|
||||
class ItemViewHolder(val binding: ItemDebugNotificationsBinding) :
|
||||
RecyclerView.ViewHolder(binding.root)
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.databinding.FragmentDebugNotificationsBinding
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class NotificationDebugFragment :
|
||||
BaseFragment<FragmentDebugNotificationsBinding>(R.layout.fragment_debug_notifications),
|
||||
NotificationDebugView, MainView.TitledView {
|
||||
|
||||
@Inject
|
||||
lateinit var presenter: NotificationDebugPresenter
|
||||
|
||||
private val notificationDebugAdapter = NotificationDebugAdapter()
|
||||
|
||||
override val titleStringId: Int
|
||||
get() = R.string.notification_debug_title
|
||||
|
||||
companion object {
|
||||
fun newInstance() = NotificationDebugFragment()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding = FragmentDebugNotificationsBinding.bind(view)
|
||||
presenter.onAttachView(this)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
with(binding.recyclerView) {
|
||||
adapter = notificationDebugAdapter
|
||||
layoutManager = LinearLayoutManager(requireContext())
|
||||
}
|
||||
}
|
||||
|
||||
override fun setItems(notificationDebugs: List<NotificationDebugItem>) {
|
||||
with(notificationDebugAdapter) {
|
||||
items = notificationDebugs
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
presenter.onDetachView()
|
||||
super.onDestroyView()
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
|
||||
data class NotificationDebugItem(
|
||||
@StringRes val title: Int,
|
||||
val onClickCallback: (numberOfNotifications: Int) -> Unit,
|
||||
)
|
@ -0,0 +1,83 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification
|
||||
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.services.sync.notifications.NewConferenceNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewExamNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewGradeNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewHomeworkNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewLuckyNumberNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewMessageNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewNoteNotification
|
||||
import io.github.wulkanowy.services.sync.notifications.NewSchoolAnnouncementNotification
|
||||
import io.github.wulkanowy.ui.base.BasePresenter
|
||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugConferenceItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugExamItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugGradeDetailsItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugGradeSummaryItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugHomeworkItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugLuckyNumber
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugMessageItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugNoteItems
|
||||
import io.github.wulkanowy.ui.modules.debug.notification.mock.debugSchoolAnnouncementItems
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class NotificationDebugPresenter @Inject constructor(
|
||||
errorHandler: ErrorHandler,
|
||||
studentRepository: StudentRepository,
|
||||
private val newGradeNotification: NewGradeNotification,
|
||||
private val newHomeworkNotification: NewHomeworkNotification,
|
||||
private val newConferenceNotification: NewConferenceNotification,
|
||||
private val newExamNotification: NewExamNotification,
|
||||
private val newMessageNotification: NewMessageNotification,
|
||||
private val newNoteNotification: NewNoteNotification,
|
||||
private val newSchoolAnnouncementNotification: NewSchoolAnnouncementNotification,
|
||||
private val newLuckyNumberNotification: NewLuckyNumberNotification,
|
||||
) : BasePresenter<NotificationDebugView>(errorHandler, studentRepository) {
|
||||
|
||||
private val items = listOf(
|
||||
NotificationDebugItem(R.string.grade_title) {
|
||||
newGradeNotification.notifyDetails(debugGradeDetailsItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.grade_summary_predicted_grade) {
|
||||
newGradeNotification.notifyPredicted(debugGradeSummaryItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.grade_summary_final_grade) {
|
||||
newGradeNotification.notifyFinal(debugGradeSummaryItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.homework_title) {
|
||||
newHomeworkNotification.notify(debugHomeworkItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.conferences_title) {
|
||||
newConferenceNotification.notify(debugConferenceItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.exam_title) {
|
||||
newExamNotification.notify(debugExamItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.message_title) {
|
||||
newMessageNotification.notify(debugMessageItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.note_title) {
|
||||
newNoteNotification.notify(debugNoteItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.school_announcement_title) {
|
||||
newSchoolAnnouncementNotification.notify(debugSchoolAnnouncementItems.take(it))
|
||||
},
|
||||
NotificationDebugItem(R.string.lucky_number_title) {
|
||||
repeat(it) {
|
||||
newLuckyNumberNotification.notify(debugLuckyNumber)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
override fun onAttachView(view: NotificationDebugView) {
|
||||
super.onAttachView(view)
|
||||
Timber.i("Notification debug view was initialized")
|
||||
with(view) {
|
||||
initView()
|
||||
setItems(items)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification
|
||||
|
||||
import io.github.wulkanowy.ui.base.BaseView
|
||||
|
||||
interface NotificationDebugView : BaseView {
|
||||
|
||||
fun initView()
|
||||
|
||||
fun setItems(notificationDebugs: List<NotificationDebugItem>)
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.Conference
|
||||
import java.time.LocalDateTime
|
||||
|
||||
val debugConferenceItems = listOf(
|
||||
generateConference(
|
||||
title = "Spotkanie z rodzicami/opiekunami",
|
||||
subject = "Podsumowanie I semestru - średnia klasy, oceny, frekwencja, zachowanie"
|
||||
),
|
||||
generateConference(
|
||||
title = "ZSW",
|
||||
subject = "Pierwsze - organizacyjne zebranie z rodzicami klas pierwszych"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie z rodzicami w sprawie bójki",
|
||||
subject = "Pierwsze - i miejmy nadzieję ostatnie - zebranie w takiej sprawie"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie z rodzicami w sprawie kolejnej bójki",
|
||||
subject = "Kolejne - ale miejmy jeszcze nadzieję, że ostatnie - zebranie w takiej sprawie"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie z rodzicami w sprawie jeszcze jednej bójki",
|
||||
subject = "Proszę państwa, proszę uspokoić swoje dzieci"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie w sprawie wydalenia części uczniów",
|
||||
subject = "Proszę państwa, to jest krok ostateczny, którego nikt nie chciał się podjąć, ale ktoś musi"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie organizacyjne w drugim semestrze",
|
||||
subject = "Prezentacja na temat projektu 'Spokojnej szkoły'"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie z pierwszakami",
|
||||
subject = "Mamy sobie do pogadania"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie z rodzicami szóstoklaistów",
|
||||
subject = "Musimy przygotować dzieci do ważnej uroczystości"
|
||||
),
|
||||
generateConference(
|
||||
title = "Spotkanie podsumowujące pracę w ciągu ostatniego roku szkolnego",
|
||||
subject = "Proszę państwa, zapraszam serdecznie na spotkanie"
|
||||
),
|
||||
)
|
||||
|
||||
private fun generateConference(title: String, subject: String) = Conference(
|
||||
title = title,
|
||||
subject = subject,
|
||||
studentId = 0,
|
||||
diaryId = 0,
|
||||
agenda = "",
|
||||
conferenceId = 0,
|
||||
date = LocalDateTime.now(),
|
||||
presentOnConference = "",
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.Exam
|
||||
import java.time.LocalDate
|
||||
|
||||
val debugExamItems = listOf(
|
||||
generateExam("Matematyka", "Figury na płaszczyźnie"),
|
||||
generateExam("Język angielski", "czasowniki nieregularne 1 część"),
|
||||
generateExam("Geografia", "Opolszczyzna - mapa"),
|
||||
generateExam("Sieci komputerowe", "Zaciskanie erjotek"),
|
||||
generateExam("Systemy operacyjne", "Instalacja ubuntu 16.04"),
|
||||
generateExam("Język niemiecki", "oral exam"),
|
||||
generateExam("Biologia", "Budowa koniczyny"),
|
||||
generateExam("Chemia", "synteza płynnego zaliczenia"),
|
||||
generateExam("Fizyka", "telekineza"),
|
||||
generateExam("Matematyka", "Liczby zespolone i pochodne piątego rzędu"),
|
||||
)
|
||||
|
||||
private fun generateExam(subject: String, description: String) = Exam(
|
||||
subject = subject,
|
||||
description = description,
|
||||
studentId = 0,
|
||||
diaryId = 0,
|
||||
date = LocalDate.now(),
|
||||
entryDate = LocalDate.now(),
|
||||
group = "",
|
||||
type = "",
|
||||
teacher = "",
|
||||
teacherSymbol = ""
|
||||
)
|
@ -0,0 +1,35 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.Grade
|
||||
import java.time.LocalDate
|
||||
|
||||
val debugGradeDetailsItems = listOf(
|
||||
generateGrade("Matematyka", "+"),
|
||||
generateGrade("Matematyka", "2="),
|
||||
generateGrade("Fizyka", "-"),
|
||||
generateGrade("Geografia", "4+"),
|
||||
generateGrade("Sieci komputerowe", "1"),
|
||||
generateGrade("Systemy operacyjne", "3+"),
|
||||
generateGrade("Język polski", "2-"),
|
||||
generateGrade("Język angielski", "4+"),
|
||||
generateGrade("Religia", "6"),
|
||||
generateGrade("Język niemiecki", "1!"),
|
||||
generateGrade("Wychowanie fizyczne", "5"),
|
||||
)
|
||||
|
||||
private fun generateGrade(subject: String, entry: String) = Grade(
|
||||
subject = subject,
|
||||
entry = entry,
|
||||
semesterId = 0,
|
||||
studentId = 0,
|
||||
value = 0.0,
|
||||
modifier = 0.0,
|
||||
comment = "",
|
||||
color = "",
|
||||
gradeSymbol = "",
|
||||
description = "",
|
||||
weight = "",
|
||||
weightValue = 0.0,
|
||||
date = LocalDate.now(),
|
||||
teacher = ""
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.GradeSummary
|
||||
|
||||
val debugGradeSummaryItems = listOf(
|
||||
generateSummary("Matematyka", "2-", "2"),
|
||||
generateSummary("Fizyka", "1", "2"),
|
||||
generateSummary("Geografia", "4+", "5"),
|
||||
generateSummary("Sieci komputerowe", "2", "5"),
|
||||
generateSummary("Systemy operacyjne", "3", "4"),
|
||||
generateSummary("Język polski", "1", "3"),
|
||||
generateSummary("Język angielski", "4", "3"),
|
||||
generateSummary("Religia", "5", "6"),
|
||||
generateSummary("Język niemiecki", "2", "2"),
|
||||
generateSummary("Wychowanie fizyczne", "5", "5"),
|
||||
generateSummary("Biologia", "4", "4"),
|
||||
)
|
||||
|
||||
private fun generateSummary(subject: String, predicted: String, final: String) = GradeSummary(
|
||||
semesterId = 0,
|
||||
studentId = 0,
|
||||
position = 0,
|
||||
subject = subject,
|
||||
predictedGrade = predicted,
|
||||
finalGrade = final,
|
||||
proposedPoints = "",
|
||||
finalPoints = "",
|
||||
pointsSum = "",
|
||||
average = .0
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.Homework
|
||||
import java.time.LocalDate
|
||||
|
||||
val debugHomeworkItems = listOf(
|
||||
generateHomework("Chemia", "Test diagnozujący i Rozdział I do 30.10"),
|
||||
generateHomework("Etyka", "Notatka własna do zajęć o ks. Jerzym Popiełuszko"),
|
||||
generateHomework("Język angielski", "Zadania egzaminacyjne"),
|
||||
generateHomework("Metodologia programowania", "Wszystkie instrukcje"),
|
||||
generateHomework("Język polski", "Notatka własna na temat Wokulskiego z lektury Lalka"),
|
||||
generateHomework("Systemy operacyjne", "Sprawozdanie z wykonania ćwiczenia nr 21.137"),
|
||||
generateHomework("Matematyka", "Zadania od strony 1 do 128"),
|
||||
generateHomework("Język niemiecki", "Opis swoich wakacji - dialog z kolegą"),
|
||||
generateHomework("Język angielski", "Opis swoich wakacji - dialog z kolegą"),
|
||||
generateHomework("Wychowanie fizyczne", "Notatka na temat skoku w dald"),
|
||||
generateHomework("Biologia", "Notatka na temat grzechotnika"),
|
||||
)
|
||||
|
||||
private fun generateHomework(subject: String, content: String) = Homework(
|
||||
subject = subject,
|
||||
content = content,
|
||||
semesterId = 0,
|
||||
studentId = 0,
|
||||
date = LocalDate.now(),
|
||||
entryDate = LocalDate.now(),
|
||||
teacher = "",
|
||||
teacherSymbol = "",
|
||||
attachments = listOf(),
|
||||
)
|
@ -0,0 +1,12 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.LuckyNumber
|
||||
import java.time.LocalDate
|
||||
import kotlin.random.Random
|
||||
|
||||
val debugLuckyNumber
|
||||
get() = LuckyNumber(
|
||||
studentId = 0,
|
||||
date = LocalDate.now(),
|
||||
luckyNumber = Random.nextInt(1, 128),
|
||||
)
|
@ -0,0 +1,32 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import java.time.LocalDateTime
|
||||
|
||||
val debugMessageItems = listOf(
|
||||
generateMessage("Kowalski Jan", "Tytuł"),
|
||||
generateMessage("Nazwisko Imię", "Tytuł wiadomości"),
|
||||
generateMessage("Malinowski Kazimierz", "Nakrętki"),
|
||||
generateMessage("Jastębowszki Orest", "Prośba do uczniów o pomoc przy projekcie"),
|
||||
generateMessage("Metylowy Oranż", "Pozew o plagiat"),
|
||||
generateMessage("VULCAN", "Uwaga na nieautoryzowane aplikacje"),
|
||||
generateMessage("Mama", "Zacznij się w końcu uczyć do matury!!!11"),
|
||||
generateMessage("Tata", "Kupisz mi coś w sklepie?"),
|
||||
generateMessage("Wychowawca", "Upomnienie od wychowawcy za nieobecności"),
|
||||
generateMessage("Kochanowska Joanna", "Poprawa rozprawki - termin"),
|
||||
)
|
||||
|
||||
private fun generateMessage(sender: String, subject: String) = Message(
|
||||
sender = sender,
|
||||
subject = subject,
|
||||
studentId = 0,
|
||||
realId = 0,
|
||||
messageId = 0,
|
||||
senderId = 0,
|
||||
recipient = "",
|
||||
date = LocalDateTime.now(),
|
||||
folderId = 0,
|
||||
unread = true,
|
||||
removed = false,
|
||||
hasAttachments = false
|
||||
)
|
@ -0,0 +1,29 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.Note
|
||||
import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory
|
||||
import java.time.LocalDate
|
||||
|
||||
val debugNoteItems = listOf(
|
||||
generateNote("Aleksadra Krajewska", "Przeszkadzanie na lekcjach", NoteCategory.NEGATIVE),
|
||||
generateNote("Zofia Czerwińska", "Udział w konkursie szkolnym", NoteCategory.POSITIVE),
|
||||
generateNote("Stanisław Krupa", "Kultura języka", NoteCategory.NEUTRAL),
|
||||
generateNote("Karolina Kowalska", "Wypełnianie obowiązków ucznia", NoteCategory.NEUTRAL),
|
||||
generateNote("Joanna Krupa", "Umycie tablicy cifem", NoteCategory.POSITIVE),
|
||||
generateNote("Duchowicz Maksymilian", "Reprezentowanie szkoły", NoteCategory.POSITIVE),
|
||||
generateNote("Michał Mazur", "Przeszkadzanie na lekcji", NoteCategory.NEGATIVE),
|
||||
generateNote("Karolina Kowalska", "Wypełnianie obowiązków ucznia", NoteCategory.NEGATIVE),
|
||||
generateNote("Aleksandra Krajewska", "Wysadzenie klasy w powietrze", NoteCategory.NEGATIVE),
|
||||
)
|
||||
|
||||
private fun generateNote(teacher: String, category: String, type: NoteCategory) = Note(
|
||||
teacher = teacher,
|
||||
category = category,
|
||||
categoryType = type.id,
|
||||
studentId = 0,
|
||||
date = LocalDate.now(),
|
||||
teacherSymbol = "",
|
||||
isPointsShow = false,
|
||||
points = 0,
|
||||
content = ""
|
||||
)
|
@ -0,0 +1,24 @@
|
||||
package io.github.wulkanowy.ui.modules.debug.notification.mock
|
||||
|
||||
import io.github.wulkanowy.data.db.entities.SchoolAnnouncement
|
||||
import java.time.LocalDate
|
||||
|
||||
val debugSchoolAnnouncementItems = listOf(
|
||||
generateAnnouncement("Dzień wolny od zajęć dydaktycznych", "Dzień wolny od zajęć dydaktycznych\n03.05.2021 - poniedziałek"),
|
||||
generateAnnouncement("Zasady bezpieczeństwa", "Wszyscy uczniowie są zobowiązani do noszenia maseczek"),
|
||||
generateAnnouncement("Święto szkoły", "W najbliższych dniach obchodzimy święto szkoły, podczas którego..."),
|
||||
generateAnnouncement("Rocznica odzyskania przez szkołę sztandaru", "Juz niedługo, bo za tydzień, a dokładnie za 8 dni..."),
|
||||
generateAnnouncement("Ogłoszenie w sprawie otwarcia stołówki", "Wszyscy uczniowie zainteresowani obiadami w szkole..."),
|
||||
generateAnnouncement("Uczniowie proszeni do sekretariatu", "Kuba i Jacek z klasy czwartej proszeni do dyrektora w trybie pilnym"),
|
||||
generateAnnouncement("Dzień wolny od zajęć dydaktycznych", "Dzień wolny od zajęć dydaktycznych\n21.06.2021 - poniedziałek"),
|
||||
generateAnnouncement("Zasady bezpieczeństwa", "Wszyscy uczniowie są zobowiązani do zdjęcia maseczek"),
|
||||
generateAnnouncement("Święto państwowe", "W najbliższych dniach obchodzimy święto państwowe, podczas którego..."),
|
||||
generateAnnouncement("Uczniowie proszeni do sekretariatu", "Kuba i Jacek z klasy czwartej proszeni do dyrektora w trybie wolnym"),
|
||||
)
|
||||
|
||||
private fun generateAnnouncement(subject: String, content: String) = SchoolAnnouncement(
|
||||
subject = subject,
|
||||
content = content,
|
||||
studentId = 0,
|
||||
date = LocalDate.now()
|
||||
)
|
@ -32,6 +32,7 @@ import io.github.wulkanowy.databinding.ActivityMainBinding
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
import io.github.wulkanowy.ui.modules.account.accountquick.AccountQuickDialog
|
||||
import io.github.wulkanowy.ui.modules.attendance.AttendanceFragment
|
||||
import io.github.wulkanowy.ui.modules.conference.ConferenceFragment
|
||||
import io.github.wulkanowy.ui.modules.exam.ExamFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeFragment
|
||||
import io.github.wulkanowy.ui.modules.homework.HomeworkFragment
|
||||
@ -39,6 +40,7 @@ import io.github.wulkanowy.ui.modules.luckynumber.LuckyNumberFragment
|
||||
import io.github.wulkanowy.ui.modules.message.MessageFragment
|
||||
import io.github.wulkanowy.ui.modules.more.MoreFragment
|
||||
import io.github.wulkanowy.ui.modules.note.NoteFragment
|
||||
import io.github.wulkanowy.ui.modules.schoolannouncement.SchoolAnnouncementFragment
|
||||
import io.github.wulkanowy.ui.modules.timetable.TimetableFragment
|
||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
@ -107,7 +109,9 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
MainView.Section.MESSAGE.id to MessageFragment.newInstance(),
|
||||
MainView.Section.HOMEWORK.id to HomeworkFragment.newInstance(),
|
||||
MainView.Section.NOTE.id to NoteFragment.newInstance(),
|
||||
MainView.Section.LUCKY_NUMBER.id to LuckyNumberFragment.newInstance()
|
||||
MainView.Section.LUCKY_NUMBER.id to LuckyNumberFragment.newInstance(),
|
||||
MainView.Section.SCHOOL_ANNOUNCEMENT.id to SchoolAnnouncementFragment.newInstance(),
|
||||
MainView.Section.CONFERENCE.id to ConferenceFragment.newInstance(),
|
||||
)
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
|
Reference in New Issue
Block a user