mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
Make separate turn reminder disable prefs for solo and networked
games, as some folks playing against the robot don't need to be reminded. From a feature request submitted via sourceforge.
This commit is contained in:
parent
32cd08b1dc
commit
b3a93cc474
9 changed files with 881 additions and 823 deletions
File diff suppressed because it is too large
Load diff
|
@ -9,6 +9,7 @@
|
|||
<string name="key_explain_robot">key_explain_robot</string>
|
||||
<string name="key_skip_confirm">key_skip_confirm</string>
|
||||
<string name="key_disable_nag">key_disable_nag</string>
|
||||
<string name="key_disable_nag_solo">key_disable_nag_solo</string>
|
||||
<string name="key_sort_tiles">key_sort_tiles</string>
|
||||
<string name="key_peek_other">key_peek_other</string>
|
||||
<string name="key_hide_crosshairs">key_hide_crosshairs</string>
|
||||
|
|
|
@ -2468,9 +2468,13 @@
|
|||
and want them back, enable them now. You can turn them off again
|
||||
in Settings.</string>
|
||||
|
||||
<string name="disable_nag_title">Disable turn reminders</string>
|
||||
<string name="disable_nag_summary">Do not notify me no matter
|
||||
how long it\'s been my turn</string>
|
||||
<string name="disable_nags_title">Turn reminders</string>
|
||||
<string name="disable_nag_title">Disable reminders, network games</string>
|
||||
<string name="disable_nag_summary_net">Do not notify me no matter
|
||||
how long it\'s been my turn - for networked games</string>
|
||||
<string name="disable_nag_summary_solo">Do not notify me no matter
|
||||
how long it\'s been my turn - for solo games</string>
|
||||
<string name="disable_nag_solo_title">Disable reminders, solo games </string>
|
||||
|
||||
<string name="confirm_get_locdict_fmt">Your device is set up for
|
||||
%1$s. Would you like to download a wordlist so you can play
|
||||
|
|
|
@ -231,11 +231,22 @@
|
|||
android:summary="@string/skip_confirm_turn_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_disable_nag"
|
||||
android:title="@string/disable_nag_title"
|
||||
android:summary="@string/disable_nag_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
|
||||
<PreferenceScreen android:title="@string/disable_nags_title"
|
||||
>
|
||||
|
||||
<CheckBoxPreference android:key="@string/key_disable_nag"
|
||||
android:title="@string/disable_nag_title"
|
||||
android:summary="@string/disable_nag_summary_net"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_disable_nag_solo"
|
||||
android:title="@string/disable_nag_solo_title"
|
||||
android:summary="@string/disable_nag_summary_solo"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
<CheckBoxPreference android:key="@string/key_default_loc"
|
||||
android:title="@string/default_loc"
|
||||
android:summary="@string/default_loc_summary"
|
||||
|
|
|
@ -2114,9 +2114,13 @@
|
|||
na \"decnavda\" erutaef ni siht esaeler. Fi uoy erew gnisu meht
|
||||
dna tnaw meht ,kcab elbane meht won. Uoy nac nrut meht ffo niaga
|
||||
ni Sgnittes.</string>
|
||||
<string name="disable_nag_title">Elbasid nrut srednimer</string>
|
||||
<string name="disable_nag_summary">Od ton yfiton em on rettam
|
||||
woh gnol ti\'s neeb ym nrut</string>
|
||||
<string name="disable_nags_title">Nrut srednimer</string>
|
||||
<string name="disable_nag_title">Elbasid ,srednimer krowten semag</string>
|
||||
<string name="disable_nag_summary_net">Od ton yfiton em on rettam
|
||||
woh gnol ti\'s neeb ym nrut - rof dekrowten semag</string>
|
||||
<string name="disable_nag_summary_solo">Od ton yfiton em on rettam
|
||||
woh gnol ti\'s neeb ym nrut - rof olos semag</string>
|
||||
<string name="disable_nag_solo_title">Elbasid ,srednimer olos semag </string>
|
||||
<string name="confirm_get_locdict_fmt">Ruoy ecived si tes pu rof
|
||||
%1$s. Dluow uoy ekil ot daolnwod a tsildrow os uoy nac yalp
|
||||
Sdrowssorc ni %1$s?</string>
|
||||
|
|
|
@ -2114,9 +2114,13 @@
|
|||
AN \"ADVANCED\" FEATURE IN THIS RELEASE. IF YOU WERE USING THEM
|
||||
AND WANT THEM BACK, ENABLE THEM NOW. YOU CAN TURN THEM OFF AGAIN
|
||||
IN SETTINGS.</string>
|
||||
<string name="disable_nag_title">DISABLE TURN REMINDERS</string>
|
||||
<string name="disable_nag_summary">DO NOT NOTIFY ME NO MATTER
|
||||
HOW LONG IT\'S BEEN MY TURN</string>
|
||||
<string name="disable_nags_title">TURN REMINDERS</string>
|
||||
<string name="disable_nag_title">DISABLE REMINDERS, NETWORK GAMES</string>
|
||||
<string name="disable_nag_summary_net">DO NOT NOTIFY ME NO MATTER
|
||||
HOW LONG IT\'S BEEN MY TURN - FOR NETWORKED GAMES</string>
|
||||
<string name="disable_nag_summary_solo">DO NOT NOTIFY ME NO MATTER
|
||||
HOW LONG IT\'S BEEN MY TURN - FOR SOLO GAMES</string>
|
||||
<string name="disable_nag_solo_title">DISABLE REMINDERS, SOLO GAMES </string>
|
||||
<string name="confirm_get_locdict_fmt">YOUR DEVICE IS SET UP FOR
|
||||
%1$s. WOULD YOU LIKE TO DOWNLOAD A WORDLIST SO YOU CAN PLAY
|
||||
CROSSWORDS IN %1$s?</string>
|
||||
|
|
|
@ -1025,10 +1025,18 @@ public class DBUtils {
|
|||
public long m_rowid;
|
||||
public long m_nextNag;
|
||||
public long m_lastMoveMillis;
|
||||
public NeedsNagInfo( long rowid, long nextNag, long lastMove ) {
|
||||
private boolean m_isSolo;
|
||||
|
||||
public NeedsNagInfo( long rowid, long nextNag, long lastMove,
|
||||
CurGameInfo.DeviceRole role ) {
|
||||
m_rowid = rowid;
|
||||
m_nextNag = nextNag;
|
||||
m_lastMoveMillis = 1000 * lastMove;
|
||||
m_isSolo = CurGameInfo.DeviceRole.SERVER_STANDALONE == role;
|
||||
}
|
||||
|
||||
public boolean isSolo() {
|
||||
return m_isSolo;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1036,7 +1044,8 @@ public class DBUtils {
|
|||
{
|
||||
NeedsNagInfo[] result = null;
|
||||
long now = new Date().getTime(); // in milliseconds
|
||||
String[] columns = { ROW_ID, DBHelper.NEXTNAG, DBHelper.LASTMOVE };
|
||||
String[] columns = { ROW_ID, DBHelper.NEXTNAG, DBHelper.LASTMOVE,
|
||||
DBHelper.SERVERROLE };
|
||||
// where nextnag > 0 AND nextnag < now
|
||||
String selection =
|
||||
String.format( "%s > 0 AND %s < %s", DBHelper.NEXTNAG,
|
||||
|
@ -1052,11 +1061,14 @@ public class DBUtils {
|
|||
int rowIndex = cursor.getColumnIndex(ROW_ID);
|
||||
int nagIndex = cursor.getColumnIndex( DBHelper.NEXTNAG );
|
||||
int lastMoveIndex = cursor.getColumnIndex( DBHelper.LASTMOVE );
|
||||
int roleIndex = cursor.getColumnIndex( DBHelper.SERVERROLE );
|
||||
for ( int ii = 0; ii < result.length && cursor.moveToNext(); ++ii ) {
|
||||
long rowid = cursor.getLong( rowIndex );
|
||||
long nextNag = cursor.getLong( nagIndex );
|
||||
long lastMove = cursor.getLong( lastMoveIndex );
|
||||
result[ii] = new NeedsNagInfo( rowid, nextNag, lastMove );
|
||||
CurGameInfo.DeviceRole role =
|
||||
CurGameInfo.DeviceRole.values()[cursor.getInt( roleIndex )];
|
||||
result[ii] = new NeedsNagInfo( rowid, nextNag, lastMove, role );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ public class NagTurnReceiver extends BroadcastReceiver {
|
|||
{ 60, R.plurals.nag_minutes_fmt },
|
||||
};
|
||||
|
||||
private static Boolean s_nagsDisabled = null;
|
||||
private static Boolean s_nagsDisabledNet = null;
|
||||
private static Boolean s_nagsDisabledSolo = null;
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent )
|
||||
|
@ -66,6 +67,15 @@ public class NagTurnReceiver extends BroadcastReceiver {
|
|||
long now = new Date().getTime(); // in milliseconds
|
||||
for ( NeedsNagInfo info : needNagging ) {
|
||||
Assert.assertTrue( info.m_nextNag < now );
|
||||
|
||||
// Skip processing if notifications disabled for this type
|
||||
// of game
|
||||
if ( s_nagsDisabledSolo && info.isSolo() ) {
|
||||
continue;
|
||||
} else if ( s_nagsDisabledNet && !info.isSolo() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
info.m_nextNag = figureNextNag( context,
|
||||
info.m_lastMoveMillis );
|
||||
boolean lastWarning = 0 == info.m_nextNag;
|
||||
|
@ -205,18 +215,24 @@ public class NagTurnReceiver extends BroadcastReceiver {
|
|||
|
||||
private static boolean getNagsDisabled( Context context )
|
||||
{
|
||||
if ( null == s_nagsDisabled ) {
|
||||
if ( null == s_nagsDisabledNet ) {
|
||||
boolean nagsDisabled =
|
||||
XWPrefs.getPrefsBoolean( context, R.string.key_disable_nag,
|
||||
false );
|
||||
s_nagsDisabled = new Boolean( nagsDisabled );
|
||||
s_nagsDisabledNet = new Boolean( nagsDisabled );
|
||||
}
|
||||
return s_nagsDisabled;
|
||||
if ( null == s_nagsDisabledSolo ) {
|
||||
boolean nagsDisabled =
|
||||
XWPrefs.getPrefsBoolean( context, R.string.key_disable_nag_solo,
|
||||
s_nagsDisabledNet );
|
||||
s_nagsDisabledSolo = new Boolean( nagsDisabled );
|
||||
}
|
||||
return s_nagsDisabledNet && s_nagsDisabledSolo;
|
||||
}
|
||||
|
||||
public static void resetNagsDisabled( Context context )
|
||||
{
|
||||
s_nagsDisabled = null;
|
||||
s_nagsDisabledNet = s_nagsDisabledSolo = null;
|
||||
restartTimer( context );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ public class PrefsDelegate extends DelegateBase
|
|||
private String m_keyLocale;
|
||||
private String m_keyLangs;
|
||||
private String m_keyFakeRadio;
|
||||
private String m_keyNagsDisabled;
|
||||
private String m_keyNagsDisabledNet;
|
||||
private String m_keyNagsDisabledSolo;
|
||||
|
||||
public PrefsDelegate( PreferenceActivity activity, Delegator delegator,
|
||||
Bundle savedInstanceState )
|
||||
|
@ -137,7 +138,8 @@ public class PrefsDelegate extends DelegateBase
|
|||
m_keyLocale = getString( R.string.key_xlations_locale );
|
||||
m_keyLangs = getString( R.string.key_default_language );
|
||||
m_keyFakeRadio = getString( R.string.key_force_radio );
|
||||
m_keyNagsDisabled = getString( R.string.key_disable_nag );
|
||||
m_keyNagsDisabledNet = getString( R.string.key_disable_nag );
|
||||
m_keyNagsDisabledSolo = getString( R.string.key_disable_nag_solo );
|
||||
|
||||
Button button = (Button)findViewById( R.id.revert_colors );
|
||||
button.setOnClickListener( new View.OnClickListener() {
|
||||
|
@ -206,7 +208,8 @@ public class PrefsDelegate extends DelegateBase
|
|||
forceDictsMatch( sp.getString( key, null ) );
|
||||
} else if ( key.equals( m_keyFakeRadio ) ) {
|
||||
SMSService.resetPhoneInfo();
|
||||
} else if ( key.equals( m_keyNagsDisabled ) ) {
|
||||
} else if ( key.equals( m_keyNagsDisabledNet )
|
||||
|| key.equals( m_keyNagsDisabledSolo ) ) {
|
||||
NagTurnReceiver.resetNagsDisabled( m_activity );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue