Compare commits

..

3 Commits

Author SHA1 Message Date
Jean-Baptiste
71483808b4 [android] Add switch to enable 3D mode from layers bottomsheet
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
2026-01-10 18:20:29 +01:00
Jean-Baptiste
cb4472c325 [android] Remove method to start facebook app
Signed-off-by: Jean-Baptiste <jeanbaptiste.charron@outlook.fr>
2026-01-10 13:36:53 +01:00
Yannik Bloscheck
d432ead844 [styles] Fix label color for minigolf courses
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
2026-01-10 11:46:24 +01:00
13 changed files with 44 additions and 84 deletions

View File

@@ -1196,7 +1196,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (mOnmapDownloader != null)
mOnmapDownloader.onResume();
mNavigationController.refresh(getApplicationContext(), Framework.nativeGetRouteFollowingInfo());
mNavigationController.refresh();
refreshLightStatusBar();
MwmApplication.from(this).getSensorHelper().addListener(this);

View File

@@ -1,17 +1,22 @@
package app.organicmaps.maplayer;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import app.organicmaps.MwmApplication;
import app.organicmaps.R;
import app.organicmaps.sdk.Framework;
import app.organicmaps.sdk.maplayer.Mode;
import app.organicmaps.sdk.util.SharedPropertiesUtils;
import app.organicmaps.util.ThemeSwitcher;
@@ -19,6 +24,7 @@ import app.organicmaps.util.Utils;
import app.organicmaps.util.bottomsheet.MenuBottomSheetFragment;
import app.organicmaps.widget.recycler.SpanningLinearLayoutManager;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.materialswitch.MaterialSwitch;
import java.util.ArrayList;
import java.util.List;
@@ -36,6 +42,11 @@ public class ToggleMapLayerFragment extends Fragment
{
View mRoot = inflater.inflate(R.layout.fragment_toggle_map_layer, container, false);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext());
final boolean _3DEnabled = sharedPreferences.getBoolean(ContextCompat.getString(requireContext(), R.string.pref_3d_buildings),true);
MaterialSwitch m3DSwitch = mRoot.findViewById(R.id._3d_button);
m3DSwitch.setChecked(_3DEnabled);
m3DSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> Framework.nativeSet3dMode(true, isChecked));
mMapButtonsController =
(MapButtonsController) requireActivity().getSupportFragmentManager().findFragmentById(R.id.map_buttons);
MaterialButton mCloseButton = mRoot.findViewById(R.id.close_button);

View File

@@ -1,10 +1,7 @@
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;
@@ -16,7 +13,6 @@ 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;
@@ -62,8 +58,6 @@ 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)
{
@@ -78,8 +72,6 @@ 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);
@@ -105,16 +97,6 @@ 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) -> {
@@ -154,8 +136,7 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
mLanesView.setLanes(info.lanes);
if (speedLimitEnabled)
updateSpeedWidgets(info);
updateSpeedWidgets(info);
}
private void updatePedestrian(@NonNull RoutingInfo info)
@@ -163,8 +144,7 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
mNextTurnDistance.setText(Utils.formatDistance(mFrame.getContext(), info.distToTurn));
info.pedestrianTurnDirection.setTurnDrawable(mNextTurnImage);
if (speedLimitEnabled)
updateSpeedWidgets(info);
updateSpeedWidgets(info);
}
public void updateNorth()
@@ -225,21 +205,9 @@ public class NavigationController implements TrafficManager.TrafficCallback, Nav
mNavMenu.collapseNavBottomSheet();
}
public void refresh(Context context, RoutingInfo info)
public void refresh()
{
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);
}
mNavMenu.refreshTts();
}
@Override

View File

@@ -184,20 +184,6 @@ public class Utils
}
}
public static void showFacebookPage(Activity activity)
{
try
{
// Exception is thrown if we don't have installed Facebook application.
getPackageInfo(activity.getPackageManager(), Constants.Package.FB_PACKAGE, 0);
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.FB_OM_COMMUNITY_NATIVE)));
}
catch (final Exception e)
{
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.Url.FB_OM_COMMUNITY_HTTP)));
}
}
public static void openUrl(@NonNull Context context, @Nullable String url)
{
if (TextUtils.isEmpty(url))

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M520,600h120q33,0 56.5,-23.5T720,520v-80q0,-33 -23.5,-56.5T640,360L520,360v240ZM580,540v-120h60q8,0 14,6t6,14v80q0,8 -6,14t-14,6h-60ZM260,600h140q17,0 28.5,-11.5T440,560v-40q0,-17 -11.5,-28.5T400,480q17,0 28.5,-11.5T440,440v-40q0,-17 -11.5,-28.5T400,360L260,360v60h120v30h-80v60h80v30L260,540v60ZM160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h640q33,0 56.5,23.5T880,240v480q0,33 -23.5,56.5T800,800L160,800ZM160,720h640v-480L160,240v480ZM160,720v-480,480Z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@@ -1,10 +0,0 @@
<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>

View File

@@ -37,7 +37,25 @@
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Button.Round" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="@dimen/margin_quarter">
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
app:srcCompat="@drawable/ic_3d_layer"
app:tint="?iconTint"/>
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/_3d_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/margin_half" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"

View File

@@ -926,6 +926,4 @@
<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>

View File

@@ -45,7 +45,6 @@
<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>

View File

@@ -975,6 +975,4 @@
<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="pref_speedlimit_title">Speed limit</string>
<string name="pref_speedlimit_summary">Show speed limit during navigation</string>
</resources>

View File

@@ -143,14 +143,6 @@
<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

View File

@@ -22,9 +22,6 @@ public final class Constants
public static final String LEMMY = "https://sopuli.xyz/c/CoMaps";
public static final String BLUESKY = "https://bsky.app/profile/comaps.app";
public static final String PIXELFED = "https://pixelfed.social/comaps";
public static final String FB_OM_COMMUNITY_HTTP = "https://www.facebook.com/profile.php?id=61575286559965";
public static final String FB_OM_COMMUNITY_NATIVE = "fb://profile/61575286559965";
public static final String CODE_REPO = "https://codeberg.org/comaps/comaps";
public static final String COPYRIGHT = "file:///android_asset/copyright.html";
@@ -36,13 +33,6 @@ public final class Constants
private Url() {}
}
public static class Package
{
public static final String FB_PACKAGE = "com.facebook.katana";
private Package() {}
}
public static class Vendor
{
public static final String HUAWEI = "HUAWEI";

View File

@@ -103,6 +103,7 @@ node[tourism=wilderness_hut],
node[amenity=dojo],
node[leisure=dance],
node[leisure=fitness_centre],
node[leisure=miniature_golf],
node[leisure=sports_centre],
node[leisure=stadium],
{text-color: @sport_label;text-halo-radius: 0.1;text-halo-opacity: 0.7;text-halo-color: @label_halo_light;}