forked from organicmaps/organicmaps
[android] Added util to detect orientation.
This commit is contained in:
parent
8b374367fe
commit
60fcb1b32f
3 changed files with 7 additions and 3 deletions
|
@ -159,7 +159,7 @@ class TabAdapter extends FragmentPagerAdapter
|
|||
{
|
||||
final Context context = tabs.getContext();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
boolean landscape = (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
boolean landscape = UiUtils.isLandscape(context);
|
||||
|
||||
int padding = UiUtils.dimen(landscape ? R.dimen.margin_half
|
||||
: R.dimen.margin_eighth);
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.mapswithme.maps.widget.placepage;
|
|||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
|
@ -397,7 +396,7 @@ public class PlacePageView extends RelativeLayout
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
setElevation(UiUtils.dimen(R.dimen.placepage_elevation));
|
||||
|
||||
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
if (UiUtils.isLandscape(getContext()))
|
||||
mDetails.setBackgroundResource(0);
|
||||
|
||||
SponsoredHotel.setListener(this);
|
||||
|
|
|
@ -334,6 +334,11 @@ public final class UiUtils
|
|||
: layout.getContext().getResources().getColor(R.color.base_red));
|
||||
}
|
||||
|
||||
public static boolean isLandscape(Context context)
|
||||
{
|
||||
return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
}
|
||||
|
||||
// utility class
|
||||
private UiUtils() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue