[android] Remove title list in description list view

Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
Jean-Baptiste
2025-10-26 10:20:34 +01:00
committed by jeanbaptisteC
parent 647b66cbd0
commit bab74782f8
4 changed files with 8 additions and 17 deletions

View File

@@ -466,12 +466,10 @@ public class BookmarkListAdapter extends RecyclerView.Adapter<Holders.BaseBookma
View desc = inflater.inflate(R.layout.item_category_description, parent, false);
MaterialTextView moreBtn = desc.findViewById(R.id.more_btn);
MaterialTextView text = desc.findViewById(R.id.text);
MaterialTextView title = desc.findViewById(R.id.title);
setMoreButtonVisibility(text, moreBtn);
holder = new Holders.DescriptionViewHolder(desc, mSectionsDataSource.getCategory());
text.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
moreBtn.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
title.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
break;
}

View File

@@ -438,21 +438,17 @@ public class Holders
static final float SPACING_MULTIPLE = 1.0f;
static final float SPACING_ADD = 0.0f;
@NonNull
private final MaterialTextView mTitle;
@NonNull
private final MaterialTextView mDescText;
DescriptionViewHolder(@NonNull View itemView, @NonNull BookmarkCategory category)
{
super(itemView);
mDescText = itemView.findViewById(R.id.text);
mTitle = itemView.findViewById(R.id.title);
}
@Override
void bind(@NonNull SectionPosition position, @NonNull BookmarkListAdapter.SectionsDataSource sectionsDataSource)
{
mTitle.setText(sectionsDataSource.getCategory().getName());
bindDescription(sectionsDataSource.getCategory());
}
@@ -462,9 +458,12 @@ public class Holders
String formattedDesc = desc.replace("\n", "<br>");
Spanned spannedDesc = Utils.fromHtml(formattedDesc);
mDescText.setText(spannedDesc);
UiUtils.showIf(!TextUtils.isEmpty(spannedDesc), mDescText);
if (!TextUtils.isEmpty(spannedDesc)) {
mDescText.setText(spannedDesc);
}
else {
mDescText.setText(R.string.list_description_empty);
}
}
}
}

View File

@@ -6,18 +6,11 @@
android:background="?cardBackground"
android:padding="@dimen/margin_base">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/MwmTextAppearance.Body2.Primary"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/title">
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"

View File

@@ -934,4 +934,5 @@
<string name="error_invalid_number">Invalid number</string>
<string name="offline_explanation_title">Offline Maps</string>
<string name="offline_explanation_text">A map needs to be downloaded to view and navigate the area.\nDownload maps for areas you want to travel.</string>
<string name="list_description_empty">Edit the list to add a description</string>
</resources>