diff options
author | lambroslambrou <lambroslambrou@chromium.org> | 2015-04-03 00:58:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-03 07:59:25 +0000 |
commit | eb5e99d923abec16b5cd12b71f4c6212b60c3291 (patch) | |
tree | d3e6902003055f64a0ddf400362a07333e631bf4 | |
parent | 82b8e167143a5f0d4dd4515c6d0e14a64f654083 (diff) | |
download | chromium_src-eb5e99d923abec16b5cd12b71f4c6212b60c3291.zip chromium_src-eb5e99d923abec16b5cd12b71f4c6212b60c3291.tar.gz chromium_src-eb5e99d923abec16b5cd12b71f4c6212b60c3291.tar.bz2 |
Android Chromoting: Remove exit-fullscreen button.
This removes the ancient Gingerbread icon button for exiting fullscreen
and implements swipe-to-exit-fullscreen instead (by using
IMMERSIVE instead of IMMERSIVE_STICKY). With this change, the screen
would occasionally flip-flop endlessly in and out of fullscreen mode,
so I've also refactored the code not to change the SysUiVisibility flag
in response to SysUiVisibility change notifications.
BUG=430328
Review URL: https://codereview.chromium.org/1054273003
Cr-Commit-Position: refs/heads/master@{#323681}
-rw-r--r-- | remoting/android/java/res/layout/desktop.xml | 8 | ||||
-rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/Desktop.java | 32 |
2 files changed, 13 insertions, 27 deletions
diff --git a/remoting/android/java/res/layout/desktop.xml b/remoting/android/java/res/layout/desktop.xml index a67a839d..8e568be 100644 --- a/remoting/android/java/res/layout/desktop.xml +++ b/remoting/android/java/res/layout/desktop.xml @@ -9,12 +9,4 @@ <org.chromium.chromoting.DesktopView android:id="@+id/desktop_view" android:layout_height="match_parent" android:layout_width="match_parent"/> - <ImageButton android:id="@+id/desktop_overlay_button" - android:background="@android:color/transparent" - android:contentDescription="@string/exit_full_screen" - android:layout_gravity="top|end" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:onClick="onOverlayButtonPressed" - android:src="@android:drawable/ic_menu_more"/> </merge> diff --git a/remoting/android/java/src/org/chromium/chromoting/Desktop.java b/remoting/android/java/src/org/chromium/chromoting/Desktop.java index a121c40..b536577 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Desktop.java +++ b/remoting/android/java/src/org/chromium/chromoting/Desktop.java @@ -15,7 +15,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; -import android.widget.ImageButton; import org.chromium.chromoting.jni.JniInterface; @@ -33,31 +32,23 @@ public class Desktop extends ActionBarActivity implements View.OnSystemUiVisibil /** The surface that displays the remote host's desktop feed. */ private DesktopView mRemoteHostDesktop; - /** The button used to show the action bar. */ - private ImageButton mOverlayButton; - /** Set of pressed keys for which we've sent TextEvent. */ private Set<Integer> mPressedTextKeys = new TreeSet<Integer>(); private ActivityLifecycleListener mActivityLifecycleListener; - /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.desktop); mRemoteHostDesktop = (DesktopView) findViewById(R.id.desktop_view); - mOverlayButton = (ImageButton) findViewById(R.id.desktop_overlay_button); mRemoteHostDesktop.setDesktop(this); // For this Activity, the home button in the action bar acts as a Disconnect button, so // set the description for accessibility/screen readers. getSupportActionBar().setHomeActionContentDescription(R.string.disconnect_myself_button); - // Ensure the overlay button is initially hidden. - showActionBar(); - View decorView = getWindow().getDecorView(); decorView.setOnSystemUiVisibilityChangeListener(this); @@ -131,9 +122,9 @@ public class Desktop extends ActionBarActivity implements View.OnSystemUiVisibil // the action-bar should remain hidden. int fullscreenFlags = getSystemUiFlags(); if ((visibility & fullscreenFlags) != 0) { - hideActionBar(); + hideActionBarWithoutSystemUi(); } else { - showActionBar(); + showActionBarWithoutSystemUi(); } } @@ -147,17 +138,20 @@ public class Desktop extends ActionBarActivity implements View.OnSystemUiVisibil } public void showActionBar() { - mOverlayButton.setVisibility(View.INVISIBLE); - getSupportActionBar().show(); + showActionBarWithoutSystemUi(); View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); } + /** Shows the action bar without changing SystemUiVisibility. */ + private void showActionBarWithoutSystemUi() { + getSupportActionBar().show(); + } + @SuppressLint("InlinedApi") public void hideActionBar() { - mOverlayButton.setVisibility(View.VISIBLE); - getSupportActionBar().hide(); + hideActionBarWithoutSystemUi(); View decorView = getWindow().getDecorView(); @@ -171,15 +165,15 @@ public class Desktop extends ActionBarActivity implements View.OnSystemUiVisibil // keeping the navigation controls hidden. This flag was introduced in 4.4, later than // HIDE_NAVIGATION, and so a runtime check is needed before setting either of these flags. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - flags |= (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + flags |= (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE); } decorView.setSystemUiVisibility(flags); } - /** The overlay button's onClick handler. */ - public void onOverlayButtonPressed(@SuppressWarnings("unused") View view) { - showActionBar(); + /** Hides the action bar without changing SystemUiVisibility. */ + private void hideActionBarWithoutSystemUi() { + getSupportActionBar().hide(); } /** Called whenever an action bar button is pressed. */ |