Merge branch 'r3.7'

This commit is contained in:
Victor Shcherb 2020-05-26 15:16:26 +02:00
commit 4b0ff54a77
116 changed files with 227 additions and 197 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -5,6 +5,6 @@
android:viewportHeight="24">
<path
android:pathData="M5,3C3.8954,3 3,3.8954 3,5V19C3,20.1046 3.8954,21 5,21H19C20.1046,21 21,20.1046 21,19V5C21,3.8954 20.1046,3 19,3H5ZM19,5H5V19H19V5ZM7,7H11V11H7V7ZM17,7H13V11H17V7ZM7,13H11V17H7V13ZM17,13H13V17H17V13Z"
android:fillColor="#727272"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>

View file

@ -5,5 +5,5 @@
android:viewportHeight="24">
<path
android:pathData="M13,2H11V11H2V13H11V22H13V13H22V11H13V2Z"
android:fillColor="#727272"/>
android:fillColor="#ffffff"/>
</vector>

View file

@ -5,5 +5,5 @@
android:viewportHeight="24">
<path
android:pathData="M22,11l-0,2l-20,0l-0,-2z"
android:fillColor="#727272"/>
android:fillColor="#ffffff"/>
</vector>

View file

@ -7,6 +7,7 @@
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="@color/app_bar_color_light"
android:padding="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetRight="0dp"

View file

@ -20,7 +20,7 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
osmand:srcCompat="@drawable/map_favorite" />
osmand:srcCompat="@drawable/ic_action_favorite" />
<LinearLayout
android:layout_width="0dp"

View file

@ -27,6 +27,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="@dimen/dashboard_map_toolbar"
android:padding="0dp"
app:contentInsetLeft="54dp"
app:contentInsetStart="54dp"
app:contentInsetRight="0dp"
@ -93,7 +94,7 @@
android:layout_height="wrap_content"
android:background="?attr/bg_color"
app:itemBackground="?attr/bg_color"
app:labelVisibilityMode="labeled"
app:labelVisibilityMode="labeled"
app:itemIconTint="@color/bottom_navigation_color_selector_light"
app:itemTextColor="@color/bottom_navigation_color_selector_light"
app:menu="@menu/map_markers_bottom_navigation"/>

View file

@ -154,7 +154,7 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/map_directions"/>
tools:src="@drawable/ic_action_gdirections_dark"/>
<TextView
android:layout_width="wrap_content"

View file

@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/actionModeBackground"
android:padding="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetRight="0dp"

View file

@ -21,15 +21,15 @@
android:layout_height="match_parent"
android:background="@null"
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half"
android:textAllCaps="true"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
android:duplicateParentState="true"
tools:text="Button"
android:paddingStart="@dimen/context_menu_button_padding_x"
android:paddingEnd="@dimen/context_menu_button_padding_x" />
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half" />
</LinearLayout>

View file

@ -120,7 +120,7 @@
android:contentDescription="@string/shared_string_more"
android:focusable="false"
android:scaleType="center"
osmand:srcCompat="@drawable/map_overflow_menu_white"
osmand:srcCompat="@drawable/ic_actions_menu"
android:visibility="gone"
android:layout_marginEnd="2dp" />

View file

@ -11,11 +11,12 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/pstsTabBackground"
android:minHeight="@dimen/dashboard_map_toolbar"
android:minHeight="@dimen/toolbar_height"
android:theme="?attr/toolbar_theme"
android:padding="0dp"
app:contentInsetLeft="72dp"
app:contentInsetStart="72dp"
app:contentInsetRight="0dp"

View file

@ -9,7 +9,7 @@
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
tools:src="@drawable/ic_dashboard_dark"
tools:src="@drawable/ic_dashboard"
android:background="?attr/dashboard_button" />

View file

@ -9,7 +9,7 @@
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
tools:src="@drawable/ic_dashboard_dark" />
tools:src="@drawable/ic_dashboard" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/selection"

View file

@ -22,6 +22,7 @@
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="?attr/bg_color"
android:minHeight="@dimen/dashboard_map_toolbar"
android:padding="0dp"
android:theme="?attr/toolbar_theme"
app:contentInsetLeft="54dp"
app:contentInsetStart="54dp"
@ -38,6 +39,7 @@
android:layout_height="@dimen/dashboard_map_toolbar"
android:background="@color/osmand_orange"
android:minHeight="@dimen/dashboard_map_toolbar"
android:padding="0dp"
android:theme="?attr/toolbar_theme"
android:visibility="gone"
app:contentInsetLeft="54dp"

View file

@ -108,7 +108,7 @@
android:contentDescription="@string/shared_string_more"
android:focusable="false"
android:scaleType="center"
osmand:srcCompat="@drawable/map_overflow_menu_white"
osmand:srcCompat="@drawable/ic_actions_menu"
android:visibility="gone"
tools:visibility="visible"/>

View file

@ -51,13 +51,11 @@
<dimen name="context_menu_first_line_bottom_margin">24dp</dimen>
<dimen name="context_menu_second_line_top_margin">6dp</dimen>
<dimen name="context_menu_top_right_button_min_width">114dp</dimen>
<dimen name="context_menu_button_padding_x">15dp</dimen>
<dimen name="context_menu_buttons_top_margin">-24dp</dimen>
<dimen name="context_menu_progress_min_height">80dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">66dp</dimen>
<dimen name="context_menu_sub_info_height">36dp</dimen>
<dimen name="context_menu_padding_margin_large">30dp</dimen>
<dimen name="context_menu_padding_margin_default">24dp</dimen>
<dimen name="context_menu_padding_margin_medium">15dp</dimen>
<dimen name="context_menu_padding_margin_tiny">9dp</dimen>
<dimen name="context_menu_title_padding">23dp</dimen>

View file

@ -128,6 +128,8 @@
<color name="map_widget_light_pressed">#e5e5e5</color>
<color name="map_widget_blue">#536dfe</color>
<color name="map_widget_blue_pressed">#485dd9</color>
<color name="map_button_icon_color_light">#727272</color>
<color name="map_button_icon_color_dark">#cccccc</color>
<color name="map_progress_bar_bg_light">#f0f0f0</color>
<color name="map_progress_bar_bg_dark">#1b1d1f</color>

View file

@ -164,7 +164,6 @@
<dimen name="context_menu_first_line_bottom_margin">16dp</dimen>
<dimen name="context_menu_second_line_top_margin">4dp</dimen>
<dimen name="context_menu_top_right_button_min_width">76dp</dimen>
<dimen name="context_menu_button_padding_x">10dp</dimen>
<dimen name="context_menu_buttons_top_margin">-16dp</dimen>
<dimen name="context_menu_buttons_padding_bottom">4dp</dimen>
<dimen name="context_menu_progress_min_height">54dp</dimen>

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="gpx_parse_error">OsmAnd GPX is not well formed, please contact support team to investigate further</string>
<string name="unsupported_type_error">Unsupported type</string>
<string name="index_item_world_basemap_detailed">World overview map (detailed)</string>
<string name="profiles_for_action_not_found">Could not find any such profiles.</string>

View file

@ -375,18 +375,20 @@ public class AndroidUtils {
}
}
public static void updateImageButton(Context ctx, ImageButton button, int iconLightId, int iconDarkId, int bgLightId, int bgDarkId, boolean night) {
public static void updateImageButton(OsmandApplication ctx, ImageButton button,
@DrawableRes int iconLightId, @DrawableRes int iconDarkId,
@DrawableRes int bgLightId, @DrawableRes int bgDarkId, boolean night) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
button.setBackground(AppCompatResources.getDrawable(ctx, night ? bgDarkId : bgLightId));
button.setBackground(ctx.getUIUtilities().getIcon(night ? bgDarkId : bgLightId));
} else {
button.setBackgroundDrawable(AppCompatResources.getDrawable(ctx, night ? bgDarkId : bgLightId));
button.setBackgroundDrawable(ctx.getUIUtilities().getIcon(night ? bgDarkId : bgLightId));
}
int btnSizePx = button.getLayoutParams().height;
int iconSizePx = (int) button.getContext().getResources().getDimension(R.dimen.map_widget_icon);
int iconSizePx = ctx.getResources().getDimensionPixelSize(R.dimen.map_widget_icon);
int iconPadding = (btnSizePx - iconSizePx) / 2;
button.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
button.setScaleType(ImageView.ScaleType.FIT_CENTER);
button.setImageDrawable(AppCompatResources.getDrawable(ctx, night ? iconDarkId : iconLightId));
button.setImageDrawable(ctx.getUIUtilities().getMapIcon(night ? iconDarkId : iconLightId, !night));
}
public static void setDashButtonBackground(Context ctx, View view, boolean night) {

View file

@ -553,7 +553,8 @@ public class AppInitializer implements IProgress {
customConfigs.put(fileName, builder);
} catch (XmlPullParserException | IOException e) {
throw new IllegalStateException(e);
Algorithms.removeAllFiles(f);
LOG.error(e.getMessage(), e);
}
}
}

View file

@ -79,7 +79,7 @@ public class OsmAndLocationSimulation {
@Override
public boolean processResult(GPXUtilities.GPXFile[] result) {
GPXRouteParamsBuilder builder = new GPXRouteParamsBuilder(result[0], app.getSettings());
startAnimationThread(app, builder.getPoints(), true, speedup.getValue() + 1);
startAnimationThread(app, builder.getPoints(app), true, speedup.getValue() + 1);
if (runnable != null) {
runnable.run();
}

View file

@ -144,7 +144,7 @@ public class UiUtilities {
}
public Drawable getMapIcon(@DrawableRes int id, boolean light) {
return getDrawable(id, light ? R.color.icon_color_default_light : 0);
return getDrawable(id, light ? R.color.map_button_icon_color_light : R.color.map_button_icon_color_dark);
}
public static Drawable getSelectableDrawable(Context ctx) {

View file

@ -368,7 +368,7 @@ public class MapActivityActions implements DialogProvider {
adapter.addItem(itemBuilder
.setTitleId(R.string.shared_string_actions, mapActivity)
.setId(MAP_CONTEXT_MENU_MORE_ID)
.setIcon(R.drawable.map_overflow_menu_white)
.setIcon(R.drawable.ic_actions_menu)
.setOrder(40)
.createItem());
@ -514,7 +514,7 @@ public class MapActivityActions implements DialogProvider {
params.setCalculateOsmAndRouteParts(settings.GPX_ROUTE_CALC_OSMAND_PARTS.get());
params.setUseIntermediatePointsRTE(settings.GPX_CALCULATE_RTEPT.get());
params.setCalculateOsmAndRoute(settings.GPX_ROUTE_CALC.get());
List<Location> ps = params.getPoints();
List<Location> ps = params.getPoints(settings.getContext());
mapActivity.getRoutingHelper().setGpxParams(params);
settings.FOLLOW_THE_GPX_ROUTE.set(result.path);
if (!ps.isEmpty()) {
@ -776,7 +776,7 @@ public class MapActivityActions implements DialogProvider {
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity)
.setId(DRAWER_DASHBOARD_ID)
.setIcon(R.drawable.map_dashboard)
.setIcon(R.drawable.ic_dashboard)
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {

View file

@ -166,17 +166,18 @@ public class OsmandInAppPurchaseActivity extends AppCompatActivity implements In
@Override
public void onItemPurchased(String sku, boolean active) {
FragmentManager fragmentManager = getSupportFragmentManager();
if (purchaseHelper != null && purchaseHelper.getLiveUpdates().containsSku(sku)) {
getMyApplication().logEvent("live_osm_subscription_purchased");
if (!active) {
if (!active && !fragmentManager.isStateSaved()) {
OsmLiveRestartBottomSheetDialogFragment fragment = new OsmLiveRestartBottomSheetDialogFragment();
fragment.setUsedOnMap(this instanceof MapActivity);
fragment.show(getSupportFragmentManager(), OsmLiveRestartBottomSheetDialogFragment.TAG);
fragment.show(fragmentManager, OsmLiveRestartBottomSheetDialogFragment.TAG);
}
}
onInAppPurchaseItemPurchased(sku);
fireInAppPurchaseItemPurchasedOnFragments(getSupportFragmentManager(), sku, active);
fireInAppPurchaseItemPurchasedOnFragments(fragmentManager, sku, active);
}
public void fireInAppPurchaseItemPurchasedOnFragments(@NonNull FragmentManager fragmentManager,

View file

@ -1,6 +1,7 @@
package net.osmand.plus.dashboard;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -96,7 +97,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
public void setupFavorites() {
View mainView = getView();
OsmandApplication app = getMyApplication();
final OsmandApplication app = getMyApplication();
if (mainView == null || app == null) {
return;
}
@ -112,7 +113,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
Collections.sort(points, new Comparator<FavouritePoint>() {
@Override
public int compare(FavouritePoint point, FavouritePoint point2) {
// LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
// LatLon lastKnownMapLocation = app.getSettings().getLastKnownMapLocation();
int dist = (int) (MapUtils.getDistance(point.getLatitude(), point.getLongitude(),
loc.getLatitude(), loc.getLongitude()));
int dist2 = (int) (MapUtils.getDistance(point2.getLatitude(), point2.getLongitude(),
@ -123,7 +124,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
}
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
favorites.removeAllViews();
DashboardOnMap.handleNumberOfRows(points, getMyApplication().getSettings(), ROW_NUMBER_TAG);
DashboardOnMap.handleNumberOfRows(points, app.getSettings(), ROW_NUMBER_TAG);
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
for (final FavouritePoint point : points) {
LayoutInflater inflater = getActivity().getLayoutInflater();
@ -136,38 +137,40 @@ public class DashFavoritesFragment extends DashLocationFragment {
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
ImageView groupImage = (ImageView)view.findViewById(R.id.group_image);
if (point.getCategory().length() > 0) {
((TextView) view.findViewById(R.id.group_name)).setText(point.getCategoryDisplayName(getMyApplication()));
groupImage.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_group_name_16));
((TextView) view.findViewById(R.id.group_name)).setText(point.getCategoryDisplayName(app));
groupImage.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_group_name_16));
} else {
groupImage.setVisibility(View.GONE);
}
((ImageView) view.findViewById(R.id.favourite_icon)).setImageDrawable(FavoriteImageDrawable.getOrCreate(
getActivity(), point.getColor(), false, point));
int iconColor = app.getFavorites().getColorWithCategory(point, getResources().getColor(R.color.color_favorite));
Drawable favoriteIcon = FavoriteImageDrawable.getOrCreate(app, iconColor, false, point);
((ImageView) view.findViewById(R.id.favourite_icon)).setImageDrawable(favoriteIcon);
DashLocationView dv = new DashLocationView(direction, label, new LatLon(point.getLatitude(),
point.getLongitude()));
distances.add(dv);
name.setText(point.getDisplayName(getMyApplication()));
name.setText(point.getDisplayName(app));
name.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
view.findViewById(R.id.navigate_to).setVisibility(View.VISIBLE);
((ImageView) view.findViewById(R.id.navigate_to)).setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_gdirections_dark));
Drawable directionIcon = app.getUIUtilities().getThemedIcon(R.drawable.ic_action_gdirections_dark);
((ImageView) view.findViewById(R.id.navigate_to)).setImageDrawable(directionIcon);
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), point.getLatitude(),
point.getLongitude(),
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getDisplayName(getMyApplication())));
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getDisplayName(app)));
}
});
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
15, new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getDisplayName(getMyApplication())), true,
point); //$NON-NLS-1$
app.getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
15, new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getDisplayName(app)),
true, point);
MapActivity.launchMapActivityMoveToTop(getActivity());
}
});

