mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-11 23:04:18 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0062eb4414 | ||
|
|
c1137bd38a |
@@ -304,8 +304,8 @@ android {
|
||||
"ru",
|
||||
"sl",
|
||||
"sk",
|
||||
"sr-rCyrl",
|
||||
"sr-rLatn",
|
||||
"sr",
|
||||
"b+sr+Latn",
|
||||
"sv",
|
||||
"sw",
|
||||
"ta",
|
||||
|
||||
@@ -1196,7 +1196,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
||||
if (mOnmapDownloader != null)
|
||||
mOnmapDownloader.onResume();
|
||||
|
||||
mNavigationController.refresh();
|
||||
mNavigationController.refresh(getApplicationContext(), Framework.nativeGetRouteFollowingInfo());
|
||||
refreshLightStatusBar();
|
||||
|
||||
MwmApplication.from(this).getSensorHelper().addListener(this);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package app.organicmaps.routing;
|
||||
|
||||
import static androidx.core.content.ContextCompat.getString;
|
||||
import static app.organicmaps.sdk.util.Utils.dimen;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.location.Location;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@@ -13,6 +16,7 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import app.organicmaps.MwmApplication;
|
||||
import app.organicmaps.R;
|
||||
import app.organicmaps.maplayer.MapButtonsViewModel;
|
||||
@@ -58,6 +62,8 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
|
||||
private final NavMenu mNavMenu;
|
||||
View.OnClickListener mOnSettingsClickListener;
|
||||
private final SharedPreferences sharedPreferences;
|
||||
private boolean speedLimitEnabled;
|
||||
|
||||
private void addWindowsInsets(@NonNull View topFrame)
|
||||
{
|
||||
@@ -72,6 +78,8 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
public NavigationController(AppCompatActivity activity, View.OnClickListener onSettingsClickListener,
|
||||
NavMenu.OnMenuSizeChangedListener onMenuSizeChangedListener)
|
||||
{
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
speedLimitEnabled = sharedPreferences.getBoolean(getString(activity, R.string.pref_speedlimit),true);
|
||||
mMapButtonsViewModel = new ViewModelProvider(activity).get(MapButtonsViewModel.class);
|
||||
|
||||
mFrame = activity.findViewById(R.id.navigation_frame);
|
||||
@@ -97,6 +105,16 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
|
||||
mSpeedLimit = topFrame.findViewById(R.id.nav_speed_limit);
|
||||
mCurrentSpeed = topFrame.findViewById(R.id.nav_current_speed);
|
||||
if (speedLimitEnabled)
|
||||
{
|
||||
UiUtils.show(mSpeedLimit);
|
||||
UiUtils.show(mCurrentSpeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
UiUtils.hide(mSpeedLimit);
|
||||
UiUtils.hide(mCurrentSpeed);
|
||||
}
|
||||
|
||||
View mTopbar = topFrame.findViewById(R.id.statutbar);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(mTopbar,(v, windowInsets) -> {
|
||||
@@ -136,7 +154,8 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
|
||||
mLanesView.setLanes(info.lanes);
|
||||
|
||||
updateSpeedWidgets(info);
|
||||
if (speedLimitEnabled)
|
||||
updateSpeedWidgets(info);
|
||||
}
|
||||
|
||||
private void updatePedestrian(@NonNull RoutingInfo info)
|
||||
@@ -144,7 +163,8 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
mNextTurnDistance.setText(Utils.formatDistance(mFrame.getContext(), info.distToTurn));
|
||||
|
||||
info.pedestrianTurnDirection.setTurnDrawable(mNextTurnImage);
|
||||
updateSpeedWidgets(info);
|
||||
if (speedLimitEnabled)
|
||||
updateSpeedWidgets(info);
|
||||
}
|
||||
|
||||
public void updateNorth()
|
||||
@@ -205,9 +225,21 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
|
||||
mNavMenu.collapseNavBottomSheet();
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
public void refresh(Context context, RoutingInfo info)
|
||||
{
|
||||
mNavMenu.refreshTts();
|
||||
mNavMenu.refreshTts();
|
||||
speedLimitEnabled = sharedPreferences.getBoolean(getString(context, R.string.pref_speedlimit),true);
|
||||
if (speedLimitEnabled)
|
||||
{
|
||||
UiUtils.show(mSpeedLimit);
|
||||
UiUtils.show(mCurrentSpeed);
|
||||
updateSpeedWidgets(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
UiUtils.hide(mSpeedLimit);
|
||||
UiUtils.hide(mCurrentSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,12 +105,4 @@ public class PlacePageUtils
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
|
||||
public static String buildPanoramaxURL(double lat, double lon)
|
||||
{
|
||||
final String panoramaxURL = "https://api.panoramax.xyz/?map=";
|
||||
final String levelZoom = "16";
|
||||
final String quality_score = "&pic_score=ABC";
|
||||
return panoramaxURL + levelZoom + "/" + lat + "/" + lon + quality_score;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static app.organicmaps.sdk.util.Utils.getLocalizedFeatureType;
|
||||
import static app.organicmaps.sdk.util.Utils.getTagValueLocalized;
|
||||
import static app.organicmaps.widget.placepage.PlacePageUtils.buildPanoramaxURL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -291,9 +290,6 @@ public class PlacePageView extends Fragment
|
||||
openIn.setOnClickListener(this);
|
||||
openIn.setOnLongClickListener(this);
|
||||
openIn.setVisibility(VISIBLE);
|
||||
LinearLayout openPhotoViewer = mFrame.findViewById(R.id.ll__place_open_phviewer);
|
||||
openPhotoViewer.setOnClickListener(this);
|
||||
openPhotoViewer.setVisibility(VISIBLE);
|
||||
mTvLatlon = mFrame.findViewById(R.id.tv__place_latlon);
|
||||
mWifi = mFrame.findViewById(R.id.ll__place_wifi);
|
||||
mTvWiFi = mFrame.findViewById(R.id.tv__place_wifi);
|
||||
@@ -1009,8 +1005,6 @@ public class PlacePageView extends Fragment
|
||||
mMapObject.getName());
|
||||
Utils.openUri(requireContext(), Uri.parse(uri), R.string.uri_open_location_failed);
|
||||
}
|
||||
else if (id == R.id.ll__place_open_phviewer)
|
||||
Utils.openUrl(requireContext(), buildPanoramaxURL(mMapObject.getLat(),mMapObject.getLon()));
|
||||
else if (id == R.id.direction_frame)
|
||||
showBigDirection();
|
||||
else if (id == R.id.item_icon)
|
||||
@@ -1058,10 +1052,6 @@ public class PlacePageView extends Fragment
|
||||
mMapObject.getName());
|
||||
PlacePageUtils.copyToClipboard(requireContext(), mFrame, uri);
|
||||
}
|
||||
else if (id == R.id.ll__place_open_phviewer)
|
||||
{
|
||||
PlacePageUtils.copyToClipboard(requireContext(),mFrame, buildPanoramaxURL(mMapObject.getLat(),mMapObject.getLon()));
|
||||
}
|
||||
else if (id == R.id.ll__place_operator)
|
||||
items.add(mTvOperator.getText().toString());
|
||||
else if (id == R.id.ll__place_network)
|
||||
|
||||
10
android/app/src/main/res/drawable/ic_speed.xml
Normal file
10
android/app/src/main/res/drawable/ic_speed.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?iconTint">
|
||||
<path
|
||||
android:pathData="M418,620q24,24 62,23.5t56,-27.5l224,-336 -336,224q-27,18 -28.5,55t22.5,61ZM480,160q59,0 113.5,16.5T696,226l-76,48q-33,-17 -68.5,-25.5T480,240q-133,0 -226.5,93.5T160,560q0,42 11.5,83t32.5,77h552q23,-38 33.5,-79t10.5,-85q0,-36 -8.5,-70T766,420l48,-76q30,47 47.5,100T880,554q1,57 -13,109t-41,99q-11,18 -30,28t-40,10L204,800q-21,0 -40,-10t-30,-28q-26,-45 -40,-95.5T80,560q0,-83 31.5,-155.5t86,-127Q252,223 325,191.5T480,160ZM487,473Z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
@@ -71,8 +71,6 @@
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_open_in"/>
|
||||
|
||||
<include layout="@layout/place_page_open_photoviewer" />
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_open_phviewer"
|
||||
style="@style/PlacePageItemFrame"
|
||||
tools:background="#20FF0000"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/iv__place_open_phviewer"
|
||||
style="@style/PlacePageMetadataIcon"
|
||||
app:srcCompat="@drawable/ic_panoramax"
|
||||
app:tint="?colorSecondary"/>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/tv__place_open_phviewer"
|
||||
android:textAlignment="viewStart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/open_place_in_pnx"
|
||||
android:textAppearance="@style/MwmTextAppearance.PlacePage.Accent"/>
|
||||
</LinearLayout>
|
||||
@@ -926,4 +926,6 @@
|
||||
<string name="download_resources_custom_url_title">Serveur de cartes personnalisé</string>
|
||||
<string name="download_resources_custom_url_error_scheme">Veuillez saisir une URL complète commençant par http:// ou https://</string>
|
||||
<string name="download_resources_custom_url_message">Serveur pour télécharger les cartes. Laissez vide pour utiliser le serveur par défaut CoMaps.</string>
|
||||
<string name="pref_speedlimit_title">Compteur de vitesse</string>
|
||||
<string name="pref_speedlimit_summary">Affichage de la vitesse durant la navigation</string>
|
||||
</resources>
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<string name="pref_power" translatable="false">pref_power</string>
|
||||
<string name="pref_custom_map_download_url" translatable="false">CustomMapDownloadUrl</string>
|
||||
<string name="pref_advanced" translatable="false">pref_advanced</string>
|
||||
<string name="pref_speedlimit" translatable="false">pref_speedlimit</string>
|
||||
|
||||
<string name="notification_ticker_ltr" translatable="false">%1$s: %2$s</string>
|
||||
<string name="notification_ticker_rtl" translatable="false">%2$s :%1$s</string>
|
||||
|
||||
@@ -975,5 +975,6 @@
|
||||
<string name="download_resources_custom_url_message">Override the default map download server used for map downloads. Leave empty to use CoMaps default server.</string>
|
||||
<string name="download_resources_custom_url_summary_none">Not set</string>
|
||||
<string name="download_resources_custom_url_error_scheme">Please enter a URL starting with http:// or https://</string>
|
||||
<string name="open_place_in_pnx">Open in Panoramax</string>
|
||||
<string name="pref_speedlimit_title">Speed limit</string>
|
||||
<string name="pref_speedlimit_summary">Show speed limit during navigation</string>
|
||||
</resources>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<locale android:name="ru" />
|
||||
<locale android:name="sl" />
|
||||
<locale android:name="sk" />
|
||||
<locale android:name="sr-Cyrl" />
|
||||
<locale android:name="sr" />
|
||||
<locale android:name="sr-Latn" />
|
||||
<locale android:name="sv" />
|
||||
<locale android:name="sw" />
|
||||
|
||||
@@ -143,6 +143,14 @@
|
||||
<extra android:name="from" android:value="settings" />
|
||||
</intent>
|
||||
</PreferenceScreen>
|
||||
<SwitchPreferenceCompat
|
||||
android:key="@string/pref_speedlimit"
|
||||
android:title="@string/pref_speedlimit_title"
|
||||
android:summary="@string/pref_speedlimit_summary"
|
||||
android:defaultValue="true"
|
||||
android:widgetLayout="@layout/preference_switch"
|
||||
app:singleLineTitle="true"
|
||||
app:icon="@drawable/ic_speed"/>
|
||||
</androidx.preference.PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
Reference in New Issue
Block a user