1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-01-31 14:38:21 +01:00

Add showing proper fragment in notifications (#331)

This commit is contained in:
Kacper Ziubryniewicz 2019-04-29 19:56:23 +02:00 committed by Rafał Borcz
parent f84040109c
commit dbbc8069b1
11 changed files with 103 additions and 56 deletions

View File

@ -15,7 +15,8 @@ import io.github.wulkanowy.data.repositories.grade.GradeRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.getCompatColor import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable import io.reactivex.Completable
import javax.inject.Inject import javax.inject.Inject
@ -48,7 +49,7 @@ class GradeWork @Inject constructor(
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, PendingIntent.getActivity(context, 0,
MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 0), FLAG_UPDATE_CURRENT)) MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU, MainView.MenuView.GRADE), FLAG_UPDATE_CURRENT))
.setStyle(NotificationCompat.InboxStyle().run { .setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.grade_number_item, grades.size, grades.size)) setSummaryText(context.resources.getQuantityString(R.plurals.grade_number_item, grades.size, grades.size))
grades.forEach { addLine("${it.subject}: ${it.entry}") } grades.forEach { addLine("${it.subject}: ${it.entry}") }

View File

@ -15,7 +15,8 @@ import io.github.wulkanowy.data.repositories.luckynumber.LuckyNumberRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.getCompatColor import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable import io.reactivex.Completable
import javax.inject.Inject import javax.inject.Inject
@ -47,8 +48,9 @@ class LuckyNumberWork @Inject constructor(
.setPriority(PRIORITY_HIGH) .setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, PendingIntent.getActivity(context, MainView.MenuView.MESSAGE.id,
MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT)) MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU, MainView.MenuView.LUCKY_NUMBER)
, FLAG_UPDATE_CURRENT))
.build()) .build())
} }
} }

View File

@ -16,7 +16,8 @@ import io.github.wulkanowy.data.repositories.message.MessageRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.getCompatColor import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable import io.reactivex.Completable
import javax.inject.Inject import javax.inject.Inject
@ -48,8 +49,8 @@ class MessageWork @Inject constructor(
.setPriority(PRIORITY_HIGH) .setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, MainActivity.getStartIntent(context) PendingIntent.getActivity(context, MainView.MenuView.MESSAGE.id, MainActivity.getStartIntent(context)
.putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT) .putExtra(EXTRA_START_MENU, MainView.MenuView.MESSAGE), FLAG_UPDATE_CURRENT)
) )
.setStyle(NotificationCompat.InboxStyle().run { .setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.message_number_item, messages.size, messages.size)) setSummaryText(context.resources.getQuantityString(R.plurals.message_number_item, messages.size, messages.size))

View File

@ -15,7 +15,8 @@ import io.github.wulkanowy.data.repositories.note.NoteRepository
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.services.sync.channels.NewEntriesChannel import io.github.wulkanowy.services.sync.channels.NewEntriesChannel
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.getCompatColor import io.github.wulkanowy.utils.getCompatColor
import io.reactivex.Completable import io.reactivex.Completable
import javax.inject.Inject import javax.inject.Inject
@ -47,8 +48,9 @@ class NoteWork @Inject constructor(
.setPriority(PRIORITY_HIGH) .setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, PendingIntent.getActivity(context, MainView.MenuView.NOTE.id,
MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT)) MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU, MainView.MenuView.NOTE)
, FLAG_UPDATE_CURRENT))
.setStyle(NotificationCompat.InboxStyle().run { .setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size)) setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size))
notes.forEach { addLine("${it.teacher}: ${it.category}") } notes.forEach { addLine("${it.teacher}: ${it.category}") }

View File

