diff --git a/code/chat.js b/code/chat.js
index a2b78797..cf10a99d 100644
--- a/code/chat.js
+++ b/code/chat.js
@@ -473,9 +473,7 @@ window.chat.needMoreMessages = function() {
chat.requestPublic(true);
}
-
-window.chat.chooser = function(event) {
- var t = $(event.target);
+window.chat.chooseAnchor = function(t) {
var tt = t.text();
var mark = $('#chatinput mark');
@@ -524,6 +522,18 @@ window.chat.chooser = function(event) {
chat.needMoreMessages();
}
+window.chat.choose = function(name) {
+ $('#chat, #chatinput, #updatestatus').show();
+ $('#map').css('visibility', 'hidden');
+
+ var t = $(''+name+'');
+ window.chat.chooseAnchor(t);
+}
+
+window.chat.chooser = function(event) {
+ var t = $(event.target);
+ window.chat.chooseAnchor(t);
+}
// contains the logic to keep the correct scroll position.
window.chat.keepScrollPosition = function(box, scrollBefore, isOldMsgs) {
diff --git a/code/smartphone.js b/code/smartphone.js
index 3162b6d5..5a1700ed 100644
--- a/code/smartphone.js
+++ b/code/smartphone.js
@@ -80,7 +80,7 @@ window.runOnSmartphonesAfterBoot = function() {
if(!isSmartphone()) return;
console.warn('running smartphone post boot stuff');
- chat.toggle();
+ //chat.toggle();
smartphone.mapButton.click();
// disable img full view
diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml
index 51f57ac3..3d8e23d4 100644
--- a/mobile/AndroidManifest.xml
+++ b/mobile/AndroidManifest.xml
@@ -16,7 +16,7 @@
android:allowBackup="true"
android:icon="@drawable/ic_iitcm"
android:label="@string/app_name"
- android:theme="@style/AppTheme" >
+ android:theme="@style/AppTheme" android:uiOptions="splitActionBarWhenNarrow">
+ android:orientation="vertical">
-
-
-
-
-
- -
+
+ -
+
+ -
+
+
+
-
- -
+
+
+ android:title="@string/action_settings">
+
+
-
-
\ No newline at end of file
diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml
index 0c8cdd72..8cb7e05d 100644
--- a/mobile/res/values/strings.xml
+++ b/mobile/res/values/strings.xml
@@ -3,7 +3,6 @@
IITC mobile
Settings
- Info
Reload IITC
Print Version
Clear Cache
@@ -46,5 +45,12 @@
If enabled, all IITC sources will be loaded from external storage of the Android device.
Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.
IITC source
-
+
+ Chat
+ Map
+ Full
+ Compact
+ Public
+ Faction
+ Info
\ No newline at end of file
diff --git a/mobile/smartphone.css b/mobile/smartphone.css
index 804f6a29..a1f89fdd 100644
--- a/mobile/smartphone.css
+++ b/mobile/smartphone.css
@@ -30,6 +30,7 @@ body {
#chatcontrols {
height: 38px;
width: 100%;
+ display: hidden;
}
/* hide shrink button */
@@ -52,7 +53,6 @@ body {
#chat {
left:0;
right:0;
- top:37px !important;
bottom:30px;
width: auto;
}
@@ -74,7 +74,6 @@ body {
}
#scrollwrapper {
- top: 36px;
bottom: 0;
max-height: none !important;
width: 100% !important;
diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
index 8227eeef..9a598aa1 100644
--- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
+++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java
@@ -3,7 +3,6 @@ package com.cradle.iitc_mobile;
import java.io.IOException;
import com.cradle.iitc_mobile.R;
-
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@@ -14,6 +13,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.StrictMode;
import android.preference.PreferenceManager;
+import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -40,16 +40,23 @@ public class IITC_Mobile extends Activity {
private LocationListener loc_listener = null;
private boolean keyboad_open = false;
private boolean fullscreen_mode = false;
+ private ActionBar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
// TODO build an async task for url.openStream() in IITC_WebViewClient
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
- setContentView(R.layout.activity_main);
+ setContentView(R.layout.activity_main);
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
+ actionBar = this.getActionBar();
+ actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
+ actionBar.setTitle(getString(R.string.menu_map));
+ actionBar.setHomeButtonEnabled(true);
+
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
listener = new OnSharedPreferenceChangeListener() {
@Override
@@ -193,7 +200,7 @@ public class IITC_Mobile extends Activity {
// leave fullscreen mode if it is enabled
if (fullscreen_mode) {
// get back action bar
- this.getActionBar().show();
+ actionBar.show();
// show notification bar again
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags ^= WindowManager.LayoutParams.FLAG_FULLSCREEN;
@@ -223,7 +230,7 @@ public class IITC_Mobile extends Activity {
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
- this.getActionBar().setHomeButtonEnabled(true);
+
return true;
}
@@ -233,9 +240,15 @@ public class IITC_Mobile extends Activity {
switch (item.getItemId()) {
case android.R.id.home:
iitc_view.loadUrl("javascript: window.smartphone.mapButton.click();");
+ actionBar.setTitle(getString(R.string.menu_map));
+ return true;
+ case R.id.menu_map:
+ iitc_view.loadUrl("javascript: window.smartphone.mapButton.click();");
+ actionBar.setTitle(getString(R.string.menu_map));
return true;
case R.id.reload_button:
this.loadUrl(intel_url);
+ actionBar.setTitle(getString(R.string.menu_map));
return true;
// clear cache
case R.id.cache_clear:
@@ -269,15 +282,33 @@ public class IITC_Mobile extends Activity {
// 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});");
+ actionBar.setTitle(getString(R.string.menu_map));
return true;
// start settings activity
- case R.id.settings:
+ case R.id.action_settings:
Intent intent = new Intent(this, IITC_Settings.class);
intent.putExtra("iitc_version", iitc_view.getWebViewClient().getIITCVersion());
startActivity(intent);
return true;
- case R.id.info:
+ case R.id.menu_info:
iitc_view.loadUrl("javascript: window.smartphone.sideButton.click();");
+ actionBar.setTitle(getString(R.string.menu_info));
+ return true;
+ case R.id.menu_full:
+ iitc_view.loadUrl("javascript: window.chat.choose('full');");
+ actionBar.setTitle(getString(R.string.menu_full));
+ return true;
+ case R.id.menu_compact:
+ iitc_view.loadUrl("javascript: window.chat.choose('compact');");
+ actionBar.setTitle(getString(R.string.menu_compact));
+ return true;
+ case R.id.menu_public:
+ iitc_view.loadUrl("javascript: window.chat.choose('public');");
+ actionBar.setTitle(getString(R.string.menu_public));
+ return true;
+ case R.id.menu_faction:
+ iitc_view.loadUrl("javascript: window.chat.choose('faction');");
+ actionBar.setTitle(getString(R.string.menu_faction));
return true;
default:
return super.onOptionsItemSelected(item);