mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-14 08:04:23 +00:00
Compare commits
1 Commits
main
...
jb_3d_laye
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f54facdc3e |
@@ -1,24 +1,31 @@
|
|||||||
package app.organicmaps.maplayer;
|
package app.organicmaps.maplayer;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import app.organicmaps.MwmApplication;
|
import app.organicmaps.MwmApplication;
|
||||||
import app.organicmaps.R;
|
import app.organicmaps.R;
|
||||||
|
import app.organicmaps.sdk.Framework;
|
||||||
import app.organicmaps.sdk.maplayer.Mode;
|
import app.organicmaps.sdk.maplayer.Mode;
|
||||||
|
import app.organicmaps.sdk.util.PowerManagment;
|
||||||
import app.organicmaps.sdk.util.SharedPropertiesUtils;
|
import app.organicmaps.sdk.util.SharedPropertiesUtils;
|
||||||
import app.organicmaps.util.ThemeSwitcher;
|
import app.organicmaps.util.ThemeSwitcher;
|
||||||
import app.organicmaps.util.Utils;
|
import app.organicmaps.util.Utils;
|
||||||
import app.organicmaps.util.bottomsheet.MenuBottomSheetFragment;
|
import app.organicmaps.util.bottomsheet.MenuBottomSheetFragment;
|
||||||
import app.organicmaps.widget.recycler.SpanningLinearLayoutManager;
|
import app.organicmaps.widget.recycler.SpanningLinearLayoutManager;
|
||||||
import com.google.android.material.button.MaterialButton;
|
import com.google.android.material.button.MaterialButton;
|
||||||
|
import com.google.android.material.materialswitch.MaterialSwitch;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -36,6 +43,20 @@ public class ToggleMapLayerFragment extends Fragment
|
|||||||
{
|
{
|
||||||
View mRoot = inflater.inflate(R.layout.fragment_toggle_map_layer, container, false);
|
View mRoot = inflater.inflate(R.layout.fragment_toggle_map_layer, container, false);
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext());
|
||||||
|
final int powerManagementValue = sharedPreferences.getInt(ContextCompat.getString(requireContext(), R.string.power_management), PowerManagment.HIGH);
|
||||||
|
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);
|
||||||
|
if (powerManagementValue != PowerManagment.HIGH)
|
||||||
|
{
|
||||||
|
m3DSwitch.setEnabled(true);
|
||||||
|
m3DSwitch.setOnCheckedChangeListener((CompoundButton buttonView, boolean isChecked) -> Framework.nativeSet3dMode(true, isChecked));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m3DSwitch.setEnabled(false);
|
||||||
|
}
|
||||||
mMapButtonsController =
|
mMapButtonsController =
|
||||||
(MapButtonsController) requireActivity().getSupportFragmentManager().findFragmentById(R.id.map_buttons);
|
(MapButtonsController) requireActivity().getSupportFragmentManager().findFragmentById(R.id.map_buttons);
|
||||||
MaterialButton mCloseButton = mRoot.findViewById(R.id.close_button);
|
MaterialButton mCloseButton = mRoot.findViewById(R.id.close_button);
|
||||||
|
|||||||
10
android/app/src/main/res/drawable/ic_3d_layer.xml
Normal file
10
android/app/src/main/res/drawable/ic_3d_layer.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="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>
|
||||||
@@ -37,7 +37,29 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Button.Round" />
|
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Button.Round" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="end">
|
||||||
|
<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"
|
||||||
|
android:layout_marginEnd="@dimen/margin_base"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<com.google.android.material.divider.MaterialDivider
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler"
|
android:id="@+id/recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="@string/pref_3d_buildings"
|
android:key="@string/pref_3d_buildings"
|
||||||
android:title="@string/pref_map_3d_buildings_title"
|
android:title="@string/pref_map_3d_buildings_title"
|
||||||
|
app:icon="@drawable/ic_3d_layer"
|
||||||
app:singleLineTitle="false"
|
app:singleLineTitle="false"
|
||||||
android:widgetLayout="@layout/preference_switch"
|
android:widgetLayout="@layout/preference_switch"
|
||||||
android:order="4"/>
|
android:order="4"/>
|
||||||
|
|||||||
@@ -183,15 +183,8 @@ void RoadGeometry::Load(VehicleModelInterface const & vehicleModel, FeatureType
|
|||||||
|
|
||||||
auto const & optionsClassfier = RoutingOptionsClassifier::Instance();
|
auto const & optionsClassfier = RoutingOptionsClassifier::Instance();
|
||||||
for (uint32_t type : types)
|
for (uint32_t type : types)
|
||||||
{
|
|
||||||
if (auto const it = optionsClassfier.Get(type))
|
if (auto const it = optionsClassfier.Get(type))
|
||||||
{
|
|
||||||
if (*it == RoutingOptions::Road::Dirty && m_routingOptions.Has(RoutingOptions::Road::Paved))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
m_routingOptions.Add(*it);
|
m_routingOptions.Add(*it);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_junctions.clear();
|
m_junctions.clear();
|
||||||
m_junctions.reserve(count);
|
m_junctions.reserve(count);
|
||||||
|
|||||||
Reference in New Issue
Block a user