Fix tablet context menu

This commit is contained in:
Dima-1 2020-05-22 20:02:06 +03:00
parent 1b75a6bd52
commit e41a71d74d
4 changed files with 10 additions and 13 deletions

View file

@ -21,15 +21,15 @@
android:layout_height="match_parent"
android:background="@null"
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half"
android:textAllCaps="true"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
android:duplicateParentState="true"
tools:text="Button"
android:paddingStart="@dimen/context_menu_button_padding_x"
android:paddingEnd="@dimen/context_menu_button_padding_x" />
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half" />
</LinearLayout>

View file

@ -51,13 +51,11 @@
<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>
<dimen name="context_menu_button_padding_x">15dp</dimen>
<dimen name="context_menu_buttons_top_margin">-24dp</dimen>
<dimen name="context_menu_progress_min_height">80dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">66dp</dimen>
<dimen name="context_menu_sub_info_height">36dp</dimen>
<dimen name="context_menu_padding_margin_large">30dp</dimen>
<dimen name="context_menu_padding_margin_default">24dp</dimen>
<dimen name="context_menu_padding_margin_medium">15dp</dimen>
<dimen name="context_menu_padding_margin_tiny">9dp</dimen>
<dimen name="context_menu_title_padding">23dp</dimen>

View file

@ -164,7 +164,6 @@
<dimen name="context_menu_first_line_bottom_margin">16dp</dimen>
<dimen name="context_menu_second_line_top_margin">4dp</dimen>
<dimen name="context_menu_top_right_button_min_width">76dp</dimen>
<dimen name="context_menu_button_padding_x">10dp</dimen>
<dimen name="context_menu_buttons_top_margin">-16dp</dimen>
<dimen name="context_menu_buttons_padding_bottom">4dp</dimen>
<dimen name="context_menu_progress_min_height">54dp</dimen>

View file

@ -1150,7 +1150,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
Drawable rightIcon = leftTitleButtonController.getRightIcon();
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
leftTitleButton.setCompoundDrawablePadding(dpToPx(8f));
leftTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) leftTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
leftTitleButtonView.setVisibility(View.INVISIBLE);
@ -1169,7 +1169,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
Drawable rightIcon = rightTitleButtonController.getRightIcon();
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
rightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
rightTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) rightTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
rightTitleButtonView.setVisibility(View.INVISIBLE);
@ -1185,7 +1185,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
Drawable rightIcon = bottomTitleButtonController.getRightIcon();
bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
bottomTitleButton.setCompoundDrawablePadding(dpToPx(8f));
bottomTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) bottomTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
bottomTitleButtonView.setVisibility(View.GONE);
@ -1209,7 +1209,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
Drawable rightIcon = leftDownloadButtonController.getRightIcon();
leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
leftDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) leftDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
leftDownloadButtonView.setVisibility(View.INVISIBLE);
@ -1225,7 +1225,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
Drawable rightIcon = rightDownloadButtonController.getRightIcon();
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
rightDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
rightDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) rightDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
rightDownloadButtonView.setVisibility(View.INVISIBLE);
@ -1295,7 +1295,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = buttonController.getLeftIcon();
Drawable rightIcon = buttonController.getRightIcon();
buttonText.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
buttonText.setCompoundDrawablePadding(dpToPx(8f));
buttonText.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) buttonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
buttonView.setOnClickListener(new View.OnClickListener() {
@Override