| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import android.view.Gravity; | 7 import android.view.Gravity; |
| 8 import android.view.View; | 8 import android.view.View; |
| 9 import android.view.ViewGroup; | 9 import android.view.ViewGroup; |
| 10 import android.widget.FrameLayout; | 10 import android.widget.FrameLayout; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 // This method is used in tests. It doesn't modify the state of zoom control
s. | 59 // This method is used in tests. It doesn't modify the state of zoom control
s. |
| 60 View getZoomControlsViewForTest() { | 60 View getZoomControlsViewForTest() { |
| 61 return mZoomButtonsController != null ? mZoomButtonsController.getZoomCo
ntrols() : null; | 61 return mZoomButtonsController != null ? mZoomButtonsController.getZoomCo
ntrols() : null; |
| 62 } | 62 } |
| 63 | 63 |
| 64 private ZoomButtonsController getZoomController() { | 64 private ZoomButtonsController getZoomController() { |
| 65 if (mZoomButtonsController == null && | 65 if (mZoomButtonsController == null && |
| 66 mAwContents.getSettings().shouldDisplayZoomControls()) { | 66 mAwContents.getSettings().shouldDisplayZoomControls()) { |
| 67 mZoomButtonsController = new ZoomButtonsController( | 67 mZoomButtonsController = new ZoomButtonsController( |
| 68 mAwContents.getContentViewCore().getContainerView()); | 68 mAwContents.getContentViewCore().getContainerView()); |
| 69 mZoomButtonsController.setOnZoomListener(new ZoomListener()); | 69 mZoomButtonsController.setOnZoomListener(new ZoomListener()); |
| 70 // ZoomButtonsController positions the buttons at the bottom, but in | 70 // ZoomButtonsController positions the buttons at the bottom, but in |
| 71 // the middle. Change their layout parameters so they appear on the | 71 // the middle. Change their layout parameters so they appear on the |
| 72 // right. | 72 // right. |
| 73 View controls = mZoomButtonsController.getZoomControls(); | 73 View controls = mZoomButtonsController.getZoomControls(); |
| 74 ViewGroup.LayoutParams params = controls.getLayoutParams(); | 74 ViewGroup.LayoutParams params = controls.getLayoutParams(); |
| 75 if (params instanceof FrameLayout.LayoutParams) { | 75 if (params instanceof FrameLayout.LayoutParams) { |
| 76 ((FrameLayout.LayoutParams) params).gravity = Gravity.RIGHT; | 76 ((FrameLayout.LayoutParams) params).gravity = Gravity.RIGHT; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 94 if (zoomIn) { | 94 if (zoomIn) { |
| 95 mAwContents.zoomIn(); | 95 mAwContents.zoomIn(); |
| 96 } else { | 96 } else { |
| 97 mAwContents.zoomOut(); | 97 mAwContents.zoomOut(); |
| 98 } | 98 } |
| 99 // ContentView will call updateZoomControls after its current page s
cale | 99 // ContentView will call updateZoomControls after its current page s
cale |
| 100 // is got updated from the native code. | 100 // is got updated from the native code. |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 } | 103 } |
| OLD | NEW |