OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser; |
| 6 |
| 7 import android.graphics.Rect; |
| 8 import android.view.Window; |
| 9 |
| 10 /** |
| 11 * This is a delegate that handles communication about a window's current state
and properties. |
| 12 */ |
| 13 public class WindowDelegate { |
| 14 |
| 15 private final Window mWindow; |
| 16 |
| 17 /** |
| 18 * @param window The Window object that this delegate will communicate with. |
| 19 */ |
| 20 public WindowDelegate(Window window) { |
| 21 mWindow = window; |
| 22 } |
| 23 |
| 24 /** |
| 25 * @return The soft input mode that is currently used by the window. |
| 26 */ |
| 27 public int getWindowSoftInputMode() { |
| 28 return mWindow.getAttributes().softInputMode; |
| 29 } |
| 30 |
| 31 /** |
| 32 * Set the soft input mode that is used by the window. |
| 33 * @param softInputMode The soft input mode to be used. |
| 34 */ |
| 35 public void setWindowSoftInputMode(int softInputMode) { |
| 36 mWindow.setSoftInputMode(softInputMode); |
| 37 } |
| 38 |
| 39 /** |
| 40 * Used for accessing the current display frame for the whole window view hi
erarchy. |
| 41 * @param displayFrame The rect that will be set to the current display fram
e for the window. |
| 42 */ |
| 43 public void getWindowVisibleDisplayFrame(Rect displayFrame) { |
| 44 mWindow.getDecorView().getWindowVisibleDisplayFrame(displayFrame); |
| 45 } |
| 46 |
| 47 /** |
| 48 * @return The height of the decor view. |
| 49 */ |
| 50 public int getDecorViewHeight() { |
| 51 return mWindow.getDecorView().getHeight(); |
| 52 } |
| 53 } |
OLD | NEW |