Cleanup
This commit is contained in:
parent
d431ab23c8
commit
a761a0dbd2
|
@ -29,7 +29,6 @@ class DebugSasEmojiActivity : AppCompatActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.fragment_generic_recycler)
|
setContentView(R.layout.fragment_generic_recycler)
|
||||||
// TODO Inject
|
|
||||||
val controller = SasEmojiController()
|
val controller = SasEmojiController()
|
||||||
recyclerView.configureWith(controller)
|
recyclerView.configureWith(controller)
|
||||||
controller.setData(SasState(getAllVerificationEmojis()))
|
controller.setData(SasState(getAllVerificationEmojis()))
|
||||||
|
|
|
@ -46,7 +46,6 @@ private const val INDEX_PEOPLE = 1
|
||||||
private const val INDEX_ROOMS = 2
|
private const val INDEX_ROOMS = 2
|
||||||
|
|
||||||
class HomeDetailFragment @Inject constructor(
|
class HomeDetailFragment @Inject constructor(
|
||||||
private val session: Session,
|
|
||||||
val homeDetailViewModelFactory: HomeDetailViewModel.Factory,
|
val homeDetailViewModelFactory: HomeDetailViewModel.Factory,
|
||||||
private val avatarRenderer: AvatarRenderer
|
private val avatarRenderer: AvatarRenderer
|
||||||
) : VectorBaseFragment(), KeysBackupBanner.Delegate {
|
) : VectorBaseFragment(), KeysBackupBanner.Delegate {
|
||||||
|
@ -56,9 +55,7 @@ class HomeDetailFragment @Inject constructor(
|
||||||
private val viewModel: HomeDetailViewModel by fragmentViewModel()
|
private val viewModel: HomeDetailViewModel by fragmentViewModel()
|
||||||
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
||||||
|
|
||||||
override fun getLayoutResId(): Int {
|
override fun getLayoutResId() = R.layout.fragment_home_detail
|
||||||
return R.layout.fragment_home_detail
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 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.riotx.features.home.room.detail.timeline.action
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||||
|
|
||||||
|
private const val ANIM_DURATION_IN_MILLIS = 300L
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We only want to animate the expand of the "Report content" submenu
|
||||||
|
*/
|
||||||
|
class MessageActionsAnimator : DefaultItemAnimator() {
|
||||||
|
|
||||||
|
init {
|
||||||
|
addDuration = ANIM_DURATION_IN_MILLIS
|
||||||
|
removeDuration = 0
|
||||||
|
moveDuration = 0
|
||||||
|
changeDuration = 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,7 +30,6 @@ import im.vector.riotx.core.extensions.cleanup
|
||||||
import im.vector.riotx.core.extensions.configureWith
|
import im.vector.riotx.core.extensions.configureWith
|
||||||
import im.vector.riotx.core.platform.VectorBaseBottomSheetDialogFragment
|
import im.vector.riotx.core.platform.VectorBaseBottomSheetDialogFragment
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
|
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
|
||||||
import kotlinx.android.synthetic.main.activity_image_media_viewer.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +87,11 @@ class MessageActionsBottomSheet : VectorBaseBottomSheetDialogFragment(), Message
|
||||||
|
|
||||||
override fun didSelectMenuAction(eventAction: EventSharedAction) {
|
override fun didSelectMenuAction(eventAction: EventSharedAction) {
|
||||||
if (eventAction is EventSharedAction.ReportContent) {
|
if (eventAction is EventSharedAction.ReportContent) {
|
||||||
// Toggle report menu // TODO Reanable item animation?
|
// Toggle report menu
|
||||||
|
// Enable item animation
|
||||||
|
if (recyclerView.itemAnimator == null) {
|
||||||
|
recyclerView.itemAnimator = MessageActionsAnimator()
|
||||||
|
}
|
||||||
viewModel.handle(MessageActionsAction.ToggleReportMenu)
|
viewModel.handle(MessageActionsAction.ToggleReportMenu)
|
||||||
} else {
|
} else {
|
||||||
sharedActionViewModel.post(eventAction)
|
sharedActionViewModel.post(eventAction)
|
||||||
|
|
|
@ -36,9 +36,7 @@ class FilteredRoomsActivity : VectorBaseActivity() {
|
||||||
return supportFragmentManager.findFragmentByTag(FRAGMENT_TAG) as? RoomListFragment
|
return supportFragmentManager.findFragmentByTag(FRAGMENT_TAG) as? RoomListFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutRes(): Int {
|
override fun getLayoutRes() = R.layout.activity_filtered_rooms
|
||||||
return R.layout.activity_filtered_rooms
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun injectWith(injector: ScreenComponent) {
|
override fun injectWith(injector: ScreenComponent) {
|
||||||
injector.inject(this)
|
injector.inject(this)
|
||||||
|
|
|
@ -54,11 +54,11 @@ class EmojiReactionPickerActivity : VectorBaseActivity(),
|
||||||
|
|
||||||
lateinit var viewModel: EmojiChooserViewModel
|
lateinit var viewModel: EmojiChooserViewModel
|
||||||
|
|
||||||
override fun getMenuRes(): Int = R.menu.menu_emoji_reaction_picker
|
override fun getMenuRes() = R.menu.menu_emoji_reaction_picker
|
||||||
|
|
||||||
override fun getLayoutRes(): Int = R.layout.activity_emoji_reaction_picker
|
override fun getLayoutRes() = R.layout.activity_emoji_reaction_picker
|
||||||
|
|
||||||
override fun getTitleRes(): Int = R.string.title_activity_emoji_reaction_picker
|
override fun getTitleRes() = R.string.title_activity_emoji_reaction_picker
|
||||||
|
|
||||||
@Inject lateinit var emojiCompatFontProvider: EmojiCompatFontProvider
|
@Inject lateinit var emojiCompatFontProvider: EmojiCompatFontProvider
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class EmojiSearchResultFragment @Inject constructor(
|
||||||
private val epoxyController: EmojiSearchResultController
|
private val epoxyController: EmojiSearchResultController
|
||||||
) : VectorBaseFragment() {
|
) : VectorBaseFragment() {
|
||||||
|
|
||||||
override fun getLayoutResId(): Int = R.layout.fragment_generic_recycler
|
override fun getLayoutResId() = R.layout.fragment_generic_recycler
|
||||||
|
|
||||||
val viewModel: EmojiSearchResultViewModel by activityViewModel()
|
val viewModel: EmojiSearchResultViewModel by activityViewModel()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 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.riotx.features.settings.push
|
||||||
|
|
||||||
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
|
import im.vector.riotx.R
|
||||||
|
import im.vector.riotx.core.resources.StringProvider
|
||||||
|
import im.vector.riotx.core.ui.list.genericFooterItem
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class PushGateWayController @Inject constructor(
|
||||||
|
private val stringProvider: StringProvider
|
||||||
|
) : TypedEpoxyController<PushGatewayViewState>() {
|
||||||
|
|
||||||
|
override fun buildModels(data: PushGatewayViewState?) {
|
||||||
|
data?.pushGateways?.invoke()?.let { pushers ->
|
||||||
|
if (pushers.isEmpty()) {
|
||||||
|
genericFooterItem {
|
||||||
|
id("footer")
|
||||||
|
text(stringProvider.getString(R.string.settings_push_gateway_no_pushers))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pushers.forEach {
|
||||||
|
pushGatewayItem {
|
||||||
|
id("${it.pushKey}_${it.appId}")
|
||||||
|
pusher(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: run {
|
||||||
|
genericFooterItem {
|
||||||
|
id("loading")
|
||||||
|
text(stringProvider.getString(R.string.loading))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,6 @@ package im.vector.riotx.features.settings.push
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
|
||||||
import com.airbnb.mvrx.fragmentViewModel
|
import com.airbnb.mvrx.fragmentViewModel
|
||||||
import com.airbnb.mvrx.withState
|
import com.airbnb.mvrx.withState
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
|
@ -27,20 +26,18 @@ import im.vector.riotx.core.extensions.cleanup
|
||||||
import im.vector.riotx.core.extensions.configureWith
|
import im.vector.riotx.core.extensions.configureWith
|
||||||
import im.vector.riotx.core.platform.VectorBaseActivity
|
import im.vector.riotx.core.platform.VectorBaseActivity
|
||||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||||
import im.vector.riotx.core.resources.StringProvider
|
|
||||||
import im.vector.riotx.core.ui.list.genericFooterItem
|
|
||||||
import kotlinx.android.synthetic.main.fragment_generic_recycler.*
|
import kotlinx.android.synthetic.main.fragment_generic_recycler.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
// Referenced in vector_settings_notifications.xml
|
// Referenced in vector_settings_notifications.xml
|
||||||
class PushGatewaysFragment @Inject constructor(
|
class PushGatewaysFragment @Inject constructor(
|
||||||
val pushGatewaysViewModelFactory: PushGatewaysViewModel.Factory
|
val pushGatewaysViewModelFactory: PushGatewaysViewModel.Factory,
|
||||||
|
private val epoxyController: PushGateWayController
|
||||||
) : VectorBaseFragment() {
|
) : VectorBaseFragment() {
|
||||||
|
|
||||||
override fun getLayoutResId(): Int = R.layout.fragment_generic_recycler
|
override fun getLayoutResId() = R.layout.fragment_generic_recycler
|
||||||
|
|
||||||
private val viewModel: PushGatewaysViewModel by fragmentViewModel(PushGatewaysViewModel::class)
|
private val viewModel: PushGatewaysViewModel by fragmentViewModel(PushGatewaysViewModel::class)
|
||||||
private val epoxyController by lazy { PushGateWayController(StringProvider(requireContext().resources)) }
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
@ -60,30 +57,4 @@ class PushGatewaysFragment @Inject constructor(
|
||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
epoxyController.setData(state)
|
epoxyController.setData(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Move to a proper file
|
|
||||||
class PushGateWayController(private val stringProvider: StringProvider) : TypedEpoxyController<PushGatewayViewState>() {
|
|
||||||
override fun buildModels(data: PushGatewayViewState?) {
|
|
||||||
data?.pushGateways?.invoke()?.let { pushers ->
|
|
||||||
if (pushers.isEmpty()) {
|
|
||||||
genericFooterItem {
|
|
||||||
id("footer")
|
|
||||||
text(stringProvider.getString(R.string.settings_push_gateway_no_pushers))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pushers.forEach {
|
|
||||||
pushGatewayItem {
|
|
||||||
id("${it.pushKey}_${it.appId}")
|
|
||||||
pusher(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ?: run {
|
|
||||||
genericFooterItem {
|
|
||||||
id("footer")
|
|
||||||
text(stringProvider.getString(R.string.loading))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import kotlinx.android.synthetic.main.fragment_generic_recycler.*
|
||||||
// Referenced in vector_settings_notifications.xml
|
// Referenced in vector_settings_notifications.xml
|
||||||
class PushRulesFragment : VectorBaseFragment() {
|
class PushRulesFragment : VectorBaseFragment() {
|
||||||
|
|
||||||
override fun getLayoutResId(): Int = R.layout.fragment_generic_recycler
|
override fun getLayoutResId() = R.layout.fragment_generic_recycler
|
||||||
|
|
||||||
private val viewModel: PushRulesViewModel by fragmentViewModel(PushRulesViewModel::class)
|
private val viewModel: PushRulesViewModel by fragmentViewModel(PushRulesViewModel::class)
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,7 @@ class IncomingShareActivity :
|
||||||
return supportFragmentManager.findFragmentById(R.id.shareRoomListFragmentContainer) as? RoomListFragment
|
return supportFragmentManager.findFragmentById(R.id.shareRoomListFragmentContainer) as? RoomListFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutRes(): Int {
|
override fun getLayoutRes() = R.layout.activity_incoming_share
|
||||||
return R.layout.activity_incoming_share
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun injectWith(injector: ScreenComponent) {
|
override fun injectWith(injector: ScreenComponent) {
|
||||||
injector.inject(this)
|
injector.inject(this)
|
||||||
|
|
Loading…
Reference in New Issue