Remove unnecessary xml duplicates
This commit is contained in:
parent
8ac031b483
commit
5e14078efb
6 changed files with 75 additions and 95 deletions
|
@ -249,6 +249,14 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</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>
|
</FrameLayout>
|
|
@ -145,94 +145,18 @@
|
||||||
tools:src="@drawable/ic_action_remove_dark"
|
tools:src="@drawable/ic_action_remove_dark"
|
||||||
android:contentDescription="@string/snap_to_road" />
|
android:contentDescription="@string/snap_to_road" />
|
||||||
|
|
||||||
<FrameLayout
|
<include layout="@layout/map_ruler" />
|
||||||
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">
|
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
<LinearLayout
|
<include
|
||||||
|
layout="@layout/map_hud_controls"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_marginBottom="@dimen/map_button_margin"
|
android:layout_marginEnd="@dimen/map_button_margin"
|
||||||
android:layout_marginRight="@dimen/map_button_margin"
|
android:layout_marginRight="@dimen/map_button_margin"
|
||||||
android:layout_marginEnd="@dimen/map_button_margin">
|
android:layout_marginBottom="@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>
|
|
||||||
|
|
||||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||||
android:id="@+id/map_horizontal_progress"
|
android:id="@+id/map_horizontal_progress"
|
||||||
|
|
|
@ -3,11 +3,7 @@
|
||||||
android:id="@+id/map_hud_controls"
|
android:id="@+id/map_hud_controls"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end|bottom"
|
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">
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/map_my_location_button"
|
android:id="@+id/map_my_location_button"
|
||||||
|
@ -21,6 +17,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
android:layout_marginStart="@dimen/map_button_spacing"
|
android:layout_marginStart="@dimen/map_button_spacing"
|
||||||
android:layout_marginLeft="@dimen/map_button_spacing"
|
android:layout_marginLeft="@dimen/map_button_spacing"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
44
OsmAnd/res/layout/map_ruler.xml
Normal file
44
OsmAnd/res/layout/map_ruler.xml
Normal 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>
|
|
@ -92,6 +92,13 @@
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/map_hud_controls"
|
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" />
|
tools:visibility="invisible" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
|
||||||
view.findViewById(R.id.control_buttons).setLayoutParams(params);
|
view.findViewById(R.id.control_buttons).setLayoutParams(params);
|
||||||
}
|
}
|
||||||
buildZoomButtons(view);
|
buildZoomButtons(view);
|
||||||
enterMeasurementMode();
|
enterTrackAppearanceMode();
|
||||||
runLayoutListener();
|
runLayoutListener();
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
|
@ -238,10 +238,10 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
exitMeasurementMode();
|
exitTrackAppearanceMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterMeasurementMode() {
|
private void enterTrackAppearanceMode() {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
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();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
||||||
|
|
Loading…
Reference in a new issue