Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | package org.mozilla.gecko; |
michael@0 | 7 | |
michael@0 | 8 | import org.json.JSONException; |
michael@0 | 9 | import org.json.JSONObject; |
michael@0 | 10 | |
michael@0 | 11 | public final class ZoomConstraints { |
michael@0 | 12 | private final boolean mAllowZoom; |
michael@0 | 13 | private final boolean mAllowDoubleTapZoom; |
michael@0 | 14 | private final float mDefaultZoom; |
michael@0 | 15 | private final float mMinZoom; |
michael@0 | 16 | private final float mMaxZoom; |
michael@0 | 17 | |
michael@0 | 18 | public ZoomConstraints(boolean allowZoom) { |
michael@0 | 19 | mAllowZoom = allowZoom; |
michael@0 | 20 | mAllowDoubleTapZoom = allowZoom; |
michael@0 | 21 | mDefaultZoom = 0.0f; |
michael@0 | 22 | mMinZoom = 0.0f; |
michael@0 | 23 | mMaxZoom = 0.0f; |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | ZoomConstraints(JSONObject message) throws JSONException { |
michael@0 | 27 | mAllowZoom = message.getBoolean("allowZoom"); |
michael@0 | 28 | mAllowDoubleTapZoom = message.getBoolean("allowDoubleTapZoom"); |
michael@0 | 29 | mDefaultZoom = (float)message.getDouble("defaultZoom"); |
michael@0 | 30 | mMinZoom = (float)message.getDouble("minZoom"); |
michael@0 | 31 | mMaxZoom = (float)message.getDouble("maxZoom"); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | public final boolean getAllowZoom() { |
michael@0 | 35 | return mAllowZoom; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | public final boolean getAllowDoubleTapZoom() { |
michael@0 | 39 | return mAllowDoubleTapZoom; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | public final float getDefaultZoom() { |
michael@0 | 43 | return mDefaultZoom; |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | public final float getMinZoom() { |
michael@0 | 47 | return mMinZoom; |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | public final float getMaxZoom() { |
michael@0 | 51 | return mMaxZoom; |
michael@0 | 52 | } |
michael@0 | 53 | } |