diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayCheckBoxPreference.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayCheckBoxPreference.java index ed49bacc6..886fde7ab 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayCheckBoxPreference.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayCheckBoxPreference.java @@ -23,37 +23,45 @@ package org.eehouse.android.xw4; import android.content.Context; import android.util.AttributeSet; +import java.lang.ref.WeakReference; + import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.loc.LocUtils; public class RelayCheckBoxPreference extends ConfirmingCheckBoxPreference { - private static ConfirmingCheckBoxPreference s_this = null; + private static final String TAG = RelayCheckBoxPreference.class.getSimpleName(); + private static WeakReference s_this = null; public RelayCheckBoxPreference( Context context, AttributeSet attrs ) { super( context, attrs ); - s_this = this; + s_this = new WeakReference<>( this ); } @Override - protected void checkIfConfirmed() { + protected void checkIfConfirmed() + { PrefsActivity activity = (PrefsActivity)getContext(); + String msg = LocUtils.getString( activity, + R.string.warn_relay_havegames ); + int count = DBUtils.getRelayGameCount( activity ); if ( 0 < count ) { - String msg = LocUtils.getString( activity, - R.string.warn_relay_havegames ); msg += LocUtils.getQuantityString( activity, R.plurals.warn_relay_games_fmt, count, count ); - activity.makeConfirmThenBuilder( msg, Action.DISABLE_RELAY_DO ) - .setPosButton( R.string.button_disable_relay ) - .show(); } + activity.makeConfirmThenBuilder( msg, Action.DISABLE_RELAY_DO ) + .setPosButton( R.string.button_disable_relay ) + .show(); } protected static void setChecked() { if ( null != s_this ) { - s_this.super_setChecked( true ); + RelayCheckBoxPreference self = s_this.get(); + if ( null != self ) { + self.super_setChecked( true ); + } } } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayTimerReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayTimerReceiver.java index 4d253814b..60235b656 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayTimerReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/RelayTimerReceiver.java @@ -1,6 +1,6 @@ /* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */ /* - * Copyright 2010 by Eric House (xwords@eehouse.org). All rights + * Copyright 2010 - 2020 by Eric House (xwords@eehouse.org). All rights * reserved. * * This program is free software; you can redistribute it and/or @@ -39,7 +39,7 @@ public class RelayTimerReceiver extends BroadcastReceiver { public static void setTimer( Context context ) { - setTimer( context, 1000 * XWPrefs.getProxyIntervalSeconds( context ) ); + setTimer( context, 1000 * 1800 ); // to be changed shortly } public static void setTimer( Context context, long interval_millis ) 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 dc2520c80..165e9f1ea 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 @@ -188,18 +188,6 @@ public class XWPrefs { return result; } - public static long getProxyIntervalSeconds( Context context ) - { - String value = getPrefsString( context, R.string.key_connect_frequency ); - long result; - try { - result = Long.parseLong( value ); - } catch ( Exception ex ) { - result = -1; - } - return result; - } - public static int getPrefsInt( Context context, int keyID, int defaultValue ) { String key = context.getString( keyID ); diff --git a/xwords4/android/app/src/main/res/values/common_rsrc.xml b/xwords4/android/app/src/main/res/values/common_rsrc.xml index eebeb0434..70eeaf5c3 100644 --- a/xwords4/android/app/src/main/res/values/common_rsrc.xml +++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml @@ -63,7 +63,6 @@ key_default_phonies2 key_relay_poll key_default_timerenabled - key_connect_frequency key_notify_sound key_disable_relay key_notify_vibrate @@ -193,17 +192,6 @@ @string/robot_smart - - @string/connect_never - - @string/connect_five_mins - @string/connect_fifteen_mins - @string/connect_thirty_mins - @string/connect_one_hour - @string/connect_six_hours - @string/connect_daily - - @@ -213,17 +201,6 @@ @string/loc_downloads - - -1 - - 300 - 900 - 1800 - 3600 - 21600 - 86400 - - @string/lang_unknown diff --git a/xwords4/android/app/src/main/res/values/strings.xml b/xwords4/android/app/src/main/res/values/strings.xml index ffc6aba3b..bdb8946bc 100644 --- a/xwords4/android/app/src/main/res/values/strings.xml +++ b/xwords4/android/app/src/main/res/values/strings.xml @@ -976,16 +976,6 @@ CrossWords wakes up periodically to check if there are any new moves available and fetches them. This controls how frequently that check is done. --> - Background move check - - Never check - Every 5 minutes - Every 15 minutes - Every 30 minutes - Every hour - Every six hours - Once every day Play sound @@ -1839,10 +1829,14 @@ You can enable relay play now, or remove it from this game. Are you sure you want to - disable play using the relay? + disable play using the relay (internet)? + \n\n + Most networked games exchange moves via the relay, so only do this + if you plan to play ALL games against a robot on this same + device. - \n\n(You have one game using it.) - \n\n(You have %1$d games using it.) + \n\n(You have one active game using the relay now.) + \n\n(You have %1$d active games using the relay now.) Enable Data SMS Enable Bluetooth diff --git a/xwords4/android/app/src/main/res/xml/xwprefs.xml b/xwords4/android/app/src/main/res/xml/xwprefs.xml index c9599d5c2..c4330709d 100644 --- a/xwords4/android/app/src/main/res/xml/xwprefs.xml +++ b/xwords4/android/app/src/main/res/xml/xwprefs.xml @@ -318,25 +318,6 @@ android:defaultValue="false" /> - - - - - - + +