added back desktop mode (see #304)
This commit is contained in:
parent
c8dc62eafb
commit
86fe10aa9c
@ -40,6 +40,8 @@
|
||||
<string name="pref_user_zoom_sum">Shows +/- buttons even on multitouch capable devices.</string>
|
||||
<string name="pref_fullscreen_actionbar">Hide Action Bar in fullscreen mode</string>
|
||||
<string name="pref_fullscreen_actionbar_sum">Nice for screenshots. Note: IITCM cannot be controlled without Action Bar.</string>
|
||||
<string name="pref_force_desktop">Force desktop mode</string>
|
||||
<string name="pref_force_desktop_sum">Nice for tablets, looks awful on smartphones</string>
|
||||
<string name="pref_force_https">Force https</string>
|
||||
<string name="pref_force_https_sum">Disabling may improve performance</string>
|
||||
<string name="pref_developer_options">Developer options</string>
|
||||
|
@ -12,22 +12,27 @@
|
||||
<PreferenceCategory
|
||||
android:key="pref_about_cat"
|
||||
android:title="@string/pref_ui_cat">
|
||||
<CheckBoxPreference
|
||||
<CheckBoxPreference
|
||||
android:key="pref_user_loc"
|
||||
android:title="@string/pref_user_loc"
|
||||
android:summary="@string/pref_user_loc_sum"
|
||||
android:defaultValue="false" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_user_zoom"
|
||||
android:title="@string/pref_user_zoom"
|
||||
android:summary="@string/pref_user_zoom_sum"
|
||||
android:defaultValue="false" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_fullscreen_actionbar"
|
||||
android:title="@string/pref_fullscreen_actionbar"
|
||||
android:summary="@string/pref_fullscreen_actionbar_sum"
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
android:defaultValue="false" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_user_zoom"
|
||||
android:title="@string/pref_user_zoom"
|
||||
android:summary="@string/pref_user_zoom_sum"
|
||||
android:defaultValue="false" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_fullscreen_actionbar"
|
||||
android:title="@string/pref_fullscreen_actionbar"
|
||||
android:summary="@string/pref_fullscreen_actionbar_sum"
|
||||
android:defaultValue="false" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_force_desktop"
|
||||
android:title="@string/pref_force_desktop"
|
||||
android:summary="@string/pref_force_desktop_sum"
|
||||
android:defaultValue="false" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="pref_mics"
|
||||
|
@ -45,6 +45,7 @@ public class IITC_Mobile extends Activity {
|
||||
private ActionBar actionBar;
|
||||
private IITC_DeviceAccountLogin mLogin;
|
||||
private MenuItem searchMenuItem;
|
||||
private boolean desktop = false;
|
||||
|
||||
// Used for custom back stack handling
|
||||
private ArrayList<Integer> backStack = new ArrayList<Integer>();
|
||||
@ -79,6 +80,10 @@ public class IITC_Mobile extends Activity {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(
|
||||
SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equals("pref_force_desktop")) {
|
||||
desktop = sharedPreferences.getBoolean("pref_force_desktop", false);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
if (key.equals("pref_user_loc"))
|
||||
user_loc = sharedPreferences.getBoolean("pref_user_loc",
|
||||
false);
|
||||
@ -93,6 +98,9 @@ public class IITC_Mobile extends Activity {
|
||||
};
|
||||
sharedPref.registerOnSharedPreferenceChangeListener(listener);
|
||||
|
||||
// enable/disable desktop mode on menu create and url load
|
||||
desktop = sharedPref.getBoolean("pref_force_desktop", false);
|
||||
|
||||
// Acquire a reference to the system Location Manager
|
||||
loc_mngr = (LocationManager) this
|
||||
.getSystemService(Context.LOCATION_SERVICE);
|
||||
@ -299,6 +307,8 @@ public class IITC_Mobile extends Activity {
|
||||
// Assumes current activity is the searchable activity
|
||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
|
||||
searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
|
||||
// enable/disable desktop menu
|
||||
enableDesktopUI(menu, desktop);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -397,10 +407,13 @@ public class IITC_Mobile extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
// Force mobile view.
|
||||
// New actions are not compatible with desktop mode
|
||||
// vp=f enables desktop mode...vp=m is the defaul mobile view
|
||||
private String addUrlParam(String url) {
|
||||
return (url + "?vp=m");
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPref.getBoolean("pref_force_desktop", false))
|
||||
return (url + "?vp=f");
|
||||
else
|
||||
return (url + "?vp=m");
|
||||
}
|
||||
|
||||
// inject the iitc-script and load the intel url
|
||||
@ -486,4 +499,17 @@ public class IITC_Mobile extends Activity {
|
||||
// garbage collection
|
||||
mLogin = null;
|
||||
}
|
||||
|
||||
// disable/enable some menu buttons...
|
||||
public void enableDesktopUI(Menu menu, boolean desktop) {
|
||||
MenuItem item;
|
||||
item = menu.findItem(R.id.menu_chat);
|
||||
item.setVisible(!desktop);
|
||||
item = menu.findItem(R.id.menu_info);
|
||||
item.setVisible(!desktop);
|
||||
item = menu.findItem(R.id.menu_debug);
|
||||
item.setVisible(!desktop);
|
||||
item = menu.findItem(R.id.layer_chooser);
|
||||
item.setVisible(!desktop);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user