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.
This commit is contained in:
Eric House 2017-04-07 00:23:37 -07:00
parent b40f938fcb
commit 50fe363da9
9 changed files with 45 additions and 86 deletions

View file

@ -616,6 +616,7 @@ public class BoardDelegate extends DelegateBase
{ {
super.onResume(); super.onResume();
doResume( false ); doResume( false );
checkAddDualpaneExpl();
} }
protected void onPause() protected void onPause()
@ -1108,6 +1109,11 @@ public class BoardDelegate extends DelegateBase
} }
break; 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: case ENABLE_SMS_DO:
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
@ -2802,4 +2808,22 @@ public class BoardDelegate extends DelegateBase
m_jniThread.handle( cmd, args ); 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 } // class BoardDelegate

View file

@ -70,8 +70,6 @@ public class DlgDelegate {
SET_HIDE_NEWGAME_BUTTONS, SET_HIDE_NEWGAME_BUTTONS,
DWNLD_LOC_DICT, DWNLD_LOC_DICT,
NEW_GAME_DFLT_NAME, NEW_GAME_DFLT_NAME,
ENABLE_DUALPANE,
ENABLE_DUALPANE_EXIT,
// BoardDelegate // BoardDelegate
UNDO_LAST_ACTION, UNDO_LAST_ACTION,
@ -98,6 +96,7 @@ public class DlgDelegate {
BLANK_PICKED, BLANK_PICKED,
TRAY_PICKED, TRAY_PICKED,
INVITE_INFO, INVITE_INFO,
DISABLE_DUALPANE,
// Dict Browser // Dict Browser
FINISH_ACTION, FINISH_ACTION,

View file

@ -954,8 +954,6 @@ public class GamesListDelegate extends ListDelegateBase
CrashTrack.init( m_activity ); CrashTrack.init( m_activity );
Utils.cancelNotification( m_activity, R.string.post_dualpane_title );
getBundledData( savedInstanceState ); getBundledData( savedInstanceState );
DBUtils.setDBChangeListener( this ); DBUtils.setDBChangeListener( this );
@ -967,15 +965,6 @@ public class GamesListDelegate extends ListDelegateBase
FirstRunDialog.show( m_activity ); FirstRunDialog.show( m_activity );
} }
s_firstShown = true; 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: case OPEN_GAME:
doOpenGame( params ); doOpenGame( params );
break; break;
case ENABLE_DUALPANE:
makeOkOnlyBuilder( R.string.dualpane_exit_now )
.setAction( Action.ENABLE_DUALPANE_EXIT )
.show();
break;
case CLEAR_SELS: case CLEAR_SELS:
clearSelections(); clearSelections();
break; break;
@ -1400,20 +1384,6 @@ public class GamesListDelegate extends ListDelegateBase
return handled; 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 @Override
protected void onActivityResult( RequestCode requestCode, int resultCode, protected void onActivityResult( RequestCode requestCode, int resultCode,
Intent data ) Intent data )
@ -1546,10 +1516,6 @@ public class GamesListDelegate extends ListDelegateBase
0 < DBUtils.getGamesWithSendsPending( m_activity ).size(); 0 < DBUtils.getGamesWithSendsPending( m_activity ).size();
Utils.setItemVisible( menu, R.id.games_menu_resend, enable ); 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 ); Assert.assertTrue( m_menuPrepared );
} else { } else {
Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" ); Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" );
@ -1582,9 +1548,6 @@ public class GamesListDelegate extends ListDelegateBase
switch ( itemID ) { switch ( itemID ) {
// There's no selection for these items, so nothing to clear // 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: case R.id.games_menu_resend:
GameUtils.resendAllIf( m_activity, null, true ); GameUtils.resendAllIf( m_activity, null, true );
break; 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 ) public static void boardDestroyed( long rowid )
{ {
if ( null != s_self ) { if ( null != s_self ) {

View file

@ -62,7 +62,7 @@ public class PrefsDelegate extends DelegateBase
R.string.key_disable_nag, R.string.key_disable_nag,
R.string.key_disable_nag_solo, R.string.key_disable_nag_solo,
R.string.key_disable_relay, R.string.key_disable_relay,
R.string.key_enable_dualpane, R.string.key_disable_dualpane,
}; };
private static Map<String, Integer> s_keysHash = null; private static Map<String, Integer> s_keysHash = null;
@ -235,7 +235,7 @@ public class PrefsDelegate extends DelegateBase
case R.string.key_disable_relay: case R.string.key_disable_relay:
RelayService.enabledChanged( m_activity ); RelayService.enabledChanged( m_activity );
break; break;
case R.string.key_enable_dualpane: case R.string.key_disable_dualpane:
makeOkOnlyBuilder( R.string.after_restart ).show(); makeOkOnlyBuilder( R.string.after_restart ).show();
break; break;
default: default:
@ -376,7 +376,7 @@ public class PrefsDelegate extends DelegateBase
} }
if ( !XWPrefs.getIsTablet( m_activity ) ) { 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() ) { if ( Perms23.haveNativePerms() ) {

View file

@ -479,7 +479,7 @@ public class XWPrefs {
public static boolean dualpaneEnabled( Context context ) 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 ) public static CommsConnTypeSet getAddrTypes( Context context )

View file

@ -3,10 +3,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Remove this once dualpane is well tested --> <!-- Remove this once dualpane is well tested -->
<item android:id="@+id/games_menu_disable_dualpane"
android:title="@string/disable_dualpane"
/>
<item android:id="@+id/games_menu_newgame_solo" <item android:id="@+id/games_menu_newgame_solo"
android:title="@string/new_game" android:title="@string/new_game"
android:icon="@drawable/content_new_solo__gen" android:icon="@drawable/content_new_solo__gen"

View file

@ -69,7 +69,7 @@
<string name="key_summary_field">key_summary_field</string> <string name="key_summary_field">key_summary_field</string>
<string name="key_default_loc">key_default_loc</string> <string name="key_default_loc">key_default_loc</string>
<string name="key_force_tablet">key_force_tablet</string> <string name="key_force_tablet">key_force_tablet</string>
<string name="key_enable_dualpane">key_enable_dualpane2</string> <string name="key_disable_dualpane">key_disable_dualpane2</string>
<string name="key_force_radio">key_force_radio</string> <string name="key_force_radio">key_force_radio</string>
<string name="key_addrs_pref">key_addrs_pref</string> <string name="key_addrs_pref">key_addrs_pref</string>

View file

@ -2413,7 +2413,7 @@
<string name="force_tablet_title">Force tablet layout</string> <string name="force_tablet_title">Force tablet layout</string>
<string name="force_tablet_summary">Even if my screen is too small</string> <string name="force_tablet_summary">Even if my screen is too small</string>
<string name="enable_dualpane_summary">Side-by-side views on tablets, very experimental!</string> <string name="disable_dualpane_summary">Side-by-side views on tablets</string>
<!-- Nagging: title of notification reminder message --> <!-- Nagging: title of notification reminder message -->
<string name="nag_title">Reminder: It\'s your turn</string> <string name="nag_title">Reminder: It\'s your turn</string>
@ -2707,30 +2707,21 @@
<string name="no_invites">This game has sent no invitations</string> <string name="no_invites">This game has sent no invitations</string>
<string name="invite_dualpane">You appear to be running a <string name="invite_dualpane">This new version of Crosswords lets
tablet-sized device. Would you like to try an experimental new devices like yours view two panes (e.g. Games List and Board)
feature that lets you view two panes (e.g. board and chat) side-by-side. That\'s when your device is horizontal; when it\'s
side-by-side when your device is horizontal? vertical there\'s no change.\n\n
\n\nYou can disable the feature later using the new \"Disable I hope you like it. If you don\'t you can disable it below or in App
side-by-side\" menu item. Or via App Settings. Settings.</string>
\n\nPlease let me know if you like the feature, report crashes, make <!-- <string name="dualpane_exit_now">Crosswords will now exit so the -->
suggestions, etc.!!</string> <!-- change can take effect. You can use the notification it posts to -->
<!-- restart.</string> -->
<string name="dualpane_exit_now">Crosswords will now exit so the
change can take effect. You can use the notification it posts to
restart.</string>
<string name="enable_dualpane">Enable side-by-side</string>
<string name="post_dualpane_title">Restart Crosswords</string>
<string name="post_dualpane_on_body">Start Crosswords with side-by-side enabled!</string>
<string name="post_dualpane_off_body">Start Crosswords with side-by-side disabled</string>
<string name="disable_dualpane">Disable side-by-side</string> <string name="disable_dualpane">Disable side-by-side</string>
<string name="dualpane_restart">Exiting app…</string> <string name="after_restart">This change will take effect after you
<string name="after_restart">This change will not take effect until restart Crosswords.</string>
you restart Crosswords.</string>
<string name="missing_perms">This game is configured to <string name="missing_perms">This game is configured to
communicate via SMS but Crosswords does not have permission to do communicate via SMS but Crosswords does not have permission to do

View file

@ -126,9 +126,9 @@
android:summary="@string/hide_title_summary" android:summary="@string/hide_title_summary"
android:defaultValue="false" android:defaultValue="false"
/> />
<CheckBoxPreference android:key="@string/key_enable_dualpane" <CheckBoxPreference android:key="@string/key_disable_dualpane"
android:title="@string/enable_dualpane" android:title="@string/disable_dualpane"
android:summary="@string/enable_dualpane_summary" android:summary="@string/disable_dualpane_summary"
android:defaultValue="false" android:defaultValue="false"
/> />
<CheckBoxPreference android:key="@string/key_show_arrow" <CheckBoxPreference android:key="@string/key_show_arrow"