disable fullscreen if 'toggle fullscreen' is pressed from fullscreen

This commit is contained in:
Philipp Schaefer 2013-05-04 01:10:01 +02:00
parent 68c089664f
commit bbeecfaaaf

View File

@ -234,15 +234,26 @@ public class IITC_Mobile extends Activity {
return true; return true;
// toggle fullscreen // toggle fullscreen
case R.id.toggle_fullscreen: case R.id.toggle_fullscreen:
// get rid of action bar if (!this.fullscreen_mode) {
this.getActionBar().hide(); // get rid of action bar
// hide notification bar this.getActionBar().hide();
WindowManager.LayoutParams attrs = getWindow().getAttributes(); // hide notification bar
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN; WindowManager.LayoutParams attrs = getWindow().getAttributes();
this.getWindow().setAttributes(attrs); attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
this.fullscreen_mode = true; this.getWindow().setAttributes(attrs);
// show a little toast for the user this.fullscreen_mode = true;
Toast.makeText(this, "Press back button to exit fullscreen", Toast.LENGTH_SHORT).show(); // 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; return true;
// get the users current location and focus it on map // get the users current location and focus it on map
case R.id.locate: case R.id.locate: