mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
move network prefs into its own category; add prefs checkboxes there
and getters controlling whether vibrate and sound are used as part of notifications.
This commit is contained in:
parent
151df44c96
commit
aaffb749cd
5 changed files with 44 additions and 3 deletions
|
@ -36,6 +36,8 @@
|
|||
<string name="key_default_phonies">key_default_phonies2</string>
|
||||
<string name="key_default_timerenabled">key_default_timerenabled</string>
|
||||
<string name="key_connect_frequency">key_connect_frequency</string>
|
||||
<string name="key_notify_sound">key_notify_sound</string>
|
||||
<string name="key_notify_vibrate">key_notify_vibrate</string>
|
||||
|
||||
<string name="key_notagain_sync">key_notagain_sync</string>
|
||||
<string name="key_notagain_chat">key_notagain_chat</string>
|
||||
|
|
|
@ -256,6 +256,10 @@
|
|||
<string name="prefs_behavior">Behavior</string>
|
||||
<string name="prefs_behavior_summary">Settings controlling app behavior</string>
|
||||
|
||||
<string name="network_behavior">Network settings</string>
|
||||
<string name="network_behavior_summary">Settings that apply to
|
||||
networked games</string>
|
||||
|
||||
<string name="default_dict">Game dictionary</string>
|
||||
<string name="default_phonies">Handle phonies</string>
|
||||
<string name="phonies_spinner_prompt">How to handle \"phonies\"
|
||||
|
@ -394,6 +398,10 @@
|
|||
<string name="connect_daily">Once every day</string>
|
||||
<string name="connect_never">Never connect</string>
|
||||
|
||||
<string name="notify_sound">Play sound</string>
|
||||
<string name="notify_vibrate">Vibrate</string>
|
||||
<string name="notify_other_summary">When opponent moves arrive</string>
|
||||
|
||||
<string name="public_names_progress">Fetching public rooms for
|
||||
%d-player games in %s.</string>
|
||||
<string name="no_name_found_f">No public rooms found for %d-player
|
||||
|
|
|
@ -156,7 +156,11 @@
|
|||
android:summary="@string/peek_other_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen android:title="@string/network_behavior"
|
||||
android:summary="@string/network_behavior_summary"
|
||||
>
|
||||
<org.eehouse.android.xw4.PollListPreference
|
||||
android:key="@string/key_connect_frequency"
|
||||
android:title="@string/connect_frequency"
|
||||
|
@ -164,6 +168,17 @@
|
|||
android:entryValues="@array/connect_frequencies_values"
|
||||
android:defaultValue="900"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference android:key="@string/key_notify_sound"
|
||||
android:title="@string/notify_sound"
|
||||
android:summary="@string/notify_other_summary"
|
||||
android:defaultValue="true"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_notify_vibrate"
|
||||
android:title="@string/notify_vibrate"
|
||||
android:summary="@string/notify_other_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen android:title="@string/advanced"
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.io.DataOutputStream;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.eehouse.android.xw4.jni.GameSummary;
|
||||
import org.eehouse.android.xw4.jni.CommonPrefs;
|
||||
|
||||
public class RelayService extends Service {
|
||||
|
||||
|
@ -81,9 +82,14 @@ public class RelayService extends Service {
|
|||
Notification notification =
|
||||
new Notification( R.drawable.icon48x48, title,
|
||||
System.currentTimeMillis() );
|
||||
notification.flags |=
|
||||
Notification.FLAG_AUTO_CANCEL | Notification.DEFAULT_SOUND;
|
||||
notification.flags |= Notification.DEFAULT_VIBRATE;
|
||||
|
||||
notification.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||
if ( CommonPrefs.getSoundNotify( this ) ) {
|
||||
notification.flags |= Notification.DEFAULT_SOUND;
|
||||
}
|
||||
if ( CommonPrefs.getVibrateNotify( this ) ) {
|
||||
notification.flags |= Notification.DEFAULT_VIBRATE;
|
||||
}
|
||||
|
||||
notification.
|
||||
setLatestEventInfo( this, title,
|
||||
|
|
|
@ -248,6 +248,16 @@ public class CommonPrefs {
|
|||
return getPrefsBoolean( context, R.string.key_hide_title, true );
|
||||
}
|
||||
|
||||
public static boolean getSoundNotify( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_notify_sound, true );
|
||||
}
|
||||
|
||||
public static boolean getVibrateNotify( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_notify_vibrate, false );
|
||||
}
|
||||
|
||||
public static boolean getPrefsBoolean( Context context, int keyID,
|
||||
boolean defaultValue )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue