From 50fe363da90e1e93c71a861252487b32bc81a1b2 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 7 Apr 2017 00:23:37 -0700 Subject: [PATCH] move notice about new dual-pane feature Make the default be that it's on, and move the new-feature notice from app launch to board open, the point where most will see the feature for the first time. Remove the notify-and-exit thing, which is harder to make work from the board, instead just posting an alert, if user chooses to disable, that the setting change takes effect after a restart. --- .../eehouse/android/xw4/BoardDelegate.java | 24 +++++++++ .../org/eehouse/android/xw4/DlgDelegate.java | 3 +- .../android/xw4/GamesListDelegate.java | 51 ------------------- .../eehouse/android/xw4/PrefsDelegate.java | 6 +-- .../java/org/eehouse/android/xw4/XWPrefs.java | 2 +- .../app/src/main/res/menu/games_list_menu.xml | 4 -- .../app/src/main/res/values/common_rsrc.xml | 2 +- .../app/src/main/res/values/strings.xml | 33 +++++------- .../android/app/src/main/res/xml/xwprefs.xml | 6 +-- 9 files changed, 45 insertions(+), 86 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index a57f3ba24..a320dfacb 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -616,6 +616,7 @@ public class BoardDelegate extends DelegateBase { super.onResume(); doResume( false ); + checkAddDualpaneExpl(); } protected void onPause() @@ -1108,6 +1109,11 @@ public class BoardDelegate extends DelegateBase } break; + case DISABLE_DUALPANE: + XWPrefs.setPrefsBoolean( m_activity, R.string.key_disable_dualpane, true ); + makeOkOnlyBuilder( R.string.after_restart ).show(); + break; + case ENABLE_SMS_DO: post( new Runnable() { public void run() { @@ -2802,4 +2808,22 @@ public class BoardDelegate extends DelegateBase m_jniThread.handle( cmd, args ); } } + + // If I'm upgrading and running this for the first time show an + // explanation about the new dualpane feature + private static boolean s_dpShown = false; + private void checkAddDualpaneExpl() + { + if ( !s_dpShown ) { + s_dpShown = true; + if ( XWPrefs.getIsTablet( m_activity ) + && !Utils.onFirstVersion(m_activity ) ) { + makeNotAgainBuilder( R.string.invite_dualpane, + R.string.key_notagain_dualpane ) + .setActionPair(new ActionPair(Action.DISABLE_DUALPANE, + R.string.disable_dualpane)) + .show(); + } + } + } } // class BoardDelegate diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java index bb5be8804..eaffec05e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DlgDelegate.java @@ -70,8 +70,6 @@ public class DlgDelegate { SET_HIDE_NEWGAME_BUTTONS, DWNLD_LOC_DICT, NEW_GAME_DFLT_NAME, - ENABLE_DUALPANE, - ENABLE_DUALPANE_EXIT, // BoardDelegate UNDO_LAST_ACTION, @@ -98,6 +96,7 @@ public class DlgDelegate { BLANK_PICKED, TRAY_PICKED, INVITE_INFO, + DISABLE_DUALPANE, // Dict Browser FINISH_ACTION, diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 349fe0f60..eb4315735 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -954,8 +954,6 @@ public class GamesListDelegate extends ListDelegateBase CrashTrack.init( m_activity ); - Utils.cancelNotification( m_activity, R.string.post_dualpane_title ); - getBundledData( savedInstanceState ); DBUtils.setDBChangeListener( this ); @@ -967,15 +965,6 @@ public class GamesListDelegate extends ListDelegateBase FirstRunDialog.show( m_activity ); } s_firstShown = true; - } else if ( !XWPrefs.getPrefsBoolean( m_activity, - R.string.key_enable_dualpane, - false ) - && XWPrefs.getIsTablet( m_activity ) ) { - makeConfirmThenBuilder(R.string.invite_dualpane, Action.ENABLE_DUALPANE) - .setNAKey(R.string.key_notagain_dualpane) - .setPosButton(R.string.enable_dualpane) - .setNegButton(R.string.button_later) - .show(); } } @@ -1311,11 +1300,6 @@ public class GamesListDelegate extends ListDelegateBase case OPEN_GAME: doOpenGame( params ); break; - case ENABLE_DUALPANE: - makeOkOnlyBuilder( R.string.dualpane_exit_now ) - .setAction( Action.ENABLE_DUALPANE_EXIT ) - .show(); - break; case CLEAR_SELS: clearSelections(); break; @@ -1400,20 +1384,6 @@ public class GamesListDelegate extends ListDelegateBase return handled; } - @Override - public boolean onDismissed( Action action, Object[] params ) - { - boolean handled = true; - switch( action ) { - case ENABLE_DUALPANE_EXIT: - setDualpaneAndFinish( true ); - break; - default: - handled = super.onDismissed( action, params ); - } - return handled; - } - @Override protected void onActivityResult( RequestCode requestCode, int resultCode, Intent data ) @@ -1546,10 +1516,6 @@ public class GamesListDelegate extends ListDelegateBase 0 < DBUtils.getGamesWithSendsPending( m_activity ).size(); Utils.setItemVisible( menu, R.id.games_menu_resend, enable ); - enable = XWPrefs.getPrefsBoolean( m_activity, R.string.key_enable_dualpane, - false ); - Utils.setItemVisible( menu, R.id.games_menu_disable_dualpane, enable ); - Assert.assertTrue( m_menuPrepared ); } else { Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" ); @@ -1582,9 +1548,6 @@ public class GamesListDelegate extends ListDelegateBase switch ( itemID ) { // There's no selection for these items, so nothing to clear - case R.id.games_menu_disable_dualpane: - setDualpaneAndFinish( false ); - break; case R.id.games_menu_resend: GameUtils.resendAllIf( m_activity, null, true ); break; @@ -2666,20 +2629,6 @@ public class GamesListDelegate extends ListDelegateBase } } - private void setDualpaneAndFinish( boolean enable ) - { - XWPrefs.setPrefsBoolean( m_activity, R.string.key_enable_dualpane, - enable ); - Intent intent = makeSelfIntent( m_activity ); - int bodyID = enable ? R.string.post_dualpane_on_body - : R.string.post_dualpane_off_body; - Utils.postNotification( m_activity, intent, - R.string.post_dualpane_title, - bodyID, R.string.post_dualpane_title ); - Utils.showToast( m_activity, R.string.dualpane_restart ); - m_activity.finish(); - } - public static void boardDestroyed( long rowid ) { if ( null != s_self ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java index a8b0eea5a..5377bef34 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java @@ -62,7 +62,7 @@ public class PrefsDelegate extends DelegateBase R.string.key_disable_nag, R.string.key_disable_nag_solo, R.string.key_disable_relay, - R.string.key_enable_dualpane, + R.string.key_disable_dualpane, }; private static Map s_keysHash = null; @@ -235,7 +235,7 @@ public class PrefsDelegate extends DelegateBase case R.string.key_disable_relay: RelayService.enabledChanged( m_activity ); break; - case R.string.key_enable_dualpane: + case R.string.key_disable_dualpane: makeOkOnlyBuilder( R.string.after_restart ).show(); break; default: @@ -376,7 +376,7 @@ public class PrefsDelegate extends DelegateBase } if ( !XWPrefs.getIsTablet( m_activity ) ) { - hideOne( R.string.key_enable_dualpane, R.string.prefs_appearance ); + hideOne( R.string.key_disable_dualpane, R.string.prefs_appearance ); } if ( Perms23.haveNativePerms() ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java index 7a30c2e15..4813027b2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWPrefs.java @@ -479,7 +479,7 @@ public class XWPrefs { public static boolean dualpaneEnabled( Context context ) { - return getPrefsBoolean( context, R.string.key_enable_dualpane, false ); + return ! getPrefsBoolean( context, R.string.key_disable_dualpane, false ); } public static CommsConnTypeSet getAddrTypes( Context context ) diff --git a/xwords4/android/app/src/main/res/menu/games_list_menu.xml b/xwords4/android/app/src/main/res/menu/games_list_menu.xml index cf96306de..fb964160a 100644 --- a/xwords4/android/app/src/main/res/menu/games_list_menu.xml +++ b/xwords4/android/app/src/main/res/menu/games_list_menu.xml @@ -3,10 +3,6 @@ - - key_summary_field key_default_loc key_force_tablet - key_enable_dualpane2 + key_disable_dualpane2 key_force_radio key_addrs_pref diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index 730de1058..88d48bf8f 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -2413,7 +2413,7 @@ Force tablet layout Even if my screen is too small - Side-by-side views on tablets, very experimental! + Side-by-side views on tablets Reminder: It\'s your turn @@ -2707,30 +2707,21 @@ This game has sent no invitations - You appear to be running a - tablet-sized device. Would you like to try an experimental new - feature that lets you view two panes (e.g. board and chat) - side-by-side when your device is horizontal? + This new version of Crosswords lets + devices like yours view two panes (e.g. Games List and Board) + side-by-side. That\'s when your device is horizontal; when it\'s + vertical there\'s no change.\n\n - \n\nYou can disable the feature later using the new \"Disable - side-by-side\" menu item. Or via App Settings. + I hope you like it. If you don\'t you can disable it below or in App + Settings. - \n\nPlease let me know if you like the feature, report crashes, make - suggestions, etc.!! - - Crosswords will now exit so the - change can take effect. You can use the notification it posts to - restart. - - Enable side-by-side - Restart Crosswords - Start Crosswords with side-by-side enabled! - Start Crosswords with side-by-side disabled + + + Disable side-by-side - Exiting app… - This change will not take effect until - you restart Crosswords. + This change will take effect after you + restart Crosswords. This game is configured to communicate via SMS but Crosswords does not have permission to do diff --git a/xwords4/android/app/src/main/res/xml/xwprefs.xml b/xwords4/android/app/src/main/res/xml/xwprefs.xml index 7093806db..9c95f68dd 100644 --- a/xwords4/android/app/src/main/res/xml/xwprefs.xml +++ b/xwords4/android/app/src/main/res/xml/xwprefs.xml @@ -126,9 +126,9 @@ android:summary="@string/hide_title_summary" android:defaultValue="false" /> -