Fix tablet sizes

This commit is contained in:
Dima-1 2020-05-14 12:29:56 +03:00
parent b151853669
commit f48c6dfcde
11 changed files with 34 additions and 30 deletions

View file

@ -9,8 +9,7 @@
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp">
app:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar">
<LinearLayout

View file

@ -18,7 +18,7 @@
<ImageView
android:id="@+id/icon"
android:scaleType="centerInside"
android:layout_width="@dimen/map_button_shadow_width"
android:layout_width="@dimen/map_markers_recycler_view_item_height"
android:layout_height="match_parent"
tools:src="@drawable/ic_action_favorite"
tools:visibility="visible"

View file

@ -26,7 +26,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/map_button_shadow_width"
android:layout_height="@dimen/map_markers_recycler_view_item_height"
android:background="?attr/selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView
@ -34,16 +34,16 @@
tools:text="3"
android:gravity="center"
android:id="@+id/map_marker_number_text_view"
android:layout_width="@dimen/map_button_shadow_width"
android:layout_height="@dimen/map_button_shadow_width"
android:layout_width="@dimen/map_markers_recycler_view_item_height"
android:layout_height="@dimen/map_markers_recycler_view_item_height"
android:layout_gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/map_marker_reorder_icon"
android:layout_width="@dimen/map_button_shadow_width"
android:layout_height="@dimen/map_button_shadow_width"
android:layout_width="@dimen/map_markers_recycler_view_item_height"
android:layout_height="@dimen/map_markers_recycler_view_item_height"
android:layout_gravity="center_vertical"
android:scaleType="centerInside"
android:tint="?attr/secondary_icon_color"
@ -155,8 +155,8 @@
<ImageButton
android:id="@+id/map_marker_options_button"
android:layout_width="@dimen/map_button_shadow_width"
android:layout_height="@dimen/map_button_shadow_width"
android:layout_width="@dimen/map_markers_recycler_view_item_height"
android:layout_height="@dimen/map_markers_recycler_view_item_height"
android:focusableInTouchMode="true"
tools:background="@drawable/marker_circle_background_dark_with_inset"
tools:src="@drawable/ic_action_marker_passed"/>
@ -186,8 +186,8 @@
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/map_button_shadow_width"
android:layout_marginStart="@dimen/map_button_shadow_width"
android:layout_marginLeft="@dimen/map_markers_recycler_view_item_height"
android:layout_marginStart="@dimen/map_markers_recycler_view_item_height"
tools:background="?attr/divider_color"/>
</LinearLayout>

View file

@ -17,8 +17,8 @@
android:id="@+id/show_hide_history_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/map_button_shadow_width"
android:paddingStart="@dimen/map_button_shadow_width"
android:paddingLeft="@dimen/map_markers_recycler_view_item_height"
android:paddingStart="@dimen/map_markers_recycler_view_item_height"
android:textAllCaps="true"
android:gravity="center_vertical"
tools:text="Show passed"

View file

@ -15,8 +15,8 @@
<ImageView
android:id="@+id/outline"
android:layout_width="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_width="@dimen/favorites_icon_outline_size"
android:layout_height="@dimen/favorites_icon_outline_size"
android:visibility="invisible"
app:srcCompat="@drawable/bg_point_circle_contour" />

View file

@ -51,7 +51,6 @@
<!-- ContextMenu -->
<dimen name="context_menu_top_shadow_h">30dp</dimen>
<dimen name="context_menu_icon_top_padding">25dp</dimen>
<dimen name="context_menu_first_line_top_margin">21dp</dimen>
<dimen name="context_menu_first_line_bottom_margin">24dp</dimen>
<dimen name="context_menu_second_line_top_margin">6dp</dimen>
<dimen name="context_menu_top_right_button_min_width">114dp</dimen>
@ -110,10 +109,7 @@
<dimen name="measurement_tool_button_height">54dp</dimen>
<dimen name="map_markers_recycler_view_padding_bottom">78dp</dimen>
<dimen name="map_markers_recycler_view_padding_top">15dp</dimen>
<dimen name="shadow_height">8dp</dimen>
<dimen name="map_marker_title_height">42dp</dimen>
<!--Route info-->
<dimen name="route_info_buttons_padding_top_bottom">24dp</dimen>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="splash_screen_logo_top">240dp</dimen>
<dimen name="splash_screen_logo_top">120dp</dimen>
<dimen name="splash_screen_text_bottom">12dp</dimen>
<dimen name="splash_screen_osm_text_bottom">24dp</dimen>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="splash_screen_logo_top">400dp</dimen>
<dimen name="splash_screen_logo_top">240dp</dimen>
<dimen name="splash_screen_text_bottom">36dp</dimen>
<dimen name="splash_screen_osm_text_bottom">24dp</dimen>

