Zoom control is now only disabled on multitouch capable devices by default

and can be forced on again via a preference.
This commit is contained in:
Jon Benson 2013-05-07 17:22:07 +10:00
parent 541d4c8899
commit 084494bec0
5 changed files with 22 additions and 4 deletions

View File

@ -3,6 +3,8 @@
// created a basic framework. All of these functions should only ever
// be run once.
// Used to disable on multitouch devices
window.showZoom = true;
window.setupBackButton = function() {
var c = window.isSmartphone()
@ -156,7 +158,7 @@ window.setupMap = function() {
window.map = new L.Map('map', $.extend(getPosition(),
{zoomControl: !window.isSmartphone()}
{zoomControl: window.showZoom}
));
var addLayers = {};

View File

@ -34,6 +34,8 @@
<string name="pref_misc_cat">Misc</string>
<string name="pref_plugins">Plugins</string>
<string name="pref_plugins_title">Available plugins</string>
<string name="pref_user_zoom">Show zoom control</string>
<string name="pref_user_zoom_sum">Shows +/- buttons even on multitouch capable devices.</string>
<string name="pref_user_loc">Display user location</string>
<string name="pref_user_loc_sum">Show users position on map</string>
<string name="pref_force_https">Force https</string>

View File

@ -12,12 +12,17 @@
<PreferenceCategory
android:key="pref_about_cat"
android:title="@string/pref_ui_cat">
<CheckBoxPreference
android:key="pref_user_zoom"
android:title="@string/pref_user_zoom"
android:summary="@string/pref_user_zoom_sum"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pref_user_loc"
android:title="@string/pref_user_loc"
android:summary="@string/pref_user_loc_sum"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceCategory>
<PreferenceCategory
android:key="pref_mics"

View File

@ -61,8 +61,6 @@ public class IITC_Mobile extends Activity {
listener = new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals("pref_force_desktop"))
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
if (key.equals("pref_user_loc"))
user_loc = sharedPreferences.getBoolean("pref_user_loc", false);
IITC_Mobile.this.loadUrl(intel_url);

View File

@ -3,6 +3,7 @@ package com.cradle.iitc_mobile;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.net.Uri;
import android.net.http.SslError;
@ -89,6 +90,16 @@ public class IITC_WebViewClient extends WebViewClient {
}
this.js = js;
PackageManager pm = context.getPackageManager();
boolean hasMultitouch =
pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
boolean forcedZoom = sharedPref.getBoolean("pref_user_zoom", false);
if (hasMultitouch && !forcedZoom) {
js = js.replace("window.showZoom = true;", "window.showZoom = false;");
}
// need to wrap the mobile iitc.js version in a document ready. IITC
// expects to be injected after the DOM has been loaded completely.