Redesigned IITC Mobile to use ActionBar menu instead of web based tabs.
16
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 = $('<a>'+name+'</a>');
|
||||
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) {
|
||||
|
@ -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
|
||||
|
@ -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">
|
||||
<activity
|
||||
android:name="com.cradle.iitc_mobile.IITC_Mobile"
|
||||
android:theme="@style/AppBaseTheme"
|
||||
|
BIN
mobile/res/drawable-hdpi/action_about.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-hdpi/action_search.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
mobile/res/drawable-hdpi/action_settings.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
mobile/res/drawable-hdpi/av_full_screen.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
mobile/res/drawable-hdpi/content_remove.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-hdpi/device_access_location_found.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
mobile/res/drawable-hdpi/device_access_location_off.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
mobile/res/drawable-hdpi/device_access_location_searching.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-hdpi/location_map.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-hdpi/navigation_refresh.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mobile/res/drawable-hdpi/social_group.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.7 KiB |
BIN
mobile/res/drawable-mdpi/action_about.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-mdpi/action_search.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/res/drawable-mdpi/action_settings.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-mdpi/av_full_screen.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/res/drawable-mdpi/content_remove.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
mobile/res/drawable-mdpi/device_access_location_found.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/res/drawable-mdpi/device_access_location_off.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
mobile/res/drawable-mdpi/device_access_location_searching.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
BIN
mobile/res/drawable-mdpi/location_map.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-mdpi/navigation_refresh.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
mobile/res/drawable-mdpi/social_group.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
mobile/res/drawable-xhdpi/action_about.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-xhdpi/action_help.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
mobile/res/drawable-xhdpi/action_search.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
mobile/res/drawable-xhdpi/av_full_screen.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
mobile/res/drawable-xhdpi/content_remove.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobile/res/drawable-xhdpi/device_access_location_found.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
mobile/res/drawable-xhdpi/device_access_location_off.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
mobile/res/drawable-xhdpi/device_access_location_searching.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.8 KiB |
BIN
mobile/res/drawable-xhdpi/location_map.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
mobile/res/drawable-xhdpi/navigation_refresh.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
mobile/res/drawable-xhdpi/social_group.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
@ -1,7 +1,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.cradle.iitc_mobile.IITC_WebView
|
||||
android:id="@+id/iitc_webview"
|
||||
|
@ -1,35 +1,95 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/reload_button"
|
||||
android:icon="@drawable/ic_menu_refresh"
|
||||
android:orderInCategory="90"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/reload"></item>
|
||||
|
||||
<item android:id="@+id/settings"
|
||||
android:orderInCategory="120"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"></item>
|
||||
|
||||
<item android:id="@+id/cache_clear"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/cache_clear"></item>
|
||||
|
||||
<item android:id="@+id/toggle_fullscreen"
|
||||
<item
|
||||
android:id="@+id/menu_map"
|
||||
android:icon="@drawable/location_map"
|
||||
android:orderInCategory="20"
|
||||
android:showAsAction="always"
|
||||
android:title="@string/menu_map">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_info"
|
||||
android:icon="@drawable/action_about"
|
||||
android:orderInCategory="30"
|
||||
android:showAsAction="always"
|
||||
android:title="@string/menu_info">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_chat"
|
||||
android:icon="@drawable/social_group"
|
||||
android:showAsAction="always"
|
||||
android:orderInCategory="35"
|
||||
android:title="@string/menu_chat">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_full"
|
||||
android:orderInCategory="40"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/menu_full">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_compact"
|
||||
android:orderInCategory="50"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/menu_compact">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_public"
|
||||
android:orderInCategory="60"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/menu_public">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_faction"
|
||||
android:orderInCategory="70"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/menu_faction">
|
||||
</item>
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/locate"
|
||||
android:icon="@drawable/device_access_location_found"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/toggle_fullscreen"
|
||||
android:icon="@android:drawable/ic_menu_zoom"></item>
|
||||
|
||||
<item android:id="@+id/locate"
|
||||
android:icon="@android:drawable/ic_menu_mylocation"
|
||||
android:orderInCategory="80"
|
||||
android:title="@string/locate">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_settings"
|
||||
android:icon="@drawable/action_settings"
|
||||
android:orderInCategory="130"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/locate"></item>
|
||||
android:title="@string/action_settings">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/reload_button"
|
||||
android:icon="@drawable/navigation_refresh"
|
||||
android:orderInCategory="110"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/reload">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/toggle_fullscreen"
|
||||
android:icon="@drawable/av_full_screen"
|
||||
android:orderInCategory="120"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/toggle_fullscreen">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:icon="@drawable/action_settings"
|
||||
android:orderInCategory="130"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/action_settings">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/cache_clear"
|
||||
android:icon="@drawable/content_remove"
|
||||
android:orderInCategory="200"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/cache_clear">
|
||||
</item>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item android:id="@+id/info"
|
||||
android:orderInCategory="160"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_info"></item>
|
||||
|
||||
</menu>
|
@ -3,7 +3,6 @@
|
||||
|
||||
<string name="app_name">IITC mobile</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_info">Info</string>
|
||||
<string name="reload">Reload IITC</string>
|
||||
<string name="version">Print Version</string>
|
||||
<string name="cache_clear">Clear Cache</string>
|
||||
@ -46,5 +45,12 @@
|
||||
<string name="pref_enable_dev_mode_sum">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/.</string>
|
||||
<string name="pref_select_iitc">IITC source</string>
|
||||
|
||||
|
||||
<string name="menu_chat">Chat</string>
|
||||
<string name="menu_map">Map</string>
|
||||
<string name="menu_full">Full</string>
|
||||
<string name="menu_compact">Compact</string>
|
||||
<string name="menu_public">Public</string>
|
||||
<string name="menu_faction">Faction</string>
|
||||
<string name="menu_info">Info</string>
|
||||
</resources>
|
@ -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;
|
||||
|
@ -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);
|
||||
|