View file

@ -73,6 +73,7 @@
<dimen name="favorites_icon_right_margin">24dp</dimen>
<dimen name="favorites_icon_size">40dp</dimen>
<dimen name="favorites_icon_outline_size">48dp</dimen>
<dimen name="favorites_icon_padding">2dp</dimen>
<dimen name="favorites_list_item_height">60dp</dimen>
<dimen name="favorites_select_group_button_height">76dp</dimen>
@ -273,6 +274,7 @@
<dimen name="action_bar_image_height">220dp</dimen>
<dimen name="action_bar_image_side_margin">70dp</dimen>
<dimen name="map_markers_recycler_view_item_height">56dp</dimen>
<dimen name="map_markers_recycler_view_padding_bottom">52dp</dimen>
<dimen name="map_markers_recycler_view_padding_top">10dp</dimen>

View file

@ -28,6 +28,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
private final static int OSM_TEXT_ID = 1003;
public static final String TAG = "SecondSplashScreenFragment";
public static final int MIN_SCREEN_WIDTH_TABLET_DP = 600;
public static boolean SHOW = true;
public static boolean VISIBLE = false;
@ -57,8 +58,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
if (!hasNavBar())
return 0;
int orientation = getResources().getConfiguration().orientation;
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
if (isSmartphone && Configuration.ORIENTATION_LANDSCAPE == orientation)
if (isSmartphone() && Configuration.ORIENTATION_LANDSCAPE == orientation)
return 0;
int id = getResources().getIdentifier(orientation == Configuration.ORIENTATION_PORTRAIT ? "navigation_bar_height" : "navigation_bar_height_landscape", "dimen", "android");
if (id > 0)
@ -70,8 +70,7 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
if (!hasNavBar())
return 0;
int orientation = getResources().getConfiguration().orientation;
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
if (orientation == Configuration.ORIENTATION_LANDSCAPE && isSmartphone) {
if (orientation == Configuration.ORIENTATION_LANDSCAPE && isSmartphone()) {
int id = getResources().getIdentifier("navigation_bar_width", "dimen", "android");
if (id > 0)
return getResources().getDimensionPixelSize(id);
@ -97,8 +96,12 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
logo.setImageDrawable(AppCompatResources.getDrawable(activity, R.drawable.ic_logo_splash_osmand_plus));
}
RelativeLayout.LayoutParams logoLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (isSmartphone()) {
logoLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
logoLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
} else {
logoLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
}
ImageView text = new ImageView(activity);
text.setId(TEXT_ID);
@ -160,6 +163,10 @@ public class SecondSplashScreenFragment extends BaseOsmAndFragment {
return view;
}
private boolean isSmartphone() {
return getResources().getConfiguration().smallestScreenWidthDp < MIN_SCREEN_WIDTH_TABLET_DP;
}
@Override
public void onResume() {
super.onResume();

View file

@ -1167,7 +1167,7 @@ public class MapControlsLayer extends OsmandMapLayer {
((ImageView) iv).setImageDrawable(new CompassDrawable(d));
} else {
int btnSizePx = (iv).getLayoutParams().height;
int iconSizePx = (int) ctx.getResources().getDimension(R.dimen.standard_icon_size);
int iconSizePx = (int) ctx.getResources().getDimension(R.dimen.map_widget_icon);
int iconPadding = (btnSizePx - iconSizePx) / 2;
iv.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
((ImageView) iv).setScaleType(ImageView.ScaleType.FIT_CENTER);