mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 06:03:45 +00:00
[android] Remove title list in description list view
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
committed by
jeanbaptisteC
parent
647b66cbd0
commit
bab74782f8
@@ -466,12 +466,10 @@ public class BookmarkListAdapter extends RecyclerView.Adapter<Holders.BaseBookma
|
|||||||
View desc = inflater.inflate(R.layout.item_category_description, parent, false);
|
View desc = inflater.inflate(R.layout.item_category_description, parent, false);
|
||||||
MaterialTextView moreBtn = desc.findViewById(R.id.more_btn);
|
MaterialTextView moreBtn = desc.findViewById(R.id.more_btn);
|
||||||
MaterialTextView text = desc.findViewById(R.id.text);
|
MaterialTextView text = desc.findViewById(R.id.text);
|
||||||
MaterialTextView title = desc.findViewById(R.id.title);
|
|
||||||
setMoreButtonVisibility(text, moreBtn);
|
setMoreButtonVisibility(text, moreBtn);
|
||||||
holder = new Holders.DescriptionViewHolder(desc, mSectionsDataSource.getCategory());
|
holder = new Holders.DescriptionViewHolder(desc, mSectionsDataSource.getCategory());
|
||||||
text.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
|
text.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
|
||||||
moreBtn.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
|
moreBtn.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
|
||||||
title.setOnClickListener(v -> onMoreButtonClicked(text, moreBtn));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -438,21 +438,17 @@ public class Holders
|
|||||||
static final float SPACING_MULTIPLE = 1.0f;
|
static final float SPACING_MULTIPLE = 1.0f;
|
||||||
static final float SPACING_ADD = 0.0f;
|
static final float SPACING_ADD = 0.0f;
|
||||||
@NonNull
|
@NonNull
|
||||||
private final MaterialTextView mTitle;
|
|
||||||
@NonNull
|
|
||||||
private final MaterialTextView mDescText;
|
private final MaterialTextView mDescText;
|
||||||
|
|
||||||
DescriptionViewHolder(@NonNull View itemView, @NonNull BookmarkCategory category)
|
DescriptionViewHolder(@NonNull View itemView, @NonNull BookmarkCategory category)
|
||||||
{
|
{
|
||||||
super(itemView);
|
super(itemView);
|
||||||
mDescText = itemView.findViewById(R.id.text);
|
mDescText = itemView.findViewById(R.id.text);
|
||||||
mTitle = itemView.findViewById(R.id.title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void bind(@NonNull SectionPosition position, @NonNull BookmarkListAdapter.SectionsDataSource sectionsDataSource)
|
void bind(@NonNull SectionPosition position, @NonNull BookmarkListAdapter.SectionsDataSource sectionsDataSource)
|
||||||
{
|
{
|
||||||
mTitle.setText(sectionsDataSource.getCategory().getName());
|
|
||||||
bindDescription(sectionsDataSource.getCategory());
|
bindDescription(sectionsDataSource.getCategory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,9 +458,12 @@ public class Holders
|
|||||||
|
|
||||||
String formattedDesc = desc.replace("\n", "<br>");
|
String formattedDesc = desc.replace("\n", "<br>");
|
||||||
Spanned spannedDesc = Utils.fromHtml(formattedDesc);
|
Spanned spannedDesc = Utils.fromHtml(formattedDesc);
|
||||||
|
if (!TextUtils.isEmpty(spannedDesc)) {
|
||||||
mDescText.setText(spannedDesc);
|
mDescText.setText(spannedDesc);
|
||||||
|
}
|
||||||
UiUtils.showIf(!TextUtils.isEmpty(spannedDesc), mDescText);
|
else {
|
||||||
|
mDescText.setText(R.string.list_description_empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,18 +6,11 @@
|
|||||||
android:background="?cardBackground"
|
android:background="?cardBackground"
|
||||||
android:padding="@dimen/margin_base">
|
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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/text"
|
android:id="@+id/text"
|
||||||
|
|||||||
@@ -934,4 +934,5 @@
|
|||||||
<string name="error_invalid_number">Invalid number</string>
|
<string name="error_invalid_number">Invalid number</string>
|
||||||
<string name="offline_explanation_title">Offline Maps</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="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>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user