This commit is contained in:
Jon Atkins 2013-05-08 17:19:26 +01:00
commit 684e6c10ee
4 changed files with 43 additions and 34 deletions

View File

@ -225,7 +225,7 @@ if buildMobile:
except: except:
pass pass
shutil.rmtree("mobile/assets/plugins") shutil.rmtree("mobile/assets/plugins")
shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*')) shutil.copytree(os.path.join(outDir,"plugins"), "mobile/assets/plugins", ignore=shutil.ignore_patterns('*.meta.js', 'force-https*', 'privacy-view*'))
if buildMobile != 'copyonly': if buildMobile != 'copyonly':

View File

@ -16,7 +16,8 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_iitcm" android:icon="@drawable/ic_iitcm"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:uiOptions="splitActionBarWhenNarrow"> android:theme="@style/AppTheme"
android:uiOptions="splitActionBarWhenNarrow">
<activity <activity
android:name="com.cradle.iitc_mobile.IITC_Mobile" android:name="com.cradle.iitc_mobile.IITC_Mobile"
android:theme="@style/AppBaseTheme" android:theme="@style/AppBaseTheme"

View File

@ -53,6 +53,7 @@ public class IITC_Mobile extends Activity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview); iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
// fetch actionbar, set display flags, title and enable home button
actionBar = this.getActionBar(); actionBar = this.getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
| ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
@ -230,15 +231,9 @@ public class IITC_Mobile extends Activity {
// we want a self defined behavior for the back button // we want a self defined behavior for the back button
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// leave fullscreen mode if it is enabled // exit fullscreen mode if it is enabled
if (fullscreen_mode) { if (fullscreen_mode) {
if (fullscreen_actionbar) this.toggleFullscreen();
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; return;
} }
if (this.back_button_pressed) { if (this.back_button_pressed) {
@ -289,31 +284,8 @@ public class IITC_Mobile extends Activity {
iitc_view.clearFormData(); iitc_view.clearFormData();
iitc_view.clearCache(true); iitc_view.clearCache(true);
return true; return true;
// toggle fullscreen
case R.id.toggle_fullscreen : case R.id.toggle_fullscreen :
if (!this.fullscreen_mode) { toggleFullscreen();
if (fullscreen_actionbar)
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 {
if (fullscreen_actionbar)
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 :
@ -394,4 +366,23 @@ public class IITC_Mobile extends Activity {
} }
} }
} }
public void toggleFullscreen() {
if (fullscreen_mode) {
if (fullscreen_actionbar)
this.getActionBar().show();
this.fullscreen_mode = false;
} else {
if (fullscreen_actionbar)
this.getActionBar().hide();
this.fullscreen_mode = true;
// show a toast with instructions to exit the fc mode again
Toast.makeText(this, "Press back button to exit fullscreen",
Toast.LENGTH_SHORT).show();
}
// toggle notification bar
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
this.getWindow().setAttributes(attrs);
}
} }

View File

@ -7,6 +7,7 @@ import java.util.Scanner;
import android.app.Activity; import android.app.Activity;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem;
public class IITC_Settings extends Activity { public class IITC_Settings extends Activity {
@ -25,6 +26,10 @@ public class IITC_Settings extends Activity {
e.printStackTrace(); e.printStackTrace();
} }
// set action bar title
this.getActionBar().setTitle("IITC Mobile Settings");
this.getActionBar().setHomeButtonEnabled(true);
ArrayList<String> asset_list = new ArrayList<String>(); ArrayList<String> asset_list = new ArrayList<String>();
ArrayList<String> asset_values = new ArrayList<String>(); ArrayList<String> asset_values = new ArrayList<String>();
@ -70,4 +75,16 @@ public class IITC_Settings extends Activity {
getFragmentManager().beginTransaction() getFragmentManager().beginTransaction()
.replace(android.R.id.content, settings).commit(); .replace(android.R.id.content, settings).commit();
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// exit settings when home button (iitc icon) is pressed
case android.R.id.home :
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
} }