From c48be8c3f5145ee55afcbc25736c121c96f1cfc8 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Mon, 13 Mar 2023 17:56:11 +0100 Subject: [PATCH] [android] move place page sections in own package Signed-off-by: Arnaud Vergnet --- .../app/organicmaps/widget/placepage/PlacePageUtils.java | 6 +++--- .../src/app/organicmaps/widget/placepage/PlacePageView.java | 5 +++++ .../placepage/{ => sections}/PlaceOpeningHoursAdapter.java | 2 +- .../placepage/{ => sections}/PlacePageBookmarkFragment.java | 4 +++- .../placepage/{ => sections}/PlacePageLinksFragment.java | 4 +++- .../{ => sections}/PlacePageOpeningHoursFragment.java | 5 ++++- .../placepage/{ => sections}/PlacePagePhoneFragment.java | 3 ++- .../{ => sections}/PlacePageWikipediaFragment.java | 5 ++++- .../widget/placepage/{ => sections}/PlacePhoneAdapter.java | 2 +- .../{ => sections}/PlaceOpeningHoursAdapterTest.java | 5 +++-- 10 files changed, 29 insertions(+), 12 deletions(-) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlaceOpeningHoursAdapter.java (99%) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlacePageBookmarkFragment.java (97%) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlacePageLinksFragment.java (98%) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlacePageOpeningHoursFragment.java (96%) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlacePagePhoneFragment.java (93%) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlacePageWikipediaFragment.java (94%) rename android/src/app/organicmaps/widget/placepage/{ => sections}/PlacePhoneAdapter.java (98%) rename android/tests/java/app/organicmaps/widget/placepage/{ => sections}/PlaceOpeningHoursAdapterTest.java (98%) diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageUtils.java b/android/src/app/organicmaps/widget/placepage/PlacePageUtils.java index 0932a87251..6c758d1c36 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageUtils.java +++ b/android/src/app/organicmaps/widget/placepage/PlacePageUtils.java @@ -15,7 +15,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior; import java.util.List; -class PlacePageUtils +public class PlacePageUtils { static void moveViewportUp(@NonNull View placePageView, int viewportMinHeight) { @@ -84,7 +84,7 @@ class PlacePageUtils } } - static void copyToClipboard(Context context, View frame, String text) + public static void copyToClipboard(Context context, View frame, String text) { Utils.copyTextToClipboard(context, text); Utils.showSnackbarAbove(frame, @@ -92,7 +92,7 @@ class PlacePageUtils context.getString(R.string.copied_to_clipboard, text)); } - static void showCopyPopup(Context context, View popupAnchor, View frame, List items) + public static void showCopyPopup(Context context, View popupAnchor, View frame, List items) { final PopupMenu popup = new PopupMenu(context, popupAnchor); final Menu menu = popup.getMenu(); diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageView.java b/android/src/app/organicmaps/widget/placepage/PlacePageView.java index 072d181baf..2392c98c93 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageView.java +++ b/android/src/app/organicmaps/widget/placepage/PlacePageView.java @@ -48,6 +48,11 @@ import app.organicmaps.util.StringUtils; import app.organicmaps.util.UiUtils; import app.organicmaps.util.concurrency.UiThread; import app.organicmaps.widget.ArrowView; +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.PlacePageWikipediaFragment; import java.util.ArrayList; import java.util.Arrays; diff --git a/android/src/app/organicmaps/widget/placepage/PlaceOpeningHoursAdapter.java b/android/src/app/organicmaps/widget/placepage/sections/PlaceOpeningHoursAdapter.java similarity index 99% rename from android/src/app/organicmaps/widget/placepage/PlaceOpeningHoursAdapter.java rename to android/src/app/organicmaps/widget/placepage/sections/PlaceOpeningHoursAdapter.java index f232f76131..c08815c22e 100644 --- a/android/src/app/organicmaps/widget/placepage/PlaceOpeningHoursAdapter.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlaceOpeningHoursAdapter.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.view.LayoutInflater; import android.view.View; diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageBookmarkFragment.java b/android/src/app/organicmaps/widget/placepage/sections/PlacePageBookmarkFragment.java similarity index 97% rename from android/src/app/organicmaps/widget/placepage/PlacePageBookmarkFragment.java rename to android/src/app/organicmaps/widget/placepage/sections/PlacePageBookmarkFragment.java index 75ec8aa81a..b400548424 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageBookmarkFragment.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlacePageBookmarkFragment.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.content.Context; import android.os.Bundle; @@ -26,6 +26,8 @@ import app.organicmaps.bookmarks.data.MapObject; import app.organicmaps.util.StringUtils; import app.organicmaps.util.UiUtils; import app.organicmaps.util.Utils; +import app.organicmaps.widget.placepage.EditBookmarkFragment; +import app.organicmaps.widget.placepage.PlacePageViewModel; public class PlacePageBookmarkFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener, diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageLinksFragment.java b/android/src/app/organicmaps/widget/placepage/sections/PlacePageLinksFragment.java similarity index 98% rename from android/src/app/organicmaps/widget/placepage/PlacePageLinksFragment.java rename to android/src/app/organicmaps/widget/placepage/sections/PlacePageLinksFragment.java index 618ef29b91..c7d1dee048 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageLinksFragment.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlacePageLinksFragment.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.os.Bundle; import android.text.TextUtils; @@ -17,6 +17,8 @@ import app.organicmaps.R; import app.organicmaps.bookmarks.data.MapObject; import app.organicmaps.bookmarks.data.Metadata; import app.organicmaps.util.Utils; +import app.organicmaps.widget.placepage.PlacePageUtils; +import app.organicmaps.widget.placepage.PlacePageViewModel; import java.util.ArrayList; import java.util.Arrays; diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageOpeningHoursFragment.java b/android/src/app/organicmaps/widget/placepage/sections/PlacePageOpeningHoursFragment.java similarity index 96% rename from android/src/app/organicmaps/widget/placepage/PlacePageOpeningHoursFragment.java rename to android/src/app/organicmaps/widget/placepage/sections/PlacePageOpeningHoursFragment.java index 37bcce2de0..9303e52f0e 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageOpeningHoursFragment.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlacePageOpeningHoursFragment.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.content.res.Resources; import android.os.Bundle; @@ -25,6 +25,9 @@ import app.organicmaps.editor.data.Timetable; import app.organicmaps.util.ThemeUtils; import app.organicmaps.util.UiUtils; import app.organicmaps.util.Utils; +import app.organicmaps.widget.placepage.PlacePageUtils; +import app.organicmaps.widget.placepage.PlacePageViewModel; +import app.organicmaps.widget.placepage.sections.PlaceOpeningHoursAdapter; import java.util.Calendar; import java.util.Locale; diff --git a/android/src/app/organicmaps/widget/placepage/PlacePagePhoneFragment.java b/android/src/app/organicmaps/widget/placepage/sections/PlacePagePhoneFragment.java similarity index 93% rename from android/src/app/organicmaps/widget/placepage/PlacePagePhoneFragment.java rename to android/src/app/organicmaps/widget/placepage/sections/PlacePagePhoneFragment.java index a3b5fccc7d..52b432d1c1 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePagePhoneFragment.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlacePagePhoneFragment.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.os.Bundle; import android.view.LayoutInflater; @@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; import app.organicmaps.R; import app.organicmaps.bookmarks.data.MapObject; import app.organicmaps.bookmarks.data.Metadata; +import app.organicmaps.widget.placepage.PlacePageViewModel; public class PlacePagePhoneFragment extends Fragment implements Observer { diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageWikipediaFragment.java b/android/src/app/organicmaps/widget/placepage/sections/PlacePageWikipediaFragment.java similarity index 94% rename from android/src/app/organicmaps/widget/placepage/PlacePageWikipediaFragment.java rename to android/src/app/organicmaps/widget/placepage/sections/PlacePageWikipediaFragment.java index f1d7a1edba..07d76291ad 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageWikipediaFragment.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlacePageWikipediaFragment.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.os.Bundle; import android.text.SpannableStringBuilder; @@ -19,6 +19,9 @@ import app.organicmaps.bookmarks.data.MapObject; import app.organicmaps.bookmarks.data.Metadata; import app.organicmaps.util.Utils; import app.organicmaps.util.UiUtils; +import app.organicmaps.widget.placepage.PlaceDescriptionActivity; +import app.organicmaps.widget.placepage.PlacePageUtils; +import app.organicmaps.widget.placepage.PlacePageViewModel; public class PlacePageWikipediaFragment extends Fragment implements Observer { diff --git a/android/src/app/organicmaps/widget/placepage/PlacePhoneAdapter.java b/android/src/app/organicmaps/widget/placepage/sections/PlacePhoneAdapter.java similarity index 98% rename from android/src/app/organicmaps/widget/placepage/PlacePhoneAdapter.java rename to android/src/app/organicmaps/widget/placepage/sections/PlacePhoneAdapter.java index c69e93ecdd..0d5b095ed0 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePhoneAdapter.java +++ b/android/src/app/organicmaps/widget/placepage/sections/PlacePhoneAdapter.java @@ -1,4 +1,4 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import android.content.Context; import android.text.TextUtils; diff --git a/android/tests/java/app/organicmaps/widget/placepage/PlaceOpeningHoursAdapterTest.java b/android/tests/java/app/organicmaps/widget/placepage/sections/PlaceOpeningHoursAdapterTest.java similarity index 98% rename from android/tests/java/app/organicmaps/widget/placepage/PlaceOpeningHoursAdapterTest.java rename to android/tests/java/app/organicmaps/widget/placepage/sections/PlaceOpeningHoursAdapterTest.java index 499662aca5..e427e084b0 100644 --- a/android/tests/java/app/organicmaps/widget/placepage/PlaceOpeningHoursAdapterTest.java +++ b/android/tests/java/app/organicmaps/widget/placepage/sections/PlaceOpeningHoursAdapterTest.java @@ -1,9 +1,10 @@ -package app.organicmaps.widget.placepage; +package app.organicmaps.widget.placepage.sections; import app.organicmaps.editor.data.HoursMinutes; import app.organicmaps.editor.data.Timespan; import app.organicmaps.editor.data.Timetable; -import app.organicmaps.widget.placepage.PlaceOpeningHoursAdapter.WeekScheduleData; +import app.organicmaps.widget.placepage.sections.PlaceOpeningHoursAdapter; +import app.organicmaps.widget.placepage.sections.PlaceOpeningHoursAdapter.WeekScheduleData; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith;