Chromium Code Reviews| 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.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.res.Configuration; | 8 import android.content.res.Configuration; |
| 9 import android.graphics.Color; | |
| 10 import android.graphics.drawable.ColorDrawable; | |
| 9 import android.os.Build; | 11 import android.os.Build; |
| 10 import android.os.Bundle; | 12 import android.os.Bundle; |
| 11 import android.os.Handler; | 13 import android.os.Handler; |
| 12 import android.support.v7.app.ActionBar.OnMenuVisibilityListener; | 14 import android.support.v7.app.ActionBar.OnMenuVisibilityListener; |
| 13 import android.support.v7.app.AppCompatActivity; | 15 import android.support.v7.app.AppCompatActivity; |
| 14 import android.support.v7.widget.Toolbar; | 16 import android.support.v7.widget.Toolbar; |
| 15 import android.view.KeyEvent; | 17 import android.view.KeyEvent; |
| 16 import android.view.Menu; | 18 import android.view.Menu; |
| 17 import android.view.MenuItem; | 19 import android.view.MenuItem; |
| 18 import android.view.MotionEvent; | 20 import android.view.MotionEvent; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec t_myself_button); | 123 getSupportActionBar().setHomeActionContentDescription(R.string.disconnec t_myself_button); |
| 122 | 124 |
| 123 // The action bar is already shown when the activity is started however calling the | 125 // The action bar is already shown when the activity is started however calling the |
| 124 // function below will set our preferred system UI flags which will adju st the layout | 126 // function below will set our preferred system UI flags which will adju st the layout |
| 125 // size of the canvas and we can avoid an initial resize event. | 127 // size of the canvas and we can avoid an initial resize event. |
| 126 showSystemUi(); | 128 showSystemUi(); |
| 127 | 129 |
| 128 View decorView = getWindow().getDecorView(); | 130 View decorView = getWindow().getDecorView(); |
| 129 decorView.setOnSystemUiVisibilityChangeListener(this); | 131 decorView.setOnSystemUiVisibilityChangeListener(this); |
| 130 | 132 |
| 133 // The background color is displayed when the user resizes the window in split-screen past | |
| 134 // the boundaries of the image we render. The default background is whi te and we use black | |
| 135 // for our canvas, thus there is a visual artifact when we draw the canv as over the | |
| 136 // background. Setting the background color to match our canvas will pr event the flash. | |
| 137 getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK)); | |
|
Lambros
2016/11/07 20:36:25
Would Color.TRANSPARENT be better?
joedow
2016/11/07 21:12:44
BLACK and TRANSPARENT have a similar effect on my
| |
| 138 | |
| 131 mActivityLifecycleListener = mClient.getCapabilityManager().onActivityAc ceptingListener( | 139 mActivityLifecycleListener = mClient.getCapabilityManager().onActivityAc ceptingListener( |
| 132 this, Capabilities.CAST_CAPABILITY); | 140 this, Capabilities.CAST_CAPABILITY); |
| 133 mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); | 141 mActivityLifecycleListener.onActivityCreated(this, savedInstanceState); |
| 134 | 142 |
| 135 mInputMode = getInitialInputModeValue(); | 143 mInputMode = getInitialInputModeValue(); |
| 136 | 144 |
| 137 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | 145 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| 138 attachSystemUiResizeListener(); | 146 attachSystemUiResizeListener(); |
| 139 } else { | 147 } else { |
| 140 mRemoteHostDesktop.setFitsSystemWindows(true); | 148 mRemoteHostDesktop.setFitsSystemWindows(true); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 @Override | 625 @Override |
| 618 public boolean dispatchKeyEvent(KeyEvent event) { | 626 public boolean dispatchKeyEvent(KeyEvent event) { |
| 619 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { | 627 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) { |
| 620 mClient.destroy(); | 628 mClient.destroy(); |
| 621 return super.dispatchKeyEvent(event); | 629 return super.dispatchKeyEvent(event); |
| 622 } | 630 } |
| 623 | 631 |
| 624 return mInjector.sendKeyEvent(event); | 632 return mInjector.sendKeyEvent(event); |
| 625 } | 633 } |
| 626 } | 634 } |
| OLD | NEW |