mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-25 23:33:53 +00:00
[android] Migrate place page to Material Components
Signed-off-by: Jean-Baptiste Charron <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
committed by
Konstantin Pastbin
parent
99bb468448
commit
15b3cda4d7
@@ -4,8 +4,6 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -15,6 +13,10 @@ import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.google.android.material.imageview.ShapeableImageView;
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.util.Graphics;
|
||||
import app.organicmaps.util.WindowInsetUtils.PaddingInsetsListener;
|
||||
@@ -109,8 +111,8 @@ public final class PlacePageButtons extends Fragment implements Observer<List<Pl
|
||||
LayoutInflater inflater = LayoutInflater.from(requireContext());
|
||||
View parent = inflater.inflate(R.layout.place_page_button, mButtonsContainer, false);
|
||||
|
||||
ImageView icon = parent.findViewById(R.id.icon);
|
||||
TextView title = parent.findViewById(R.id.title);
|
||||
ShapeableImageView icon = parent.findViewById(R.id.icon);
|
||||
MaterialTextView title = parent.findViewById(R.id.title);
|
||||
|
||||
title.setText(current.getTitle());
|
||||
parent.setContentDescription(getString(current.getTitle()));
|
||||
|
||||
@@ -13,7 +13,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -49,11 +48,11 @@ import app.organicmaps.widget.placepage.sections.PlacePageBookmarkFragment;
|
||||
import app.organicmaps.widget.placepage.sections.PlacePageLinksFragment;
|
||||
import app.organicmaps.widget.placepage.sections.PlacePageOpeningHoursFragment;
|
||||
import app.organicmaps.widget.placepage.sections.PlacePagePhoneFragment;
|
||||
import app.organicmaps.widget.placepage.sections.PlacePageProductsFragment;
|
||||
import app.organicmaps.widget.placepage.sections.PlacePageWikipediaFragment;
|
||||
|
||||
import com.google.android.material.appbar.MaterialToolbar;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -88,38 +87,38 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
||||
// Preview.
|
||||
private ViewGroup mPreview;
|
||||
private MaterialToolbar mToolbar;
|
||||
private TextView mTvTitle;
|
||||
private TextView mTvSecondaryTitle;
|
||||
private TextView mTvSubtitle;
|
||||
private MaterialTextView mTvTitle;
|
||||
private MaterialTextView mTvSecondaryTitle;
|
||||
private MaterialTextView mTvSubtitle;
|
||||
private ArrowView mAvDirection;
|
||||
private TextView mTvDistance;
|
||||
private TextView mTvAddress;
|
||||
private MaterialTextView mTvDistance;
|
||||
private MaterialTextView mTvAddress;
|
||||
// Details.
|
||||
private TextView mTvLatlon;
|
||||
private MaterialTextView mTvLatlon;
|
||||
private View mWifi;
|
||||
private TextView mTvWiFi;
|
||||
private MaterialTextView mTvWiFi;
|
||||
private View mOperator;
|
||||
private TextView mTvOperator;
|
||||
private MaterialTextView mTvOperator;
|
||||
private View mNetwork;
|
||||
private TextView mTvNetwork;
|
||||
private MaterialTextView mTvNetwork;
|
||||
private View mLevel;
|
||||
private TextView mTvLevel;
|
||||
private MaterialTextView mTvLevel;
|
||||
private View mAtm;
|
||||
private TextView mTvAtm;
|
||||
private MaterialTextView mTvAtm;
|
||||
private View mCapacity;
|
||||
private TextView mTvCapacity;
|
||||
private MaterialTextView mTvCapacity;
|
||||
private View mWheelchair;
|
||||
private TextView mTvWheelchair;
|
||||
private MaterialTextView mTvWheelchair;
|
||||
private View mDriveThrough;
|
||||
private TextView mTvDriveThrough;
|
||||
private MaterialTextView mTvDriveThrough;
|
||||
private View mSelfService;
|
||||
private TextView mTvSelfService;
|
||||
private MaterialTextView mTvSelfService;
|
||||
private View mCuisine;
|
||||
private TextView mTvCuisine;
|
||||
private MaterialTextView mTvCuisine;
|
||||
private View mOutdoorSeating;
|
||||
private TextView mTvOutdoorSeating;
|
||||
private MaterialTextView mTvOutdoorSeating;
|
||||
private View mEntrance;
|
||||
private TextView mTvEntrance;
|
||||
private MaterialTextView mTvEntrance;
|
||||
private View mEditPlace;
|
||||
private View mAddOrganisation;
|
||||
private View mAddPlace;
|
||||
@@ -129,7 +128,7 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
||||
private CoordinatesFormat mCoordsFormat = CoordinatesFormat.LatLonDecimal;
|
||||
// Downloader`s stuff
|
||||
private DownloaderStatusIcon mDownloaderIcon;
|
||||
private TextView mDownloaderInfo;
|
||||
private MaterialTextView mDownloaderInfo;
|
||||
private int mStorageCallbackSlot;
|
||||
@Nullable
|
||||
private CountryItem mCurrentCountry;
|
||||
@@ -161,7 +160,7 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
||||
private PlacePageViewModel mViewModel;
|
||||
private MapObject mMapObject;
|
||||
|
||||
private static void refreshMetadataOrHide(@Nullable String metadata, @NonNull View metaLayout, @NonNull TextView metaTv)
|
||||
private static void refreshMetadataOrHide(@Nullable String metadata, @NonNull View metaLayout, @NonNull MaterialTextView metaTv)
|
||||
{
|
||||
if (!TextUtils.isEmpty(metadata))
|
||||
{
|
||||
@@ -481,9 +480,9 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
|
||||
mEditPlace.setEnabled(Editor.nativeShouldEnableEditPlace());
|
||||
mAddOrganisation.setEnabled(Editor.nativeShouldEnableAddPlace());
|
||||
mAddPlace.setEnabled(Editor.nativeShouldEnableAddPlace());
|
||||
TextView mTvEditPlace = mEditPlace.findViewById(R.id.tv__editor);
|
||||
TextView mTvAddBusiness = mAddPlace.findViewById(R.id.tv__editor);
|
||||
TextView mTvAddPlace = mAddPlace.findViewById(R.id.tv__editor);
|
||||
MaterialTextView mTvEditPlace = mEditPlace.findViewById(R.id.tv__editor);
|
||||
MaterialTextView mTvAddBusiness = mAddPlace.findViewById(R.id.tv__editor);
|
||||
MaterialTextView mTvAddPlace = mAddPlace.findViewById(R.id.tv__editor);
|
||||
final int editPlaceButtonColor = Editor.nativeShouldEnableEditPlace() ? ContextCompat.getColor(getContext(), UiUtils.getStyledResourceId(getContext(), androidx.appcompat.R.attr.colorAccent)) : getResources().getColor(R.color.button_accent_text_disabled);
|
||||
mTvEditPlace.setTextColor(editPlaceButtonColor);
|
||||
mTvAddBusiness.setTextColor(editPlaceButtonColor);
|
||||
|
||||
@@ -3,7 +3,6 @@ package app.organicmaps.widget.placepage.sections;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -21,6 +20,8 @@ import java.util.List;
|
||||
import static app.organicmaps.editor.data.TimeFormatUtils.formatNonBusinessTime;
|
||||
import static app.organicmaps.editor.data.TimeFormatUtils.formatWeekdaysRange;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
public class PlaceOpeningHoursAdapter extends RecyclerView.Adapter<PlaceOpeningHoursAdapter.ViewHolder>
|
||||
{
|
||||
private List<WeekScheduleData> mWeekSchedule = Collections.emptyList();
|
||||
@@ -161,9 +162,9 @@ public class PlaceOpeningHoursAdapter extends RecyclerView.Adapter<PlaceOpeningH
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
private final TextView mWeekdays;
|
||||
private final TextView mOpenTime;
|
||||
private final TextView mNonBusinessTime;
|
||||
private final MaterialTextView mWeekdays;
|
||||
private final MaterialTextView mOpenTime;
|
||||
private final MaterialTextView mNonBusinessTime;
|
||||
|
||||
public ViewHolder(@NonNull View itemView)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ import android.view.ViewGroup;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -21,6 +20,9 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.bookmarks.data.Bookmark;
|
||||
import app.organicmaps.bookmarks.data.BookmarkManager;
|
||||
@@ -37,7 +39,7 @@ public class PlacePageBookmarkFragment extends Fragment implements View.OnClickL
|
||||
EditBookmarkFragment.EditBookmarkListener
|
||||
{
|
||||
private View mFrame;
|
||||
private TextView mTvBookmarkNote;
|
||||
private MaterialTextView mTvBookmarkNote;
|
||||
@Nullable
|
||||
private WebView mWvBookmarkNote;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -27,43 +26,45 @@ import java.util.List;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
public class PlacePageLinksFragment extends Fragment implements Observer<MapObject>
|
||||
{
|
||||
private static final String TAG = PlacePageLinksFragment.class.getSimpleName();
|
||||
|
||||
private View mFrame;
|
||||
private View mFacebookPage;
|
||||
private TextView mTvFacebookPage;
|
||||
private MaterialTextView mTvFacebookPage;
|
||||
private View mInstagramPage;
|
||||
private TextView mTvInstagramPage;
|
||||
private MaterialTextView mTvInstagramPage;
|
||||
private View mTwitterPage;
|
||||
private TextView mTvTwitterPage;
|
||||
private MaterialTextView mTvTwitterPage;
|
||||
private View mFediversePage;
|
||||
private TextView mTvFediversePage;
|
||||
private MaterialTextView mTvFediversePage;
|
||||
private View mBlueskyPage;
|
||||
private TextView mTvBlueskyPage;
|
||||
private MaterialTextView mTvBlueskyPage;
|
||||
private View mVkPage;
|
||||
private TextView mTvVkPage;
|
||||
private MaterialTextView mTvVkPage;
|
||||
private View mLinePage;
|
||||
private TextView mTvLinePage;
|
||||
private MaterialTextView mTvLinePage;
|
||||
|
||||
private View mWebsite;
|
||||
private TextView mTvWebsite;
|
||||
private MaterialTextView mTvWebsite;
|
||||
private View mWebsiteMenu;
|
||||
private TextView mTvWebsiteMenuSubsite;
|
||||
private MaterialTextView mTvWebsiteMenuSubsite;
|
||||
private View mEmail;
|
||||
private TextView mTvEmail;
|
||||
private MaterialTextView mTvEmail;
|
||||
private View mWikimedia;
|
||||
private TextView mTvWikimedia;
|
||||
private MaterialTextView mTvWikimedia;
|
||||
|
||||
private View mPanoramax;
|
||||
private TextView mTvPanoramax;
|
||||
private MaterialTextView mTvPanoramax;
|
||||
|
||||
private PlacePageViewModel mViewModel;
|
||||
private MapObject mMapObject;
|
||||
|
||||
private static void refreshMetadataOrHide(@Nullable String metadata, @NonNull View metaLayout,
|
||||
@NonNull TextView metaTv)
|
||||
@NonNull MaterialTextView metaTv)
|
||||
{
|
||||
if (!TextUtils.isEmpty(metadata))
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -15,6 +14,9 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.bookmarks.data.MapObject;
|
||||
import app.organicmaps.bookmarks.data.Metadata;
|
||||
@@ -34,9 +36,9 @@ import java.util.Locale;
|
||||
public class PlacePageOpeningHoursFragment extends Fragment implements Observer<MapObject>
|
||||
{
|
||||
private View mFrame;
|
||||
private TextView mTodayLabel;
|
||||
private TextView mTodayOpenTime;
|
||||
private TextView mTodayNonBusinessTime;
|
||||
private MaterialTextView mTodayLabel;
|
||||
private MaterialTextView mTodayOpenTime;
|
||||
private MaterialTextView mTodayNonBusinessTime;
|
||||
private RecyclerView mFullWeekOpeningHours;
|
||||
private PlaceOpeningHoursAdapter mOpeningHoursAdapter;
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@ import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.bookmarks.data.MapObject;
|
||||
import app.organicmaps.bookmarks.data.Metadata;
|
||||
@@ -29,7 +31,7 @@ public class PlacePageWikipediaFragment extends Fragment implements Observer<Map
|
||||
private View mWiki;
|
||||
private View mPlaceDescriptionViewContainer;
|
||||
|
||||
private TextView mPlaceDescriptionView;
|
||||
private MaterialTextView mPlaceDescriptionView;
|
||||
|
||||
private PlacePageViewModel mViewModel;
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@ import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.util.Utils;
|
||||
|
||||
@@ -61,7 +63,7 @@ public class PlacePhoneAdapter extends RecyclerView.Adapter<PlacePhoneAdapter.Vi
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener
|
||||
{
|
||||
private final TextView mPhone;
|
||||
private final MaterialTextView mPhone;
|
||||
|
||||
public ViewHolder(@NonNull View itemView)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user