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:
pass
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':

View File

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

View File

@ -53,6 +53,7 @@ public class IITC_Mobile extends Activity {
setContentView(R.layout.activity_main);
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
// fetch actionbar, set display flags, title and enable home button
actionBar = this.getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
| 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
@Override
public void onBackPressed() {
// leave fullscreen mode if it is enabled
// exit fullscreen mode if it is enabled
if (fullscreen_mode) {
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;
this.toggleFullscreen();
return;
}
if (this.back_button_pressed) {
@ -289,31 +284,8 @@ public class IITC_Mobile extends Activity {
iitc_view.clearFormData();
iitc_view.clearCache(true);
return true;
// toggle fullscreen
case R.id.toggle_fullscreen :
if (!this.fullscreen_mode) {
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;
}
toggleFullscreen();
return true;
// get the users current location and focus it on map
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.content.res.AssetManager;
import android.os.Bundle;
import android.view.MenuItem;
public class IITC_Settings extends Activity {
@ -25,6 +26,10 @@ public class IITC_Settings extends Activity {
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_values = new ArrayList<String>();
@ -70,4 +75,16 @@ public class IITC_Settings extends Activity {
getFragmentManager().beginTransaction()
.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);
}
}
}