@ -6,7 +6,7 @@ import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.student.StudentRepository import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.ui.modules.luckynumberwidget.LuckyNumberWidgetProvider.Companion.createWidgetKey import io.github.wulkanowy.ui.modules.luckynumberwidget.LuckyNumberWidgetProvider.Companion.getStudentWidgetKey
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import javax.inject.Inject import javax.inject.Inject
@ -34,7 +34,7 @@ class LuckyNumberWidgetConfigurePresenter @Inject constructor(
private fun loadData() { private fun loadData() {
disposable.add(studentRepository.getSavedStudents(false) disposable.add(studentRepository.getSavedStudents(false)
.map { it to appWidgetId?.let { id -> sharedPref.getLong(createWidgetKey(id), 0) } } .map { it to appWidgetId?.let { id -> sharedPref.getLong(getStudentWidgetKey(id), 0) } }
.map { (students, currentStudentId) -> .map { (students, currentStudentId) ->
students.map { student -> LuckyNumberWidgetConfigureItem(student, student.id == currentStudentId) } students.map { student -> LuckyNumberWidgetConfigureItem(student, student.id == currentStudentId) }
} }
@ -51,7 +51,7 @@ class LuckyNumberWidgetConfigurePresenter @Inject constructor(
private fun registerStudent(student: Student) { private fun registerStudent(student: Student) {
appWidgetId?.also { appWidgetId?.also {
sharedPref.putLong(createWidgetKey(it), student.id) sharedPref.putLong(getStudentWidgetKey(it), student.id)
view?.apply { view?.apply {
updateLuckyNumberWidget(it) updateLuckyNumberWidget(it)
setSuccessResult(it) setSuccessResult(it)

View File

@ -26,7 +26,8 @@ import io.github.wulkanowy.data.repositories.luckynumber.LuckyNumberRepository
import io.github.wulkanowy.data.repositories.semester.SemesterRepository import io.github.wulkanowy.data.repositories.semester.SemesterRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.reactivex.Maybe import io.reactivex.Maybe
import timber.log.Timber import timber.log.Timber
@ -53,7 +54,7 @@ class LuckyNumberWidgetProvider : BroadcastReceiver() {
lateinit var sharedPref: SharedPrefHelper lateinit var sharedPref: SharedPrefHelper
companion object { companion object {
fun createWidgetKey(appWidgetId: Int) = "lucky_number_widget_$appWidgetId" fun getStudentWidgetKey(appWidgetId: Int) = "lucky_number_widget_student_$appWidgetId"
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@ -70,11 +71,11 @@ class LuckyNumberWidgetProvider : BroadcastReceiver() {
intent.getIntArrayExtra(EXTRA_APPWIDGET_IDS).forEach { appWidgetId -> intent.getIntArrayExtra(EXTRA_APPWIDGET_IDS).forEach { appWidgetId ->
RemoteViews(context.packageName, R.layout.widget_luckynumber).apply { RemoteViews(context.packageName, R.layout.widget_luckynumber).apply {
setTextViewText(R.id.luckyNumberWidgetNumber, setTextViewText(R.id.luckyNumberWidgetNumber,
getLuckyNumber(sharedPref.getLong(createWidgetKey(appWidgetId), 0), appWidgetId)?.luckyNumber?.toString() ?: "#" getLuckyNumber(sharedPref.getLong(getStudentWidgetKey(appWidgetId), 0), appWidgetId)?.luckyNumber?.toString() ?: "#"
) )
setOnClickPendingIntent(R.id.luckyNumberWidgetContainer, setOnClickPendingIntent(R.id.luckyNumberWidgetContainer,
PendingIntent.getActivity(context, 2, MainActivity.getStartIntent(context).apply { PendingIntent.getActivity(context, MainView.MenuView.LUCKY_NUMBER.id, MainActivity.getStartIntent(context).apply {
putExtra(EXTRA_START_MENU_INDEX, 4) putExtra(EXTRA_START_MENU, MainView.MenuView.LUCKY_NUMBER)
}, PendingIntent.FLAG_UPDATE_CURRENT)) }, PendingIntent.FLAG_UPDATE_CURRENT))
}.also { }.also {
setStyles(it, intent) setStyles(it, intent)
@ -85,7 +86,7 @@ class LuckyNumberWidgetProvider : BroadcastReceiver() {
private fun onDelete(intent: Intent) { private fun onDelete(intent: Intent) {
intent.getIntExtra(EXTRA_APPWIDGET_ID, 0).let { intent.getIntExtra(EXTRA_APPWIDGET_ID, 0).let {
if (it != 0) sharedPref.delete(createWidgetKey(it)) if (it != 0) sharedPref.delete(getStudentWidgetKey(it))
} }
} }
@ -97,12 +98,14 @@ class LuckyNumberWidgetProvider : BroadcastReceiver() {
.flatMap { students -> .flatMap { students ->
students.singleOrNull { student -> student.id == studentId } students.singleOrNull { student -> student.id == studentId }
.let { student -> .let { student ->
if (student != null) { when {
Maybe.just(student) student != null -> Maybe.just(student)
} else { studentId != 0L -> {
studentRepository.getCurrentStudent(false) studentRepository.getCurrentStudent(false)
.toMaybe() .toMaybe()
.doOnSuccess { sharedPref.putLong(createWidgetKey(appWidgetId), it.id) } .doOnSuccess { sharedPref.putLong(getStudentWidgetKey(appWidgetId), it.id) }
}
else -> null
} }
} }
} }

View File

@ -22,8 +22,12 @@ import io.github.wulkanowy.ui.modules.account.AccountDialog
import io.github.wulkanowy.ui.modules.attendance.AttendanceFragment import io.github.wulkanowy.ui.modules.attendance.AttendanceFragment
import io.github.wulkanowy.ui.modules.exam.ExamFragment import io.github.wulkanowy.ui.modules.exam.ExamFragment
import io.github.wulkanowy.ui.modules.grade.GradeFragment import io.github.wulkanowy.ui.modules.grade.GradeFragment
import io.github.wulkanowy.ui.modules.homework.HomeworkFragment
import io.github.wulkanowy.ui.modules.login.LoginActivity import io.github.wulkanowy.ui.modules.login.LoginActivity
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.more.MoreFragment
import io.github.wulkanowy.ui.modules.note.NoteFragment
import io.github.wulkanowy.ui.modules.timetable.TimetableFragment import io.github.wulkanowy.ui.modules.timetable.TimetableFragment
import io.github.wulkanowy.utils.getThemeAttrColor import io.github.wulkanowy.utils.getThemeAttrColor
import io.github.wulkanowy.utils.safelyPopFragment import io.github.wulkanowy.utils.safelyPopFragment
@ -40,7 +44,7 @@ class MainActivity : BaseActivity(), MainView {
lateinit var navController: FragNavController lateinit var navController: FragNavController
companion object { companion object {
const val EXTRA_START_MENU_INDEX = "extraStartMenuIndex" const val EXTRA_START_MENU = "extraStartMenu"
fun getStartIntent(context: Context) = Intent(context, MainActivity::class.java) fun getStartIntent(context: Context) = Intent(context, MainActivity::class.java)
} }
@ -56,14 +60,27 @@ class MainActivity : BaseActivity(), MainView {
override var startMenuIndex = 0 override var startMenuIndex = 0
override var startMenuMoreIndex = -1
private val moreMenuFragments = listOf<Fragment>(
MessageFragment.newInstance(),
HomeworkFragment.newInstance(),
NoteFragment.newInstance(),
LuckyNumberFragment.newInstance()
)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
setSupportActionBar(mainToolbar) setSupportActionBar(mainToolbar)
messageContainer = mainFragmentContainer messageContainer = mainFragmentContainer
presenter.onAttachView(this, intent.getIntExtra(EXTRA_START_MENU_INDEX, -1)) presenter.onAttachView(this, intent.getSerializableExtra(EXTRA_START_MENU) as? MainView.MenuView)
navController.initialize(startMenuIndex, savedInstanceState)
navController.run {
initialize(startMenuIndex, savedInstanceState)
pushFragment(moreMenuFragments.getOrNull(startMenuMoreIndex))
}
} }
override fun onCreateOptionsMenu(menu: Menu?): Boolean { override fun onCreateOptionsMenu(menu: Menu?): Boolean {

View File

@ -22,22 +22,19 @@ class MainPresenter @Inject constructor(
private val analytics: FirebaseAnalyticsHelper private val analytics: FirebaseAnalyticsHelper
) : BasePresenter<MainView>(errorHandler) { ) : BasePresenter<MainView>(errorHandler) {
fun onAttachView(view: MainView, initMenuIndex: Int) { fun onAttachView(view: MainView, initMenu: MainView.MenuView?) {
super.onAttachView(view) super.onAttachView(view)
view.run { view.apply {
startMenuIndex = if (initMenuIndex != -1) initMenuIndex else prefRepository.startMenuIndex getProperViewIndexes(initMenu).let { (main, more) ->
startMenuIndex = main
startMenuMoreIndex = more
}
initView() initView()
Timber.i("Main view was initialized with $startMenuIndex menu index") Timber.i("Main view was initialized with $startMenuIndex menu index and $startMenuMoreIndex more index")
} }
syncManager.startSyncWorker() syncManager.startSyncWorker()
analytics.logEvent(APP_OPEN, DESTINATION to initMenu?.name)
analytics.logEvent(APP_OPEN, DESTINATION to when (initMenuIndex) {
1 -> "Grades"
3 -> "Timetable"
4 -> "More"
else -> "User action"
})
} }
fun onViewChange() { fun onViewChange() {
@ -104,4 +101,12 @@ class MainPresenter @Inject constructor(
errorHandler.dispatch(it) errorHandler.dispatch(it)
})) }))
} }
private fun getProperViewIndexes(initMenu: MainView.MenuView?): Pair<Int, Int> {
return when {
initMenu?.id in 0..3 -> initMenu!!.id to -1
(initMenu?.id ?: 0) > 3 -> 4 to initMenu!!.id - 4
else -> prefRepository.startMenuIndex to -1
}
}
} }

View File

@ -6,6 +6,8 @@ interface MainView : BaseView {
var startMenuIndex: Int var startMenuIndex: Int
var startMenuMoreIndex: Int
val isRootView: Boolean val isRootView: Boolean
val currentViewTitle: String? val currentViewTitle: String?
@ -37,4 +39,15 @@ interface MainView : BaseView {
val titleStringId: Int val titleStringId: Int
} }
enum class MenuView(val id: Int) {
GRADE(0),
ATTENDANCE(1),
EXAM(2),
TIMETABLE(3),
MESSAGE(4),
HOMEWORK(5),
NOTE(6),
LUCKY_NUMBER(7),
}
} }

View File

@ -20,7 +20,8 @@ import io.github.wulkanowy.data.db.entities.Student
import io.github.wulkanowy.data.repositories.student.StudentRepository import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.services.widgets.TimetableWidgetService import io.github.wulkanowy.services.widgets.TimetableWidgetService
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU_INDEX import io.github.wulkanowy.ui.modules.main.MainActivity.Companion.EXTRA_START_MENU
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.FirebaseAnalyticsHelper
import io.github.wulkanowy.utils.SchedulersProvider import io.github.wulkanowy.utils.SchedulersProvider
import io.github.wulkanowy.utils.nextOrSameSchoolDay import io.github.wulkanowy.utils.nextOrSameSchoolDay
@ -131,7 +132,7 @@ class TimetableWidgetProvider : BroadcastReceiver() {
}, FLAG_UPDATE_CURRENT)) }, FLAG_UPDATE_CURRENT))
setPendingIntentTemplate(R.id.timetableWidgetList, setPendingIntentTemplate(R.id.timetableWidgetList,
PendingIntent.getActivity(context, 1, MainActivity.getStartIntent(context).apply { PendingIntent.getActivity(context, 1, MainActivity.getStartIntent(context).apply {
putExtra(EXTRA_START_MENU_INDEX, 3) putExtra(EXTRA_START_MENU, MainView.MenuView.TIMETABLE)
}, FLAG_UPDATE_CURRENT)) }, FLAG_UPDATE_CURRENT))
}.also { }.also {
sharedPref.putLong(getDateWidgetKey(appWidgetId), date.toEpochDay(), true) sharedPref.putLong(getDateWidgetKey(appWidgetId), date.toEpochDay(), true)
@ -151,21 +152,23 @@ class TimetableWidgetProvider : BroadcastReceiver() {
}, FLAG_UPDATE_CURRENT) }, FLAG_UPDATE_CURRENT)
} }
private fun getStudent(id: Long, appWidgetId: Int): Student? { private fun getStudent(studentId: Long, appWidgetId: Int): Student? {
return try { return try {
studentRepository.isStudentSaved() studentRepository.isStudentSaved()
.filter { true } .filter { true }
.flatMap { studentRepository.getSavedStudents(false).toMaybe() } .flatMap { studentRepository.getSavedStudents(false).toMaybe() }
.flatMap { students -> .flatMap { students ->
students.singleOrNull { student -> student.id == id } students.singleOrNull { student -> student.id == studentId }
.let { student -> .let { student ->
if (student != null) { when {
Maybe.just(student) student != null -> Maybe.just(student)
} else { studentId != 0L -> {
studentRepository.getCurrentStudent(false) studentRepository.getCurrentStudent(false)
.toMaybe() .toMaybe()
.doOnSuccess { sharedPref.putLong(getStudentWidgetKey(appWidgetId), it.id) } .doOnSuccess { sharedPref.putLong(getStudentWidgetKey(appWidgetId), it.id) }
} }
else -> null
}
} }
} }
.subscribeOn(schedulers.backgroundThread) .subscribeOn(schedulers.backgroundThread)

View File

@ -41,7 +41,7 @@ class MainPresenterTest {
clearInvocations(mainView) clearInvocations(mainView)
presenter = MainPresenter(errorHandler, studentRepository, prefRepository, syncManager, TestSchedulersProvider(), analytics) presenter = MainPresenter(errorHandler, studentRepository, prefRepository, syncManager, TestSchedulersProvider(), analytics)
presenter.onAttachView(mainView, -1) presenter.onAttachView(mainView, null)
} }
@Test @Test