OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.ui.base; | 5 package org.chromium.ui.base; |
6 | 6 |
7 import android.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
9 import android.annotation.SuppressLint; | 9 import android.annotation.SuppressLint; |
10 import android.annotation.TargetApi; | 10 import android.annotation.TargetApi; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 private final AccessibilityManager mAccessibilityManager; | 102 private final AccessibilityManager mAccessibilityManager; |
103 | 103 |
104 // Whether touch exploration is enabled. | 104 // Whether touch exploration is enabled. |
105 private boolean mIsTouchExplorationEnabled; | 105 private boolean mIsTouchExplorationEnabled; |
106 | 106 |
107 // On KitKat and higher, a class that monitors the touch exploration state. | 107 // On KitKat and higher, a class that monitors the touch exploration state. |
108 private TouchExplorationMonitor mTouchExplorationMonitor; | 108 private TouchExplorationMonitor mTouchExplorationMonitor; |
109 | 109 |
110 private AndroidPermissionDelegate mPermissionDelegate; | 110 private AndroidPermissionDelegate mPermissionDelegate; |
111 | 111 |
| 112 private EventHandler mEventHandler; |
| 113 |
112 /** | 114 /** |
113 * An interface to notify listeners of changes in the soft keyboard's visibi
lity. | 115 * An interface to notify listeners of changes in the soft keyboard's visibi
lity. |
114 */ | 116 */ |
115 public interface KeyboardVisibilityListener { | 117 public interface KeyboardVisibilityListener { |
116 public void keyboardVisibilityChanged(boolean isShowing); | 118 public void keyboardVisibilityChanged(boolean isShowing); |
117 } | 119 } |
118 private LinkedList<KeyboardVisibilityListener> mKeyboardVisibilityListeners
= | 120 private LinkedList<KeyboardVisibilityListener> mKeyboardVisibilityListeners
= |
119 new LinkedList<>(); | 121 new LinkedList<>(); |
120 | 122 |
121 private final VSyncMonitor.Listener mVSyncListener = new VSyncMonitor.Listen
er() { | 123 private final VSyncMonitor.Listener mVSyncListener = new VSyncMonitor.Listen
er() { |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf
aceView, | 682 * setWillNotDraw(false) to ensure that the animation is drawn over the Surf
aceView, |
681 * and otherwise we call setWillNotDraw(true). | 683 * and otherwise we call setWillNotDraw(true). |
682 */ | 684 */ |
683 private void refreshWillNotDraw() { | 685 private void refreshWillNotDraw() { |
684 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont
ent.isEmpty(); | 686 boolean willNotDraw = !mIsTouchExplorationEnabled && mAnimationsOverCont
ent.isEmpty(); |
685 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) { | 687 if (mAnimationPlaceholderView.willNotDraw() != willNotDraw) { |
686 mAnimationPlaceholderView.setWillNotDraw(willNotDraw); | 688 mAnimationPlaceholderView.setWillNotDraw(willNotDraw); |
687 } | 689 } |
688 } | 690 } |
689 | 691 |
| 692 /** |
| 693 * @return {@link EventHandler} instance used to forward input/view events d
own to native. |
| 694 */ |
| 695 public EventHandler getEventHandler() { |
| 696 if (mEventHandler == null) { |
| 697 mEventHandler = nativeGetEventHandler(mNativeWindowAndroid); |
| 698 } |
| 699 return mEventHandler; |
| 700 } |
| 701 |
| 702 @CalledByNative |
| 703 private EventHandler createEventHandler(long nativeView) { |
| 704 return new EventHandler(nativeView); |
| 705 } |
| 706 |
690 private native long nativeInit(int displayId); | 707 private native long nativeInit(int displayId); |
691 private native void nativeOnVSync(long nativeWindowAndroid, | 708 private native void nativeOnVSync(long nativeWindowAndroid, |
692 long vsyncTimeMicros, | 709 long vsyncTimeMicros, |
693 long vsyncPeriodMicros); | 710 long vsyncPeriodMicros); |
694 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool
ean visible); | 711 private native void nativeOnVisibilityChanged(long nativeWindowAndroid, bool
ean visible); |
695 private native void nativeOnActivityStopped(long nativeWindowAndroid); | 712 private native void nativeOnActivityStopped(long nativeWindowAndroid); |
696 private native void nativeOnActivityStarted(long nativeWindowAndroid); | 713 private native void nativeOnActivityStarted(long nativeWindowAndroid); |
697 private native void nativeDestroy(long nativeWindowAndroid); | 714 private native void nativeDestroy(long nativeWindowAndroid); |
698 | 715 private native EventHandler nativeGetEventHandler(long nativeWindowAndroid); |
699 } | 716 } |
OLD | NEW |