Route details UI fixes
This commit is contained in:
parent
ee8777ee28
commit
3051fb5069
8 changed files with 149 additions and 102 deletions
8
OsmAnd/res/drawable/btn_circle_transparent_full.xml
Normal file
8
OsmAnd/res/drawable/btn_circle_transparent_full.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="@color/map_widget_dark_pressed" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
|
@ -21,67 +21,74 @@
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<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="start|center_vertical"
|
android:layout_gravity="start|center_vertical"
|
||||||
android:background="?attr/flow_toolbar_bg"
|
android:background="?attr/flow_toolbar_bg" />
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageView
|
<android.support.v7.widget.AppCompatImageButton
|
||||||
android:id="@+id/back_button_flow"
|
android:id="@+id/back_button_flow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="@drawable/btn_circle_transparent_full"
|
||||||
android:contentDescription="@string/shared_string_back"
|
android:contentDescription="@string/shared_string_back"
|
||||||
android:src="@drawable/ic_arrow_back"
|
android:src="@drawable/ic_arrow_back"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/toolbar_options_flow"
|
android:id="@+id/toolbar_options_flow_bg"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="144dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end|center_vertical"
|
android:layout_gravity="end|center_vertical"
|
||||||
android:background="?attr/flow_toolbar_bg"
|
android:background="?attr/flow_toolbar_bg"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="20dp"
|
||||||
android:paddingRight="20dp">
|
android:paddingRight="20dp" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageView
|
<LinearLayout
|
||||||
|
android:id="@+id/toolbar_options_flow"
|
||||||
|
android:layout_width="144dp"
|
||||||
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="12dp"
|
||||||
|
android:paddingRight="12dp">
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatImageButton
|
||||||
android:id="@+id/print_route_flow"
|
android:id="@+id/print_route_flow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
android:background="@drawable/btn_circle_transparent_full"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:contentDescription="@string/print_route"
|
android:contentDescription="@string/print_route"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_gprint_dark"
|
android:src="@drawable/ic_action_gprint_dark"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageView
|
<android.support.v7.widget.AppCompatImageButton
|
||||||
android:id="@+id/save_as_gpx_flow"
|
android:id="@+id/save_as_gpx_flow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="@drawable/btn_circle_transparent_full"
|
||||||
android:contentDescription="@string/shared_string_save_as_gpx"
|
android:contentDescription="@string/shared_string_save_as_gpx"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_gsave_dark"
|
android:src="@drawable/ic_action_gsave_dark"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageView
|
<android.support.v7.widget.AppCompatImageButton
|
||||||
android:id="@+id/share_as_gpx_flow"
|
android:id="@+id/share_as_gpx_flow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
android:background="@drawable/btn_circle_transparent_full"
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:contentDescription="@string/share_route_as_gpx"
|
android:contentDescription="@string/share_route_as_gpx"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_gshare_dark"
|
android:src="@drawable/ic_action_gshare_dark"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
|
@ -105,17 +112,26 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="@dimen/dashboard_map_toolbar"
|
||||||
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
|
android:layout_gravity="start|center_vertical"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageView
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/back_button"
|
android:id="@+id/back_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/shared_string_close"
|
android:contentDescription="@string/shared_string_close"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_arrow_back"
|
android:src="@drawable/ic_arrow_back"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -139,37 +155,51 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageButton
|
<LinearLayout
|
||||||
|
android:id="@+id/toolbar_options"
|
||||||
|
android:layout_width="144dp"
|
||||||
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="12dp"
|
||||||
|
android:paddingRight="12dp"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/print_route"
|
android:id="@+id/print_route"
|
||||||
style="@style/Widget.AppCompat.ActionButton"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_width="44dp"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="48dp"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/print_route"
|
android:contentDescription="@string/print_route"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_gprint_dark"
|
android:src="@drawable/ic_action_gprint_dark"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageButton
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/save_as_gpx"
|
android:id="@+id/save_as_gpx"
|
||||||
style="@style/Widget.AppCompat.ActionButton"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_width="44dp"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="48dp"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/shared_string_save_as_gpx"
|
android:contentDescription="@string/shared_string_save_as_gpx"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_gsave_dark"
|
android:src="@drawable/ic_action_gsave_dark"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
<android.support.v7.widget.AppCompatImageButton
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/share_as_gpx"
|
android:id="@+id/share_as_gpx"
|
||||||
style="@style/Widget.AppCompat.ActionButton"
|
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_width="44dp"
|
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||||
android:layout_height="48dp"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_marginEnd="@dimen/content_padding_small"
|
|
||||||
android:layout_marginRight="@dimen/content_padding_small"
|
|
||||||
android:contentDescription="@string/share_route_as_gpx"
|
android:contentDescription="@string/share_route_as_gpx"
|
||||||
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_gshare_dark"
|
android:src="@drawable/ic_action_gshare_dark"
|
||||||
android:tint="?attr/primary_icon_color" />
|
android:tint="?attr/primary_icon_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -283,6 +283,7 @@
|
||||||
<dimen name="route_info_legend_padding">8dp</dimen>
|
<dimen name="route_info_legend_padding">8dp</dimen>
|
||||||
<dimen name="route_info_warning_padding">18dp</dimen>
|
<dimen name="route_info_warning_padding">18dp</dimen>
|
||||||
<dimen name="route_info_chart_height">52dp</dimen>
|
<dimen name="route_info_chart_height">52dp</dimen>
|
||||||
|
<dimen name="route_info_toolbar_button_size">40dp</dimen>
|
||||||
|
|
||||||
<dimen name="multi_selection_header_height">52dp</dimen>
|
<dimen name="multi_selection_header_height">52dp</dimen>
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v7.view.ContextThemeWrapper;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
|
@ -171,7 +172,9 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
|
||||||
preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||||
transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
|
transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
|
||||||
|
|
||||||
view = inflater.inflate(getMainLayoutId(), container, false);
|
ContextThemeWrapper context =
|
||||||
|
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||||
|
view = LayoutInflater.from(context).inflate(getMainLayoutId(), container, false);
|
||||||
currentMenuState = getInitialMenuState();
|
currentMenuState = getInitialMenuState();
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
||||||
import net.osmand.plus.routepreparationmenu.RouteDetailsFragment;
|
import net.osmand.plus.routepreparationmenu.RouteDetailsFragment;
|
||||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -42,7 +43,7 @@ public class DashNavigationFragment extends DashBaseFragment {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
RouteDetailsFragment.showInstance((MapActivity) activity);
|
ChooseRouteFragment.showInstance(((MapActivity) activity).getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.support.v7.view.ContextThemeWrapper;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -62,6 +63,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
|
|
||||||
public static final String TAG = "ChooseRouteFragment";
|
public static final String TAG = "ChooseRouteFragment";
|
||||||
public static final String ROUTE_INDEX_KEY = "route_index_key";
|
public static final String ROUTE_INDEX_KEY = "route_index_key";
|
||||||
|
public static final String ROUTE_INFO_STATE_KEY = "route_info_state_key";
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LockableViewPager viewPager;
|
private LockableViewPager viewPager;
|
||||||
|
@ -80,6 +82,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
private boolean wasDrawerDisabled;
|
private boolean wasDrawerDisabled;
|
||||||
|
|
||||||
private boolean publicTransportMode;
|
private boolean publicTransportMode;
|
||||||
|
private int routeInfoMenuState = -1;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,11 +97,14 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
routeIndex = args.getInt(ROUTE_INDEX_KEY);
|
routeIndex = args.getInt(ROUTE_INDEX_KEY);
|
||||||
|
routeInfoMenuState = args.getInt(ROUTE_INFO_STATE_KEY, -1);
|
||||||
}
|
}
|
||||||
if (routes != null && !routes.isEmpty()) {
|
if (routes != null && !routes.isEmpty()) {
|
||||||
publicTransportMode = true;
|
publicTransportMode = true;
|
||||||
}
|
}
|
||||||
View view = inflater.inflate(R.layout.fragment_show_all_routes, null);
|
ContextThemeWrapper context =
|
||||||
|
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||||
|
View view = LayoutInflater.from(context).inflate(R.layout.fragment_show_all_routes, null);
|
||||||
AndroidUtils.addStatusBarPadding21v(mapActivity, view);
|
AndroidUtils.addStatusBarPadding21v(mapActivity, view);
|
||||||
solidToolbarView = view.findViewById(R.id.toolbar_layout);
|
solidToolbarView = view.findViewById(R.id.toolbar_layout);
|
||||||
solidToolbarHeight = getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
|
solidToolbarHeight = getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
|
||||||
|
@ -209,6 +215,9 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
mapActivity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
|
mapActivity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
|
||||||
|
if (routeInfoMenuState != -1) {
|
||||||
|
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoMenu(routeInfoMenuState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ignore
|
// ignore
|
||||||
|
@ -331,7 +340,6 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildMenuButtons(@NonNull View view) {
|
private void buildMenuButtons(@NonNull View view) {
|
||||||
OsmandApplication app = requireMyApplication();
|
|
||||||
View backButton = view.findViewById(R.id.back_button);
|
View backButton = view.findViewById(R.id.back_button);
|
||||||
View backButtonFlow = view.findViewById(R.id.back_button_flow);
|
View backButtonFlow = view.findViewById(R.id.back_button_flow);
|
||||||
OnClickListener backOnClick = new OnClickListener() {
|
OnClickListener backOnClick = new OnClickListener() {
|
||||||
|
@ -343,7 +351,6 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
backButton.setOnClickListener(backOnClick);
|
backButton.setOnClickListener(backOnClick);
|
||||||
backButtonFlow.setOnClickListener(backOnClick);
|
backButtonFlow.setOnClickListener(backOnClick);
|
||||||
|
|
||||||
int buttonsVisible = 3;
|
|
||||||
OnClickListener printOnClick = new OnClickListener() {
|
OnClickListener printOnClick = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -354,11 +361,6 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
View printRouteFlow = view.findViewById(R.id.print_route_flow);
|
View printRouteFlow = view.findViewById(R.id.print_route_flow);
|
||||||
printRoute.setOnClickListener(printOnClick);
|
printRoute.setOnClickListener(printOnClick);
|
||||||
printRouteFlow.setOnClickListener(printOnClick);
|
printRouteFlow.setOnClickListener(printOnClick);
|
||||||
if (publicTransportMode) {
|
|
||||||
printRoute.setVisibility(View.GONE);
|
|
||||||
printRouteFlow.setVisibility(View.GONE);
|
|
||||||
buttonsVisible--;
|
|
||||||
}
|
|
||||||
|
|
||||||
View saveRoute = view.findViewById(R.id.save_as_gpx);
|
View saveRoute = view.findViewById(R.id.save_as_gpx);
|
||||||
View saveRouteFlow = view.findViewById(R.id.save_as_gpx_flow);
|
View saveRouteFlow = view.findViewById(R.id.save_as_gpx_flow);
|
||||||
|
@ -374,11 +376,6 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
};
|
};
|
||||||
saveRoute.setOnClickListener(saveOnClick);
|
saveRoute.setOnClickListener(saveOnClick);
|
||||||
saveRouteFlow.setOnClickListener(saveOnClick);
|
saveRouteFlow.setOnClickListener(saveOnClick);
|
||||||
if (publicTransportMode) {
|
|
||||||
saveRoute.setVisibility(View.GONE);
|
|
||||||
saveRouteFlow.setVisibility(View.GONE);
|
|
||||||
buttonsVisible--;
|
|
||||||
}
|
|
||||||
|
|
||||||
View shareRoute = view.findViewById(R.id.share_as_gpx);
|
View shareRoute = view.findViewById(R.id.share_as_gpx);
|
||||||
View shareRouteFlow = view.findViewById(R.id.share_as_gpx_flow);
|
View shareRouteFlow = view.findViewById(R.id.share_as_gpx_flow);
|
||||||
|
@ -419,13 +416,11 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
};
|
};
|
||||||
shareRoute.setOnClickListener(shareOnClick);
|
shareRoute.setOnClickListener(shareOnClick);
|
||||||
shareRouteFlow.setOnClickListener(shareOnClick);
|
shareRouteFlow.setOnClickListener(shareOnClick);
|
||||||
|
|
||||||
if (publicTransportMode) {
|
if (publicTransportMode) {
|
||||||
shareRoute.setVisibility(View.GONE);
|
view.findViewById(R.id.toolbar_options).setVisibility(View.GONE);
|
||||||
shareRouteFlow.setVisibility(View.GONE);
|
|
||||||
buttonsVisible--;
|
|
||||||
}
|
|
||||||
if (buttonsVisible == 0) {
|
|
||||||
view.findViewById(R.id.toolbar_options_flow).setVisibility(View.GONE);
|
view.findViewById(R.id.toolbar_options_flow).setVisibility(View.GONE);
|
||||||
|
view.findViewById(R.id.toolbar_options_flow_bg).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,6 +686,22 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean showFromRouteInfo(FragmentManager fragmentManager, int routeIndex, int routeInfoState) {
|
||||||
|
try {
|
||||||
|
ChooseRouteFragment fragment = new ChooseRouteFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt(ROUTE_INDEX_KEY, routeIndex);
|
||||||
|
args.putInt(ROUTE_INFO_STATE_KEY, routeInfoState);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
fragmentManager.beginTransaction()
|
||||||
|
.add(R.id.routeMenuContainer, fragment, TAG)
|
||||||
|
.commitAllowingStateLoss();
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class RoutesPagerAdapter extends FragmentPagerAdapter {
|
public class RoutesPagerAdapter extends FragmentPagerAdapter {
|
||||||
private int routesCount;
|
private int routesCount;
|
||||||
|
|
||||||
|
|
|
@ -609,7 +609,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
if (card instanceof SimpleRouteCard) {
|
if (card instanceof SimpleRouteCard) {
|
||||||
hide();
|
hide();
|
||||||
RouteDetailsFragment.showInstance(mapActivity);
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, getCurrentMenuState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -633,14 +633,15 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
} else if (card instanceof PublicTransportCard) {
|
} else if (card instanceof PublicTransportCard) {
|
||||||
if (buttonIndex == PublicTransportCard.DETAILS_BUTTON_INDEX) {
|
if (buttonIndex == PublicTransportCard.DETAILS_BUTTON_INDEX) {
|
||||||
hide();
|
hide();
|
||||||
ChooseRouteFragment.showInstance(mapActivity.getSupportFragmentManager(), ((PublicTransportCard) card).getRouteId());
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
||||||
|
((PublicTransportCard) card).getRouteId(), getCurrentMenuState());
|
||||||
} else if (buttonIndex == PublicTransportCard.SHOW_BUTTON_INDEX) {
|
} else if (buttonIndex == PublicTransportCard.SHOW_BUTTON_INDEX) {
|
||||||
setupCards();
|
setupCards();
|
||||||
openMenuHeaderOnly();
|
openMenuHeaderOnly();
|
||||||
}
|
}
|
||||||
} else if (card instanceof SimpleRouteCard) {
|
} else if (card instanceof SimpleRouteCard) {
|
||||||
hide();
|
hide();
|
||||||
RouteDetailsFragment.showInstance(mapActivity);
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, getCurrentMenuState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1262,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
if (app.getRoutingHelper().isPublicTransportMode()) {
|
if (app.getRoutingHelper().isPublicTransportMode()) {
|
||||||
if (isTransportRouteCalculated()) {
|
if (isTransportRouteCalculated()) {
|
||||||
ChooseRouteFragment.showInstance(mapActivity.getSupportFragmentManager(), app.getTransportRoutingHelper().getCurrentRoute());
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
||||||
|
app.getTransportRoutingHelper().getCurrentRoute(), getCurrentMenuState());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().startNavigation();
|
mapActivity.getMapLayers().getMapControlsLayer().startNavigation();
|
||||||
|
|
|
@ -1511,13 +1511,4 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
|
||||||
final int timeInSeconds = model.getExpectedTime();
|
final int timeInSeconds = model.getExpectedTime();
|
||||||
return Algorithms.formatDuration(timeInSeconds, app.accessibilityEnabled());
|
return Algorithms.formatDuration(timeInSeconds, app.accessibilityEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(@NonNull MapActivity mapActivity) {
|
|
||||||
try {
|
|
||||||
ChooseRouteFragment.showInstance(mapActivity.getSupportFragmentManager());
|
|
||||||
return true;
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue