[android] Migrate download item layouts to Material Components

Signed-off-by: Jean-Baptiste Charron <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
Jean-Baptiste
2025-06-22 10:20:13 +02:00
committed by Konstantin Pastbin
parent 754748123c
commit 273eeed9f3
5 changed files with 15 additions and 14 deletions

View File

@@ -11,7 +11,6 @@ import android.text.style.StyleSpan;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.LayoutRes; import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@@ -28,6 +27,7 @@ import app.organicmaps.util.UiUtils;
import app.organicmaps.util.bottomsheet.MenuBottomSheetFragment; import app.organicmaps.util.bottomsheet.MenuBottomSheetFragment;
import app.organicmaps.util.bottomsheet.MenuBottomSheetItem; import app.organicmaps.util.bottomsheet.MenuBottomSheetItem;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.textview.MaterialTextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@@ -362,10 +362,10 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
private class ItemViewHolder extends BaseInnerViewHolder<CountryItem> private class ItemViewHolder extends BaseInnerViewHolder<CountryItem>
{ {
private final DownloaderStatusIcon mStatusIcon; private final DownloaderStatusIcon mStatusIcon;
private final TextView mName; private final MaterialTextView mName;
private final TextView mSubtitle; private final MaterialTextView mSubtitle;
private final TextView mFoundName; private final MaterialTextView mFoundName;
private final TextView mSize; private final MaterialTextView mSize;
private void processClick(boolean clickOnStatus) private void processClick(boolean clickOnStatus)
{ {
@@ -510,7 +510,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
static class HeaderViewHolder extends BaseInnerViewHolder<String> static class HeaderViewHolder extends BaseInnerViewHolder<String>
{ {
@NonNull @NonNull
private final TextView mTitle; private final MaterialTextView mTitle;
HeaderViewHolder(@NonNull View frame) HeaderViewHolder(@NonNull View frame)
{ {

View File

@@ -2,11 +2,12 @@ package app.organicmaps.downloader;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import androidx.annotation.AttrRes; import androidx.annotation.AttrRes;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import com.google.android.material.imageview.ShapeableImageView;
import app.organicmaps.R; import app.organicmaps.R;
import app.organicmaps.widget.WheelProgressView; import app.organicmaps.widget.WheelProgressView;
import app.organicmaps.util.ThemeUtils; import app.organicmaps.util.ThemeUtils;
@@ -15,7 +16,7 @@ import app.organicmaps.util.UiUtils;
public class DownloaderStatusIcon public class DownloaderStatusIcon
{ {
private final View mFrame; private final View mFrame;
protected final ImageView mIcon; protected final ShapeableImageView mIcon;
private final WheelProgressView mProgress; private final WheelProgressView mProgress;
private static final SparseIntArray sIconsCache = new SparseIntArray(); private static final SparseIntArray sIconsCache = new SparseIntArray();

View File

@@ -18,7 +18,7 @@
android:layout_marginEnd="@dimen/margin_base" android:layout_marginEnd="@dimen/margin_base"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
<TextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/size" android:id="@+id/size"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -37,7 +37,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toEndOf="@id/downloader_status_frame" android:layout_toEndOf="@id/downloader_status_frame"
android:layout_toStartOf="@id/size"> android:layout_toStartOf="@id/size">
<TextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/found_name" android:id="@+id/found_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -46,7 +46,7 @@
tools:text="Крымск" tools:text="Крымск"
tools:background="#60FF00FF"/> tools:background="#60FF00FF"/>
<TextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -54,7 +54,7 @@
tools:text="Донецкая область" tools:text="Донецкая область"
tools:background="#40FF0000"/> tools:background="#40FF0000"/>
<TextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/subtitle" android:id="@+id/subtitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:background="#400000FF"> tools:background="#400000FF">
<TextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -15,7 +15,7 @@
wheel:wheelSecondaryColor="?dividerHorizontal" wheel:wheelSecondaryColor="?dividerHorizontal"
wheel:wheelThickness="@dimen/margin_eighth"/> wheel:wheelThickness="@dimen/margin_eighth"/>
<ImageView <com.google.android.material.imageview.ShapeableImageView
android:id="@+id/downloader_status" android:id="@+id/downloader_status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"