forked from organicmaps/organicmaps
[android] Added divider below promo catalog title and fixed margins in promo gallery
This commit is contained in:
parent
f2225bc5c9
commit
6a7a556005
3 changed files with 34 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/catalog_promo_container"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/windowBackgroundForced"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -8,20 +9,26 @@
|
|||
<TextView
|
||||
android:id="@+id/catalog_promo_title"
|
||||
android:text="@string/gallery_pp_download_guides_title"
|
||||
android:textAppearance="@style/MwmTextAppearance.Discovery.Subtitle"
|
||||
style="@style/MwmWidget.Discovery.Subtitle"
|
||||
android:textAppearance="?android:textAppearance"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginLeft="@dimen/margin_base"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:layout_marginRight="@dimen/margin_base"
|
||||
android:layout_marginEnd="@dimen/margin_base"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginBottom="@dimen/margin_half_plus"
|
||||
android:textAllCaps="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<include
|
||||
android:id="@+id/catalog_promo_title_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/divider_height"
|
||||
layout="@layout/list_divider"/>
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/catalog_promo_recycler"
|
||||
android:layout_marginBottom="@dimen/margin_half_plus"
|
||||
android:layout_marginBottom="@dimen/margin_quarter"
|
||||
android:layout_marginTop="@dimen/margin_quarter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -66,7 +66,6 @@ import com.mapswithme.maps.gallery.Constants;
|
|||
import com.mapswithme.maps.gallery.FullScreenGalleryActivity;
|
||||
import com.mapswithme.maps.gallery.GalleryActivity;
|
||||
import com.mapswithme.maps.gallery.Items;
|
||||
import com.mapswithme.maps.gallery.impl.BaseItemSelectedListener;
|
||||
import com.mapswithme.maps.gallery.impl.Factory;
|
||||
import com.mapswithme.maps.gallery.impl.RegularCatalogPromoListener;
|
||||
import com.mapswithme.maps.location.LocationHelper;
|
||||
|
@ -886,8 +885,8 @@ public class PlacePageView extends NestedScrollView
|
|||
false);
|
||||
mCatalogPromoRecycler.setLayoutManager(layoutManager);
|
||||
RecyclerView.ItemDecoration decor =
|
||||
ItemDecoratorFactory.createSponsoredGalleryDecorator(getContext(),
|
||||
LinearLayoutManager.HORIZONTAL);
|
||||
ItemDecoratorFactory.createPlacePagePromoGalleryDecorator(getContext(),
|
||||
LinearLayoutManager.HORIZONTAL);
|
||||
mCatalogPromoRecycler.addItemDecoration(decor);
|
||||
mCatalogPromoRecycler.setAdapter(mCatalogPromoLoadingAdapter);
|
||||
}
|
||||
|
@ -2176,8 +2175,7 @@ public class PlacePageView extends NestedScrollView
|
|||
|
||||
public void toggleCatalogPromoGallery(boolean enabled)
|
||||
{
|
||||
UiUtils.showIf(enabled, mCatalogPromoRecycler);
|
||||
UiUtils.showIf(enabled, mCatalogPromoTitleView);
|
||||
UiUtils.showIf(enabled, this, R.id.catalog_promo_container);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -9,6 +9,8 @@ import android.support.v7.widget.RecyclerView;
|
|||
|
||||
import com.mapswithme.maps.R;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ItemDecoratorFactory
|
||||
{
|
||||
@NonNull
|
||||
|
@ -16,7 +18,9 @@ public class ItemDecoratorFactory
|
|||
int orientation)
|
||||
{
|
||||
DividerItemDecoration decoration = new HotelDividerItemDecoration(context, orientation);
|
||||
decoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.divider_transparent_quarter));
|
||||
@DrawableRes
|
||||
int dividerId = R.drawable.divider_transparent_quarter;
|
||||
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerId)));
|
||||
return decoration;
|
||||
}
|
||||
|
||||
|
@ -25,7 +29,19 @@ public class ItemDecoratorFactory
|
|||
int orientation)
|
||||
{
|
||||
DividerItemDecoration decoration = new SponsoredDividerItemDecoration(context, orientation);
|
||||
decoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.divider_transparent_half));
|
||||
@DrawableRes
|
||||
int dividerId = R.drawable.divider_transparent_half;
|
||||
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerId)));
|
||||
return decoration;
|
||||
}
|
||||
|
||||
public static RecyclerView.ItemDecoration createPlacePagePromoGalleryDecorator(@NonNull Context context,
|
||||
int orientation)
|
||||
{
|
||||
DividerItemDecoration decoration = new SponsoredDividerItemDecoration(context, orientation);
|
||||
@DrawableRes
|
||||
int dividerId = R.drawable.divider_transparent_quarter;
|
||||
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerId)));
|
||||
return decoration;
|
||||
}
|
||||
|
||||
|
@ -35,7 +51,7 @@ public class ItemDecoratorFactory
|
|||
@DrawableRes int dividerResId)
|
||||
{
|
||||
DividerItemDecoration decoration = new DividerItemDecoration(context, orientation);
|
||||
decoration.setDrawable(ContextCompat.getDrawable(context, dividerResId));
|
||||
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(context, dividerResId)));
|
||||
return decoration;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue