added toggle fullscreen button (see #237)
This commit is contained in:
parent
e57c0b65dd
commit
5c254c95b4
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cradle.iitc_mobile"
|
||||
android:versionCode="16"
|
||||
android:versionName="0.3.4" >
|
||||
android:versionCode="17"
|
||||
android:versionName="0.3.5" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
@ -15,6 +15,11 @@
|
||||
android:showAsAction="never"
|
||||
android:title="@string/cache_clear"></item>
|
||||
|
||||
<item android:id="@+id/toggle_fullscreen"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/toggle_fullscreen"></item>
|
||||
|
||||
<item android:id="@+id/locate"
|
||||
android:icon="@android:drawable/ic_menu_mylocation"
|
||||
android:orderInCategory="80"
|
||||
|
@ -6,6 +6,7 @@
|
||||
<string name="reload">Reload IITC</string>
|
||||
<string name="version">Print Version</string>
|
||||
<string name="cache_clear">Clear Cache</string>
|
||||
<string name="toggle_fullscreen">Toggle fullscreen</string>
|
||||
<string name="locate">Get Location</string>
|
||||
<string name="local">local</string>
|
||||
<string name="close">close</string>
|
||||
|
@ -24,6 +24,7 @@ import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class IITC_Mobile extends Activity {
|
||||
@ -37,6 +38,7 @@ public class IITC_Mobile extends Activity {
|
||||
private LocationManager loc_mngr = null;
|
||||
private LocationListener loc_listener = null;
|
||||
private boolean keyboad_open = false;
|
||||
private boolean fullscreen_mode = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -181,6 +183,17 @@ public class IITC_Mobile extends Activity {
|
||||
// we want a self defined behavior for the back button
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// leave fullscreen mode if it is enabled
|
||||
if (fullscreen_mode) {
|
||||
// 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;
|
||||
}
|
||||
if (this.back_button_pressed) {
|
||||
super.onBackPressed();
|
||||
return;
|
||||
@ -219,6 +232,16 @@ public class IITC_Mobile extends Activity {
|
||||
iitc_view.clearFormData();
|
||||
iitc_view.clearCache(true);
|
||||
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;
|
||||
return true;
|
||||
// get the users current location and focus it on map
|
||||
case R.id.locate:
|
||||
iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 13});");
|
||||
|
Loading…
x
Reference in New Issue
Block a user