Route preparation menu in progress
This commit is contained in:
parent
c2bd5f184b
commit
e6eb1b0ecd
19 changed files with 539 additions and 187 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
<View
|
||||
android:id="@+id/map_route_land_left_margin"
|
||||
android:layout_width="@dimen/map_route_planning_land_width"
|
||||
android:layout_width="@dimen/map_route_planning_land_width_minus_shadow"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="top|left"
|
||||
android:visibility="gone"/>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
android:layout_width="@dimen/map_route_planning_land_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/left_menu_view_bg"
|
||||
android:background="@drawable/bg_left_menu_dark"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -26,10 +26,11 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerModesLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -85,7 +86,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/fromIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
|
@ -98,6 +99,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fromTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
|
@ -127,9 +129,10 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerFromDropDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -140,7 +143,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/viaIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
|
@ -180,7 +183,7 @@
|
|||
android:id="@+id/viaLayoutDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -191,7 +194,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/toIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
|
@ -204,6 +207,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
|
@ -232,9 +236,10 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerToDropDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -246,7 +251,8 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/Info"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
@ -261,13 +267,84 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/InfoIcon"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/info_button"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_info_dark"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/InfoDistance"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DistanceTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="left"
|
||||
android:text="@string/route_distance"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DistanceText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:gravity="left"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/DurationIcon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/info_button"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_time"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/InfoDuration"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DurationTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="left"
|
||||
android:text="@string/route_duration"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DurationText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:gravity="left"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/InfoTextView"
|
||||
android:layout_width="0dp"
|
||||
|
@ -293,10 +370,11 @@
|
|||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerButtons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<include layout="@layout/map_route_prepare_bottom"/>
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
android:src="@drawable/ic_action_test_light" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerBtn1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
android:background="@color/dashboard_divider_dark"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map_waypoints_route_button"
|
||||
|
@ -28,9 +29,10 @@
|
|||
android:src="@drawable/ic_action_test_light" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerBtn2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
android:background="@color/dashboard_divider_dark"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/map_options_route_button"
|
||||
|
@ -41,9 +43,10 @@
|
|||
android:src="@drawable/ic_action_test_light" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerBtn3"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
android:background="@color/dashboard_divider_dark"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_go_route_button"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bottom_menu_view_bg"
|
||||
android:background="@drawable/bg_bottom_menu_dark"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -26,10 +26,11 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerModesLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -85,7 +86,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/fromIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
|
@ -98,6 +99,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fromTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
|
@ -127,9 +129,10 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerFromDropDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -140,7 +143,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/viaIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
|
@ -180,7 +183,7 @@
|
|||
android:id="@+id/viaLayoutDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -191,7 +194,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/toIcon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
|
@ -204,6 +207,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
|
@ -232,9 +236,10 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerToDropDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -246,7 +251,8 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/Info"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
@ -261,13 +267,84 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/InfoIcon"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/info_button"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_info_dark"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/InfoDistance"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DistanceTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="left"
|
||||
android:text="@string/route_distance"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DistanceText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:gravity="left"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/DurationIcon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/info_button"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_time"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/InfoDuration"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DurationTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="left"
|
||||
android:text="@string/route_duration"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DurationText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:gravity="left"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/InfoTextView"
|
||||
android:layout_width="0dp"
|
||||
|
@ -293,10 +370,11 @@
|
|||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerButtons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:background="@color/dashboard_divider_dark"
|
||||
android:focusable="false"/>
|
||||
|
||||
<include layout="@layout/map_route_prepare_bottom"/>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<dimen name="map_route_planning_max_height">450dp</dimen>
|
||||
<dimen name="map_minwidth_widget">160dp</dimen>
|
||||
<dimen name="map_route_planning_land_width">510dp</dimen>
|
||||
<dimen name="map_route_planning_land_width_minus_shadow">496dp</dimen>
|
||||
|
||||
<dimen name="map_address_height">60dp</dimen>
|
||||
<dimen name="map_button_size">78dp</dimen>
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
<dimen name="map_button_stroke">1dp</dimen>
|
||||
<dimen name="map_button_stroke_dark">1dp</dimen>
|
||||
<dimen name="map_route_planning_land_width">320dp</dimen>
|
||||
<dimen name="map_route_planning_land_width_minus_shadow">306dp</dimen>
|
||||
<dimen name="map_route_planning_max_height">330dp</dimen>
|
||||
<dimen name="map_minwidth_widget">100dp</dimen>
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="route_distance">Distance:</string>
|
||||
<string name="route_duration">Travelling time:</string>
|
||||
<string-array name="update_frequencies_array">
|
||||
<item>Every Hour</item>
|
||||
<item>Once a day</item>
|
||||
|
|
|
@ -3,8 +3,10 @@ package net.osmand;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
|
@ -64,4 +66,15 @@ public class AndroidUtils {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
view.setBackground(ctx.getResources().getDrawable(night ? darkResId : lightResId,
|
||||
ctx.getTheme()));
|
||||
} else {
|
||||
view.setBackgroundDrawable(ctx.getResources().getDrawable(night ? darkResId : lightResId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ public class ContextMenuAdapter {
|
|||
Integer lid = getLayoutId(position);
|
||||
if (lid == R.layout.mode_toggles) {
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||
return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, new View.OnClickListener() {
|
||||
return AppModeDialog.prepareAppModeDrawerView(activity, visibleModes, selected, allModes, false, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selected.size() > 0) {
|
||||
|
|
|
@ -82,6 +82,10 @@ public class IconsCache {
|
|||
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0);
|
||||
}
|
||||
|
||||
public Drawable getContentIcon(@DrawableRes int id, boolean isLightContent) {
|
||||
return getDrawable(id, isLightContent ? R.color.icon_color : 0);
|
||||
}
|
||||
|
||||
public Drawable getIcon(@DrawableRes int id) {
|
||||
return getDrawable(id, 0);
|
||||
}
|
||||
|
|
|
@ -555,8 +555,13 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
|||
if (mapLabelToShow != null && !mapLabelToShow.contextMenuDisabled()) {
|
||||
mapContextMenu.setMapCenter(latLonToShow);
|
||||
mapContextMenu.setMapPosition(mapView.getMapPosition());
|
||||
if (mapLayers.getMapControlsLayer().getMapRouteInfoMenu().isVisible()) {
|
||||
mapContextMenu.showMinimized(latLonToShow, mapLabelToShow, toShow);
|
||||
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().updateMenu();
|
||||
} else {
|
||||
mapContextMenu.show(latLonToShow, mapLabelToShow, toShow);
|
||||
}
|
||||
}
|
||||
if (!latLonToShow.equals(cur)) {
|
||||
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(),
|
||||
latLonToShow.getLongitude(), settings.getMapZoomToShow(), true);
|
||||
|
|
|
@ -400,7 +400,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
|||
protected void profileDialog() {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(this);
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
|
||||
View v = AppModeDialog.prepareAppModeView(this, selected, false, null, true,
|
||||
View v = AppModeDialog.prepareAppModeView(this, selected, false, null, true, false,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -20,7 +21,7 @@ import android.widget.LinearLayout.LayoutParams;
|
|||
public class AppModeDialog {
|
||||
|
||||
public static View prepareAppModeView(Activity a, final Set<ApplicationMode> selected, boolean showDefault,
|
||||
ViewGroup parent, final boolean singleSelection, final View.OnClickListener onClickListener) {
|
||||
ViewGroup parent, final boolean singleSelection, boolean useMapTheme, final View.OnClickListener onClickListener) {
|
||||
OsmandSettings settings = ((OsmandApplication) a.getApplication()).getSettings();
|
||||
final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(settings));
|
||||
if(!showDefault) {
|
||||
|
@ -29,21 +30,21 @@ public class AppModeDialog {
|
|||
if (showDefault || settings.getApplicationMode() != ApplicationMode.DEFAULT) {
|
||||
selected.add(settings.getApplicationMode());
|
||||
}
|
||||
return prepareAppModeView(a, values, selected, parent, singleSelection, false, onClickListener);
|
||||
return prepareAppModeView(a, values, selected, parent, singleSelection, false, useMapTheme, onClickListener);
|
||||
}
|
||||
|
||||
//special method for drawer menu
|
||||
//needed because if there's more than 4 items - the don't fit in drawer
|
||||
public static View prepareAppModeDrawerView(Activity a, List<ApplicationMode> visible, final Set<ApplicationMode> selected, ContextMenuAdapter.BooleanResult allModes,
|
||||
final View.OnClickListener onClickListener) {
|
||||
boolean useMapTheme, final View.OnClickListener onClickListener) {
|
||||
OsmandSettings settings = ((OsmandApplication) a.getApplication()).getSettings();
|
||||
final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(settings));
|
||||
selected.add(settings.getApplicationMode());
|
||||
return prepareAppModeView(a, values, selected, null, true, true, onClickListener);
|
||||
return prepareAppModeView(a, values, selected, null, true, true, useMapTheme, onClickListener);
|
||||
}
|
||||
|
||||
public static View prepareAppModeView(Activity a, final List<ApplicationMode> values , final Set<ApplicationMode> selected,
|
||||
ViewGroup parent, final boolean singleSelection, boolean drawer, final View.OnClickListener onClickListener) {
|
||||
ViewGroup parent, final boolean singleSelection, boolean drawer, boolean useMapTheme, final View.OnClickListener onClickListener) {
|
||||
View ll = a.getLayoutInflater().inflate(R.layout.mode_toggles, parent);
|
||||
final View[] buttons = new View[values.size()];
|
||||
int k = 0;
|
||||
|
@ -52,7 +53,7 @@ public class AppModeDialog {
|
|||
}
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
updateButtonState((OsmandApplication) a.getApplication(), values, selected, onClickListener, buttons, i,
|
||||
singleSelection);
|
||||
singleSelection, useMapTheme);
|
||||
}
|
||||
return ll;
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ public class AppModeDialog {
|
|||
|
||||
private static void updateButtonState(final OsmandApplication ctx, final List<ApplicationMode> visible,
|
||||
final Set<ApplicationMode> selected, final View.OnClickListener onClickListener, final View[] buttons,
|
||||
int i, final boolean singleChoice) {
|
||||
int i, final boolean singleChoice, final boolean useMapTheme) {
|
||||
if (buttons[i] != null) {
|
||||
View tb = buttons[i];
|
||||
final ApplicationMode mode = visible.get(i);
|
||||
|
@ -69,8 +70,14 @@ public class AppModeDialog {
|
|||
if (checked) {
|
||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
||||
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (useMapTheme) {
|
||||
boolean nightMode = ctx.getDaynightHelper().isNightMode();
|
||||
iv.setImageDrawable(ctx.getIconsCache().getContentIcon(mode.getSmallIconDark(), !nightMode));
|
||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getIconsCache().getContentIcon(mode.getSmallIconDark()));
|
||||
}
|
||||
tb.findViewById(R.id.selection).setVisibility(View.INVISIBLE);
|
||||
}
|
||||
iv.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -94,7 +101,7 @@ public class AppModeDialog {
|
|||
onClickListener.onClick(null);
|
||||
}
|
||||
for(int i = 0; i < visible.size(); i++) {
|
||||
updateButtonState(ctx, visible, selected, onClickListener, buttons, i, singleChoice);
|
||||
updateButtonState(ctx, visible, selected, onClickListener, buttons, i, singleChoice, useMapTheme);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -211,7 +211,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
modes.remove(ApplicationMode.DEFAULT);
|
||||
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>(ApplicationMode.values(settings));
|
||||
selected.remove(ApplicationMode.DEFAULT);
|
||||
View v = AppModeDialog.prepareAppModeView(this, modes, selected, null, false, false,
|
||||
View v = AppModeDialog.prepareAppModeView(this, modes, selected, null, false, false, false,
|
||||
new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
|
@ -35,6 +39,7 @@ import net.osmand.plus.activities.ShowRouteInfoActivity;
|
|||
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||
import net.osmand.plus.activities.search.SearchAddressActivity;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -48,6 +53,8 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||
public static int directionInfo = -1;
|
||||
public static boolean controlVisible = false;
|
||||
|
@ -61,6 +68,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
private MapActivity mapActivity;
|
||||
private MapControlsLayer mapControlsLayer;
|
||||
public static final String TARGET_SELECT = "TARGET_SELECT";
|
||||
private boolean nightMode;
|
||||
private boolean switched;
|
||||
|
||||
public MapRouteInfoMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
|
||||
this.mapActivity = mapActivity;
|
||||
|
@ -116,6 +125,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
public void updateInfo(final View main) {
|
||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||
updateViaView(main);
|
||||
updateFromSpinner(main);
|
||||
updateToSpinner(main);
|
||||
|
@ -132,6 +142,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
private void updateRouteCalcProgress(final View main) {
|
||||
TargetPointsHelper targets = getTargets();
|
||||
if (targets.hasTooLongDistanceToNavigate()) {
|
||||
main.findViewById(R.id.dividerToDropDown).setVisibility(View.VISIBLE);
|
||||
main.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
|
||||
TextView textView = (TextView) main.findViewById(R.id.InfoTextView);
|
||||
ImageView iconView = (ImageView) main.findViewById(R.id.InfoIcon);
|
||||
|
@ -139,8 +150,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
main.findViewById(R.id.Next).setVisibility(View.GONE);
|
||||
textView.setText(R.string.route_is_too_long);
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_warning));
|
||||
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_warning, isLight()));
|
||||
} else {
|
||||
main.findViewById(R.id.dividerToDropDown).setVisibility(View.GONE);
|
||||
main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +165,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
|
||||
vg.removeAllViews();
|
||||
AppModeDialog.prepareAppModeView(mapActivity, selected, false,
|
||||
vg, true, new View.OnClickListener() {
|
||||
vg, true, true, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (selected.size() > 0) {
|
||||
|
@ -167,15 +179,25 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
|
||||
private void updateViaView(final View parentView) {
|
||||
String via = generateViaDescription();
|
||||
View viaLayout = parentView.findViewById(R.id.ViaLayout);
|
||||
if (via.length() == 0) {
|
||||
parentView.findViewById(R.id.ViaLayout).setVisibility(View.GONE);
|
||||
viaLayout.setVisibility(View.GONE);
|
||||
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE);
|
||||
} else {
|
||||
parentView.findViewById(R.id.ViaLayout).setVisibility(View.VISIBLE);
|
||||
viaLayout.setVisibility(View.VISIBLE);
|
||||
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE);
|
||||
((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
|
||||
}
|
||||
|
||||
viaLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getTargets().checkPointToNavigateShort()) {
|
||||
mapActivity.getMapActions().openIntermediatePointsDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
|
||||
if (isLight()) {
|
||||
viaIcon.setImageDrawable(getIconOrig(R.drawable.widget_intermediate_day));
|
||||
|
@ -186,6 +208,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
|
||||
private void updateToSpinner(final View parentView) {
|
||||
final Spinner toSpinner = setupToSpinner(parentView);
|
||||
toSpinner.setClickable(false);
|
||||
toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
@ -206,6 +229,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
});
|
||||
|
||||
parentView.findViewById(R.id.ToLayout).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
toSpinner.performClick();
|
||||
}
|
||||
});
|
||||
|
||||
ImageView toIcon = (ImageView) parentView.findViewById(R.id.toIcon);
|
||||
if (isLight()) {
|
||||
toIcon.setImageDrawable(getIconOrig(R.drawable.widget_target_day));
|
||||
|
@ -214,19 +244,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
ImageView toDropDownIcon = (ImageView) parentView.findViewById(R.id.toDropDownIcon);
|
||||
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||
toDropDownIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
toSpinner.performClick();
|
||||
}
|
||||
});
|
||||
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void updateFromSpinner(final View parentView) {
|
||||
final TargetPointsHelper targets = getTargets();
|
||||
final Spinner fromSpinner = setupFromSpinner(parentView);
|
||||
fromSpinner.setClickable(false);
|
||||
fromSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
|
@ -252,18 +277,19 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
});
|
||||
|
||||
ImageView fromIcon = (ImageView) parentView.findViewById(R.id.fromIcon);
|
||||
ApplicationMode appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
|
||||
fromIcon.setImageDrawable(mapActivity.getResources().getDrawable(appMode.getResourceLocationDay()));
|
||||
|
||||
ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
|
||||
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||
fromDropDownIcon.setOnClickListener(new View.OnClickListener() {
|
||||
parentView.findViewById(R.id.FromLayout).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
fromSpinner.performClick();
|
||||
}
|
||||
});
|
||||
|
||||
ImageView fromIcon = (ImageView) parentView.findViewById(R.id.fromIcon);
|
||||
ApplicationMode appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
|
||||
fromIcon.setImageDrawable(mapActivity.getResources().getDrawable(appMode.getResourceLocationDay()));
|
||||
|
||||
ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
|
||||
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down, isLight()));
|
||||
}
|
||||
|
||||
protected void selectOnScreen(boolean target) {
|
||||
|
@ -304,7 +330,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
private boolean isLight() {
|
||||
return mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
return !nightMode;
|
||||
}
|
||||
|
||||
private Drawable getIconOrig(int iconId) {
|
||||
|
@ -357,10 +383,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
private void updateRouteButtons(final View mainView) {
|
||||
mainView.findViewById(R.id.dividerToDropDown).setVisibility(View.VISIBLE);
|
||||
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
|
||||
final OsmandApplication ctx = mapActivity.getMyApplication();
|
||||
ImageView prev = (ImageView) mainView.findViewById(R.id.Prev);
|
||||
prev.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_prev));
|
||||
prev.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_prev, isLight()));
|
||||
if (directionInfo >= 0) {
|
||||
prev.setVisibility(View.VISIBLE);
|
||||
prev.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -389,7 +416,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
ImageView next = (ImageView) mainView.findViewById(R.id.Next);
|
||||
next.setVisibility(View.VISIBLE);
|
||||
next.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_next));
|
||||
next.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_next, isLight()));
|
||||
next.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -416,19 +443,45 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
});
|
||||
|
||||
TextView textView = (TextView) mainView.findViewById(R.id.InfoTextView);
|
||||
ImageView iconView = (ImageView) mainView.findViewById(R.id.InfoIcon);
|
||||
ImageView infoIcon = (ImageView) mainView.findViewById(R.id.InfoIcon);
|
||||
ImageView durationIcon = (ImageView) mainView.findViewById(R.id.DurationIcon);
|
||||
View infoDistanceView = mainView.findViewById(R.id.InfoDistance);
|
||||
View infoDurationView = mainView.findViewById(R.id.InfoDuration);
|
||||
if (directionInfo >= 0) {
|
||||
iconView.setVisibility(View.GONE);
|
||||
infoIcon.setVisibility(View.GONE);
|
||||
durationIcon.setVisibility(View.GONE);
|
||||
infoDistanceView.setVisibility(View.GONE);
|
||||
infoDurationView.setVisibility(View.GONE);
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iconView.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_info_dark));
|
||||
iconView.setVisibility(View.VISIBLE);
|
||||
infoIcon.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_polygom_dark, isLight()));
|
||||
infoIcon.setVisibility(View.VISIBLE);
|
||||
durationIcon.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_time, isLight()));
|
||||
durationIcon.setVisibility(View.VISIBLE);
|
||||
infoDistanceView.setVisibility(View.VISIBLE);
|
||||
infoDurationView.setVisibility(View.VISIBLE);
|
||||
textView.setVisibility(View.GONE);
|
||||
}
|
||||
if (directionInfo >= 0 && routingHelper.getRouteDirections() != null
|
||||
&& directionInfo < routingHelper.getRouteDirections().size()) {
|
||||
RouteDirectionInfo ri = routingHelper.getRouteDirections().get(directionInfo);
|
||||
textView.setText((directionInfo + 1) + ". " + ri.getDescriptionRoutePart() + " " + OsmAndFormatter.getFormattedDistance(ri.distance, ctx));
|
||||
} else {
|
||||
textView.setText(ctx.getRoutingHelper().getGeneralRouteInformation().replace(",", ",\n"));
|
||||
TextView distanceText = (TextView) mainView.findViewById(R.id.DistanceText);
|
||||
TextView durationText = (TextView) mainView.findViewById(R.id.DurationText);
|
||||
distanceText.setText(OsmAndFormatter.getFormattedDistance(ctx.getRoutingHelper().getLeftDistance(), ctx));
|
||||
int leftTime = ctx.getRoutingHelper().getLeftTime();
|
||||
int hours = leftTime / (60 * 60);
|
||||
int minutes = (leftTime / 60) % 60;
|
||||
if (hours > 0) {
|
||||
durationText.setText(hours + " "
|
||||
+ ctx.getString(R.string.osmand_parking_hour)
|
||||
+ (minutes > 0 ? " " + minutes + " "
|
||||
+ ctx.getString(R.string.osmand_parking_minute) : ""));
|
||||
} else {
|
||||
durationText.setText(minutes + " "
|
||||
+ ctx.getString(R.string.osmand_parking_minute));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,24 +525,25 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
private Spinner setupFromSpinner(View view) {
|
||||
ArrayList<String> fromActions = new ArrayList<>();
|
||||
fromActions.add(mapActivity.getString(R.string.route_descr_current_location));
|
||||
fromActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis));
|
||||
fromActions.add(mapActivity.getString(R.string.shared_string_select_on_map));
|
||||
fromActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis));
|
||||
ArrayList<RouteSpinnerRow> fromActions = new ArrayList<>();
|
||||
fromActions.add(new RouteSpinnerRow(R.drawable.ic_action_get_my_location,
|
||||
mapActivity.getString(R.string.route_descr_current_location)));
|
||||
fromActions.add(new RouteSpinnerRow(R.drawable.ic_action_fav_dark,
|
||||
mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
||||
fromActions.add(new RouteSpinnerRow(R.drawable.ic_action_marker_dark,
|
||||
mapActivity.getString(R.string.shared_string_select_on_map)));
|
||||
fromActions.add(new RouteSpinnerRow(R.drawable.ic_action_home_dark,
|
||||
mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
||||
|
||||
TargetPoint start = getTargets().getPointToStart();
|
||||
if (start != null) {
|
||||
String oname = start.getOnlyName().length() > 0 ? start.getOnlyName()
|
||||
: (mapActivity.getString(R.string.route_descr_map_location) + " " + getRoutePointDescription(start.getLatitude(), start.getLongitude()));
|
||||
fromActions.add(oname);
|
||||
fromActions.add(new RouteSpinnerRow(R.drawable.ic_action_get_my_location, oname));
|
||||
}
|
||||
final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner));
|
||||
ArrayAdapter<String> fromAdapter = new ArrayAdapter<>(view.getContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
fromActions
|
||||
);
|
||||
fromAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
RouteSpinnerArrayAdapter fromAdapter = new RouteSpinnerArrayAdapter(view.getContext());
|
||||
fromAdapter.addAll(fromActions);
|
||||
fromSpinner.setAdapter(fromAdapter);
|
||||
if (start != null) {
|
||||
fromSpinner.setSelection(fromActions.size() - 1);
|
||||
|
@ -505,24 +559,25 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
private Spinner setupToSpinner(View view) {
|
||||
final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner));
|
||||
final TargetPointsHelper targets = getTargets();
|
||||
ArrayList<String> toActions = new ArrayList<>();
|
||||
ArrayList<RouteSpinnerRow> toActions = new ArrayList<>();
|
||||
if (targets.getPointToNavigate() != null) {
|
||||
toActions.add(mapActivity.getString(R.string.route_descr_destination) + " "
|
||||
+ getRoutePointDescription(targets.getPointToNavigate().point,
|
||||
targets.getPointToNavigate().getOnlyName()));
|
||||
toActions.add(new RouteSpinnerRow(R.drawable.ic_action_get_my_location,
|
||||
getRoutePointDescription(targets.getPointToNavigate().point,
|
||||
targets.getPointToNavigate().getOnlyName())));
|
||||
} else {
|
||||
toSpinner.setPromptId(R.string.route_descr_select_destination);
|
||||
toActions.add(mapActivity.getString(R.string.route_descr_select_destination));
|
||||
toActions.add(new RouteSpinnerRow(R.drawable.ic_action_get_my_location,
|
||||
mapActivity.getString(R.string.route_descr_select_destination)));
|
||||
}
|
||||
toActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis));
|
||||
toActions.add(mapActivity.getString(R.string.shared_string_select_on_map));
|
||||
toActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis));
|
||||
toActions.add(new RouteSpinnerRow(R.drawable.ic_action_fav_dark,
|
||||
mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
||||
toActions.add(new RouteSpinnerRow(R.drawable.ic_action_marker_dark,
|
||||
mapActivity.getString(R.string.shared_string_select_on_map)));
|
||||
toActions.add(new RouteSpinnerRow(R.drawable.ic_action_home_dark,
|
||||
mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
||||
|
||||
ArrayAdapter<String> toAdapter = new ArrayAdapter<>(view.getContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
toActions
|
||||
);
|
||||
toAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
RouteSpinnerArrayAdapter toAdapter = new RouteSpinnerArrayAdapter(view.getContext());
|
||||
toAdapter.addAll(toActions);
|
||||
toSpinner.setAdapter(toAdapter);
|
||||
return toSpinner;
|
||||
}
|
||||
|
@ -537,9 +592,34 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
// do not hide fragment (needed for use case entering Planning mode without destination)
|
||||
}
|
||||
|
||||
public void onDismiss() {
|
||||
mapActivity.getMapView().setMapPositionX(0);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false);
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), true);
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_left_widgets_panel), true);
|
||||
if (switched) {
|
||||
mapControlsLayer.switchToRouteFollowingLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void show() {
|
||||
switched = mapControlsLayer.switchToRoutePlanningLayout();
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
if (!portrait) {
|
||||
mapActivity.getMapView().setMapPositionX(1);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
}
|
||||
|
||||
MapRouteInfoMenuFragment.showInstance(mapActivity);
|
||||
|
||||
if (!AndroidUiHelper.isXLargeDevice(mapActivity)) {
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), false);
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_left_widgets_panel), false);
|
||||
}
|
||||
if (!portrait) {
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
|
@ -552,4 +632,54 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
public void setShowMenu() {
|
||||
showMenu = true;
|
||||
}
|
||||
|
||||
private class RouteSpinnerRow {
|
||||
int iconId;
|
||||
String text;
|
||||
|
||||
public RouteSpinnerRow(int iconId, String text) {
|
||||
this.iconId = iconId;
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
private class RouteSpinnerArrayAdapter extends ArrayAdapter<RouteSpinnerRow> {
|
||||
|
||||
public RouteSpinnerArrayAdapter(Context context) {
|
||||
super(context, android.R.layout.simple_spinner_item);
|
||||
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView label = (TextView) super.getView(position, convertView, parent);
|
||||
RouteSpinnerRow row = getItem(position);
|
||||
label.setText(row.text);
|
||||
label.setTextColor(!isLight() ?
|
||||
ContextCompat.getColorStateList(mapActivity, android.R.color.primary_text_dark) : ContextCompat.getColorStateList(mapActivity, android.R.color.primary_text_light));
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
TextView label = (TextView) super.getDropDownView(position, convertView, parent);
|
||||
|
||||
RouteSpinnerRow row = getItem(position);
|
||||
label.setText(row.text);
|
||||
Drawable icon = mapActivity.getMyApplication().getIconsCache().getContentIcon(row.iconId);
|
||||
label.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||
label.setCompoundDrawablePadding(dpToPx(12f));
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = mapActivity.getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,13 @@ import android.os.Bundle;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
@ -54,8 +57,17 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (menu != null) {
|
||||
menu.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInfo() {
|
||||
menu.updateInfo(mainView);
|
||||
applyDayNightMode();
|
||||
}
|
||||
|
||||
public void show(MapActivity mapActivity) {
|
||||
|
@ -81,6 +93,81 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void applyDayNightMode() {
|
||||
MapActivity ctx = getMapActivity();
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(ctx);
|
||||
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightMode();
|
||||
if (portrait) {
|
||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
|
||||
}
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerModesLayout), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn1), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn2), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn3), nightMode,
|
||||
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
|
||||
((TextView) mainView.findViewById(R.id.ViaView)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.primary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.primary_text_light));
|
||||
((TextView) mainView.findViewById(R.id.ViaSubView)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
||||
|
||||
((TextView) mainView.findViewById(R.id.toTitle)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
||||
|
||||
((TextView) mainView.findViewById(R.id.fromTitle)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
||||
|
||||
((TextView) mainView.findViewById(R.id.InfoTextView)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
||||
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.FromLayout), nightMode,
|
||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.ViaLayout), nightMode,
|
||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.ToLayout), nightMode,
|
||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.Info), nightMode,
|
||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.Next), nightMode,
|
||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.Prev), nightMode,
|
||||
R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
|
||||
((TextView) mainView.findViewById(R.id.DistanceText)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.primary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.primary_text_light));
|
||||
((TextView) mainView.findViewById(R.id.DistanceTitle)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
||||
((TextView) mainView.findViewById(R.id.DurationText)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.primary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.primary_text_light));
|
||||
((TextView) mainView.findViewById(R.id.DurationTitle)).setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_dark)
|
||||
: ContextCompat.getColorStateList(ctx, android.R.color.secondary_text_light));
|
||||
|
||||
}
|
||||
|
||||
public static boolean showInstance(final MapActivity mapActivity) {
|
||||
try {
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
|
|
|
@ -461,7 +461,7 @@ public class MapRoutePreferencesControl {
|
|||
final Set<ApplicationMode> selected = new HashSet<ApplicationMode>();
|
||||
selected.add(settings.APPLICATION_MODE.get());
|
||||
AppModeDialog.prepareAppModeView(mapActivity, selected, false,
|
||||
(ViewGroup) settingsDlg.findViewById(R.id.app_modes), true, new View.OnClickListener() {
|
||||
(ViewGroup) settingsDlg.findViewById(R.id.app_modes), true, false, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (selected.size() > 0) {
|
||||
|
|
|
@ -102,6 +102,9 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
|||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
List<LocationPoint> fullObjects = new ArrayList<>();
|
||||
for (LocationPoint o : getPoints()) {
|
||||
if (!o.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
|
||||
float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import android.graphics.ColorFilter;
|
|||
import android.graphics.PointF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -26,6 +26,7 @@ import android.widget.TextView;
|
|||
|
||||
import net.londatiga.android.ActionItem;
|
||||
import net.londatiga.android.QuickAction;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -40,7 +41,6 @@ import net.osmand.plus.TargetPointsHelper;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchAddressFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapRoutePreferencesControl;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -81,9 +81,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
private MapHudButton menuControl;
|
||||
private MapHudButton compassHud;
|
||||
private float cachedRotate = 0;
|
||||
private static long startCounter;
|
||||
private Runnable delayStart;
|
||||
private Handler showUIHandler;
|
||||
private ImageView appModeIcon;
|
||||
private TextView zoomText;
|
||||
private OsmandMapTileView mapView;
|
||||
|
@ -114,7 +111,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
@Override
|
||||
public void initLayer(final OsmandMapTileView view) {
|
||||
showUIHandler = new Handler();
|
||||
initTopControls();
|
||||
initTransparencyBar();
|
||||
initZooms();
|
||||
|
@ -200,7 +196,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
configureMap.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
notifyClicked();
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.CONFIGURE_MAP);
|
||||
}
|
||||
});
|
||||
|
@ -213,7 +208,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
compass.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
notifyClicked();
|
||||
mapActivity.getMapViewTrackingUtilities().switchRotateMapMode();
|
||||
}
|
||||
});
|
||||
|
@ -226,8 +220,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
public void updateRouteButtons(View main, boolean routeInfo) {
|
||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightMode();
|
||||
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
|
||||
cancelRouteButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_cancel));
|
||||
cancelRouteButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_cancel, !nightMode));
|
||||
AndroidUtils.setBackground(mapActivity, cancelRouteButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -236,7 +232,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
});
|
||||
|
||||
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
|
||||
waypointsButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_waypoints));
|
||||
waypointsButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_waypoints, !nightMode));
|
||||
AndroidUtils.setBackground(mapActivity, waypointsButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
waypointsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -246,7 +243,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
ImageView options = (ImageView) main.findViewById(R.id.map_options_route_button);
|
||||
options.setImageDrawable(!routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_settings,
|
||||
R.color.osmand_orange) : app.getIconsCache().getContentIcon(R.drawable.map_action_settings));
|
||||
R.color.osmand_orange) : app.getIconsCache().getContentIcon(R.drawable.map_action_settings, !nightMode));
|
||||
AndroidUtils.setBackground(mapActivity, options, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -256,8 +254,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button);
|
||||
routeGoButton.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getIcon(R.drawable.map_start_navigation, R.color.color_myloc_distance), null, null, null);
|
||||
routeGoButton.setText(/*AndroidUiHelper.isOrientationPortrait(mapActivity) ?*/
|
||||
mapActivity.getString(R.string.shared_string_go) /*: ""*/);
|
||||
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go));
|
||||
routeGoButton.setTextColor(nightMode ?
|
||||
ContextCompat.getColorStateList(mapActivity, android.R.color.secondary_text_dark) : ContextCompat.getColorStateList(mapActivity, android.R.color.secondary_text_light));
|
||||
AndroidUtils.setBackground(mapActivity, routeGoButton, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||
routeGoButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -277,7 +277,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
protected void clickRouteParams() {
|
||||
notifyClicked();
|
||||
if (optionsRouteControlDialog.isDialogVisible()) {
|
||||
optionsRouteControlDialog.hideDialog();
|
||||
mapRouteInfoMenu.showHideMenu();
|
||||
|
@ -289,13 +288,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
protected void clickRouteWaypoints() {
|
||||
if (getTargets().checkPointToNavigateShort()) {
|
||||
notifyClicked();
|
||||
mapActivity.getMapActions().openIntermediatePointsDialog();
|
||||
}
|
||||
}
|
||||
|
||||
protected void clickRouteCancel() {
|
||||
notifyClicked();
|
||||
mapRouteInfoMenu.hide();
|
||||
optionsRouteControlDialog.hideDialog();
|
||||
if (mapActivity.getRoutingHelper().isFollowingMode()) {
|
||||
|
@ -306,16 +303,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
protected void clickRouteGo() {
|
||||
notifyClicked();
|
||||
mapRouteInfoMenu.hide();
|
||||
optionsRouteControlDialog.hideDialog();
|
||||
// RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
|
||||
// if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
// never possible
|
||||
// mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
|
||||
// } else {
|
||||
startNavigation();
|
||||
// }
|
||||
}
|
||||
|
||||
public void showRouteInfoControlDialog() {
|
||||
|
@ -356,10 +346,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
backToMenuButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// double lat = activity.getMapView().getLatitude();
|
||||
// double lon = activity.getMapView().getLongitude();
|
||||
// MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon));
|
||||
notifyClicked();
|
||||
if (dash) {
|
||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
|
||||
} else {
|
||||
|
@ -397,7 +383,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private void onNavigationClick() {
|
||||
notifyClicked();
|
||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
|
||||
|
@ -433,7 +418,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
zoomInButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
notifyClicked();
|
||||
if (view.isZooming()) {
|
||||
mapActivity.changeZoom(2, System.currentTimeMillis());
|
||||
} else {
|
||||
|
@ -451,7 +435,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
notifyClicked();
|
||||
mapActivity.changeZoom(-1, System.currentTimeMillis());
|
||||
}
|
||||
});
|
||||
|
@ -459,7 +442,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
public void startNavigation() {
|
||||
stopCounter();
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||
if (routingHelper.isFollowingMode()) {
|
||||
|
@ -480,44 +462,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void stopCounter() {
|
||||
startCounter = 0;
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void startCounter() {
|
||||
//OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||
int del = 0; // settings.DELAY_TO_START_NAVIGATION.get();
|
||||
if (del <= 0) {
|
||||
return;
|
||||
}
|
||||
if (startCounter <= 0) {
|
||||
startCounter = System.currentTimeMillis() + del * 1000;
|
||||
delayStart = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (startCounter > 0) {
|
||||
if (System.currentTimeMillis() > startCounter) {
|
||||
startCounter = 0;
|
||||
startNavigation();
|
||||
} else {
|
||||
mapActivity.refreshMap();
|
||||
showUIHandler.postDelayed(delayStart, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
delayStart.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void notifyClicked() {
|
||||
stopCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyLayer() {
|
||||
controls.clear();
|
||||
|
@ -528,7 +472,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
updateControls(tileBox, nightMode);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void updateControls(@NonNull RotatedTileBox tileBox, DrawSettings nightMode) {
|
||||
boolean isNight = nightMode != null && nightMode.isNightMode();
|
||||
int shadw = isNight ? Color.TRANSPARENT : Color.WHITE;
|
||||
|
@ -538,7 +482,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
// TODOnightMode
|
||||
// updatextColor(textColor, shadw, rulerControl, zoomControls, mapMenuControls);
|
||||
}
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
// default buttons
|
||||
boolean routePlanningMode = false;
|
||||
RoutingHelper rh = mapActivity.getRoutingHelper();
|
||||
|
@ -552,12 +495,18 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
boolean showRouteCalculationControls = routePlanningMode ||
|
||||
((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode);
|
||||
updateMyLocation(rh, dialogOpened);
|
||||
// routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions );
|
||||
// routePlanningBtn.updateVisibility(showButtons && !routePlanningMode);
|
||||
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode);
|
||||
routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
|
||||
if (routePlanningMode || routeFollowingMode) {
|
||||
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
|
||||
routePlanningBtn.setIconColorId(R.color.color_myloc_distance);
|
||||
} else {
|
||||
routePlanningBtn.setIconResId(R.drawable.map_directions);
|
||||
routePlanningBtn.updateVisibility(!dialogOpened);
|
||||
routePlanningBtn.resetIconColors();
|
||||
}
|
||||
routePlanningBtn.updateVisibility(showButtons);
|
||||
menuControl.updateVisibility(showButtons);
|
||||
|
||||
menuControl.updateVisibility(!dialogOpened);
|
||||
mapZoomIn.updateVisibility(!dialogOpened);
|
||||
mapZoomOut.updateVisibility(!dialogOpened);
|
||||
compassHud.updateVisibility(!dialogOpened);
|
||||
|
@ -586,15 +535,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
mapRouteInfoMenu.setVisible(showRouteCalculationControls);
|
||||
if (showRouteCalculationControls) {
|
||||
if (!mapActivity.getRoutingHelper().isFollowingMode()
|
||||
&& !mapActivity.getRoutingHelper().isPauseNavigation()) {
|
||||
startCounter();
|
||||
}
|
||||
} else {
|
||||
stopCounter();
|
||||
}
|
||||
|
||||
updateCompass(isNight);
|
||||
|
||||
for (MapHudButton mc : controls) {
|
||||
|
@ -638,16 +578,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
if (mapRouteInfoMenu.onSingleTap(point, tileBox)) {
|
||||
return true;
|
||||
}
|
||||
stopCounter();
|
||||
return false;
|
||||
return mapRouteInfoMenu.onSingleTap(point, tileBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) {
|
||||
stopCounter();
|
||||
touchEvent = System.currentTimeMillis();
|
||||
RoutingHelper rh = mapActivity.getRoutingHelper();
|
||||
if (rh.isFollowingMode()) {
|
||||
|
@ -771,6 +706,11 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void resetIconColors() {
|
||||
resClrLight = R.color.icon_color;
|
||||
resClrDark = 0;
|
||||
}
|
||||
|
||||
public MapHudButton setIconColorId(int clr) {
|
||||
if (resClrLight == clr && resClrDark == clr) {
|
||||
return this;
|
||||
|
@ -802,6 +742,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public void update(OsmandApplication ctx, boolean night) {
|
||||
if (nightMode == night && !f) {
|
||||
return;
|
||||
|
@ -883,7 +824,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
public static View.OnLongClickListener getOnClickMagnifierListener(final OsmandMapTileView view) {
|
||||
final View.OnLongClickListener listener = new View.OnLongClickListener() {
|
||||
return new View.OnLongClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View notUseCouldBeNull) {
|
||||
|
@ -891,7 +832,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
|
||||
int p = (int) (mapDensity.get() * 100);
|
||||
final TIntArrayList tlist = new TIntArrayList(new int[]{20, 25, 33, 50, 75, 100, 150, 200, 300, 400});
|
||||
final List<String> values = new ArrayList<String>();
|
||||
final List<String> values = new ArrayList<>();
|
||||
int i = -1;
|
||||
for (int k = 0; k <= tlist.size(); k++) {
|
||||
final boolean end = k == tlist.size();
|
||||
|
@ -931,7 +872,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
|
Loading…
Reference in a new issue