forked from organicmaps/organicmaps
raw commit
This commit is contained in:
parent
0049019dc0
commit
8284c776a7
13 changed files with 84 additions and 37 deletions
|
@ -12,7 +12,7 @@
|
|||
<LinearLayout
|
||||
android:foreground="?clickableBackground"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="@dimen/viator_product_width"
|
||||
android:layout_width="@dimen/gallery_product_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/discovery_expert_item_min_height">
|
||||
<ImageView
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/viator_product_width"
|
||||
android:layout_width="@dimen/gallery_product_width"
|
||||
android:layout_height="match_parent"
|
||||
android:minHeight="@dimen/discovery_search_item_min_height"
|
||||
android:orientation="vertical">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/viator_product_width"
|
||||
android:layout_width="@dimen/gallery_product_width"
|
||||
android:layout_height="match_parent"
|
||||
android:minHeight="@dimen/discovery_search_item_min_height"
|
||||
android:orientation="vertical">
|
||||
|
|
29
android/res/layout/item_search_more.xml
Normal file
29
android/res/layout/item_search_more.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/gallery_product_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:minHeight="@dimen/discovery_search_item_min_height"
|
||||
android:padding="@dimen/margin_quarter"
|
||||
android:gravity="center"
|
||||
android:clipToPadding="false"
|
||||
android:foreground="?clickableBackground">
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="?attr/sponsoredGalleryMore"/>
|
||||
<TextView
|
||||
android:id="@+id/tv__title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_half_plus"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body2"
|
||||
android:fontFamily="@string/robotoMedium"
|
||||
android:textColor="?colorAccent"
|
||||
android:textAllCaps="true"
|
||||
tools:text="More"
|
||||
tools:targetApi="jelly_bean"/>
|
||||
</LinearLayout>
|
|
@ -2,7 +2,7 @@
|
|||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/viator_product_width"
|
||||
android:layout_width="@dimen/gallery_product_width"
|
||||
android:layout_height="@dimen/viator_product_height"
|
||||
android:padding="@dimen/margin_quarter"
|
||||
android:clipToPadding="false"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:layout_width="@dimen/viator_product_width"
|
||||
android:layout_width="@dimen/gallery_product_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?clickableBackground">
|
||||
<ImageView
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
<dimen name="placepage_hotel_gallery_height">100dp</dimen>
|
||||
<dimen name="placepage_hotel_gallery_width">150dp</dimen>
|
||||
<dimen name="gallery_image_height">84dp</dimen>
|
||||
<dimen name="gallery_product_width">160dp</dimen>
|
||||
|
||||
<!-- Nearby-->
|
||||
<dimen name="placepage_hotel_nearby_height">64dp</dimen>
|
||||
|
@ -210,7 +211,6 @@
|
|||
|
||||
<!-- Viator-->
|
||||
<dimen name="viator_product_height">218dp</dimen>
|
||||
<dimen name="viator_product_width">160dp</dimen>
|
||||
<dimen name="viator_product_image_height">80dp</dimen>
|
||||
|
||||
<!-- Luggage-->
|
||||
|
|
|
@ -80,19 +80,20 @@ public class Holders
|
|||
}
|
||||
}
|
||||
|
||||
public static final class ViatorMoreItemViewHolder extends BaseViewHolder<Items.ViatorItem>
|
||||
public static class GenericMoreHolder<T extends RegularAdapterStrategy.Item>
|
||||
extends BaseViewHolder<T>
|
||||
{
|
||||
|
||||
public ViatorMoreItemViewHolder(@NonNull View itemView, @NonNull List<Items.ViatorItem> items,
|
||||
@NonNull GalleryAdapter<?, Items.ViatorItem> adapter)
|
||||
public GenericMoreHolder(@NonNull View itemView, @NonNull List<T> items, @NonNull GalleryAdapter<?, T>
|
||||
adapter)
|
||||
{
|
||||
super(itemView, items, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected(@NonNull Items.ViatorItem item, int position)
|
||||
protected void onItemSelected(@NonNull T item, int position)
|
||||
{
|
||||
ItemSelectedListener<ViatorItem> listener = mAdapter.getListener();
|
||||
ItemSelectedListener<T> listener = mAdapter.getListener();
|
||||
if (listener == null || TextUtils.isEmpty(item.getUrl()))
|
||||
return;
|
||||
|
||||
|
@ -100,6 +101,24 @@ public class Holders
|
|||
}
|
||||
}
|
||||
|
||||
public static class SearchMoreHolder extends GenericMoreHolder<Items.SearchItem>
|
||||
{
|
||||
|
||||
public SearchMoreHolder(@NonNull View itemView, @NonNull List<Items.SearchItem> items, @NonNull
|
||||
GalleryAdapter<?, Items.SearchItem> adapter)
|
||||
{
|
||||
super(itemView, items, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected(@NonNull Items.SearchItem item, int position)
|
||||
{
|
||||
ItemSelectedListener<Items.SearchItem> listener = mAdapter.getListener();
|
||||
if (listener != null)
|
||||
listener.onMoreItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LocalExpertViewHolder extends BaseViewHolder<Items.LocalExpertItem>
|
||||
{
|
||||
@NonNull
|
||||
|
@ -161,26 +180,6 @@ public class Holders
|
|||
}
|
||||
}
|
||||
|
||||
public static class LocalExpertMoreItemViewHolder extends BaseViewHolder<Items.LocalExpertItem>
|
||||
{
|
||||
public LocalExpertMoreItemViewHolder(@NonNull View itemView,
|
||||
@NonNull List<Items.LocalExpertItem> items,
|
||||
@NonNull GalleryAdapter<?, Items.LocalExpertItem> adapter)
|
||||
{
|
||||
super(itemView, items, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected(@NonNull Items.LocalExpertItem item, int position)
|
||||
{
|
||||
ItemSelectedListener<Items.LocalExpertItem> listener = mAdapter.getListener();
|
||||
if (listener == null || TextUtils.isEmpty(item.getUrl()))
|
||||
return;
|
||||
|
||||
listener.onMoreItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class ActionButtonViewHolder<T extends RegularAdapterStrategy.Item>
|
||||
extends BaseViewHolder<T>
|
||||
{
|
||||
|
@ -334,7 +333,7 @@ public class Holders
|
|||
@NonNull GalleryAdapter<?, I> 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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,7 +19,7 @@ public class HotelAdapterStrategy extends RegularAdapterStrategy<Items.SearchIte
|
|||
{
|
||||
HotelAdapterStrategy(@NonNull SearchResult[] results)
|
||||
{
|
||||
this(SearchBasedAdapterStrategy.convertItems(results), null/*TODO: coming soon*/);
|
||||
this(SearchBasedAdapterStrategy.convertItems(results), new Items.MoreSearchItem());
|
||||
}
|
||||
|
||||
private HotelAdapterStrategy(@NonNull List<Items.SearchItem> items, @Nullable Items.SearchItem
|
||||
|
@ -45,7 +45,8 @@ public class HotelAdapterStrategy extends RegularAdapterStrategy<Items.SearchIte
|
|||
(@NonNull ViewGroup parent, int viewType,
|
||||
@NonNull GalleryAdapter<?, Items.SearchItem> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class LocalExpertsAdapterStrategy extends RegularAdapterStrategy<Items.Lo
|
|||
{
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_viator_more, parent,
|
||||
false);
|
||||
return new Holders.LocalExpertMoreItemViewHolder(view, mItems, adapter);
|
||||
return new Holders.GenericMoreHolder<>(view, mItems, adapter);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue