Reorganize classes

- Move base classes to its own package
- Move most logic out of MagiskActivity to MainActivity
This commit is contained in:
topjohnwu
2019-09-28 03:37:24 -04:00
parent fc886a5a47
commit 08b528dc4f
41 changed files with 365 additions and 413 deletions
@@ -15,4 +15,11 @@ internal interface EventHandler {
* the way how you handle them.
*/
fun onSimpleEventDispatched(event: Int) {}
val viewEventObserver get() = ViewEventObserver {
onEventDispatched(it)
if (it is SimpleViewEvent) {
onSimpleEventDispatched(it.event)
}
}
}
@@ -1,10 +1,10 @@
package com.topjohnwu.magisk.model.events
import com.topjohnwu.magisk.utils.RxBus
import com.topjohnwu.magisk.model.entity.MagiskPolicy
import com.topjohnwu.magisk.model.entity.recycler.HideProcessRvItem
import com.topjohnwu.magisk.model.entity.recycler.ModuleRvItem
import com.topjohnwu.magisk.model.entity.recycler.PolicyRvItem
import com.topjohnwu.magisk.utils.RxBus
class HideProcessEvent(val item: HideProcessRvItem) : RxBus.Event
@@ -1,7 +1,5 @@
package com.topjohnwu.magisk.model.events
import com.topjohnwu.magisk.model.events.ViewEvent
class SimpleViewEvent(
val event: Int
) : ViewEvent()
@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.model.events
import android.content.Context
import androidx.annotation.StringRes
import com.google.android.material.snackbar.Snackbar
import com.topjohnwu.magisk.model.events.ViewEvent
class SnackbarEvent private constructor(
@StringRes private val messageRes: Int,