Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Marchuk <trashkalmar@users.noreply.github.com>2016-07-18 15:20:53 +0300
committerGitHub <noreply@github.com>2016-07-18 15:20:53 +0300
commitd45e117cc7d4a559a6ea66158f61d53adb5211cc (patch)
tree8bbf5b2d2fb63e7e9f188c22c2fb7396de73550b /android
parent4d1e6ff3aa74fe169471ba9f1697bbf84d7d0ad4 (diff)
parent09bd213ff9844a3c219d152ce934a7cc0e25002d (diff)
Merge pull request #3815 from rokuz/android-settings-autozoom
[Android] Added auto zoom to settings
Diffstat (limited to 'android')
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp17
-rw-r--r--android/res/values/donottranslate.xml1
-rw-r--r--android/res/xml-v21/prefs_route.xml6
-rw-r--r--android/res/xml/prefs_route.xml4
-rw-r--r--android/src/com/mapswithme/maps/Framework.java4
-rw-r--r--android/src/com/mapswithme/maps/settings/RoutePrefsFragment.java15
6 files changed, 46 insertions, 1 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index 5eaf5ce5dd..9efab79d49 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -998,6 +998,23 @@ Java_com_mapswithme_maps_Framework_nativeGet3dMode(JNIEnv * env, jclass, jobject
env->SetBooleanField(result, buildingsField, buildings);
}
+JNIEXPORT void JNICALL
+Java_com_mapswithme_maps_Framework_nativeSetAutoZoomEnabled(JNIEnv * env, jclass, jboolean enabled)
+{
+ bool const autoZoomEnabled = static_cast<bool>(enabled);
+ frm()->SaveAutoZoom(autoZoomEnabled);
+ g_framework->PostDrapeTask([autoZoomEnabled]()
+ {
+ frm()->AllowAutoZoom(autoZoomEnabled);
+ });
+}
+
+JNIEXPORT jboolean JNICALL
+Java_com_mapswithme_maps_Framework_nativeGetAutoZoomEnabled(JNIEnv * env, jclass)
+{
+ return frm()->LoadAutoZoom();
+}
+
// static void nativeZoomToPoint(double lat, double lon, int zoom, boolean animate);
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeZoomToPoint(JNIEnv * env, jclass, jdouble lat, jdouble lon, jint zoom, jboolean animate)
diff --git a/android/res/values/donottranslate.xml b/android/res/values/donottranslate.xml
index 609259fcc4..7e8f321ff9 100644
--- a/android/res/values/donottranslate.xml
+++ b/android/res/values/donottranslate.xml
@@ -47,6 +47,7 @@
<string name="pref_track_record" translatable="false">TrackRecord</string>
<string name="pref_showcase_switched_on" translatable="false">DisplayShowcase</string>
<string name="pref_osm_profile" translatable="false">Osm profile</string>
+ <string name="pref_auto_zoom" translatable="false">AutoZoom</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>
diff --git a/android/res/xml-v21/prefs_route.xml b/android/res/xml-v21/prefs_route.xml
index 75dea87a18..89826e6ec1 100644
--- a/android/res/xml-v21/prefs_route.xml
+++ b/android/res/xml-v21/prefs_route.xml
@@ -17,4 +17,10 @@
android:title="@string/pref_map_3d_title"
android:switchTextOn=""
android:switchTextOff=""/>
+
+ <SwitchPreference
+ android:key="@string/pref_auto_zoom"
+ android:title="@string/pref_map_auto_zoom"
+ android:switchTextOn=""
+ android:switchTextOff=""/>
</PreferenceScreen> \ No newline at end of file
diff --git a/android/res/xml/prefs_route.xml b/android/res/xml/prefs_route.xml
index ece3af7c90..70c3fcfbe8 100644
--- a/android/res/xml/prefs_route.xml
+++ b/android/res/xml/prefs_route.xml
@@ -13,4 +13,8 @@
<CheckBoxPreference
android:key="@string/pref_3d"
android:title="@string/pref_map_3d_title"/>
+
+ <CheckBoxPreference
+ android:key="@string/pref_auto_zoom"
+ android:title="@string/pref_map_auto_zoom"/>
</PreferenceScreen> \ No newline at end of file
diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java
index 93717c0ae0..36b26a9156 100644
--- a/android/src/com/mapswithme/maps/Framework.java
+++ b/android/src/com/mapswithme/maps/Framework.java
@@ -194,6 +194,10 @@ public class Framework
public static native void nativeSet3dMode(boolean allow3d, boolean allow3dBuildings);
+ public static native boolean nativeGetAutoZoomEnabled();
+
+ public static native void nativeSetAutoZoomEnabled(boolean enabled);
+
@NonNull
public static native MapObject nativeDeleteBookmarkFromMapObject();
diff --git a/android/src/com/mapswithme/maps/settings/RoutePrefsFragment.java b/android/src/com/mapswithme/maps/settings/RoutePrefsFragment.java
index e058b04e16..dda64ad753 100644
--- a/android/src/com/mapswithme/maps/settings/RoutePrefsFragment.java
+++ b/android/src/com/mapswithme/maps/settings/RoutePrefsFragment.java
@@ -163,7 +163,20 @@ public class RoutePrefsFragment extends PreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue)
{
- Framework.nativeSet3dMode((Boolean)newValue, _3d.buildings);
+ Framework.nativeSet3dMode((Boolean) newValue, _3d.buildings);
+ return true;
+ }
+ });
+
+ boolean autozoomEnabled = Framework.nativeGetAutoZoomEnabled();
+ final TwoStatePreference prefAutoZoom = (TwoStatePreference)findPreference(getString(R.string.pref_auto_zoom));
+ prefAutoZoom.setChecked(autozoomEnabled);
+ prefAutoZoom.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
+ {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue)
+ {
+ Framework.nativeSetAutoZoomEnabled((Boolean)newValue);
return true;
}
});