Renaming header list view to be consistent

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

View file

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

View file

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

View file

@ -56,7 +56,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deviceListInactiveSessionsRecommendation" /> 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:id="@+id/deviceListHeaderCurrentSession"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -66,7 +66,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deviceListSecurityRecommendationsDivider" /> 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:id="@+id/deviceListCurrentSession"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -86,7 +86,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deviceListCurrentSession" /> 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:id="@+id/deviceListHeaderOtherSessions"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

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