Remove unnecessary xml duplicates

This commit is contained in:
Vitaliy 2020-07-24 19:45:14 +03:00
parent 8ac031b483
commit 5e14078efb
6 changed files with 75 additions and 95 deletions

View file

@ -249,6 +249,14 @@
</LinearLayout>
<include layout="@layout/map_hud_controls" />
<include
layout="@layout/map_hud_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginStart="@dimen/fab_margin_right"
android:layout_marginLeft="@dimen/fab_margin_right"
android:layout_marginEnd="@dimen/fab_margin_right"
android:layout_marginRight="@dimen/fab_margin_right" />
</FrameLayout>

View file

@ -145,94 +145,18 @@
tools:src="@drawable/ic_action_remove_dark"
android:contentDescription="@string/snap_to_road" />
<FrameLayout
android:id="@+id/map_ruler_layout"
android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginStart="@dimen/map_button_margin">
<include layout="@layout/map_ruler" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin">
<TextView
android:id="@+id/map_ruler_text_shadow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m"/>
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m"/>
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/map_ruler_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/ruler"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:layout_marginEnd="@dimen/map_button_margin">
<ImageButton
android:id="@+id/map_my_location_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_gravity="bottom"
android:background="@drawable/btn_circle"
android:contentDescription="@string/shared_string_my_location"
tools:src="@drawable/ic_action_remove_dark"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/map_button_spacing"
android:layout_marginStart="@dimen/map_button_spacing"
android:orientation="vertical">
<ImageButton
android:id="@+id/map_zoom_in_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomIn"
tools:src="@drawable/ic_action_remove_dark"/>
<ImageButton
android:id="@+id/map_zoom_out_button"
android:layout_width="@dimen/map_button_size"
android:layout_height="@dimen/map_button_size"
android:layout_marginTop="@dimen/map_button_spacing"
android:background="@drawable/btn_circle"
android:contentDescription="@string/zoomOut"
tools:src="@drawable/ic_action_remove_dark"/>
</LinearLayout>
</LinearLayout>
<include
layout="@layout/map_hud_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:layout_marginBottom="@dimen/map_button_margin" />
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/map_horizontal_progress"

View file

@ -3,11 +3,7 @@
android:id="@+id/map_hud_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginStart="@dimen/fab_margin_right"
android:layout_marginLeft="@dimen/fab_margin_right"
android:layout_marginEnd="@dimen/fab_margin_right"
android:layout_marginRight="@dimen/fab_margin_right">
android:layout_gravity="end|bottom">
<ImageButton
android:id="@+id/map_my_location_button"
@ -21,6 +17,7 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/map_button_spacing"
android:layout_marginLeft="@dimen/map_button_spacing"
android:orientation="vertical">

View file

@ -0,0 +1,44 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_ruler_layout"
android:layout_width="@dimen/map_ruler_width"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="@dimen/map_button_margin"
android:layout_marginLeft="@dimen/map_button_margin">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/map_ruler_bottom_margin">
<TextView
android:id="@+id/map_ruler_text_shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m" />
<TextView
android:id="@+id/map_ruler_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:lineSpacingMultiplier="0.9"
android:textSize="@dimen/map_widget_text_size_small"
tools:text="100 m" />
</FrameLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/map_ruler_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/ruler" />
</FrameLayout>

View file

@ -92,6 +92,13 @@
<include
layout="@layout/map_hud_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginStart="@dimen/fab_margin_right"
android:layout_marginLeft="@dimen/fab_margin_right"
android:layout_marginEnd="@dimen/fab_margin_right"
android:layout_marginRight="@dimen/fab_margin_right"
tools:visibility="invisible" />
<LinearLayout

View file

@ -170,7 +170,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
view.findViewById(R.id.control_buttons).setLayoutParams(params);
}
buildZoomButtons(view);
enterMeasurementMode();
enterTrackAppearanceMode();
runLayoutListener();
}
return view;
@ -238,10 +238,10 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
@Override
public void onDestroyView() {
super.onDestroyView();
exitMeasurementMode();
exitTrackAppearanceMode();
}
private void enterMeasurementMode() {
private void enterTrackAppearanceMode() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
@ -252,7 +252,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
}
}
private void exitMeasurementMode() {
private void exitTrackAppearanceMode() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
AndroidUiHelper.mark(mapActivity, View.VISIBLE,