Renaming header list view to be consistent

This commit is contained in:
Maxime NATUREL 2022-08-29 17:30:59 +02:00
parent e2aa66e4c2
commit 969663786b
4 changed files with 18 additions and 18 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DevicesListHeaderView">
<declare-styleable name="SessionsListHeaderView">
<attr name="devicesListHeaderTitle" format="string" />
<attr name="devicesListHeaderDescription" format="string" />
</declare-styleable>

View file

@ -25,15 +25,15 @@ import androidx.core.content.res.use
import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.core.extensions.setTextWithColoredPart
import im.vector.app.databinding.ViewDevicesListHeaderBinding
import im.vector.app.databinding.ViewSessionsListHeaderBinding
class DevicesListHeaderView @JvmOverloads constructor(
class SessionsListHeaderView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private val binding = ViewDevicesListHeaderBinding.inflate(
private val binding = ViewSessionsListHeaderBinding.inflate(
LayoutInflater.from(context),
this
)
@ -43,7 +43,7 @@ class DevicesListHeaderView @JvmOverloads constructor(
init {
context.obtainStyledAttributes(
attrs,
R.styleable.DevicesListHeaderView,
R.styleable.SessionsListHeaderView,
0,
0
).use {
@ -53,14 +53,14 @@ class DevicesListHeaderView @JvmOverloads constructor(
}
private fun setTitle(typedArray: TypedArray) {
val title = typedArray.getString(R.styleable.DevicesListHeaderView_devicesListHeaderTitle)
binding.devicesListHeaderTitle.text = title
val title = typedArray.getString(R.styleable.SessionsListHeaderView_devicesListHeaderTitle)
binding.sessionsListHeaderTitle.text = title
}
private fun setDescription(typedArray: TypedArray) {
val description = typedArray.getString(R.styleable.DevicesListHeaderView_devicesListHeaderDescription)
val description = typedArray.getString(R.styleable.SessionsListHeaderView_devicesListHeaderDescription)
if (description.isNullOrEmpty()) {
binding.devicesListHeaderDescription.isVisible = false
binding.sessionsListHeaderDescription.isVisible = false
return
}
@ -70,8 +70,8 @@ class DevicesListHeaderView @JvmOverloads constructor(
stringBuilder.append(" ")
stringBuilder.append(learnMore)
binding.devicesListHeaderDescription.isVisible = true
binding.devicesListHeaderDescription.setTextWithColoredPart(
binding.sessionsListHeaderDescription.isVisible = true
binding.sessionsListHeaderDescription.setTextWithColoredPart(
fullText = stringBuilder.toString(),
coloredPart = learnMore,
underline = false

View file

@ -56,7 +56,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deviceListInactiveSessionsRecommendation" />
<im.vector.app.features.settings.devices.v2.list.DevicesListHeaderView
<im.vector.app.features.settings.devices.v2.list.SessionsListHeaderView
android:id="@+id/deviceListHeaderCurrentSession"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -66,7 +66,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deviceListSecurityRecommendationsDivider" />
<im.vector.app.features.settings.devices.v2.list.CurrentSessionView
<im.vector.app.features.settings.devices.v2.list.SessionInfoView
android:id="@+id/deviceListCurrentSession"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -86,7 +86,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deviceListCurrentSession" />
<im.vector.app.features.settings.devices.v2.list.DevicesListHeaderView
<im.vector.app.features.settings.devices.v2.list.SessionsListHeaderView
android:id="@+id/deviceListHeaderOtherSessions"
android:layout_width="0dp"
android:layout_height="wrap_content"

View file

@ -7,7 +7,7 @@
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<TextView
android:id="@+id/devices_list_header_title"
android:id="@+id/sessions_list_header_title"
style="@style/TextAppearance.Vector.Subtitle.Medium.DevicesManagement"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -19,14 +19,14 @@
tools:text="Other sessions" />
<TextView
android:id="@+id/devices_list_header_description"
android:id="@+id/sessions_list_header_description"
style="@style/TextAppearance.Vector.Body.DevicesManagement"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="18.5dp"
android:layout_marginEnd="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/devices_list_header_title"
app:layout_constraintTop_toBottomOf="@id/devices_list_header_title"
app:layout_constraintStart_toStartOf="@id/sessions_list_header_title"
app:layout_constraintTop_toBottomOf="@id/sessions_list_header_title"
tools:text="For best security, verify your sessions and sign out from any session that you dont recognize or use anymore. Learn More." />
</merge>