From 3172fc4e69fb50ce21f3f1abe885f5ae500dfaa8 Mon Sep 17 00:00:00 2001 From: fkloft Date: Tue, 24 Sep 2013 14:17:55 +0200 Subject: [PATCH] Add notice about long tapping --- mobile/res/values/strings.xml | 5 ++- .../com/cradle/iitc_mobile/IITC_Mobile.java | 2 +- .../iitc_mobile/IITC_NavigationHelper.java | 33 ++++++++++++++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/mobile/res/values/strings.xml b/mobile/res/values/strings.xml index 5fe5d225..8699ebec 100644 --- a/mobile/res/values/strings.xml +++ b/mobile/res/values/strings.xml @@ -62,7 +62,10 @@ • 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 IITC Plugins diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index e899287f..af56d2c4 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -106,7 +106,7 @@ public class IITC_Mobile extends Activity { if (key.equals("pref_press_twice_to_exit") || key.equals("pref_share_selected_tab") - || key.equals("pref_drawers_seen")) + || key.equals("pref_messages")) // no reload needed return; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java index 34aaf348..07d5ff9d 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_NavigationHelper.java @@ -94,6 +94,10 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt COMPACT, DEBUG, FACTION, FULL, INFO, MAP, PUBLIC } + public static final int NOTICE_DRAWERS = 1 << 0; + public static final int NOTICE_INFO = 1 << 1; + // next one would be 1<<2; (this results in 1,2,4,8,...) + private IITC_Mobile mIitc; private ActionBar mActionBar; private SharedPreferences mPrefs; @@ -130,16 +134,28 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt onPrefChanged(); // also calls updateActionBar() - showNotice(); + showNotice(NOTICE_DRAWERS); } - private void showNotice() { - if (mPrefs.getBoolean("pref_drawers_seen", false)) + private void showNotice(final int which) { + if ((mPrefs.getInt("pref_messages", 0) & which) != 0) return; + String text; + switch (which) { + case NOTICE_DRAWERS: + text = mIitc.getText(R.string.notice_drawers).toString(); + break; + case NOTICE_INFO: + text = mIitc.getText(R.string.notice_info).toString(); + break; + default: + return; + } + TextView message = new TextView(mIitc); message.setPadding(20, 20, 20, 20); - message.setText(Html.fromHtml(mIitc.getText(R.string.notice_drawers).toString())); + message.setText(Html.fromHtml(text)); AlertDialog dialog = new AlertDialog.Builder(mIitc) .setView(message) @@ -154,9 +170,12 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { + int value = mPrefs.getInt("pref_messages", 0); + value |= which; + mPrefs .edit() - .putBoolean("pref_drawers_seen", true) + .putInt("pref_messages", value) .commit(); } }); @@ -255,6 +274,10 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt public void onItemClick(AdapterView parent, View view, int position, long id) { Pane item = mNavigationAdapter.getItem(position); mIitc.switchToPane(item); + + if (item == Pane.INFO) + showNotice(NOTICE_INFO); + mDrawerLayout.closeDrawer(mDrawerLeft); }