Merge pull request #5174 from goblinr/MAPSME-102-ext-fix-crash-on-old-devices

[android] Fix crash on pre lollipop devices.
This commit is contained in:
mpimenov 2017-01-13 11:38:48 +03:00 committed by GitHub
commit 356c030246
4 changed files with 43 additions and 18 deletions

View file

@ -36,23 +36,29 @@ public class HotelsFilterView extends FrameLayout
public HotelsFilterView(Context context)
{
this(context, null, 0, 0);
this(context, null, 0);
}
public HotelsFilterView(Context context, AttributeSet attrs)
{
this(context, attrs, 0, 0);
this(context, attrs, 0);
}
public HotelsFilterView(Context context, AttributeSet attrs, int defStyleAttr)
{
this(context, attrs, defStyleAttr, 0);
super(context, attrs, defStyleAttr);
init(context);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public HotelsFilterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
{
super(context, attrs, defStyleAttr, defStyleRes);
init(context);
}
private void init(Context context)
{
LayoutInflater.from(context).inflate(R.layout.hotels_filter, this, true);
}

View file

@ -84,23 +84,29 @@ public class PriceFilterView extends LinearLayout implements View.OnClickListene
public PriceFilterView(Context context)
{
this(context, null, 0, 0);
this(context, null, 0);
}
public PriceFilterView(Context context, AttributeSet attrs)
{
this(context, attrs, 0, 0);
this(context, attrs, 0);
}
public PriceFilterView(Context context, AttributeSet attrs, int defStyleAttr)
{
this(context, attrs, defStyleAttr, 0);
super(context, attrs, defStyleAttr);
init(context);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public PriceFilterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
{
super(context, attrs, defStyleAttr, defStyleRes);
init(context);
}
private void init(Context context)
{
setOrientation(HORIZONTAL);
LayoutInflater.from(context).inflate(R.layout.price_filter, this, true);
}

View file

@ -73,23 +73,29 @@ public class RatingFilterView extends LinearLayout implements View.OnClickListen
public RatingFilterView(Context context)
{
this(context, null, 0, 0);
this(context, null, 0);
}
public RatingFilterView(Context context, AttributeSet attrs)
{
this(context, attrs, 0, 0);
this(context, attrs, 0);
}
public RatingFilterView(Context context, AttributeSet attrs, int defStyleAttr)
{
this(context, attrs, defStyleAttr, 0);
super(context, attrs, defStyleAttr);
init(context);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public RatingFilterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
{
super(context, attrs, defStyleAttr, defStyleRes);
init(context);
}
private void init(Context context)
{
setOrientation(HORIZONTAL);
LayoutInflater.from(context).inflate(R.layout.rating_filter, this, true);
}

View file

@ -30,28 +30,30 @@ public class PlaceholderView extends FrameLayout
@Nullable
private TextView mSubtitle;
private final float mImageSizeFull;
private final float mImageSizeSmall;
private final float mPaddingImage;
private final float mPaddingNoImage;
private final float mScreenHeight;
private final float mScreenWidth;
private float mImageSizeFull;
private float mImageSizeSmall;
private float mPaddingImage;
private float mPaddingNoImage;
private float mScreenHeight;
private float mScreenWidth;
private int mOrientation;
public PlaceholderView(Context context)
{
this(context, null, 0, 0);
this(context, null, 0);
}
public PlaceholderView(Context context, @Nullable AttributeSet attrs)
{
this(context, attrs, 0, 0);
this(context, attrs, 0);
}
public PlaceholderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr)
{
this(context, attrs, defStyleAttr, 0);
super(context, attrs, defStyleAttr);
init(context);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@ -60,6 +62,11 @@ public class PlaceholderView extends FrameLayout
{
super(context, attrs, defStyleAttr, defStyleRes);
init(context);
}
private void init(Context context)
{
Resources res = getResources();
mImageSizeFull = res.getDimension(R.dimen.placeholder_size);
mImageSizeSmall = res.getDimension(R.dimen.placeholder_size_small);