Create a generic class for ViewModel
This commit is contained in:
parent
ee96d5c68f
commit
f5af15454e
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.app.core.ui.bottomsheet
|
||||||
|
|
||||||
|
import com.airbnb.mvrx.MvRxState
|
||||||
|
import im.vector.app.core.platform.EmptyAction
|
||||||
|
import im.vector.app.core.platform.EmptyViewEvents
|
||||||
|
import im.vector.app.core.platform.VectorViewModel
|
||||||
|
|
||||||
|
abstract class BottomSheetGenericViewModel<State : MvRxState>(initialState: State) :
|
||||||
|
VectorViewModel<State, EmptyAction, EmptyViewEvents>(initialState) {
|
||||||
|
|
||||||
|
override fun handle(action: EmptyAction) {
|
||||||
|
// No op
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,14 +16,7 @@
|
||||||
|
|
||||||
package im.vector.app.features.roomprofile.settings.historyvisibility
|
package im.vector.app.features.roomprofile.settings.historyvisibility
|
||||||
|
|
||||||
import im.vector.app.core.platform.EmptyAction
|
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericViewModel
|
||||||
import im.vector.app.core.platform.EmptyViewEvents
|
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
|
||||||
|
|
||||||
class RoomHistoryVisibilityViewModel(initialState: RoomHistoryVisibilityState)
|
class RoomHistoryVisibilityViewModel(initialState: RoomHistoryVisibilityState)
|
||||||
: VectorViewModel<RoomHistoryVisibilityState, EmptyAction, EmptyViewEvents>(initialState) {
|
: BottomSheetGenericViewModel<RoomHistoryVisibilityState>(initialState)
|
||||||
|
|
||||||
override fun handle(action: EmptyAction) {
|
|
||||||
// No op
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,14 +16,7 @@
|
||||||
|
|
||||||
package im.vector.app.features.roomprofile.settings.joinrule
|
package im.vector.app.features.roomprofile.settings.joinrule
|
||||||
|
|
||||||
import im.vector.app.core.platform.EmptyAction
|
import im.vector.app.core.ui.bottomsheet.BottomSheetGenericViewModel
|
||||||
import im.vector.app.core.platform.EmptyViewEvents
|
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
|
||||||
|
|
||||||
class RoomJoinRuleViewModel(initialState: RoomJoinRuleState)
|
class RoomJoinRuleViewModel(initialState: RoomJoinRuleState)
|
||||||
: VectorViewModel<RoomJoinRuleState, EmptyAction, EmptyViewEvents>(initialState) {
|
: BottomSheetGenericViewModel<RoomJoinRuleState>(initialState)
|
||||||
|
|
||||||
override fun handle(action: EmptyAction) {
|
|
||||||
// No op
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue