Merge branch 'r3.4'

This commit is contained in:
madwasp79 2019-07-10 15:24:02 +03:00
commit 03a6a26759
14 changed files with 56 additions and 36 deletions

View file

@ -185,7 +185,7 @@
android:layout_width="match_parent"
android:layout_height="60dp"
app:primaryColor="@color/active_color_primary_dark"
app:labelText="Navigation Type">
app:labelText="@string/nav_type_hint">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:id="@+id/navigation_type_et"

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="turn_on_profile_desc">Please turn on at least one application profile, to use this setting.</string>
<string name="rendering_attr_winter_road_name">Winter road</string>
<string name="rendering_attr_ice_road_name">Ice road</string>
<string name="routeInfo_winter_ice_road_name">Winter and ice roads</string>

View file

@ -258,6 +258,7 @@
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_light</item>
<item name="profile_save_btn">@drawable/btn_round_profile_blue</item>
<item name="profile_cancel_btn">@drawable/btn_round_profile_gray</item>
<item name="android:textColor">@color/text_color_primary_light</item>
</style>
<style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow">
@ -504,6 +505,7 @@
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_dark</item>
<item name="profile_save_btn">@drawable/btn_round_profile_night</item>
<item name="profile_cancel_btn">@drawable/btn_round_profile_gray_n</item>
<item name="android:textColor">@color/text_color_primary_dark</item>
</style>
<style name="FreeVersionBanner" parent="OsmandDarkTheme">

View file

@ -339,6 +339,14 @@ public class OsmandSettings {
public ApplicationMode getApplicationMode() {
return APPLICATION_MODE.get();
}
public boolean hasAvailableApplicationMode() {
int currentModeCount = ApplicationMode.values(ctx).size();
if (currentModeCount == 0 || currentModeCount == 1 && getApplicationMode() == ApplicationMode.DEFAULT) {
return false;
}
return true;
}
protected ApplicationMode readApplicationMode() {
String s = settingsAPI.getString(globalPreferences, APPLICATION_MODE.getId(), ApplicationMode.DEFAULT.getStringKey());

View file

@ -25,6 +25,7 @@ import android.widget.ArrayAdapter;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
@ -81,6 +82,12 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
settings = getMyApplication().getSettings();
if (!settings.hasAvailableApplicationMode()) {
Toast.makeText(this, R.string.turn_on_profile_desc, Toast.LENGTH_SHORT).show();
finish();
return;
}
getToolbar().setTitle(R.string.routing_settings);
createUI();
}
@ -98,7 +105,6 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
private void createUI() {
addPreferencesFromResource(R.xml.navigation_settings);
PreferenceScreen screen = getPreferenceScreen();
settings = getMyApplication().getSettings();
RouteService[] vls = RouteService.getAvailableRouters(getMyApplication());
String[] entries = new String[vls.length];
for (int i = 0; i < entries.length; i++) {

View file

@ -309,6 +309,9 @@ public class MenuBuilder {
buildPlainMenuItems(view);
}
buildInternal(view);
if (needBuildCoordinatesRow()) {
buildCoordinatesRow(view);
}
if (showOnlinePhotos) {
buildNearestPhotosRow(view);
}
@ -354,6 +357,10 @@ public class MenuBuilder {
protected boolean needBuildPlainMenuItems() {
return true;
}
protected boolean needBuildCoordinatesRow() {
return true;
}
protected void buildPluginRows(View view) {
for (OsmandPlugin plugin : menuPlugins) {
@ -412,6 +419,15 @@ public class MenuBuilder {
}
}
private void buildCoordinatesRow(View view) {
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, latLon.getLatitude(), latLon.getLongitude(), true);
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
CollapsableView cv = getLocationCollapsableView(locationData);
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv, false, 1,
false, null, false);
}
private void startLoadingImages() {
if (onlinePhotoCardsRow == null) {
return;

View file

@ -282,18 +282,6 @@ public abstract class MenuController extends BaseMenuController implements Colla
addAltitudeToPlainItems();
addPrecisionToPlainItems();
}
addMyLocationToPlainItems(latLon);
}
protected void addMyLocationToPlainItems(LatLon latlon) {
final MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, latlon.getLatitude(), latlon.getLongitude(), true);
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
CollapsableView cv = builder.getLocationCollapsableView(locationData);
addPlainMenuItem(R.drawable.ic_action_get_my_location, title, false, false, true, cv, null);
}
}
protected void addSpeedToPlainItems() {

View file

@ -672,15 +672,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
buildRow(view, R.drawable.ic_action_openstreetmap_logo, null, link + (amenity.getId() >> 1),
0, false, null, true, 0, true, null, false);
}
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true);
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
CollapsableView cv = getLocationCollapsableView(locationData);
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv,
true, 1, false, null, false);
}
private String getFormattedInt(String value) {

View file

@ -0,0 +1,17 @@
package net.osmand.plus.mapcontextmenu.builders;
import android.support.annotation.NonNull;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
public class MapDataMenuBuilder extends MenuBuilder {
public MapDataMenuBuilder(@NonNull MapActivity mapActivity) {
super(mapActivity);
}
@Override
protected boolean needBuildCoordinatesRow() {
return false;
}
}

View file

@ -166,8 +166,6 @@ public class FavouritePointMenuController extends MenuController {
if (originObject instanceof Amenity) {
AmenityMenuController.addTypeMenuItem((Amenity) originObject, builder);
}
} else {
addMyLocationToPlainItems(latLon);
}
}
}
}

View file

@ -28,8 +28,8 @@ import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.liveupdates.LiveUpdatesHelper;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.builders.MapDataMenuBuilder;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
import net.osmand.plus.views.DownloadedRegionsLayer.DownloadMapObject;
@ -57,7 +57,7 @@ public class MapDataMenuController extends MenuController {
private DownloadIndexesThread downloadThread;
public MapDataMenuController(@NonNull MapActivity mapActivity, @NonNull PointDescription pointDescription, final @NonNull DownloadMapObject mapObject) {
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
super(new MapDataMenuBuilder(mapActivity), pointDescription, mapActivity);
this.mapObject = mapObject;
indexItem = mapObject.getIndexItem();
localIndexInfo = mapObject.getLocalIndexInfo();

View file

@ -126,7 +126,6 @@ public class RenderedObjectMenuController extends MenuController {
}
addPlainMenuItem(R.drawable.ic_action_info_dark, null, link + (renderedObject.getId() >> MapObject.NON_AMENITY_ID_RIGHT_SHIFT), true, true, null);
}
addMyLocationToPlainItems(latLon);
}
}

View file

@ -71,12 +71,5 @@ public class EditPOIMenuBuilder extends MenuBuilder {
buildRow(view, R.drawable.ic_action_info_dark, null, text, 0, false, null, false, 0, false, null, false);
}
}
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, osmPoint.getLatitude(), osmPoint.getLongitude(), true);
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
CollapsableView cv = getLocationCollapsableView(locationData);
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv,
true, 1, false, null, false);
}
}

View file

@ -15,6 +15,7 @@ public class SettingsProfileActivity extends OsmandActionBarActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.single_fragment_layout);
getSupportActionBar().setElevation(5.0f);
getSupportActionBar().setTitle(R.string.application_profiles);
if (savedInstanceState == null) {
SettingsProfileFragment profileFragment = new SettingsProfileFragment();
profileFragment.setArguments(getIntent().getExtras());