Fix context menu crash

This commit is contained in:
crimean 2019-07-06 22:36:29 +03:00
parent 630b20f1ab
commit 4e651f8164
2 changed files with 12 additions and 49 deletions

View file

@ -1,61 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half"
android:paddingBottom="@dimen/context_menu_padding_margin_small">
<LinearLayout
<include
android:id="@+id/additional_button_left_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_weight="1"
android:background="?attr/ctx_menu_controller_bg"
android:minHeight="@dimen/context_menu_controller_height">
layout="@layout/map_context_menu_button" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/additional_button_left"
android:layout_width="wrap_content"
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:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/poi_additional_type" />
<View
android:id="@+id/additional_buttons_divider"
android:layout_width="@dimen/content_padding_half"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
<include
android:id="@+id/additional_button_right_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_weight="1"
android:background="?attr/ctx_menu_controller_bg"
android:minHeight="@dimen/context_menu_controller_height">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/additional_button_right"
android:layout_width="wrap_content"
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:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/shared_string_others" />
</LinearLayout>
layout="@layout/map_context_menu_button" />
</LinearLayout>

View file

@ -1231,12 +1231,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
// Left button
final View leftButtonView = view.findViewById(R.id.additional_button_left_view);
final TextView leftButton = (TextView) view.findViewById(R.id.additional_button_left);
final TextView leftButton = (TextView) leftButtonView.findViewById(R.id.button_text);
fillButtonInfo(leftButtonController, leftButtonView, leftButton);
// Right button
final View rightButtonView = view.findViewById(R.id.additional_button_right_view);
final TextView rightButton = (TextView) view.findViewById(R.id.additional_button_right);
final TextView rightButton = (TextView) rightButtonView.findViewById(R.id.button_text);
fillButtonInfo(rightButtonController, rightButtonView, rightButton);
container.addView(view);