Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-10 04:19:30 +02:00
commit f808d819e3
15 changed files with 374 additions and 261 deletions

View file

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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="match_parent"
android:background="@color/color_transparent"
android:clickable="true">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:clickable="true"
android:orientation="vertical"
tools:background="@drawable/bg_bottom_menu_dark">
<ProgressBar
android:id="@+id/snap_to_road_progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
android:id="@+id/up_down_row"
android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_up_down_row_height"
android:background="?attr/selectableItemBackground">
<ImageView
android:id="@+id/up_down_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginRight="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_arrow_down"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/markers_distance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
</LinearLayout>
<TextView
android:id="@+id/markers_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="3 markers"/>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/select_all_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
android:paddingLeft="@dimen/measurement_tool_text_button_padding"
android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
android:paddingStart="@dimen/measurement_tool_text_button_padding"
android:text="@string/shared_string_select_all"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
<FrameLayout
android:id="@+id/markers_list_container"
android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_points_list_container_height"
android:background="@color/ctx_menu_info_view_bg_dark">
<android.support.v7.widget.RecyclerView
android:id="@+id/markers_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_color"
android:orientation="vertical">
<include layout="@layout/plan_route_toolbar_and_up_down_row"/>
<FrameLayout
android:id="@+id/markers_list_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:background="@color/ctx_menu_info_view_bg_dark">
<android.support.v7.widget.RecyclerView
android:id="@+id/markers_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_transparent"
android:clickable="true">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_onmap"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_color"
android:orientation="vertical">
<include layout="@layout/plan_route_toolbar_and_up_down_row"/>
<FrameLayout
android:id="@+id/markers_list_container"
android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_points_list_container_height"
tools:background="@color/ctx_menu_info_view_bg_dark">
<android.support.v7.widget.RecyclerView
android:id="@+id/markers_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/plan_route_toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:minHeight="@dimen/dashboard_map_toolbar"
android:visibility="gone"
app:contentInsetLeft="54dp"
app:contentInsetStart="54dp"
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/plan_route"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/options_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="@string/shared_string_options"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<View
android:id="@+id/toolbar_divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="54dp"
android:layout_marginStart="54dp"
android:visibility="gone"
tools:background="?attr/dashboard_divider"
tools:visibility="visible"/>
<ProgressBar
android:id="@+id/snap_to_road_progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
android:id="@+id/up_down_row"
android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_up_down_row_height"
android:background="?attr/selectableItemBackground">
<ImageView
android:id="@+id/up_down_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginRight="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_arrow_down"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/markers_distance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
</LinearLayout>
<TextView
android:id="@+id/markers_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="3 markers"/>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/select_all_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
android:paddingLeft="@dimen/measurement_tool_text_button_padding"
android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
android:paddingStart="@dimen/measurement_tool_text_button_padding"
android:text="@string/shared_string_select_all"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
</LinearLayout>

View file

@ -190,7 +190,7 @@
<string name="marker_moved_to_active">Քարտեզի Մարկերները տեղափոխվեցին ակտիվ</string>
<string name="shared_string_list">Ցուցակ</string>
<string name="shared_string_groups">Խմբեր</string>
<string name="passed">Անցավ `% 1 $ s</string>
<string name="passed">Անցավ `%1$s</string>
<string name="make_active">Ակտիվացնել</string>
<string name="today">Այսօր</string>
<string name="yesterday">Երեկ</string>

View file

