diff --git a/android/res/layout/item_discovery_expert.xml b/android/res/layout/item_discovery_expert.xml index c7acfea2d6..a3b93086ca 100644 --- a/android/res/layout/item_discovery_expert.xml +++ b/android/res/layout/item_discovery_expert.xml @@ -12,7 +12,7 @@ diff --git a/android/res/layout/item_discovery_search.xml b/android/res/layout/item_discovery_search.xml index 8f2a29c15e..b687983064 100644 --- a/android/res/layout/item_discovery_search.xml +++ b/android/res/layout/item_discovery_search.xml @@ -10,7 +10,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> diff --git a/android/res/layout/item_search_more.xml b/android/res/layout/item_search_more.xml new file mode 100644 index 0000000000..e966ace341 --- /dev/null +++ b/android/res/layout/item_search_more.xml @@ -0,0 +1,29 @@ + + + + + diff --git a/android/res/layout/item_viator_more.xml b/android/res/layout/item_viator_more.xml index ea9e5e71ec..081c5a53a7 100644 --- a/android/res/layout/item_viator_more.xml +++ b/android/res/layout/item_viator_more.xml @@ -2,7 +2,7 @@ 100dp 150dp 84dp + 160dp 64dp @@ -210,7 +211,6 @@ 218dp - 160dp 80dp diff --git a/android/src/com/mapswithme/maps/gallery/Holders.java b/android/src/com/mapswithme/maps/gallery/Holders.java index 4466f13ae6..2fcfd9fdca 100644 --- a/android/src/com/mapswithme/maps/gallery/Holders.java +++ b/android/src/com/mapswithme/maps/gallery/Holders.java @@ -80,19 +80,20 @@ public class Holders } } - public static final class ViatorMoreItemViewHolder extends BaseViewHolder + public static class GenericMoreHolder + extends BaseViewHolder { - public ViatorMoreItemViewHolder(@NonNull View itemView, @NonNull List items, - @NonNull GalleryAdapter adapter) + public GenericMoreHolder(@NonNull View itemView, @NonNull List items, @NonNull GalleryAdapter + adapter) { super(itemView, items, adapter); } @Override - protected void onItemSelected(@NonNull Items.ViatorItem item, int position) + protected void onItemSelected(@NonNull T item, int position) { - ItemSelectedListener listener = mAdapter.getListener(); + ItemSelectedListener listener = mAdapter.getListener(); if (listener == null || TextUtils.isEmpty(item.getUrl())) return; @@ -100,6 +101,24 @@ public class Holders } } + public static class SearchMoreHolder extends GenericMoreHolder + { + + public SearchMoreHolder(@NonNull View itemView, @NonNull List items, @NonNull + GalleryAdapter adapter) + { + super(itemView, items, adapter); + } + + @Override + protected void onItemSelected(@NonNull Items.SearchItem item, int position) + { + ItemSelectedListener listener = mAdapter.getListener(); + if (listener != null) + listener.onMoreItemSelected(item); + } + } + public static class LocalExpertViewHolder extends BaseViewHolder { @NonNull @@ -161,26 +180,6 @@ public class Holders } } - public static class LocalExpertMoreItemViewHolder extends BaseViewHolder - { - public LocalExpertMoreItemViewHolder(@NonNull View itemView, - @NonNull List items, - @NonNull GalleryAdapter adapter) - { - super(itemView, items, adapter); - } - - @Override - protected void onItemSelected(@NonNull Items.LocalExpertItem item, int position) - { - ItemSelectedListener listener = mAdapter.getListener(); - if (listener == null || TextUtils.isEmpty(item.getUrl())) - return; - - listener.onMoreItemSelected(item); - } - } - public static abstract class ActionButtonViewHolder extends BaseViewHolder { @@ -334,7 +333,7 @@ public class Holders @NonNull GalleryAdapter adapter) { super(itemView); - mTitle = (TextView) itemView.findViewById(R.id.tv__title); + mTitle = itemView.findViewById(R.id.tv__title); itemView.setOnClickListener(this); mItems = items; mAdapter = adapter; diff --git a/android/src/com/mapswithme/maps/gallery/Items.java b/android/src/com/mapswithme/maps/gallery/Items.java index 21b0c668a0..6b95811e26 100644 --- a/android/src/com/mapswithme/maps/gallery/Items.java +++ b/android/src/com/mapswithme/maps/gallery/Items.java @@ -116,6 +116,13 @@ public class Items mResult = result; } + public SearchItem(@NonNull String title) + { + super(TYPE_MORE, title, null, + null); + mResult = SearchResult.EMPTY; + } + @NonNull public String getDistance() { @@ -169,6 +176,14 @@ public class Items } } + public static class MoreSearchItem extends SearchItem + { + public MoreSearchItem() + { + super(MwmApplication.get().getString(R.string.placepage_more_button)); + } + } + public static class Item { @NonNull diff --git a/android/src/com/mapswithme/maps/gallery/impl/HotelAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/HotelAdapterStrategy.java index 6307d7c61c..8d8703e244 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/HotelAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/impl/HotelAdapterStrategy.java @@ -19,7 +19,7 @@ public class HotelAdapterStrategy extends RegularAdapterStrategy items, @Nullable Items.SearchItem @@ -45,7 +45,8 @@ public class HotelAdapterStrategy extends RegularAdapterStrategy adapter) { - //TODO: filter item - return null; + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_search_more, parent, + false); + return new Holders.SearchMoreHolder(view, mItems, adapter); } } diff --git a/android/src/com/mapswithme/maps/gallery/impl/LocalExpertsAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/LocalExpertsAdapterStrategy.java index 3e834575ea..a4efe4684b 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/LocalExpertsAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/impl/LocalExpertsAdapterStrategy.java @@ -43,7 +43,7 @@ public class LocalExpertsAdapterStrategy extends RegularAdapterStrategy(view, mItems, adapter); } @NonNull diff --git a/android/src/com/mapswithme/maps/gallery/impl/ViatorAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/impl/ViatorAdapterStrategy.java index b424092577..0792e71902 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/ViatorAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/impl/ViatorAdapterStrategy.java @@ -42,7 +42,7 @@ public class ViatorAdapterStrategy { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_viator_more, parent, false); - return new Holders.ViatorMoreItemViewHolder(view, mItems, adapter); + return new Holders.GenericMoreHolder<>(view, mItems, adapter); } @NonNull diff --git a/android/src/com/mapswithme/maps/search/SearchResult.java b/android/src/com/mapswithme/maps/search/SearchResult.java index a732d6a173..7f7d7439f0 100644 --- a/android/src/com/mapswithme/maps/search/SearchResult.java +++ b/android/src/com/mapswithme/maps/search/SearchResult.java @@ -17,6 +17,9 @@ public class SearchResult implements SearchData public static final int OPEN_NOW_YES = 1; public static final int OPEN_NOW_NO = 2; + public static final SearchResult EMPTY = new SearchResult("", "", 0, 0, + new int[] {}); + public static class Description { public final FeatureId featureId;