-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Space List Bottom Sheet #6749
Changes from 17 commits
ab4eda1
55d8b6a
aa24deb
5d18365
b4ed380
79e6dd0
ff71e69
0506c9a
a821f34
90f2b93
0567fa3
e6508e8
41d859d
1ffa02c
7565707
7b61460
9892c66
65b7a31
f94aad6
ddaf539
e87eefb
358ec5a
fd37b31
8b0fba2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds space list bottom sheet for new app layout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to provide changelogs for features, which are not accessible for users 🤔 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* 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.app.features.grouplist | ||
|
||
import android.content.res.ColorStateList | ||
import android.widget.ImageView | ||
import android.widget.TextView | ||
import androidx.core.content.ContextCompat | ||
import androidx.core.graphics.ColorUtils | ||
import com.airbnb.epoxy.EpoxyAttribute | ||
import com.airbnb.epoxy.EpoxyModelClass | ||
import im.vector.app.R | ||
import im.vector.app.core.epoxy.ClickListener | ||
import im.vector.app.core.epoxy.VectorEpoxyHolder | ||
import im.vector.app.core.epoxy.VectorEpoxyModel | ||
import im.vector.app.core.epoxy.onClick | ||
import im.vector.app.core.platform.CheckableConstraintLayout | ||
import im.vector.app.features.home.room.list.UnreadCounterBadgeView | ||
import im.vector.app.features.themes.ThemeUtils | ||
|
||
@EpoxyModelClass | ||
abstract class NewHomeSpaceSummaryItem : VectorEpoxyModel<NewHomeSpaceSummaryItem.Holder>(R.layout.item_new_space) { | ||
|
||
@EpoxyAttribute var text: String = "" | ||
@EpoxyAttribute var selected: Boolean = false | ||
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) var listener: ClickListener? = null | ||
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false) | ||
@EpoxyAttribute var showSeparator: Boolean = false | ||
|
||
override fun getViewType() = R.id.space_item_home | ||
|
||
override fun bind(holder: Holder) { | ||
super.bind(holder) | ||
holder.root.onClick(listener) | ||
holder.name.text = holder.view.context.getString(R.string.all_chats) | ||
holder.root.isChecked = selected | ||
holder.root.context.resources | ||
holder.avatar.background = ContextCompat.getDrawable(holder.view.context, R.drawable.new_space_home_background) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it better to set it in xml? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No because we use the same XML for |
||
holder.avatar.backgroundTintList = ColorStateList.valueOf( | ||
ColorUtils.setAlphaComponent(ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_tertiary), (255 * 0.3).toInt())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to move to xml resource, both declaration of color state and setting it as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
holder.avatar.setImageResource(R.drawable.ic_space_home) | ||
holder.avatar.imageTintList = ColorStateList.valueOf(ThemeUtils.getColor(holder.view.context, R.attr.vctr_content_primary)) | ||
holder.avatar.scaleType = ImageView.ScaleType.CENTER_INSIDE | ||
|
||
holder.unreadCounter.render(countState) | ||
} | ||
|
||
class Holder : VectorEpoxyHolder() { | ||
val root by bind<CheckableConstraintLayout>(R.id.root) | ||
val avatar by bind<ImageView>(R.id.avatar) | ||
val name by bind<TextView>(R.id.name) | ||
val unreadCounter by bind<UnreadCounterBadgeView>(R.id.unread_counter) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ import im.vector.app.features.call.SharedKnownCallsViewModel | |
import im.vector.app.features.call.VectorCallActivity | ||
import im.vector.app.features.call.dialpad.DialPadFragment | ||
import im.vector.app.features.call.webrtc.WebRtcCallManager | ||
import im.vector.app.features.home.room.list.RoomListParams | ||
import im.vector.app.features.home.room.list.home.HomeRoomListFragment | ||
import im.vector.app.features.popup.PopupAlertManager | ||
import im.vector.app.features.popup.VerificationVectorAlert | ||
|
@@ -67,7 +68,7 @@ class NewHomeDetailFragment @Inject constructor( | |
private val alertManager: PopupAlertManager, | ||
private val callManager: WebRtcCallManager, | ||
private val vectorPreferences: VectorPreferences, | ||
private val appStateHandler: SpaceStateHandler, | ||
private val spaceStateHandler: SpaceStateHandler, | ||
private val session: Session, | ||
) : VectorBaseFragment<FragmentNewHomeDetailBinding>(), | ||
KeysBackupBanner.Delegate, | ||
|
@@ -176,13 +177,13 @@ class NewHomeDetailFragment @Inject constructor( | |
} | ||
|
||
private fun navigateBack() { | ||
val previousSpaceId = appStateHandler.getSpaceBackstack().removeLastOrNull() | ||
val parentSpaceId = appStateHandler.getCurrentSpace()?.flattenParentIds?.lastOrNull() | ||
val previousSpaceId = spaceStateHandler.getSpaceBackstack().removeLastOrNull() | ||
val parentSpaceId = spaceStateHandler.getCurrentSpace()?.flattenParentIds?.lastOrNull() | ||
setCurrentSpace(previousSpaceId ?: parentSpaceId) | ||
} | ||
|
||
private fun setCurrentSpace(spaceId: String?) { | ||
appStateHandler.setCurrentSpace(spaceId, isForwardNavigation = false) | ||
spaceStateHandler.setCurrentSpace(spaceId, isForwardNavigation = false) | ||
sharedActionViewModel.post(HomeActivitySharedAction.OnCloseSpace) | ||
} | ||
|
||
|
@@ -205,7 +206,7 @@ class NewHomeDetailFragment @Inject constructor( | |
} | ||
|
||
private fun refreshSpaceState() { | ||
appStateHandler.getCurrentSpace()?.let { | ||
spaceStateHandler.getCurrentSpace()?.let { | ||
onSpaceChange(it) | ||
} | ||
} | ||
|
@@ -337,7 +338,8 @@ class NewHomeDetailFragment @Inject constructor( | |
if (fragmentToShow == null) { | ||
when (tab) { | ||
is HomeTab.RoomList -> { | ||
add(R.id.roomListContainer, HomeRoomListFragment::class.java, null, fragmentTag) | ||
val params = RoomListParams(tab.displayMode) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need any param for HomeRoomListFragment |
||
add(R.id.roomListContainer, HomeRoomListFragment::class.java, params.toMvRxBundle(), fragmentTag) | ||
} | ||
is HomeTab.DialPad -> { | ||
add(R.id.roomListContainer, createDialPadFragment(), fragmentTag) | ||
|
@@ -450,7 +452,7 @@ class NewHomeDetailFragment @Inject constructor( | |
return this | ||
} | ||
|
||
override fun onBackPressed(toolbarButton: Boolean) = if (appStateHandler.getCurrentSpace() != null) { | ||
override fun onBackPressed(toolbarButton: Boolean) = if (spaceStateHandler.getCurrentSpace() != null) { | ||
navigateBack() | ||
true | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2022 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.features.home.room.list.actions | ||
|
||
import im.vector.app.core.platform.VectorSharedAction | ||
|
||
sealed class RoomListSharedAction : VectorSharedAction { | ||
|
||
object CloseBottomSheet : RoomListSharedAction() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2022 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.features.home.room.list.actions | ||
|
||
import im.vector.app.core.platform.VectorSharedActionViewModel | ||
import javax.inject.Inject | ||
|
||
class RoomListSharedActionViewModel @Inject constructor() : VectorSharedActionViewModel<RoomListSharedAction>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to provide changelog for features which are not accessible yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should them but they should be
.wip