Chromium Code Reviews| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 mKeyboardAccessoryView = view; | 398 mKeyboardAccessoryView = view; |
| 399 } | 399 } |
| 400 | 400 |
| 401 /** | 401 /** |
| 402 * {@see setKeyboardAccessoryView(ViewGroup)}. | 402 * {@see setKeyboardAccessoryView(ViewGroup)}. |
| 403 */ | 403 */ |
| 404 public ViewGroup getKeyboardAccessoryView() { | 404 public ViewGroup getKeyboardAccessoryView() { |
| 405 return mKeyboardAccessoryView; | 405 return mKeyboardAccessoryView; |
| 406 } | 406 } |
| 407 | 407 |
| 408 protected void registerKeyboardVisibilityCallbacks() { | |
|
jdduke (slow)
2015/05/14 21:51:54
Should we be failing here, or just asserting false
boliu
2015/05/14 23:05:29
I don't want to add random asserts that I don't ac
jdduke (slow)
2015/05/14 23:09:36
How is it random? In what world should we be regis
boliu
2015/05/14 23:12:47
Random as in it's not part of this fix (and I don'
| |
| 409 } | |
| 410 | |
| 411 protected void unregisterKeyboardVisibilityCallbacks() { | |
| 412 } | |
| 413 | |
| 408 /** | 414 /** |
| 409 * Adds a listener that is updated of keyboard visibility changes. This work s as a best guess. | 415 * Adds a listener that is updated of keyboard visibility changes. This work s as a best guess. |
| 410 * {@see UiUtils.isKeyboardShowing} | 416 * {@see UiUtils.isKeyboardShowing} |
| 411 */ | 417 */ |
| 412 public void addKeyboardVisibilityListener(KeyboardVisibilityListener listene r) { | 418 public void addKeyboardVisibilityListener(KeyboardVisibilityListener listene r) { |
| 419 if (mKeyboardVisibilityListeners.isEmpty()) { | |
| 420 registerKeyboardVisibilityCallbacks(); | |
| 421 } | |
| 413 mKeyboardVisibilityListeners.add(listener); | 422 mKeyboardVisibilityListeners.add(listener); |
| 414 } | 423 } |
| 415 | 424 |
| 416 /** | 425 /** |
| 417 * {@see addKeyboardVisibilityListener()}. | 426 * {@see addKeyboardVisibilityListener()}. |
| 418 */ | 427 */ |
| 419 public void removeKeyboardVisibilityListener(KeyboardVisibilityListener list ener) { | 428 public void removeKeyboardVisibilityListener(KeyboardVisibilityListener list ener) { |
| 420 mKeyboardVisibilityListeners.remove(listener); | 429 mKeyboardVisibilityListeners.remove(listener); |
| 430 if (mKeyboardVisibilityListeners.isEmpty()) { | |
| 431 unregisterKeyboardVisibilityCallbacks(); | |
| 432 } | |
| 421 } | 433 } |
| 422 | 434 |
| 423 /** | 435 /** |
| 424 * To be called when the keyboard visibility state might have changed. Infor ms listeners of the | 436 * To be called when the keyboard visibility state might have changed. Infor ms listeners of the |
| 425 * state change IFF there actually was a change. | 437 * state change IFF there actually was a change. |
| 426 * @param isShowing The current (guesstimated) state of the keyboard. | 438 * @param isShowing The current (guesstimated) state of the keyboard. |
| 427 */ | 439 */ |
| 428 protected void keyboardVisibilityPossiblyChanged(boolean isShowing) { | 440 protected void keyboardVisibilityPossiblyChanged(boolean isShowing) { |
| 429 if (mIsKeyboardShowing == isShowing) return; | 441 if (mIsKeyboardShowing == isShowing) return; |
| 430 mIsKeyboardShowing = isShowing; | 442 mIsKeyboardShowing = isShowing; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 | 500 |
| 489 private native long nativeInit(); | 501 private native long nativeInit(); |
| 490 private native void nativeOnVSync(long nativeWindowAndroid, | 502 private native void nativeOnVSync(long nativeWindowAndroid, |
| 491 long vsyncTimeMicros, | 503 long vsyncTimeMicros, |
| 492 long vsyncPeriodMicros); | 504 long vsyncPeriodMicros); |
| 493 private native void nativeOnActivityPaused(long nativeWindowAndroid); | 505 private native void nativeOnActivityPaused(long nativeWindowAndroid); |
| 494 private native void nativeOnActivityResumed(long nativeWindowAndroid); | 506 private native void nativeOnActivityResumed(long nativeWindowAndroid); |
| 495 private native void nativeDestroy(long nativeWindowAndroid); | 507 private native void nativeDestroy(long nativeWindowAndroid); |
| 496 | 508 |
| 497 } | 509 } |
| OLD | NEW |