mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Add encryption shield
Change thread list filtering UI tick to radio buttons
This commit is contained in:
parent
ff87f07f65
commit
3a3cce85f8
12 changed files with 62 additions and 20 deletions
|
@ -1594,6 +1594,7 @@ class TimelineFragment @Inject constructor(
|
||||||
timelineArgs.threadTimelineArgs?.let {
|
timelineArgs.threadTimelineArgs?.let {
|
||||||
val matrixItem = MatrixItem.RoomItem(it.roomId, it.displayName, it.avatarUrl)
|
val matrixItem = MatrixItem.RoomItem(it.roomId, it.displayName, it.avatarUrl)
|
||||||
avatarRenderer.render(matrixItem, views.includeThreadToolbar.roomToolbarThreadImageView)
|
avatarRenderer.render(matrixItem, views.includeThreadToolbar.roomToolbarThreadImageView)
|
||||||
|
views.includeThreadToolbar.roomToolbarThreadShieldImageView.render(it.roomEncryptionTrustLevel)
|
||||||
views.includeThreadToolbar.roomToolbarThreadSubtitleTextView.text = it.displayName
|
views.includeThreadToolbar.roomToolbarThreadSubtitleTextView.text = it.displayName
|
||||||
}
|
}
|
||||||
views.includeThreadToolbar.roomToolbarThreadTitleTextView.text = resources.getText(R.string.thread_timeline_title)
|
views.includeThreadToolbar.roomToolbarThreadTitleTextView.text = resources.getText(R.string.thread_timeline_title)
|
||||||
|
@ -2321,6 +2322,7 @@ class TimelineFragment @Inject constructor(
|
||||||
roomId = timelineArgs.roomId,
|
roomId = timelineArgs.roomId,
|
||||||
displayName = roomDetailViewModel.getRoomSummary()?.displayName,
|
displayName = roomDetailViewModel.getRoomSummary()?.displayName,
|
||||||
avatarUrl = roomDetailViewModel.getRoomSummary()?.avatarUrl,
|
avatarUrl = roomDetailViewModel.getRoomSummary()?.avatarUrl,
|
||||||
|
roomEncryptionTrustLevel = roomDetailViewModel.getRoomSummary()?.roomEncryptionTrustLevel,
|
||||||
rootThreadEventId = rootThreadEventId)
|
rootThreadEventId = rootThreadEventId)
|
||||||
navigator.openThread(it, roomThreadDetailArgs)
|
navigator.openThread(it, roomThreadDetailArgs)
|
||||||
}
|
}
|
||||||
|
@ -2336,6 +2338,7 @@ class TimelineFragment @Inject constructor(
|
||||||
val roomThreadDetailArgs = ThreadTimelineArgs(
|
val roomThreadDetailArgs = ThreadTimelineArgs(
|
||||||
roomId = timelineArgs.roomId,
|
roomId = timelineArgs.roomId,
|
||||||
displayName = roomDetailViewModel.getRoomSummary()?.displayName,
|
displayName = roomDetailViewModel.getRoomSummary()?.displayName,
|
||||||
|
roomEncryptionTrustLevel = roomDetailViewModel.getRoomSummary()?.roomEncryptionTrustLevel,
|
||||||
avatarUrl = roomDetailViewModel.getRoomSummary()?.avatarUrl)
|
avatarUrl = roomDetailViewModel.getRoomSummary()?.avatarUrl)
|
||||||
navigator.openThreadList(it, roomThreadDetailArgs)
|
navigator.openThreadList(it, roomThreadDetailArgs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,12 @@ class SearchFragment @Inject constructor(
|
||||||
private fun navigateToEvent(event: Event) {
|
private fun navigateToEvent(event: Event) {
|
||||||
val roomId = event.roomId ?: return
|
val roomId = event.roomId ?: return
|
||||||
event.getRootThreadEventId()?.let {
|
event.getRootThreadEventId()?.let {
|
||||||
val threadTimelineArgs = ThreadTimelineArgs(roomId, displayName = fragmentArgs.roomDisplayName, fragmentArgs.roomAvatarUrl, it)
|
val threadTimelineArgs = ThreadTimelineArgs(
|
||||||
|
roomId = roomId,
|
||||||
|
displayName = fragmentArgs.roomDisplayName,
|
||||||
|
avatarUrl = fragmentArgs.roomAvatarUrl,
|
||||||
|
roomEncryptionTrustLevel = null,
|
||||||
|
rootThreadEventId = it)
|
||||||
navigator.openThread(requireContext(), threadTimelineArgs, event.eventId)
|
navigator.openThread(requireContext(), threadTimelineArgs, event.eventId)
|
||||||
} ?: navigator.openRoom(requireContext(), roomId, event.eventId)
|
} ?: navigator.openRoom(requireContext(), roomId, event.eventId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ class ThreadsActivity : VectorBaseActivity<ActivityThreadsBinding>(), ToolbarCon
|
||||||
roomId = timelineEvent.roomId,
|
roomId = timelineEvent.roomId,
|
||||||
displayName = timelineEvent.senderInfo.displayName,
|
displayName = timelineEvent.senderInfo.displayName,
|
||||||
avatarUrl = timelineEvent.senderInfo.avatarUrl,
|
avatarUrl = timelineEvent.senderInfo.avatarUrl,
|
||||||
|
roomEncryptionTrustLevel = null,
|
||||||
rootThreadEventId = timelineEvent.eventId)
|
rootThreadEventId = timelineEvent.eventId)
|
||||||
val commonOption: (FragmentTransaction) -> Unit = {
|
val commonOption: (FragmentTransaction) -> Unit = {
|
||||||
it.setCustomAnimations(
|
it.setCustomAnimations(
|
||||||
|
|
|
@ -18,10 +18,12 @@ package im.vector.app.features.home.room.threads.arguments
|
||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class ThreadListArgs(
|
data class ThreadListArgs(
|
||||||
val roomId: String,
|
val roomId: String,
|
||||||
val displayName: String?,
|
val displayName: String?,
|
||||||
val avatarUrl: String?,
|
val avatarUrl: String?,
|
||||||
|
val roomEncryptionTrustLevel: RoomEncryptionTrustLevel?
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
|
@ -18,11 +18,13 @@ package im.vector.app.features.home.room.threads.arguments
|
||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class ThreadTimelineArgs(
|
data class ThreadTimelineArgs(
|
||||||
val roomId: String,
|
val roomId: String,
|
||||||
val displayName: String?,
|
val displayName: String?,
|
||||||
val avatarUrl: String?,
|
val avatarUrl: String?,
|
||||||
|
val roomEncryptionTrustLevel: RoomEncryptionTrustLevel?,
|
||||||
val rootThreadEventId: String? = null
|
val rootThreadEventId: String? = null
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
|
@ -16,17 +16,21 @@
|
||||||
|
|
||||||
package im.vector.app.features.home.room.threads.list.views
|
package im.vector.app.features.home.room.threads.list.views
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.annotation.AttrRes
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import com.airbnb.mvrx.parentFragmentViewModel
|
import com.airbnb.mvrx.parentFragmentViewModel
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
|
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
|
||||||
import im.vector.app.databinding.BottomSheetThreadListBinding
|
import im.vector.app.databinding.BottomSheetThreadListBinding
|
||||||
import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewModel
|
import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewModel
|
||||||
import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewState
|
import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewState
|
||||||
|
import im.vector.app.features.themes.ThemeUtils
|
||||||
|
|
||||||
class ThreadListBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetThreadListBinding>() {
|
class ThreadListBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetThreadListBinding>() {
|
||||||
|
|
||||||
|
@ -53,8 +57,29 @@ class ThreadListBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetThr
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderState(state: ThreadListViewState) {
|
private fun renderState(state: ThreadListViewState) {
|
||||||
val tickDrawable = ContextCompat.getDrawable(requireContext(), R.drawable.ic_tick)
|
val radioOffDrawable = ContextCompat.getDrawable(requireContext(), R.drawable.ic_radio_off)
|
||||||
views.threadListModalAllThreads.rightIcon = if (state.shouldFilterThreads) null else tickDrawable
|
val radioOnDrawable = ContextCompat.getDrawable(requireContext(), R.drawable.ic_radio_on)
|
||||||
views.threadListModalMyThreads.rightIcon = if (state.shouldFilterThreads) tickDrawable else null
|
|
||||||
|
if (state.shouldFilterThreads) {
|
||||||
|
setRightIconDrawableAllThreads(radioOffDrawable, R.attr.vctr_content_primary)
|
||||||
|
setRightIconDrawableMyThreads(radioOnDrawable, R.attr.colorPrimary)
|
||||||
|
} else {
|
||||||
|
setRightIconDrawableAllThreads(radioOnDrawable, R.attr.colorPrimary)
|
||||||
|
setRightIconDrawableMyThreads(radioOffDrawable, R.attr.vctr_content_primary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setRightIconDrawableAllThreads(drawable: Drawable?, @AttrRes tint: Int) {
|
||||||
|
views.threadListModalAllThreads.rightIcon = drawable
|
||||||
|
views.threadListModalAllThreads.rightIcon?.setTintFromAttribute(tint)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setRightIconDrawableMyThreads(drawable: Drawable?, @AttrRes tint: Int) {
|
||||||
|
views.threadListModalMyThreads.rightIcon = drawable
|
||||||
|
views.threadListModalMyThreads.rightIcon?.setTintFromAttribute(tint)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Drawable.setTintFromAttribute(@AttrRes tint: Int) {
|
||||||
|
DrawableCompat.setTint(this, ThemeUtils.getColor(requireContext(), tint))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ class ThreadListFragment @Inject constructor(
|
||||||
views.includeThreadListToolbar.roomToolbarThreadConstraintLayout.isVisible = true
|
views.includeThreadListToolbar.roomToolbarThreadConstraintLayout.isVisible = true
|
||||||
val matrixItem = MatrixItem.RoomItem(threadListArgs.roomId, threadListArgs.displayName, threadListArgs.avatarUrl)
|
val matrixItem = MatrixItem.RoomItem(threadListArgs.roomId, threadListArgs.displayName, threadListArgs.avatarUrl)
|
||||||
avatarRenderer.render(matrixItem, views.includeThreadListToolbar.roomToolbarThreadImageView)
|
avatarRenderer.render(matrixItem, views.includeThreadListToolbar.roomToolbarThreadImageView)
|
||||||
|
views.includeThreadListToolbar.roomToolbarThreadShieldImageView.render(threadListArgs.roomEncryptionTrustLevel)
|
||||||
views.includeThreadListToolbar.roomToolbarThreadTitleTextView.text = resources.getText(R.string.thread_list_title)
|
views.includeThreadListToolbar.roomToolbarThreadTitleTextView.text = resources.getText(R.string.thread_list_title)
|
||||||
views.includeThreadListToolbar.roomToolbarThreadSubtitleTextView.text = threadListArgs.displayName
|
views.includeThreadListToolbar.roomToolbarThreadSubtitleTextView.text = threadListArgs.displayName
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,7 +569,8 @@ class DefaultNavigator @Inject constructor(
|
||||||
threadListArgs = ThreadListArgs(
|
threadListArgs = ThreadListArgs(
|
||||||
roomId = threadTimelineArgs.roomId,
|
roomId = threadTimelineArgs.roomId,
|
||||||
displayName = threadTimelineArgs.displayName,
|
displayName = threadTimelineArgs.displayName,
|
||||||
avatarUrl = threadTimelineArgs.avatarUrl
|
avatarUrl = threadTimelineArgs.avatarUrl,
|
||||||
|
roomEncryptionTrustLevel = threadTimelineArgs.roomEncryptionTrustLevel
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,12 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
|
||||||
) {
|
) {
|
||||||
if (this?.navToRoom(roomId, eventId, rawLink, rootThreadEventId) != true) {
|
if (this?.navToRoom(roomId, eventId, rawLink, rootThreadEventId) != true) {
|
||||||
rootThreadEventId?.let {
|
rootThreadEventId?.let {
|
||||||
val threadTimelineArgs = ThreadTimelineArgs(roomId, displayName = roomSummary.displayName, roomSummary.avatarUrl, it)
|
val threadTimelineArgs = ThreadTimelineArgs(
|
||||||
|
roomId = roomId,
|
||||||
|
displayName = roomSummary.displayName,
|
||||||
|
avatarUrl = roomSummary.avatarUrl,
|
||||||
|
roomEncryptionTrustLevel = roomSummary.roomEncryptionTrustLevel,
|
||||||
|
rootThreadEventId = it)
|
||||||
navigator.openThread(context, threadTimelineArgs, eventId)
|
navigator.openThread(context, threadTimelineArgs, eventId)
|
||||||
} ?: navigator.openRoom(context, roomId, eventId, buildTask)
|
} ?: navigator.openRoom(context, roomId, eventId, buildTask)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,6 @@
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24">
|
||||||
<path
|
<path
|
||||||
android:pathData="M4,6.5h16"
|
android:pathData="M10.9996,18H12.9996C13.5496,18 13.9996,17.55 13.9996,17C13.9996,16.45 13.5496,16 12.9996,16H10.9996C10.4496,16 9.9996,16.45 9.9996,17C9.9996,17.55 10.4496,18 10.9996,18ZM2.9996,7C2.9996,7.55 3.4496,8 3.9996,8H19.9996C20.5496,8 20.9996,7.55 20.9996,7C20.9996,6.45 20.5496,6 19.9996,6H3.9996C3.4496,6 2.9996,6.45 2.9996,7ZM6.9996,13H16.9996C17.5496,13 17.9996,12.55 17.9996,12C17.9996,11.45 17.5496,11 16.9996,11H6.9996C6.4496,11 5.9996,11.45 5.9996,12C5.9996,12.55 6.4496,13 6.9996,13Z"
|
||||||
android:strokeWidth="1.8"
|
android:fillColor="#737D8C"/>
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:strokeColor="#9E9E9E"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:strokeLineCap="round"/>
|
|
||||||
<path
|
|
||||||
android:pathData="M6,12.5h12M9,18.5h6"
|
|
||||||
android:strokeWidth="2"
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:strokeColor="#9E9E9E"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:strokeLineCap="round"/>
|
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?colorSurface"
|
android:background="?colorSurface"
|
||||||
|
|
|
@ -35,6 +35,15 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/roomToolbarThreadTitleTextView"
|
app:layout_constraintTop_toBottomOf="@id/roomToolbarThreadTitleTextView"
|
||||||
tools:src="@sample/room_round_avatars" />
|
tools:src="@sample/room_round_avatars" />
|
||||||
|
|
||||||
|
<im.vector.app.core.ui.views.ShieldImageView
|
||||||
|
android:id="@+id/roomToolbarThreadShieldImageView"
|
||||||
|
android:layout_width="10dp"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
app:layout_constraintCircle="@id/roomToolbarThreadImageView"
|
||||||
|
app:layout_constraintCircleAngle="135"
|
||||||
|
app:layout_constraintCircleRadius="10dp"
|
||||||
|
tools:ignore="MissingConstraints" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/roomToolbarThreadSubtitleTextView"
|
android:id="@+id/roomToolbarThreadSubtitleTextView"
|
||||||
style="@style/Widget.Vector.TextView.Caption"
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
|
|
Loading…
Reference in a new issue