Skip to content

Commit

Permalink
Merge branch 'master' into rzr-click
Browse files Browse the repository at this point in the history
  • Loading branch information
RZR-UA committed Dec 5, 2024
2 parents 93636ce + 32bd0bc commit b1d3b4a
Show file tree
Hide file tree
Showing 27 changed files with 148 additions and 69 deletions.
3 changes: 3 additions & 0 deletions OsmAnd/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5686,4 +5686,7 @@
<string name="obd_throttle_position_desc">Viser vinklen på gasspjældspladen i gasspjældshuset.</string>
<string name="obd_speed_desc">Viser hastighed fra køretøjets hastighedssensor (VVS).</string>
<string name="obd_air_intake_temp_desc">Viser temperaturen på den luft, der kommer ind i motorens indsugningsmanifold.</string>
<string name="shared_string_interpolation">Interpolation</string>
<string name="location_interpolation_percent_desc">Indstil procentdelen af lokationsinterpolation under rutenavigation. Denne parameter reducerer forsinkelsen af din position på kortet under animation.</string>
<string name="location_interpolation_percent">Interpolation af placering i procent</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5968,4 +5968,7 @@
<string name="auto_zoom_3d_angle">Autozoom 3D-Winkel</string>
<string name="shared_string_engine">Motor</string>
<string name="vehicle_metrics_recording_description">Wählen Sie die Parameter aus, die in der GPX-Datei aufgezeichnet werden sollen.</string>
<string name="location_interpolation_percent_desc">Legt den Prozentsatz der Standortinterpolation während der Routennavigation fest. Dieser Parameter reduziert die Verzögerung der Position des Standorts auf der Karte während der Animation.</string>
<string name="shared_string_interpolation">Interpolation</string>
<string name="location_interpolation_percent">Prozentualer Anteil der Standortinterpolation</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6073,4 +6073,7 @@
<string name="auto_zoom_3d_angle">Escalado automático de ángulos 3D</string>
<string name="vehicle_metrics_recording_description">Seleccione los parámetros que se registrarán en el archivo GPX .</string>
<string name="shared_string_engine">Motor</string>
<string name="location_interpolation_percent">Porcentaje de interpolación de la ubicación</string>
<string name="location_interpolation_percent_desc">Establece el porcentaje de interpolación de la posición durante la navegación por la ruta. Este parámetro reduce el desfase de la posición de tu ubicación en el mapa durante la animación.</string>
<string name="shared_string_interpolation">Interpolación</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-ga/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5451,4 +5451,7 @@
<string name="show_free_version_banner">Taispeáin meirge leagan saor in aisce</string>
<string name="show_free_version_banner_description">Taispeáin an meirge leagan saor in aisce fiú sa leagan íoctha.</string>
<string name="pick_up_till">Pioc suas go dtí</string>
<string name="location_interpolation_percent">Céatadán idirshuímh suímh</string>
<string name="location_interpolation_percent_desc">Socraigh an céatadán d\'idirshuíomh suímh le linn loingseoireachta bealaigh. Laghdaíonn an paraiméadar seo aga moille do shuíomh suímh ar an léarscáil le linn beochana.</string>
<string name="shared_string_interpolation">Idirshuíomh</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5640,4 +5640,7 @@
<string name="auto_zoom_3d_angle">Automatikus zoom 3D szög</string>
<string name="vehicle_metrics_recording_description">Válassza ki a GPX-fájlba elmentendő paramétereket.</string>
<string name="shared_string_engine">Motor</string>
<string name="shared_string_interpolation">Interpoláció</string>
<string name="location_interpolation_percent">Hely interpolációs százaléka</string>
<string name="location_interpolation_percent_desc">Állítsa be a navigáció használata közbeni helyinterpoláció százalékos értékét. Ez a paraméter csökkenti a térképen az animálás során megjelenített pozíciójának lemaradását a tényleges helyzetéhez képest.</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6049,4 +6049,7 @@
<string name="connect_new_scanner">Hubungkan pemindai baru</string>
<string name="vehicle_metrics_recording_description">Pilih parameter untuk direkam dalam berkas GPX.</string>
<string name="shared_string_engine">Mesin</string>
<string name="location_interpolation_percent">Persentase interpolasi lokasi</string>
<string name="shared_string_interpolation">Interpolasi</string>
<string name="location_interpolation_percent_desc">Tetapkan presentasi interpolasi lokasi saat navigasi rute. Parameter ini mengurangi kelambatan posisi lokasi di peta saat ada animasi.</string>
</resources>
4 changes: 4 additions & 0 deletions OsmAnd/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5674,4 +5674,8 @@
<string name="connect_new_scanner">Connetti il nuovo scanner</string>
<string name="vehicle_metrics_recording_description">Seleziona i parametri da salvare nel file GPX.</string>
<string name="shared_string_engine">Motore</string>
<string name="preview_next_turn">Anteprima della svolta successiva</string>
<string name="location_interpolation_percent">Percentuale di interpolazione della posizione</string>
<string name="location_interpolation_percent_desc">Imposta la percentuale di interpolazione della posizione durante la navigazione del percorso. Questo parametro riduce il ritardo della tua posizione sulla mappa durante l\'animazione.</string>
<string name="shared_string_interpolation">Interpolazione</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6077,4 +6077,7 @@
<string name="shared_string_engine">Двигатель</string>
<string name="av_audio_sample_rate">Частота дискретизации звука</string>
<string name="av_audio_sample_rate_descr">Выберите частоту дискретизации звука.</string>
<string name="location_interpolation_percent">Процент интерполяции местоположения</string>
<string name="shared_string_interpolation">Интерполяция</string>
<string name="location_interpolation_percent_desc">Установите процент интерполяции местоположения при навигации по маршруту. Этот параметр уменьшает задержку отображения вашего местоположения на карте во время анимации.</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/src/net/osmand/plus/AppInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -22,6 +23,7 @@
import net.osmand.OnResultCallback;
import net.osmand.PlatformUtil;
import net.osmand.aidl.OsmandAidlApi;
import net.osmand.core.android.NativeCore;
import net.osmand.map.OsmandRegions;
import net.osmand.map.OsmandRegions.RegionTranslation;
import net.osmand.map.WorldRegion;
Expand Down Expand Up @@ -628,6 +630,7 @@ private void initOpenGl() {
try {
settings.OPENGL_RENDER_FAILED.set(settings.OPENGL_RENDER_FAILED.get() + 1);
NativeCoreContext.init(app);
settings.USE_OPENGL_RENDER.setDefaultValue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && NativeCore.is64Bit());
settings.OPENGL_RENDER_FAILED.set(0);
} catch (Throwable throwable) {
LOG.error("NativeCoreContext", throwable);
Expand Down
4 changes: 1 addition & 3 deletions OsmAnd/src/net/osmand/plus/activities/MapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,7 @@ public MapContextMenu getContextMenu() {
}

@NonNull
public static MapRouteInfoMenu getMapRouteInfoMenu() {
return mapRouteInfoMenu;
}
public MapRouteInfoMenu getMapRouteInfoMenu() { return mapRouteInfoMenu; }

@NonNull
public TrackDetailsMenu getTrackDetailsMenu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,7 @@ private ContextMenuAdapter createNormalOptionsMenu(OsmandApplication app, Contex
.setIcon(R.drawable.ic_action_gdirections_dark)
.setListener((uiAdapter, view, item, isChecked) -> {
app.logEvent("drawer_directions_open");
MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
if (mapControlsLayer != null) {
mapControlsLayer.getMapActionsHelper().doRoute();
}
mapActivity.getMapLayers().getMapActionsHelper().doRoute();
return true;
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public TracksSortMode getSortMode(@NonNull String id) {

public void setSortMode(@NonNull String id, @Nullable TracksSortMode sortMode) {
id = removeExtraFileSeparator(id);
cachedSortModes.put(id, sortMode);
if (sortMode != null) {
cachedSortModes.put(id, sortMode);
} else {
cachedSortModes.remove(id);
}
}

public void setSortModes(@NonNull Map<String, TracksSortMode> sortModes) {
Expand Down Expand Up @@ -97,9 +101,7 @@ private void saveToPreference() {
List<String> tokens = new ArrayList<>();
for (Entry<String, TracksSortMode> entry : cachedSortModes.entrySet()) {
TracksSortMode value = entry.getValue();
if (value != null) {
tokens.add(entry.getKey() + SEPARATOR + value.name());
}
tokens.add(entry.getKey() + SEPARATOR + value.name());
}
preference.setStringsList(tokens);
}
Expand Down
22 changes: 20 additions & 2 deletions OsmAnd/src/net/osmand/plus/configmap/tracks/TrackTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
import androidx.annotation.Nullable;

import net.osmand.plus.settings.enums.TracksSortMode;
import net.osmand.plus.track.helpers.GpxUiHelper;
import net.osmand.shared.gpx.TrackItem;
import net.osmand.shared.gpx.data.ComparableTracksGroup;
import net.osmand.shared.gpx.data.SmartFolder;
import net.osmand.shared.gpx.data.TrackFolder;
import net.osmand.plus.track.helpers.GpxUiHelper;
import net.osmand.shared.gpx.TrackItem;
import net.osmand.shared.gpx.data.TracksGroup;
import net.osmand.shared.gpx.filters.TrackFolderAnalysis;
import net.osmand.util.Algorithms;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -158,6 +159,23 @@ public long lastModified() {
return 0;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TrackTab that = (TrackTab) o;
return Algorithms.stringsEqual(getId(), that.getId());
}

@Override
public int hashCode() {
return Algorithms.hash(getId());
}

@NonNull
@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import net.osmand.plus.OsmandApplication;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TracksTabAdapter extends FragmentStatePagerAdapter {

Expand All @@ -37,6 +34,11 @@ public int getItemPosition(@NonNull Object object) {
return POSITION_NONE;
}

@NonNull
public List<TrackTab> getTrackTabs() {
return trackTabs;
}

@Override
public int getCount() {
return trackTabs.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.ViewPager.SimpleOnPageChangeListener;

import net.osmand.plus.shared.SharedUtil;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.configmap.tracks.appearance.ChangeAppearanceController;
Expand All @@ -44,6 +43,7 @@
import net.osmand.plus.plugins.monitoring.SavingTrackHelper;
import net.osmand.plus.plugins.osmedit.OsmEditingPlugin;
import net.osmand.plus.settings.enums.TracksSortMode;
import net.osmand.plus.shared.SharedUtil;
import net.osmand.plus.track.BaseTracksTabsFragment;
import net.osmand.plus.track.fragments.TrackMenuFragment;
import net.osmand.plus.track.helpers.GpxSelectionHelper;
Expand Down Expand Up @@ -272,6 +272,17 @@ public void loadTracksFinished(@NonNull TrackFolder folder) {
preselectedTabParams = null;
}

@Override
protected void updateTrackTabs() {
List<TrackTab> trackTabs = getSortedTrackTabs();
if (Algorithms.objectEquals(adapter.getTrackTabs(), trackTabs)) {
super.updateTrackTabs();
} else {
TrackTab tab = getSelectedTab();
setTabs(trackTabs, tab != null ? tab.getId() : null);
}
}

@Override
public void deferredLoadTracksFinished(@NonNull TrackFolder folder) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
private void setupImageView(@NonNull ViewGroup view) {
imageView = view.findViewById(R.id.image);

ImageCard imageCard = controller.getOnlinePhotoCards().get(selectedPosition);
downloadThumbnail(imageCard);
if (controller != null) {
ImageCard imageCard = controller.getOnlinePhotoCards().get(selectedPosition);
if (imageCard != null) {
downloadThumbnail(imageCard);
}
}

imageView.setOnDoubleTapListener(new SimpleOnGestureListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public void onFolderRenamed(@NonNull File newDir) {

@Override
public void onFolderDeleted() {
reloadTracks();
reloadTracks(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.fragment.app.FragmentManager
import net.osmand.plus.R
import net.osmand.plus.myplaces.tracks.DialogClosedListener
import net.osmand.plus.myplaces.tracks.EmptySmartFolderListener
import net.osmand.plus.myplaces.tracks.ItemsSelectionHelper
import net.osmand.plus.utils.AndroidUtils
import net.osmand.plus.widgets.popup.PopUpMenu
import net.osmand.plus.widgets.popup.PopUpMenuDisplayData
Expand Down Expand Up @@ -153,4 +154,13 @@ class SmartFolderFragment : TrackFolderFragment(), SmartFolderUpdateListener,
override fun onDialogClosed() {
updateContent()
}

override fun getSelectionHelper(): ItemsSelectionHelper<TrackItem> {
return ItemsSelectionHelper<TrackItem>().apply {
val items = smartFolder.getTrackItems()
setAllItems(items)
setSelectedItems(items)
setOriginalSelectedItems(items)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import net.osmand.Period.PeriodUnit;
import net.osmand.PlatformUtil;
import net.osmand.StateChangedListener;
import net.osmand.core.android.NativeCore;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.ValueHolder;
Expand Down Expand Up @@ -3172,7 +3173,9 @@ public CommonPreference<Boolean> getCustomRoutingBooleanProperty(String attrName

public final CommonPreference<Integer> LOCATION_INTERPOLATION_PERCENT = new IntPreference(this, "location_interpolation_percent", 0).makeGlobal().makeShared();

public final OsmandPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render", Build.VERSION.SDK_INT >= Build.VERSION_CODES.P).makeGlobal().makeShared().cache();
public final CommonPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render",
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P).makeGlobal().makeShared().cache();

public final OsmandPreference<Integer> OPENGL_RENDER_FAILED = new IntPreference(this, "opengl_render_failed_count", 0).makeGlobal().cache();

public final OsmandPreference<String> CONTRIBUTION_INSTALL_APP_DATE = new StringPreference(this, "CONTRIBUTION_INSTALL_APP_DATE", null).makeGlobal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ public void onDisplayPreferenceDialog(Preference preference) {
public void onApplyPreferenceChange(String prefId, boolean applyToAllProfiles, Object newValue) {
super.onApplyPreferenceChange(prefId, applyToAllProfiles, newValue);
if (MOTOR_TYPE_PREF_ID.equals(prefId)) {
MapActivity.getMapRouteInfoMenu().updateMenu();
if (getActivity() instanceof MapActivity) {
((MapActivity) getActivity()).getMapRouteInfoMenu().updateMenu();
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions OsmAnd/src/net/osmand/plus/track/BaseTracksTabsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import androidx.viewpager.widget.ViewPager;

import net.osmand.plus.OsmandApplication;
import net.osmand.plus.shared.SharedUtil;
import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.configmap.tracks.SortByBottomSheet;
Expand All @@ -44,6 +43,7 @@
import net.osmand.plus.myplaces.tracks.ItemsSelectionHelper.SelectionHelperProvider;
import net.osmand.plus.myplaces.tracks.dialogs.MoveGpxFileBottomSheet.OnTrackFileMoveListener;
import net.osmand.plus.settings.enums.TracksSortMode;
import net.osmand.plus.shared.SharedUtil;
import net.osmand.plus.track.helpers.GpxSelectionHelper;
import net.osmand.plus.track.helpers.SelectGpxTask.SelectGpxTaskListener;
import net.osmand.plus.track.helpers.SelectedGpxFile;
Expand Down Expand Up @@ -253,7 +253,7 @@ public void loadTracksStarted() {
}

protected void updateTrackTabs() {
adapter.setTrackTabs(trackTabsHelper.getSortedTrackTabs(false));
adapter.setTrackTabs(getSortedTrackTabs());
}

@Override
Expand Down Expand Up @@ -366,16 +366,17 @@ public void onSaveComplete(boolean success, GpxFile gpxFile) {
}
};
}

abstract protected void addTrackItem(@NonNull TrackItem item);

protected void setTabs(@NonNull List<TrackTab> tabs) {
setTabs(tabs, 0);
}

protected void setTabs(@NonNull List<TrackTab> tabs, @NonNull String preselectedTabId) {
protected void setTabs(@NonNull List<TrackTab> tabs, @Nullable String preselectedTabId) {
int index = 0;
for (int i = 0; i < tabs.size(); i++) {
if (preselectedTabId.equals(tabs.get(i).getId())) {
if (Algorithms.stringsEqual(preselectedTabId, tabs.get(i).getId())) {
index = i;
break;
}
Expand Down
Loading

0 comments on commit b1d3b4a

Please sign in to comment.