From bbeecfaaafe62fdeaa498d7fb4de91944cff8a81 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Sat, 4 May 2013 01:10:01 +0200 Subject: [PATCH] disable fullscreen if 'toggle fullscreen' is pressed from fullscreen --- .../com/cradle/iitc_mobile/IITC_Mobile.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 449d8ea0..04bf99b1 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -234,15 +234,26 @@ public class IITC_Mobile extends Activity { return true; // toggle fullscreen case R.id.toggle_fullscreen: - // get rid of action bar - this.getActionBar().hide(); - // hide notification bar - WindowManager.LayoutParams attrs = getWindow().getAttributes(); - attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN; - this.getWindow().setAttributes(attrs); - this.fullscreen_mode = true; - // show a little toast for the user - Toast.makeText(this, "Press back button to exit fullscreen", Toast.LENGTH_SHORT).show(); + if (!this.fullscreen_mode) { + // get rid of action bar + this.getActionBar().hide(); + // hide notification bar + WindowManager.LayoutParams attrs = getWindow().getAttributes(); + attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN; + this.getWindow().setAttributes(attrs); + this.fullscreen_mode = true; + // show a little toast for the user + Toast.makeText(this, "Press back button to exit fullscreen", Toast.LENGTH_SHORT).show(); + } + else { + // get back action bar + this.getActionBar().show(); + // show notification bar again + WindowManager.LayoutParams attrs = getWindow().getAttributes(); + attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN; + this.getWindow().setAttributes(attrs); + this.fullscreen_mode = false; + } return true; // get the users current location and focus it on map case R.id.locate: