From 1cc7a6c5f211c59fa286cdd2d47f2b5327c5ec24 Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Sep 2013 19:34:16 +0200 Subject: [PATCH 1/3] Enable right drawer in desktop mode --- mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java index fed3677f..ae425dfa 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java @@ -126,7 +126,8 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt mActionBar.setDisplayHomeAsUpEnabled(false); // Hide "up" indicator mActionBar.setHomeButtonEnabled(false); // Make icon unclickable mActionBar.setTitle(mIitc.getString(R.string.app_name)); - mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, mDrawerLeft); + mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mDrawerRight); setDrawerIndicatorEnabled(false); } else { if (mIsLoading) { From 7939cd9adf2e3ade2ef06becfcbeece6e7b0a909 Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Sep 2013 20:42:54 +0200 Subject: [PATCH 2/3] More drawer tweaks --- .../src/com/cradle/iitc_mobile/IITC_Mobile.java | 13 +++++++++++++ .../cradle/iitc_mobile/IITC_NavigationHelper.java | 15 +++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 70716074..59c83b85 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -411,6 +411,19 @@ public class IITC_Mobile extends Activity { return true; } + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + if (mNavigationHelper != null) { + boolean visible = !mNavigationHelper.isDrawerOpened(); + + for (int i = 0; i < menu.size(); i++) + if (menu.getItem(i).getItemId() != R.id.action_settings) + menu.getItem(i).setVisible(visible); + } + + return super.onPrepareOptionsMenu(menu); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { if (mNavigationHelper.onOptionsItemSelected(item)) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java index ae425dfa..898dbc5f 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java @@ -140,13 +140,16 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt mActionBar.setHomeButtonEnabled(true);// Make icon clickable mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); - if (mPane != Pane.MAP) - setDrawerIndicatorEnabled(false); - else + if (mPane == Pane.MAP || mDrawerLayout.isDrawerOpen(mDrawerLeft)) setDrawerIndicatorEnabled(true); + else + setDrawerIndicatorEnabled(false); } - mActionBar.setTitle(getPaneTitle(mPane)); + if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) + mActionBar.setTitle(mIitc.getString(R.string.app_name)); + else + mActionBar.setTitle(getPaneTitle(mPane)); } if (mFullscreen && mHideInFullscreen) @@ -189,15 +192,15 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt @Override public void onDrawerClosed(View drawerView) { - // TODO change menu? (via invalidateOptionsMenu) super.onDrawerClosed(drawerView); + mIitc.invalidateOptionsMenu(); updateActionBar(); } @Override public void onDrawerOpened(View drawerView) { - // TODO change menu? (via invalidateOptionsMenu) super.onDrawerOpened(drawerView); + mIitc.invalidateOptionsMenu(); updateActionBar(); mDrawerLayout.closeDrawer(drawerView.equals(mDrawerLeft) ? mDrawerRight : mDrawerLeft); } From 943482b0bdb0de10438f31ea2393e525ebbcc92f Mon Sep 17 00:00:00 2001 From: fkloft Date: Mon, 23 Sep 2013 23:22:35 +0200 Subject: [PATCH 3/3] Show notice for new interface --- mobile/res/values/strings.xml | 7 ++++ .../com/cradle/iitc_mobile/IITC_Mobile.java | 7 +++- .../iitc_mobile/IITC_NavigationHelper.java | 37 +++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index a31bdf3e..e843ef92 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -55,6 +55,13 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.]]> + +
+ • Navigation: swipe from the left edge of your screen (or click the app icon) to evoke the Navigation Drawer. + Click the app icon again to return to the map.

+ • Layers/Highlights: swipe from the right edge of your screen (or click the layer-chooser icon in the ActionBar) + to evoke the Layer Drawer]]> +
UI Misc diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index 59c83b85..c4a5ee83 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -104,8 +104,11 @@ public class IITC_Mobile extends Activity { // no reload needed return; } - // 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") + || key.equals("pref_drawers_seen")) + // no reload needed return; mReloadNeeded = true; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java index 898dbc5f..30c33d02 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java @@ -1,11 +1,16 @@ package com.cradle.iitc_mobile; import android.app.ActionBar; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.DialogInterface.OnClickListener; +import android.content.DialogInterface.OnDismissListener; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; +import android.text.Html; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; @@ -115,6 +120,38 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt mDrawerLayout.setDrawerListener(this); onPrefChanged(); // also calls updateActionBar() + + showNotice(); + } + + private void showNotice() { + if (mPrefs.getBoolean("pref_drawers_seen", false)) + return; + + TextView message = new TextView(mIitc); + message.setPadding(20, 20, 20, 20); + message.setText(Html.fromHtml(mIitc.getText(R.string.notice_drawers).toString())); + + AlertDialog dialog = new AlertDialog.Builder(mIitc) + .setView(message) + .setCancelable(true) + .setPositiveButton(android.R.string.ok, new OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.cancel(); + } + }) + .create(); + dialog.setOnDismissListener(new OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + mPrefs + .edit() + .putBoolean("pref_drawers_seen", true) + .commit(); + } + }); + dialog.show(); } private void updateActionBar() {