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