View file

@ -415,7 +415,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
DashboardActionButton myLocationButton = new DashboardActionButton();
myLocationButton.icon = AppCompatResources.getDrawable(mapActivity, R.drawable.map_my_location);
myLocationButton.icon = AppCompatResources.getDrawable(mapActivity, R.drawable.ic_my_location);
myLocationButton.text = mapActivity.getString(R.string.map_widget_back_to_loc);
myLocationButton.onClickListener = new View.OnClickListener() {
@Override
@ -430,7 +430,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
};
DashboardActionButton navigateButton = new DashboardActionButton();
navigateButton.icon = AppCompatResources.getDrawable(mapActivity, R.drawable.map_start_navigation);
navigateButton.icon = AppCompatResources.getDrawable(mapActivity, R.drawable.ic_action_start_navigation);
navigateButton.text = mapActivity.getString(R.string.follow);
navigateButton.onClickListener = new View.OnClickListener() {
@Override
@ -441,7 +441,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
};
DashboardActionButton routeButton = new DashboardActionButton();
routeButton.icon = AppCompatResources.getDrawable(mapActivity, R.drawable.map_directions);
routeButton.icon = AppCompatResources.getDrawable(mapActivity, R.drawable.ic_action_gdirections_dark);
routeButton.text = mapActivity.getString(R.string.layer_route);
routeButton.onClickListener = new View.OnClickListener() {
@Override

View file

@ -215,7 +215,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
SunriseSunset sunriseSunset = getMyApplication().getDaynightHelper().getSunriseSunset();
pref = new Preference(this);
pref.setTitle(R.string.day_night_info);
if (sunriseSunset != null) {
if (sunriseSunset != null && sunriseSunset.getSunrise() != null && sunriseSunset.getSunset() != null) {
SimpleDateFormat prt = new SimpleDateFormat("yyyy-MM-dd HH:mm");
pref.setSummary(getString(R.string.day_night_info_description, prt.format(sunriseSunset.getSunrise()),
prt.format(sunriseSunset.getSunset())));

View file

@ -504,7 +504,7 @@ public class ConfigureMapMenu {
String description = "";
SunriseSunset sunriseSunset = activity.getMyApplication().getDaynightHelper().getSunriseSunset();
if (sunriseSunset != null) {
if (sunriseSunset != null && sunriseSunset.getSunrise() != null && sunriseSunset.getSunset() != null) {
DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
String sunriseTime = dateFormat.format(sunriseSunset.getSunrise());
String sunsetTime = dateFormat.format(sunriseSunset.getSunset());

View file

@ -768,13 +768,15 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i);
if (itemId == contextMenuItem.getTitleId()) {
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null);
return true;
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (optionsMenuAdapter != null) {
int itemId = item.getItemId();
for (int i = 0; i < optionsMenuAdapter.length(); i++) {
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(i);
if (itemId == contextMenuItem.getTitleId()) {
contextMenuItem.getItemClickListener().onContextMenuClick(null, itemId, i, false, null);
return true;
}
}
}
return super.onOptionsItemSelected(item);

View file

@ -17,11 +17,8 @@ import net.osmand.data.LocationPoint;
import net.osmand.data.PointDescription;
import net.osmand.data.WptLocationPoint;
import net.osmand.osm.PoiType;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.UiUtilities;
@ -33,6 +30,9 @@ import net.osmand.plus.routing.AlarmInfo;
import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
import net.osmand.plus.routing.RouteCalculationResult;
import net.osmand.plus.routing.VoiceRouter;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
import net.osmand.util.MapUtils;
import java.util.ArrayList;
@ -627,20 +627,21 @@ public class WaypointHelper {
amenities.addAll(pf.searchAmenitiesOnThePath(locs, poiSearchDeviationRadius));
}
for (Amenity a : amenities) {
AmenityRoutePoint rp = a.getRoutePoint();
int i = locs.indexOf(rp.pointA);
if (i >= 0) {
LocationPointWrapper lwp = new LocationPointWrapper(route, POI, new AmenityLocationPoint(a),
(float) rp.deviateDistance, i);
lwp.deviationDirectionRight = rp.deviationDirectionRight;
lwp.setAnnounce(announcePOI);
locationPoints.add(lwp);
AmenityRoutePoint routePoint = a.getRoutePoint();
if (routePoint != null) {
int i = locs.indexOf(routePoint.pointA);
if (i >= 0) {
LocationPointWrapper lwp = new LocationPointWrapper(route, POI, new AmenityLocationPoint(a),
(float) routePoint.deviateDistance, i);
lwp.deviationDirectionRight = routePoint.deviationDirectionRight;
lwp.setAnnounce(announcePOI);
locationPoints.add(lwp);
}
}
}
}
}
private void calculateAlarms(RouteCalculationResult route, List<LocationPointWrapper> array, ApplicationMode mode) {
AlarmInfo prevSpeedCam = null;
for (AlarmInfo i : route.getAlarmInfo()) {

View file

@ -914,7 +914,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
public int getFabIconId() {
int res = R.drawable.map_directions;
int res = R.drawable.ic_action_gdirections_dark;
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();

View file

@ -513,9 +513,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
zoomInButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_in_button);
zoomOutButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_out_button);
if (menu.zoomButtonsVisible()) {
AndroidUtils.updateImageButton(mapActivity, zoomInButtonView, R.drawable.map_zoom_in, R.drawable.map_zoom_in_night,
AndroidUtils.updateImageButton(app, zoomInButtonView, R.drawable.ic_zoom_in, R.drawable.ic_zoom_in,
R.drawable.btn_circle_trans, R.drawable.btn_circle_night, nightMode);
AndroidUtils.updateImageButton(mapActivity, zoomOutButtonView, R.drawable.map_zoom_out, R.drawable.map_zoom_out_night,
AndroidUtils.updateImageButton(app, zoomOutButtonView, R.drawable.ic_zoom_out, R.drawable.ic_zoom_out,
R.drawable.btn_circle_trans, R.drawable.btn_circle_night, nightMode);
zoomInButtonView.setOnClickListener(new View.OnClickListener() {
@Override
@ -622,7 +622,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
});
TextView directionsButton = (TextView) view.findViewById(R.id.context_menu_directions_button);
int iconResId = R.drawable.map_directions;
int iconResId = R.drawable.ic_action_gdirections_dark;
if (menu.navigateInPedestrianMode()) {
iconResId = R.drawable.ic_action_pedestrian_dark;
}
@ -1150,7 +1150,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
Drawable rightIcon = leftTitleButtonController.getRightIcon();
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
leftTitleButton.setCompoundDrawablePadding(dpToPx(8f));
leftTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) leftTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
leftTitleButtonView.setVisibility(View.INVISIBLE);
@ -1169,7 +1169,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
Drawable rightIcon = rightTitleButtonController.getRightIcon();
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
rightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
rightTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) rightTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
rightTitleButtonView.setVisibility(View.INVISIBLE);
@ -1185,7 +1185,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
Drawable rightIcon = bottomTitleButtonController.getRightIcon();
bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
bottomTitleButton.setCompoundDrawablePadding(dpToPx(8f));
bottomTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) bottomTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
bottomTitleButtonView.setVisibility(View.GONE);
@ -1209,7 +1209,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
Drawable rightIcon = leftDownloadButtonController.getRightIcon();
leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
leftDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) leftDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
leftDownloadButtonView.setVisibility(View.INVISIBLE);
@ -1225,7 +1225,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
Drawable rightIcon = rightDownloadButtonController.getRightIcon();
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
rightDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
rightDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) rightDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
} else {
rightDownloadButtonView.setVisibility(View.INVISIBLE);
@ -1295,7 +1295,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
Drawable leftIcon = buttonController.getLeftIcon();
Drawable rightIcon = buttonController.getRightIcon();
buttonText.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
buttonText.setCompoundDrawablePadding(dpToPx(8f));
buttonText.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
((LinearLayout) buttonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
buttonView.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -2,7 +2,6 @@ package net.osmand.plus.mapcontextmenu.editors;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -99,7 +98,7 @@ public class SelectCategoryDialogFragment extends DialogFragment {
}
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.map_zoom_in), null, null, null);
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.ic_zoom_in), null, null, null);
button.setCompoundDrawablePadding(AndroidUtils.dpToPx(activity,15f));
button.setText(activity.getResources().getText(R.string.favorite_category_add_new));
button.setOnClickListener(new View.OnClickListener() {

View file

@ -25,19 +25,19 @@ import com.google.android.material.slider.Slider;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.ValueHolder;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.NavigationService;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndTaskManager.OsmAndTaskRunnable;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.SavingTrackHelper.SaveGpxResult;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
@ -333,18 +333,20 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
startGPXMonitoring(activity, showTrackSelection);
}
} else if (item == R.string.clear_recorded_data) {
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.clear_recorded_data);
builder.setMessage(R.string.are_you_sure);
builder.setNegativeButton(R.string.shared_string_cancel, null).setPositiveButton(
R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
app.getSavingTrackHelper().clearRecordedData(true);
app.getNotificationHelper().refreshNotifications();
}
});
builder.show();
if (AndroidUtils.isActivityNotDestroyed(activity)) {
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.clear_recorded_data);
builder.setMessage(R.string.are_you_sure);
builder.setNegativeButton(R.string.shared_string_cancel, null).setPositiveButton(
R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
app.getSavingTrackHelper().clearRecordedData(true);
app.getNotificationHelper().refreshNotifications();
}
});
builder.show();
}
} else if(item == R.string.gpx_monitoring_stop) {
stopRecording();
} else if(item == R.string.gpx_start_new_segment) {
@ -482,19 +484,21 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
}
}
public static void showIntervalChooseDialog(final Context uiCtx, final String patternMsg,
public static void showIntervalChooseDialog(final Activity activity, final String patternMsg,
String title, final int[] seconds, final int[] minutes,
final ValueHolder<Boolean> choice, final ValueHolder<Integer> v,
final boolean showTrackSelection, OnClickListener onclick) {
final OsmandApplication app = (OsmandApplication) uiCtx.getApplicationContext();
if (!AndroidUtils.isActivityNotDestroyed(activity)) {
return;
}
final OsmandApplication app = (OsmandApplication) activity.getApplicationContext();
boolean nightMode;
if (uiCtx instanceof MapActivity) {
if (activity instanceof MapActivity) {
nightMode = app.getDaynightHelper().isNightModeForMapControls();
} else {
nightMode = !app.getSettings().isLightContent();
}
Context themedContext = UiUtilities.getThemedContext(uiCtx, nightMode);
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
AlertDialog.Builder dlg = new AlertDialog.Builder(themedContext);
dlg.setTitle(title);
LinearLayout ll = createIntervalChooseLayout(app, themedContext, patternMsg, seconds, minutes, choice, v, showTrackSelection, nightMode);

View file

@ -784,7 +784,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
i++;
}
menuAdapter.addItem(itemBuilder.setTitleId(R.string.add_new_folder, app)
.setIcon(R.drawable.map_zoom_in).setTag(-1).createItem());
.setIcon(R.drawable.ic_zoom_in).setTag(-1).createItem());
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final ArrayAdapter<ContextMenuItem> listAdapter =
menuAdapter.createListAdapter(getActivity(), app.getSettings().isLightContent());

Some files were not shown because too many files have changed in this diff Show more