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();
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

View file

@ -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,

View file

@ -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 ) {

View file

@ -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<String, Integer> 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() ) {

View file

@ -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 )

View file

@ -3,10 +3,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 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"
android:title="@string/new_game"
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_default_loc">key_default_loc</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_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_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 -->
<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="invite_dualpane">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?
<string name="invite_dualpane">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.</string>
\n\nPlease let me know if you like the feature, report crashes, make
suggestions, etc.!!</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="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="disable_dualpane">Disable side-by-side</string>
<string name="dualpane_restart">Exiting app…</string>
<string name="after_restart">This change will not take effect until
you restart Crosswords.</string>
<string name="after_restart">This change will take effect after you
restart Crosswords.</string>
<string name="missing_perms">This game is configured to
communicate via SMS but Crosswords does not have permission to do

View file

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