* added advanced menu...most users are not interested in the debug pane

* moved debug pane to advanced menu
* added clear-cookie button to advanced menu (fix for #551)
This commit is contained in:
Philipp Schaefer 2013-09-13 11:23:22 +02:00
parent 7b12e0bcc2
commit 95325cc336
4 changed files with 45 additions and 5 deletions

View File

@ -87,4 +87,10 @@
android:showAsAction="never" android:showAsAction="never"
android:title="@string/menu_debug"> android:title="@string/menu_debug">
</item> </item>
<item
android:id="@+id/menu_clear_cookies"
android:orderInCategory="200"
android:showAsAction="never"
android:title="@string/menu_clear_cookies">
</item>
</menu> </menu>

View File

@ -70,6 +70,9 @@
<string name="pref_enable_dev_mode">Enable developer mode</string> <string name="pref_enable_dev_mode">Enable developer mode</string>
<string name="pref_enable_dev_mode_sum">If enabled, all IITC sources will be loaded from external storage of the Android device. <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> Please copy all sources from $IITC_folder/build/mobile/ to /sdcard/IITC_Mobile/dev/.</string>
<string name="pref_advanced_menu">Display advanced menu</string>
<string name="pref_advanced_menu_sum">In addition to the default IITC buttons the advanced menu
contains a debug pane plus an option to clear cookies</string>
<string name="pref_disable_splash">Disable Splash Screen</string> <string name="pref_disable_splash">Disable Splash Screen</string>
<string name="pref_select_iitc">IITC source</string> <string name="pref_select_iitc">IITC source</string>
<string name="pref_select_iitc_sum">Load IITC main script from url or use local script. Currently used source:</string> <string name="pref_select_iitc_sum">Load IITC main script from url or use local script. Currently used source:</string>
@ -81,6 +84,7 @@
<string name="menu_faction">Faction</string> <string name="menu_faction">Faction</string>
<string name="menu_info">Info</string> <string name="menu_info">Info</string>
<string name="menu_debug">Debug</string> <string name="menu_debug">Debug</string>
<string name="menu_clear_cookies">Clear Cookies</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="choose_account_to_login">Choose account to login</string> <string name="choose_account_to_login">Choose account to login</string>
<string name="login_failed">Login failed.</string> <string name="login_failed">Login failed.</string>

View File

@ -72,6 +72,12 @@
android:summary="@string/pref_enable_dev_mode_sum" android:summary="@string/pref_enable_dev_mode_sum"
android:defaultValue="false" /> android:defaultValue="false" />
<CheckBoxPreference
android:key="pref_advanced_menu"
android:title="@string/pref_advanced_menu"
android:summary="@string/pref_advanced_menu_sum"
android:defaultValue="false" />
<CheckBoxPreference <CheckBoxPreference
android:key="pref_disable_splash" android:key="pref_disable_splash"
android:title="@string/pref_disable_splash" android:title="@string/pref_disable_splash"

View File

@ -26,6 +26,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.SearchView; import android.widget.SearchView;
@ -52,6 +53,7 @@ public class IITC_Mobile extends Activity {
private IITC_DeviceAccountLogin mLogin; private IITC_DeviceAccountLogin mLogin;
private MenuItem mSearchMenuItem; private MenuItem mSearchMenuItem;
private boolean mDesktopMode = false; private boolean mDesktopMode = false;
private boolean mAdvancedMenu = false;
private boolean mReloadNeeded = false; private boolean mReloadNeeded = false;
private final ArrayList<String> mDialogStack = new ArrayList<String>(); private final ArrayList<String> mDialogStack = new ArrayList<String>();
private SharedPreferences mSharedPrefs; private SharedPreferences mSharedPrefs;
@ -106,6 +108,12 @@ public class IITC_Mobile extends Activity {
// no iitc reload needed here // no iitc reload needed here
return; return;
} }
if (key.equals("pref_advanced_menu")) {
mAdvancedMenu = sharedPreferences.getBoolean("pref_advanced_menu", false);
invalidateOptionsMenu();
// no reload needed
return;
}
// no reload needed // no reload needed
if (key.equals("pref_press_twice_to_exit") || key.equals("pref_share_selected_tab")) if (key.equals("pref_press_twice_to_exit") || key.equals("pref_share_selected_tab"))
return; return;
@ -118,6 +126,9 @@ public class IITC_Mobile extends Activity {
// enable/disable mDesktopMode mode on menu create and url load // enable/disable mDesktopMode mode on menu create and url load
mDesktopMode = mSharedPrefs.getBoolean("pref_force_desktop", false); mDesktopMode = mSharedPrefs.getBoolean("pref_force_desktop", false);
// enable/disable advance menu
mAdvancedMenu = mSharedPrefs.getBoolean("pref_advanced_menu", false);
// Acquire a reference to the system Location Manager // Acquire a reference to the system Location Manager
mLocMngr = (LocationManager) this mLocMngr = (LocationManager) this
.getSystemService(Context.LOCATION_SERVICE); .getSystemService(Context.LOCATION_SERVICE);
@ -438,7 +449,8 @@ public class IITC_Mobile extends Activity {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
// enable/disable mDesktopMode menu // enable/disable mDesktopMode menu
enableDesktopUI(menu, mDesktopMode); enableDesktopUI(menu);
enableAdvancedMenu(menu);
return true; return true;
} }
@ -508,6 +520,10 @@ public class IITC_Mobile extends Activity {
case R.id.menu_debug: case R.id.menu_debug:
mIitcWebView.loadUrl("javascript: window.show('debug')"); mIitcWebView.loadUrl("javascript: window.show('debug')");
return true; return true;
case R.id.menu_clear_cookies:
CookieManager cm = CookieManager.getInstance();
cm.removeAllCookie();
return true;
default: default:
return false; return false;
} }
@ -629,14 +645,14 @@ public class IITC_Mobile extends Activity {
} }
// disable/enable some menu buttons... // disable/enable some menu buttons...
public void enableDesktopUI(Menu menu, boolean desktop) { public void enableDesktopUI(Menu menu) {
MenuItem item; MenuItem item;
item = menu.findItem(R.id.menu_chat); item = menu.findItem(R.id.menu_chat);
item.setVisible(!desktop); item.setVisible(!mDesktopMode);
item = menu.findItem(R.id.menu_info); item = menu.findItem(R.id.menu_info);
item.setVisible(!desktop); item.setVisible(!mDesktopMode);
item = menu.findItem(R.id.menu_debug); item = menu.findItem(R.id.menu_debug);
item.setVisible(!desktop); item.setVisible(!mDesktopMode);
} }
// remove dialog and add it back again // remove dialog and add it back again
@ -665,4 +681,12 @@ public class IITC_Mobile extends Activity {
findViewById(R.id.imageLoading).setVisibility(View.VISIBLE); findViewById(R.id.imageLoading).setVisibility(View.VISIBLE);
} }
} }
public void enableAdvancedMenu(Menu menu) {
MenuItem item;
item = menu.findItem(R.id.menu_debug);
item.setVisible(mAdvancedMenu);
item = menu.findItem(R.id.menu_clear_cookies);
item.setVisible(mAdvancedMenu);
}
} }