From 1d4783e862f18723d29897abdecff6332f6c6ed7 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Fri, 22 May 2020 10:14:30 +0300 Subject: [PATCH] Fix tablet sizes --- .../first_splash_screen_free.xml | 2 +- .../first_splash_screen_free_dev.xml | 2 +- .../first_splash_screen_plus.xml | 2 +- OsmAnd/res/layout/fragment_subcategories.xml | 2 +- OsmAnd/res/layout/mode_view.xml | 4 ++-- .../layout/mode_view_route_preparation.xml | 4 ++-- OsmAnd/res/layout/search_custom_poi.xml | 2 +- OsmAnd/res/values-land/sizes.xml | 4 +--- OsmAnd/res/values-large/sizes.xml | 4 ---- OsmAnd/res/values-sw600dp-land/sizes.xml | 2 +- OsmAnd/res/values-sw600dp/sizes.xml | 2 +- .../osmand/SecondSplashScreenFragment.java | 24 +++++++------------ .../MapContextMenuFragment.java | 2 +- 13 files changed, 21 insertions(+), 35 deletions(-) diff --git a/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free.xml b/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free.xml index b3d6f99388..ed3f0e5956 100644 --- a/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free.xml +++ b/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free.xml @@ -4,7 +4,7 @@ \ No newline at end of file diff --git a/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free_dev.xml b/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free_dev.xml index b3d6f99388..ed3f0e5956 100644 --- a/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free_dev.xml +++ b/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_free_dev.xml @@ -4,7 +4,7 @@ \ No newline at end of file diff --git a/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_plus.xml b/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_plus.xml index 1dc65ed611..4c95aa687e 100644 --- a/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_plus.xml +++ b/OsmAnd/res/drawable-sw600dp-v21/first_splash_screen_plus.xml @@ -4,7 +4,7 @@ \ No newline at end of file diff --git a/OsmAnd/res/layout/fragment_subcategories.xml b/OsmAnd/res/layout/fragment_subcategories.xml index 26b3f33ef4..aa3b449c0c 100644 --- a/OsmAnd/res/layout/fragment_subcategories.xml +++ b/OsmAnd/res/layout/fragment_subcategories.xml @@ -17,7 +17,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/actionModeBackground" - android:minHeight="@dimen/dashboard_map_toolbar" + android:minHeight="@dimen/toolbar_height" android:theme="?attr/toolbar_theme" app:contentInsetLeft="54dp" app:contentInsetStart="54dp"> diff --git a/OsmAnd/res/layout/mode_view.xml b/OsmAnd/res/layout/mode_view.xml index f21a90246e..689d3db45a 100644 --- a/OsmAnd/res/layout/mode_view.xml +++ b/OsmAnd/res/layout/mode_view.xml @@ -6,8 +6,8 @@ diff --git a/OsmAnd/res/layout/mode_view_route_preparation.xml b/OsmAnd/res/layout/mode_view_route_preparation.xml index 14ca12a135..9b5883b264 100644 --- a/OsmAnd/res/layout/mode_view_route_preparation.xml +++ b/OsmAnd/res/layout/mode_view_route_preparation.xml @@ -6,8 +6,8 @@ diff --git a/OsmAnd/res/layout/search_custom_poi.xml b/OsmAnd/res/layout/search_custom_poi.xml index 111fa6c3d5..7023b905ce 100644 --- a/OsmAnd/res/layout/search_custom_poi.xml +++ b/OsmAnd/res/layout/search_custom_poi.xml @@ -16,7 +16,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/osmand_orange" - android:minHeight="@dimen/dashboard_map_toolbar" + android:minHeight="@dimen/toolbar_height" android:theme="?attr/toolbar_theme" app:contentInsetLeft="54dp" app:contentInsetStart="54dp" diff --git a/OsmAnd/res/values-land/sizes.xml b/OsmAnd/res/values-land/sizes.xml index a927d1e718..3dac1a225d 100644 --- a/OsmAnd/res/values-land/sizes.xml +++ b/OsmAnd/res/values-land/sizes.xml @@ -1,8 +1,6 @@ - 200dp - - 12dp + 22dp 12dp 12dp diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml index 00e5606654..2773ca50f3 100644 --- a/OsmAnd/res/values-large/sizes.xml +++ b/OsmAnd/res/values-large/sizes.xml @@ -69,7 +69,6 @@ 11dp 9dp 5dp - 54dp 90dp 18dp @@ -101,12 +100,9 @@ 21dp 72dp 18dp - 72dp 18dp 48dp 60dp - 90dp - 84dp 78dp 27dp 27dp diff --git a/OsmAnd/res/values-sw600dp-land/sizes.xml b/OsmAnd/res/values-sw600dp-land/sizes.xml index fcb6e1f8c5..90baa4ed8e 100644 --- a/OsmAnd/res/values-sw600dp-land/sizes.xml +++ b/OsmAnd/res/values-sw600dp-land/sizes.xml @@ -1,6 +1,6 @@ - 120dp + -48dp 12dp 24dp diff --git a/OsmAnd/res/values-sw600dp/sizes.xml b/OsmAnd/res/values-sw600dp/sizes.xml index cd419b6f73..8008a2e0d0 100644 --- a/OsmAnd/res/values-sw600dp/sizes.xml +++ b/OsmAnd/res/values-sw600dp/sizes.xml @@ -1,6 +1,6 @@ - 240dp + -48dp 36dp 24dp diff --git a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java index 9853e77390..147c4b80cc 100644 --- a/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java +++ b/OsmAnd/src/net/osmand/SecondSplashScreenFragment.java @@ -10,6 +10,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.content.res.AppCompatResources; import androidx.fragment.app.FragmentActivity; @@ -36,15 +37,6 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment { return (MapActivity) getActivity(); } - private boolean hasNavBar() { - int id = getResources().getIdentifier("config_showNavigationBar", "bool", "android"); - if (id > 0) { - return getResources().getBoolean(id); - } else { - return false; - } - } - private int getStatusBarHeight() { int statusBarHeight = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); @@ -55,7 +47,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment { } private int getNavigationBarHeight() { - if (!hasNavBar()) + if (!AndroidUtils.hasNavBar(getContext()) && !AndroidUtils.isNavBarVisible(getMapActivity())) return 0; int orientation = getResources().getConfiguration().orientation; if (isSmartphone() && Configuration.ORIENTATION_LANDSCAPE == orientation) @@ -67,7 +59,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment { } private int getNavigationBarWidth() { - if (!hasNavBar()) + if (!AndroidUtils.hasNavBar(getContext()) && !AndroidUtils.isNavBarVisible(getMapActivity())) return 0; int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE && isSmartphone()) { @@ -80,7 +72,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment { @Nullable @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { OsmandApplication app = requireMyApplication(); FragmentActivity activity = requireActivity(); @@ -130,11 +122,11 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment { RelativeLayout.LayoutParams osmTextLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); osmTextLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); osmTextLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL); - - int defaultLogoMarginTop = (int) getResources().getDimension(R.dimen.splash_screen_logo_top); + + int defaultLogoMarginTop = getResources().getDimensionPixelSize(R.dimen.splash_screen_logo_top); int logoMarginTop = defaultLogoMarginTop - (Build.VERSION.SDK_INT >= 21 ? 0 : getStatusBarHeight()); - int textMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_text_bottom); - int osmTextMarginBottom = (int) getResources().getDimension(R.dimen.splash_screen_osm_text_bottom); + int textMarginBottom = getResources().getDimensionPixelSize(R.dimen.splash_screen_text_bottom); + int osmTextMarginBottom = getResources().getDimensionPixelSize(R.dimen.splash_screen_osm_text_bottom); int elementsPaddingLeft = 0; int elementsPaddingRight = 0; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 7c8d5b6553..31ef529274 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1314,7 +1314,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view); Drawable icon = menu.getRightIcon(); int iconId = menu.getRightIconId(); - int sizeId = menu.isBigRightIcon() ? R.dimen.context_menu_big_icon_size : R.dimen.map_widget_icon; + int sizeId = menu.isBigRightIcon() ? R.dimen.context_menu_big_icon_size : R.dimen.standard_icon_size; if (menu.getPointDescription().isFavorite() || menu.getPointDescription().isWpt()) { sizeId = R.dimen.favorites_icon_size; }