@ -321,7 +321,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
fm.beginTransaction()
.remove(planRouteFragment)
.commitNowAllowingStateLoss();
app.getMapMarkersHelper().getPlanRouteContext().setFragmentShowed(true);
app.getMapMarkersHelper().getPlanRouteContext().setFragmentVisible(true);
}
super.onSaveInstanceState(outState);
}
@ -568,8 +568,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
super.onResume();
long tm = System.currentTimeMillis();
if (app.getMapMarkersHelper().getPlanRouteContext().isFragmentShowed()) {
PlanRouteFragment.showInstance(getSupportFragmentManager(), AndroidUiHelper.isOrientationPortrait(this));
if (app.getMapMarkersHelper().getPlanRouteContext().isFragmentVisible()) {
PlanRouteFragment.showInstance(this);
}
if (app.isApplicationInitializing() || DashboardOnMap.staticVisible) {

View file

@ -368,7 +368,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
fragmentRef.get().centerMarkerLocation();
}
}
updateWidgetsVisibility(false);
updateControlsVisibility();
}
public void show(@NonNull LatLon latLon,
@ -377,6 +377,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (init(latLon, pointDescription, object)) {
showInternal();
}
updateControlsVisibility();
}
private void showInternal() {
@ -389,7 +390,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
centerMarker = false;
autoHide = false;
updateWidgetsVisibility(false);
}
public void update(LatLon latLon, PointDescription pointDescription, Object object) {
@ -450,17 +450,21 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (fragmentRef != null) {
fragmentRef.get().dismissMenu();
}
updateWidgetsVisibility(true);
updateControlsVisibility();
}
private void updateWidgetsVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
public void updateControlsVisibility() {
int visibility = shouldShowControls() ? View.VISIBLE : View.GONE;
mapActivity.findViewById(R.id.map_center_info).setVisibility(visibility);
mapActivity.findViewById(R.id.map_left_widgets_panel).setVisibility(visibility);
mapActivity.findViewById(R.id.map_right_widgets_panel).setVisibility(visibility);
mapActivity.refreshMap();
}
public boolean shouldShowControls() {
return !isVisible() || isLandscapeLayout() || getCurrentMenuState() == MenuController.MenuState.HEADER_ONLY;
}
// timeout in msec
public void hideWithTimeout(long timeout) {
autoHide = true;

View file

@ -525,6 +525,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
boolean needMapAdjust = oldMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN;
if (newMenuState != oldMenuState) {
menu.updateControlsVisibility();
doBeforeMenuStateChange(oldMenuState, newMenuState);
}

View file

@ -25,7 +25,6 @@ import net.osmand.plus.OsmandSettings.MapMarkersOrderByMode;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener;
import net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener;
import net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener;
@ -210,7 +209,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
@Override
public void buildRouteOnClick() {
PlanRouteFragment.showInstance(mapActivity.getSupportFragmentManager(), AndroidUiHelper.isOrientationPortrait(mapActivity));
PlanRouteFragment.showInstance(mapActivity);
dismiss();
}

View file

@ -39,7 +39,8 @@ public class MarkersPlanRouteContext {
private PlanRouteProgressListener listener;
private boolean progressBarVisible;
private boolean fragmentShowed;
private boolean fragmentVisible;
private boolean markersListOpened;
Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedToRoadPoints() {
return snappedToRoadPoints;
@ -73,12 +74,20 @@ public class MarkersPlanRouteContext {
this.progressBarVisible = progressBarVisible;
}
public boolean isFragmentShowed() {
return fragmentShowed;
public boolean isFragmentVisible() {
return fragmentVisible;
}
public void setFragmentShowed(boolean fragmentShowed) {
this.fragmentShowed = fragmentShowed;
public void setFragmentVisible(boolean fragmentVisible) {
this.fragmentVisible = fragmentVisible;
}
public boolean isMarkersListOpened() {
return markersListOpened;
}
public void setMarkersListOpened(boolean markersListOpened) {
this.markersListOpened = markersListOpened;
}
public MarkersPlanRouteContext(OsmandApplication app) {

View file

@ -77,7 +77,6 @@ public class PlanRouteFragment extends Fragment {
private boolean nightMode;
private boolean portrait;
private boolean markersListOpened;
private boolean wasCollapseButtonVisible;
private View mainView;
@ -144,10 +143,12 @@ public class PlanRouteFragment extends Fragment {
final int backgroundColor = ContextCompat.getColor(mapActivity,
nightMode ? R.color.ctx_menu_info_view_bg_dark : R.color.ctx_menu_info_view_bg_light);
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
boolean fullScreen = portrait && planRouteContext.isMarkersListOpened();
int layoutRes = fullScreen ? R.layout.fragment_plan_route_full_screen : R.layout.fragment_plan_route_half_screen;
View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_plan_route, null);
View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), layoutRes, null);
mainView = view.findViewById(R.id.main_view);
mainView = fullScreen ? view : view.findViewById(R.id.main_view);
enterPlanRouteMode();
@ -157,18 +158,16 @@ public class PlanRouteFragment extends Fragment {
}
if (portrait) {
AndroidUtils.setBackground(mapActivity, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
mainView.findViewById(R.id.toolbar_divider).setBackgroundColor(ContextCompat.getColor(mapActivity,
nightMode ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up));
Drawable arrow = getContentIcon(fullScreen ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up);
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(arrow);
mainView.findViewById(R.id.up_down_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!markersListOpened) {
showMarkersList();
} else {
hideMarkersList();
}
showHideMarkersList();
}
});
@ -200,48 +199,54 @@ public class PlanRouteFragment extends Fragment {
});
mapActivity.showTopToolbar(toolbarController);
final int screenH = AndroidUtils.getScreenHeight(mapActivity);
final int statusBarH = AndroidUtils.getStatusBarHeight(mapActivity);
final int navBarH = AndroidUtils.getNavBarHeight(mapActivity);
final int availableHeight = (screenH - statusBarH - navBarH) / 2;
if (fullScreen) {
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.GONE);
mainView.findViewById(R.id.plan_route_toolbar).setVisibility(View.VISIBLE);
mainView.findViewById(R.id.toolbar_divider).setVisibility(View.VISIBLE);
} else {
final int screenH = AndroidUtils.getScreenHeight(mapActivity);
final int statusBarH = AndroidUtils.getStatusBarHeight(mapActivity);
final int navBarH = AndroidUtils.getNavBarHeight(mapActivity);
final int availableHeight = (screenH - statusBarH - navBarH) / 2;
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int upDownRowH = mainView.findViewById(R.id.up_down_row).getHeight();
closedListContainerHeight = availableHeight - upDownRowH;
View listContainer = mainView.findViewById(R.id.markers_list_container);
listContainer.getLayoutParams().height = closedListContainerHeight;
listContainer.requestLayout();
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int upDownRowH = mainView.findViewById(R.id.up_down_row).getHeight();
closedListContainerHeight = availableHeight - upDownRowH;
View listContainer = mainView.findViewById(R.id.markers_list_container);
listContainer.getLayoutParams().height = closedListContainerHeight;
listContainer.requestLayout();
ViewTreeObserver obs = mainView.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
ViewTreeObserver obs = mainView.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
}
});
} else {
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.plan_route_toolbar);
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (quit(false)) {
MapMarkersDialogFragment.showInstance(mapActivity);
}
}
});
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
optionsOnClick();
}
});
});
}
}
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.plan_route_toolbar);
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (quit(false)) {
MapMarkersDialogFragment.showInstance(mapActivity);
}
}
});
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
optionsOnClick();
}
});
markersRv = mainView.findViewById(R.id.markers_recycler_view);
adapter = new MapMarkersListAdapter(mapActivity);
@ -312,33 +317,10 @@ public class PlanRouteFragment extends Fragment {
return view;
}
private void selectAllOnClick() {
int activeMarkersCount = markersHelper.getMapMarkers().size();
if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) {
markersHelper.deselectAllActiveMarkers();
markersHelper.setStartFromMyLocation(false);
selectedCount = 0;
} else {
markersHelper.selectAllActiveMarkers();
markersHelper.setStartFromMyLocation(true);
selectedCount = activeMarkersCount;
}
adapter.calculateStartAndFinishPos();
adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.refreshMap();
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
exitPlanRouteMode();
if (markersListOpened) {
hideMarkersList();
}
}
private MapActivity getMapActivity() {
@ -428,6 +410,26 @@ public class PlanRouteFragment extends Fragment {
};
}
private void selectAllOnClick() {
int activeMarkersCount = markersHelper.getMapMarkers().size();
if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) {
markersHelper.deselectAllActiveMarkers();
markersHelper.setStartFromMyLocation(false);
selectedCount = 0;
} else {
markersHelper.selectAllActiveMarkers();
markersHelper.setStartFromMyLocation(true);
selectedCount = activeMarkersCount;
}
adapter.calculateStartAndFinishPos();
adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.refreshMap();
}
}
private void showProgressBar() {
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
progressBar.setVisibility(View.VISIBLE);
@ -533,6 +535,7 @@ public class PlanRouteFragment extends Fragment {
mapActivity.findViewById(R.id.snap_to_road_image_button).setVisibility(View.GONE);
mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE);
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.VISIBLE);
mapActivity.getMapView().setMapPosition(previousMapPosition);
@ -604,30 +607,15 @@ public class PlanRouteFragment extends Fragment {
}
}
//todo create one method
private void showMarkersList() {
private void showHideMarkersList() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && portrait) {
markersListOpened = true;
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.GONE);
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_down));
View listContainer = mainView.findViewById(R.id.markers_list_container);
if (listContainer != null) {
listContainer.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
}
}
}
private void hideMarkersList() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && portrait) {
markersListOpened = false;
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(View.VISIBLE);
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up));
View listContainer = mainView.findViewById(R.id.markers_list_container);
if (listContainer != null) {
listContainer.getLayoutParams().height = closedListContainerHeight;
}
planRouteContext.setMarkersListOpened(!planRouteContext.isMarkersListOpened());
int containerRes = planRouteContext.isMarkersListOpened() ? R.id.fragmentContainer : R.id.bottomFragmentContainer;
mapActivity.getSupportFragmentManager().beginTransaction()
.remove(this)
.add(containerRes, new PlanRouteFragment(), PlanRouteFragment.TAG)
.commitAllowingStateLoss();
}
}
@ -682,8 +670,8 @@ public class PlanRouteFragment extends Fragment {
}
public boolean quit(boolean hideMarkersListFirst) {
if (portrait && markersListOpened && hideMarkersListFirst) {
hideMarkersList();
if (planRouteContext.isMarkersListOpened() && hideMarkersListFirst) {
showHideMarkersList();
return false;
} else {
dismiss(getMapActivity());
@ -692,19 +680,18 @@ public class PlanRouteFragment extends Fragment {
}
private void dismiss(MapActivity activity) {
if (portrait && markersListOpened) {
hideMarkersList();
}
planRouteContext.setFragmentShowed(false);
planRouteContext.setFragmentVisible(false);
activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
}
public static boolean showInstance(FragmentManager fragmentManager, boolean portrait) {
public static boolean showInstance(MapActivity mapActivity) {
try {
PlanRouteFragment fragment = new PlanRouteFragment();
fragment.setRetainInstance(true);
fragmentManager.beginTransaction()
.add(portrait ? R.id.bottomFragmentContainer : R.id.topFragmentContainer, fragment, PlanRouteFragment.TAG)
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
boolean fullscreen = portrait && mapActivity.getMyApplication().getMapMarkersHelper().getPlanRouteContext().isMarkersListOpened();
int containerRes = portrait ? (fullscreen ? R.id.fragmentContainer : R.id.bottomFragmentContainer) : R.id.topFragmentContainer;
FragmentManager fm = mapActivity.getSupportFragmentManager();
fm.beginTransaction()
.add(containerRes, new PlanRouteFragment(), PlanRouteFragment.TAG)
.commitAllowingStateLoss();
return true;
} catch (Exception e) {

View file

@ -708,12 +708,12 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
boolean contextMenuOpened = mapActivity.getContextMenu().isVisible();
boolean contextMenuOpened = mapActivity.getContextMenu().shouldShowControls();
boolean showRouteCalculationControls = routePlanningMode ||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || contextMenuOpened);
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || !contextMenuOpened);
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened;
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && contextMenuOpened;
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
if (rh.isFollowingMode()) {
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
@ -728,16 +728,18 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningBtn.updateVisibility(showButtons);
menuControl.updateVisibility(showButtons);
mapZoomIn.updateVisibility(!routeDialogOpened && !contextMenuOpened);
mapZoomOut.updateVisibility(!routeDialogOpened && !contextMenuOpened);
mapZoomIn.updateVisibility(!routeDialogOpened && contextMenuOpened);
mapZoomOut.updateVisibility(!routeDialogOpened && contextMenuOpened);
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && contextMenuOpened);
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
layersHud.update(app, isNight);
}
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
&& contextMenuOpened);
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
&& contextMenuOpened);
if (!routePlanningMode && !routeFollowingMode) {
if (mapView.isZooming()) {

View file

@ -28,6 +28,8 @@ import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
@ -811,7 +813,7 @@ public class MapInfoWidgetsFactory {
}
}
}
if (map.isTopToolbarActive() || map.getContextMenu().isVisible()) {
if (map.isTopToolbarActive() || !map.getContextMenu().shouldShowControls()) {
updateVisibility(false);
} else if (!showNextTurn && updateWaypoint()) {
updateVisibility(true);

View file

@ -17,6 +17,8 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.DirectionDrawable;
@ -198,7 +200,7 @@ public class MapMarkersWidgetsFactory {
|| MapRouteInfoMenu.isVisible()
|| addressTopBar.getVisibility() == View.VISIBLE
|| map.isTopToolbarActive()
|| map.getContextMenu().isVisible()) {
|| !map.getContextMenu().shouldShowControls()) {
updateVisibility(false);
return;
}