Update Header Setting to allow for a description under the title

Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
This commit is contained in:
David Griswold 2024-09-27 11:57:14 +01:00 committed by OpenSauce04
parent 47b487ff65
commit 8b800e58f6
3 changed files with 31 additions and 8 deletions

View file

@ -1,9 +1,9 @@
// Copyright 2023 Citra Emulator Project
// Copyright Citra Emulator Project / Lime3DS Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
package io.github.lime3ds.android.features.settings.model.view
class HeaderSetting(titleId: Int) : SettingsItem(null, titleId, 0) {
class HeaderSetting(titleId: Int, descId: Int = 0) : SettingsItem(null, titleId, descId) {
override val type = TYPE_HEADER
}

View file

@ -1,4 +1,4 @@
// Copyright 2023 Citra Emulator Project
// Copyright Citra Emulator Project / Lime3DS Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -18,6 +18,12 @@ class HeaderViewHolder(val binding: ListItemSettingsHeaderBinding, adapter: Sett
override fun bind(item: SettingsItem) {
binding.textHeaderName.setText(item.nameId)
if (item.descriptionId != 0) {
binding.textHeaderDescription.visibility = View.VISIBLE
binding.textHeaderDescription.setText(item.descriptionId)
}else {
binding.textHeaderDescription.visibility = View.GONE
}
}
override fun onClick(clicked: View) {

View file

@ -1,16 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textview.MaterialTextView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false"
android:clickable="false"
android:padding="16dp"
>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text_header_name"
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingHorizontal="@dimen/spacing_large"
android:paddingVertical="16dp"
android:focusable="false"
android:clickable="false"
android:textAlignment="viewStart"
android:textColor="?attr/colorPrimary"
android:textStyle="bold"
tools:text="CPU Settings" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text_header_description"
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_small"
android:textAlignment="viewStart"
tools:text="@string/app_disclaimer" />
</LinearLayout>