Add some code
This commit is contained in:
parent
8ab7f878b9
commit
658d7bdd3e
2 changed files with 32 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/navigation_types_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.measurementtool;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
@ -59,4 +60,34 @@ public class SnapToRoadBottomSheetDialogFragment extends BottomSheetDialogFragme
|
|||
|
||||
return view;
|
||||
}
|
||||
|
||||
private boolean hasNavBar() {
|
||||
int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
||||
return id > 0 && getResources().getBoolean(id);
|
||||
}
|
||||
|
||||
private int getStatusBarHeight() {
|
||||
int statusBarHeight = 0;
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return statusBarHeight;
|
||||
}
|
||||
|
||||
private int getNavigationBarHeight() {
|
||||
if (!hasNavBar()) {
|
||||
return 0;
|
||||
}
|
||||
boolean landscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
||||
if (isSmartphone && landscape) {
|
||||
return 0;
|
||||
}
|
||||
int id = getResources().getIdentifier(landscape ? "navigation_bar_height_landscape" : "navigation_bar_height", "dimen", "android");
|
||||
if (id > 0) {
|
||||
return getResources().getDimensionPixelSize(id);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue