Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Desktop.java

Issue 2067093002: Fixing Toolbar flakiness in Android client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A bit more cleanup Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | remoting/android/java/src/org/chromium/chromoting/DesktopView.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.content.DialogInterface; 8 import android.content.DialogInterface;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.pm.ApplicationInfo; 10 import android.content.pm.ApplicationInfo;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 /** 56 /**
57 * Preference used for displaying an interestitial dialog only when the user first accesses the 57 * Preference used for displaying an interestitial dialog only when the user first accesses the
58 * Cardboard function. 58 * Cardboard function.
59 */ 59 */
60 private static final String PREFERENCE_CARDBOARD_DIALOG_SEEN = "cardboard_di alog_seen"; 60 private static final String PREFERENCE_CARDBOARD_DIALOG_SEEN = "cardboard_di alog_seen";
61 61
62 /** Preference used to track the last input mode selected by the user. */ 62 /** Preference used to track the last input mode selected by the user. */
63 private static final String PREFERENCE_INPUT_MODE = "input_mode"; 63 private static final String PREFERENCE_INPUT_MODE = "input_mode";
64 64
65 /** The amount of time to wait to hide the Actionbar after user input is see n. */ 65 /** The amount of time to wait to hide the ActionBar after user input is see n. */
66 private static final int ACTIONBAR_AUTO_HIDE_DELAY_MS = 3000; 66 private static final int ACTIONBAR_AUTO_HIDE_DELAY_MS = 3000;
67 67
68 private final Event.Raisable<SoftInputMethodVisibilityChangedEventParameter> 68 private final Event.Raisable<SoftInputMethodVisibilityChangedEventParameter>
69 mOnSoftInputMethodVisibilityChanged = new Event.Raisable<>(); 69 mOnSoftInputMethodVisibilityChanged = new Event.Raisable<>();
70 70
71 private final Event.Raisable<InputModeChangedEventParameter> mOnInputModeCha nged = 71 private final Event.Raisable<InputModeChangedEventParameter> mOnInputModeCha nged =
72 new Event.Raisable<>(); 72 new Event.Raisable<>();
73 73
74 private Client mClient; 74 private Client mClient;
75 75
76 /** Set of pressed keys for which we've sent TextEvent. */ 76 /** Set of pressed keys for which we've sent TextEvent. */
77 private Set<Integer> mPressedTextKeys = new TreeSet<Integer>(); 77 private Set<Integer> mPressedTextKeys = new TreeSet<Integer>();
78 78
79 private ActivityLifecycleListener mActivityLifecycleListener; 79 private ActivityLifecycleListener mActivityLifecycleListener;
80 80
81 /** Flag to indicate whether the current activity is switching to Cardboard desktop activity. */ 81 /** Flag to indicate whether the current activity is switching to Cardboard desktop activity. */
82 private boolean mSwitchToCardboardDesktopActivity; 82 private boolean mSwitchToCardboardDesktopActivity;
83 83
84 /** Flag to indicate whether to manually hide the system UI when the OSK is dismissed. */
85 private boolean mHideSystemUIOnSoftKeyboardDismiss = false;
86
87 /** Indicates whether a Soft Input UI (such as a keyboard) is visible. */ 84 /** Indicates whether a Soft Input UI (such as a keyboard) is visible. */
88 private boolean mSoftInputVisible = false; 85 private boolean mSoftInputVisible = false;
89 86
90 /** Holds the scheduled task object which will be called to hide the ActionB ar. */ 87 /** Holds the scheduled task object which will be called to hide the ActionB ar. */
91 private Runnable mActionBarAutoHideTask; 88 private Runnable mActionBarAutoHideTask;
92 89
93 /** The Toolbar instance backing our SupportActionBar. */ 90 /** The Toolbar instance backing our SupportActionBar. */
94 private Toolbar mToolbar; 91 private Toolbar mToolbar;
95 92
96 /** Tracks the current input mode (e.g. trackpad/touch). */ 93 /** Tracks the current input mode (e.g. trackpad/touch). */
(...skipping 21 matching lines...) Expand all
118 getSupportActionBar().setDisplayShowTitleEnabled(false); 115 getSupportActionBar().setDisplayShowTitleEnabled(false);
119 getSupportActionBar().setDisplayHomeAsUpEnabled(true); 116 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
120 117
121 // For this Activity, the home button in the action bar acts as a Discon nect button, so 118 // For this Activity, the home button in the action bar acts as a Discon nect button, so
122 // set the description for accessibility/screen readers. 119 // set the description for accessibility/screen readers.
123 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec t_myself_button); 120 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec t_myself_button);
124 121
125 // The action bar is already shown when the activity is started however calling the 122 // The action bar is already shown when the activity is started however calling the
126 // function below will set our preferred system UI flags which will adju st the layout 123 // function below will set our preferred system UI flags which will adju st the layout
127 // size of the canvas and we can avoid an initial resize event. 124 // size of the canvas and we can avoid an initial resize event.
128 showActionBar(); 125 showSystemUi();
129 126
130 View decorView = getWindow().getDecorView(); 127 View decorView = getWindow().getDecorView();
131 decorView.setOnSystemUiVisibilityChangeListener(this); 128 decorView.setOnSystemUiVisibilityChangeListener(this);
132 129
133 mActivityLifecycleListener = mClient.getCapabilityManager().onActivityAc ceptingListener( 130 mActivityLifecycleListener = mClient.getCapabilityManager().onActivityAc ceptingListener(
134 this, Capabilities.CAST_CAPABILITY); 131 this, Capabilities.CAST_CAPABILITY);
135 mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); 132 mActivityLifecycleListener.onActivityCreated(this, savedInstanceState);
136 133
137 mInputMode = getInitialInputModeValue(); 134 mInputMode = getInitialInputModeValue();
138 135
139 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 136 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
140 attachKeyboardVisibilityListener(); 137 attachKeyboardVisibilityListener();
141 138
142 // Only create an Autohide task if the system supports immersive ful lscreen mode. Older 139 // Only create an Autohide task if the system supports immersive ful lscreen mode. Older
143 // versions of the OS benefit less from this functionality and we do n't want to change 140 // versions of the OS benefit less from this functionality and we do n't want to change
144 // the experience for them. 141 // the experience for them.
145 mActionBarAutoHideTask = new Runnable() { 142 mActionBarAutoHideTask = new Runnable() {
146 public void run() { 143 public void run() {
147 if (!mToolbar.isOverflowMenuShowing()) { 144 if (!mToolbar.isOverflowMenuShowing()) {
148 hideActionBar(); 145 hideSystemUi();
149 } 146 }
150 } 147 }
151 }; 148 };
152 149
153 // Suspend the ActionBar timer when the user interacts with the opti ons menu. 150 // Suspend the ActionBar timer when the user interacts with the opti ons menu.
154 getSupportActionBar().addOnMenuVisibilityListener(new OnMenuVisibili tyListener() { 151 getSupportActionBar().addOnMenuVisibilityListener(new OnMenuVisibili tyListener() {
155 public void onMenuVisibilityChanged(boolean isVisible) { 152 public void onMenuVisibilityChanged(boolean isVisible) {
156 if (isVisible) { 153 if (isVisible) {
157 stopActionBarAutoHideTimer(); 154 stopActionBarAutoHideTimer();
158 } else { 155 } else {
(...skipping 24 matching lines...) Expand all
183 mClient.enableVideoChannel(false); 180 mClient.enableVideoChannel(false);
184 } 181 }
185 stopActionBarAutoHideTimer(); 182 stopActionBarAutoHideTimer();
186 } 183 }
187 184
188 @Override 185 @Override
189 public void onResume() { 186 public void onResume() {
190 super.onResume(); 187 super.onResume();
191 mActivityLifecycleListener.onActivityResumed(this); 188 mActivityLifecycleListener.onActivityResumed(this);
192 mClient.enableVideoChannel(true); 189 mClient.enableVideoChannel(true);
193 startActionBarAutoHideTimer(); 190 syncActionBarToSystemUiState();
194 } 191 }
195 192
196 @Override 193 @Override
197 protected void onStop() { 194 protected void onStop() {
198 mClient.getCapabilityManager().removeListener(this); 195 mClient.getCapabilityManager().removeListener(this);
199 mActivityLifecycleListener.onActivityStopped(this); 196 mActivityLifecycleListener.onActivityStopped(this);
200 super.onStop(); 197 super.onStop();
201 if (mSwitchToCardboardDesktopActivity) { 198 if (mSwitchToCardboardDesktopActivity) {
202 mSwitchToCardboardDesktopActivity = false; 199 mSwitchToCardboardDesktopActivity = false;
203 } else { 200 } else {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 358 }
362 } 359 }
363 360
364 // Clear all existing delayed tasks to prevent the ActionBar from being hidd en. 361 // Clear all existing delayed tasks to prevent the ActionBar from being hidd en.
365 private void stopActionBarAutoHideTimer() { 362 private void stopActionBarAutoHideTimer() {
366 if (mActionBarAutoHideTask != null) { 363 if (mActionBarAutoHideTask != null) {
367 getWindow().getDecorView().removeCallbacks(mActionBarAutoHideTask); 364 getWindow().getDecorView().removeCallbacks(mActionBarAutoHideTask);
368 } 365 }
369 } 366 }
370 367
368 // Updates the ActionBar visibility to match the System UI elements. This i s useful after a
369 // power or activity lifecycle event in which the current System UI state ha s changed but we
370 // never received the notification.
371 private void syncActionBarToSystemUiState() {
372 onSystemUiVisibilityChange(getWindow().getDecorView().getSystemUiVisibil ity());
373 }
374
375 private boolean isActionBarVisible() {
376 return getSupportActionBar() != null && getSupportActionBar().isShowing( );
377 }
378
371 /** Called whenever the visibility of the system status bar or navigation ba r changes. */ 379 /** Called whenever the visibility of the system status bar or navigation ba r changes. */
372 @Override 380 @Override
373 public void onSystemUiVisibilityChange(int visibility) { 381 public void onSystemUiVisibilityChange(int visibility) {
374 // Ensure the action-bar's visibility matches that of the system control s. This 382 // Ensure the action-bar's visibility matches that of the system control s. This
375 // minimizes the number of states the UI can be in, to keep things simpl e for the user. 383 // minimizes the number of states the UI can be in, to keep things simpl e for the user.
376 384
377 // Determine if the system is in fullscreen/lights-out mode. LOW_PROFILE is needed since 385 // Check if the system is in fullscreen/lights-out mode then update the ActionBar to match.
378 // it's the only flag supported in 4.0. But it is not sufficient in itse lf; when
379 // IMMERSIVE_STICKY mode is used, the system clears this flag (leaving t he FULLSCREEN flag
380 // set) when the user swipes the edge to reveal the bars temporarily. Wh en this happens,
381 // the action-bar should remain hidden.
382 int fullscreenFlags = getFullscreenFlags(); 386 int fullscreenFlags = getFullscreenFlags();
383 if ((visibility & fullscreenFlags) != 0) { 387 if ((visibility & fullscreenFlags) != 0) {
384 hideActionBarWithoutSystemUi(); 388 hideActionBar();
385 } else { 389 } else {
386 showActionBarWithoutSystemUi(); 390 showActionBar();
387 } 391 }
388 } 392 }
389 393
390 @SuppressLint("InlinedApi") 394 @SuppressLint("InlinedApi")
391 private static int getFullscreenFlags() { 395 private static int getFullscreenFlags() {
396 // LOW_PROFILE gives the status and navigation bars a "lights-out" appea rance.
397 // FULLSCREEN hides the status bar on supported devices (4.1 and above).
392 int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE; 398 int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
393 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 399 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
394 flags |= View.SYSTEM_UI_FLAG_FULLSCREEN; 400 flags |= View.SYSTEM_UI_FLAG_FULLSCREEN;
395 } 401 }
396 return flags; 402 return flags;
397 } 403 }
398 404
399 @SuppressLint("InlinedApi") 405 @SuppressLint("InlinedApi")
400 private static int getImmersiveLayoutFlags() { 406 private static int getLayoutFlags() {
401 int flags = 0; 407 int flags = 0;
402 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 408 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
403 flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; 409 flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
404 flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; 410 flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
405 flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; 411 flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
406 } 412 }
407 return flags; 413 return flags;
408 } 414 }
409 415
410 public void showActionBar() { 416 public void showSystemUi() {
411 mHideSystemUIOnSoftKeyboardDismiss = false;
412
413 // Request exit from any fullscreen mode. The action-bar controls will b e shown in response 417 // Request exit from any fullscreen mode. The action-bar controls will b e shown in response
414 // to the SystemUiVisibility notification. The visibility of the action- bar should be tied 418 // to the SystemUiVisibility notification. The visibility of the action- bar should be tied
415 // to the fullscreen state of the system, so there's no need to explicit ly show it here. 419 // to the fullscreen state of the system, so there's no need to explicit ly show it here.
416 int flags = View.SYSTEM_UI_FLAG_VISIBLE | getImmersiveLayoutFlags(); 420 int flags = View.SYSTEM_UI_FLAG_VISIBLE | getLayoutFlags();
417 getWindow().getDecorView().setSystemUiVisibility(flags); 421 getWindow().getDecorView().setSystemUiVisibility(flags);
418 422
419 // The OS will not call onSystemUiVisibilityChange() if the keyboard is visible which means 423 // The OS will not call onSystemUiVisibilityChange() if the soft keyboar d is visible which
420 // our ActionBar will not be visible until then. This check allows us t o work around this 424 // means our ActionBar will not be shown if this function is called in t hat scenario.
421 // issue and still allow the system to show the ActionBar normally with the soft keyboard.
422 if (mSoftInputVisible) { 425 if (mSoftInputVisible) {
423 showActionBarWithoutSystemUi(); 426 showActionBar();
424 } 427 }
425 } 428 }
426 429
427 /** Shows the action bar without changing SystemUiVisibility. */ 430 /** Shows the action bar without changing SystemUiVisibility. */
428 private void showActionBarWithoutSystemUi() { 431 private void showActionBar() {
429 getSupportActionBar().show(); 432 getSupportActionBar().show();
430 startActionBarAutoHideTimer(); 433 startActionBarAutoHideTimer();
431 } 434 }
432 435
433 @SuppressLint("InlinedApi") 436 @SuppressLint("InlinedApi")
434 public void hideActionBar() { 437 public void hideSystemUi() {
438 // If a soft input device is present, then hide the ActionBar but do not hide the rest of
439 // system UI. A second call will be made once the soft input device is hidden.
440 if (mSoftInputVisible) {
441 hideActionBar();
442 return;
443 }
444
435 // Request the device to enter fullscreen mode. Don't hide the controls yet, because the 445 // Request the device to enter fullscreen mode. Don't hide the controls yet, because the
436 // system might not honor the fullscreen request immediately (for exampl e, if the 446 // system might not honor the fullscreen request immediately (for exampl e, if the
437 // keyboard is visible, the system might delay fullscreen until the keyb oard is hidden). 447 // keyboard is visible, the system might delay fullscreen until the keyb oard is hidden).
438 // The controls will be hidden in response to the SystemUiVisibility not ification. 448 // The controls will be hidden in response to the SystemUiVisibility not ification.
439 // This helps ensure that the visibility of the controls is synchronized with the 449 // This helps ensure that the visibility of the controls is synchronized with the
440 // fullscreen state. 450 // fullscreen state.
441
442 // LOW_PROFILE gives the status and navigation bars a "lights-out" appea rance.
443 // FULLSCREEN hides the status bar on supported devices (4.1 and above).
444 int flags = getFullscreenFlags(); 451 int flags = getFullscreenFlags();
445 452
446 // HIDE_NAVIGATION hides the navigation bar. However, if the user touche s the screen, the 453 // HIDE_NAVIGATION hides the navigation bar. However, if the user touche s the screen, the
447 // event is not seen by the application and instead the navigation bar i s re-shown. 454 // event is not seen by the application and instead the navigation bar i s re-shown.
448 // IMMERSIVE(_STICKY) fixes this problem and allows the user to interact with the app while 455 // IMMERSIVE fixes this problem and allows the user to interact with the app while
449 // keeping the navigation controls hidden. This flag was introduced in 4 .4, later than 456 // keeping the navigation controls hidden. This flag was introduced in 4 .4, later than
450 // HIDE_NAVIGATION, and so a runtime check is needed before setting eith er of these flags. 457 // HIDE_NAVIGATION, and so a runtime check is needed before setting eith er of these flags.
451 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 458 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
452 flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; 459 flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
453 flags |= View.SYSTEM_UI_FLAG_IMMERSIVE; 460 flags |= View.SYSTEM_UI_FLAG_IMMERSIVE;
454 flags |= getImmersiveLayoutFlags();
455 } 461 }
462 flags |= getLayoutFlags();
456 463
457 getWindow().getDecorView().setSystemUiVisibility(flags); 464 getWindow().getDecorView().setSystemUiVisibility(flags);
458
459 // The OS will not call onSystemUiVisibilityChange() until the keyboard has been dismissed
460 // which means our ActionBar will still be visible. This check allows u s to work around
461 // this issue when the keyboard is visible and the user wants additional space on the screen
462 // and still allow the system to hide the ActionBar normally when no key board is present.
463 if (mSoftInputVisible) {
464 hideActionBarWithoutSystemUi();
465
466 // Android OSes prior to Marshmallow do not call onSystemUiVisibilit yChange after the
467 // OSK is dismissed if the user has interacted with the status bar.
468 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
469 mHideSystemUIOnSoftKeyboardDismiss = true;
470 }
471 }
472 } 465 }
473 466
474 /** Hides the action bar without changing SystemUiVisibility. */ 467 /** Hides the action bar without changing SystemUiVisibility. */
475 private void hideActionBarWithoutSystemUi() { 468 private void hideActionBar() {
476 getSupportActionBar().hide(); 469 getSupportActionBar().hide();
477 stopActionBarAutoHideTimer(); 470 stopActionBarAutoHideTimer();
478 } 471 }
479 472
480 /** Called whenever an action bar button is pressed. */ 473 /** Called whenever an action bar button is pressed. */
481 @Override 474 @Override
482 public boolean onOptionsItemSelected(MenuItem item) { 475 public boolean onOptionsItemSelected(MenuItem item) {
483 int id = item.getItemId(); 476 int id = item.getItemId();
484 477
485 mActivityLifecycleListener.onActivityOptionsItemSelected(this, item); 478 mActivityLifecycleListener.onActivityOptionsItemSelected(this, item);
(...skipping 10 matching lines...) Expand all
496 if (id == R.id.actionbar_touch_mode) { 489 if (id == R.id.actionbar_touch_mode) {
497 // When the touch icon is tapped, we want to switch the input mode t o trackpad. 490 // When the touch icon is tapped, we want to switch the input mode t o trackpad.
498 setInputMode(InputMode.TRACKPAD); 491 setInputMode(InputMode.TRACKPAD);
499 return true; 492 return true;
500 } 493 }
501 if (id == R.id.actionbar_keyboard) { 494 if (id == R.id.actionbar_keyboard) {
502 ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggle SoftInput(0, 0); 495 ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).toggle SoftInput(0, 0);
503 return true; 496 return true;
504 } 497 }
505 if (id == R.id.actionbar_hide) { 498 if (id == R.id.actionbar_hide) {
506 hideActionBar(); 499 hideSystemUi();
507 return true; 500 return true;
508 } 501 }
509 if (id == R.id.actionbar_disconnect || id == android.R.id.home) { 502 if (id == R.id.actionbar_disconnect || id == android.R.id.home) {
510 mClient.destroy(); 503 mClient.destroy();
511 return true; 504 return true;
512 } 505 }
513 if (id == R.id.actionbar_send_ctrl_alt_del) { 506 if (id == R.id.actionbar_send_ctrl_alt_del) {
514 int[] keys = { 507 int[] keys = {
515 KeyEvent.KEYCODE_CTRL_LEFT, 508 KeyEvent.KEYCODE_CTRL_LEFT,
516 KeyEvent.KEYCODE_ALT_LEFT, 509 KeyEvent.KEYCODE_ALT_LEFT,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // are transitioning from another activity/orientation, then the re may be several 541 // are transitioning from another activity/orientation, then the re may be several
549 // layout change events as the view is updated (i.e. the OSK mig ht have been 542 // layout change events as the view is updated (i.e. the OSK mig ht have been
550 // displayed previously but is being dismissed). Therefore we w ant to track the 543 // displayed previously but is being dismissed). Therefore we w ant to track the
551 // largest value we have seen and use it to determine if a new s ystem UI (such as 544 // largest value we have seen and use it to determine if a new s ystem UI (such as
552 // the OSK) is being displayed. 545 // the OSK) is being displayed.
553 if (mMaxBottomValue < bottom) { 546 if (mMaxBottomValue < bottom) {
554 mMaxBottomValue = bottom; 547 mMaxBottomValue = bottom;
555 return; 548 return;
556 } 549 }
557 550
558 // If the delta between lowest bound we have seen (should be a s ystemUI such as 551 // If the delta between lowest bound we have seen (should be a S ystem UI such as
559 // the navigation bar) and the current bound does not match, the n we have a form 552 // the navigation bar) and the current bound does not match, the n we have a form
560 // of soft input displayed. Note that the size of a soft input device can change 553 // of soft input displayed. Note that the size of a soft input device can change
561 // when the input method is changed so we want to send updates t o the image canvas 554 // when the input method is changed so we want to send updates t o the image canvas
562 // whenever they occur. 555 // whenever they occur.
556 boolean oldSoftInputVisible = mSoftInputVisible;
563 mSoftInputVisible = (bottom < mMaxBottomValue); 557 mSoftInputVisible = (bottom < mMaxBottomValue);
564 mOnSoftInputMethodVisibilityChanged.raise( 558 mOnSoftInputMethodVisibilityChanged.raise(
565 new SoftInputMethodVisibilityChangedEventParameter( 559 new SoftInputMethodVisibilityChangedEventParameter(
566 mSoftInputVisible, left, top, right, bottom)); 560 mSoftInputVisible, left, top, right, bottom));
567 561
568 if (!mSoftInputVisible && mHideSystemUIOnSoftKeyboardDismiss) { 562 boolean softInputVisibilityChanged = oldSoftInputVisible != mSof tInputVisible;
563 if (!mSoftInputVisible && softInputVisibilityChanged && !isActio nBarVisible()) {
569 // Queue a task which will run after the current action (OSK dismiss) has 564 // Queue a task which will run after the current action (OSK dismiss) has
570 // completed, otherwise the hide request will not take effec t. 565 // completed, otherwise the hide request will not take effec t.
571 new Handler().post(new Runnable() { 566 new Handler().post(new Runnable() {
572 @Override 567 @Override
573 public void run() { 568 public void run() {
574 if (mHideSystemUIOnSoftKeyboardDismiss) { 569 if (!mSoftInputVisible && !isActionBarVisible()) {
575 mHideSystemUIOnSoftKeyboardDismiss = false; 570 hideSystemUi();
576 hideActionBar();
577 } 571 }
578 } 572 }
579 }); 573 });
580 } 574 }
581 } 575 }
582 }); 576 });
583 } 577 }
584 578
585 private void onCardboardItemSelected() { 579 private void onCardboardItemSelected() {
586 if (getPreferences(MODE_PRIVATE).getBoolean(PREFERENCE_CARDBOARD_DIALOG_ SEEN, false)) { 580 if (getPreferences(MODE_PRIVATE).getBoolean(PREFERENCE_CARDBOARD_DIALOG_ SEEN, false)) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 mClient.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed); 692 mClient.sendKeyEvent(0, KeyEvent.KEYCODE_SHIFT_LEFT, pressed);
699 mClient.sendKeyEvent(0, KeyEvent.KEYCODE_EQUALS, pressed); 693 mClient.sendKeyEvent(0, KeyEvent.KEYCODE_EQUALS, pressed);
700 return true; 694 return true;
701 695
702 default: 696 default:
703 // We try to send all other key codes to the host directly. 697 // We try to send all other key codes to the host directly.
704 return mClient.sendKeyEvent(0, keyCode, pressed); 698 return mClient.sendKeyEvent(0, keyCode, pressed);
705 } 699 }
706 } 700 }
707 } 701 }
OLDNEW
« no previous file with comments | « no previous file | remoting/android/java/src/org/chromium/chromoting/DesktopView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698