Merge branch 'android_branch' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_branch

This commit is contained in:
Eric House 2011-02-22 19:56:40 -08:00
commit 29b05b83ec
7 changed files with 47 additions and 8 deletions

View file

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

View file

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

View file

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

View file

@ -145,8 +145,10 @@ public class BoardActivity extends XWActivity {
case QUERY_REQUEST_BLK:
case QUERY_INFORM_BLK:
ab = new AlertDialog.Builder( this )
.setTitle( m_dlgTitle )
.setMessage( m_dlgBytes );
if ( 0 != m_dlgTitle ) {
ab.setTitle( m_dlgTitle );
}
lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dialog,
int whichButton ) {

View file

@ -58,7 +58,6 @@ public class GamesList extends XWListActivity
private static final int SHOW_SUBST = WARN_NODICT + 2;
private GameListAdapter m_adapter;
private String m_invalPath = null;
private String m_missingDict;
private Handler m_handler;
private String m_missingDictName;
@ -206,7 +205,6 @@ public class GamesList extends XWListActivity
String path = addGame( true );
GameUtils.doConfig( GamesList.this, path,
RelayGameActivity.class );
m_invalPath = path;
}
});
@ -290,9 +288,7 @@ public class GamesList extends XWListActivity
public void onWindowFocusChanged( boolean hasFocus )
{
super.onWindowFocusChanged( hasFocus );
if ( hasFocus && null != m_invalPath ) {
m_adapter.inval( m_invalPath );
m_invalPath = null;
if ( hasFocus ) {
onContentChanged();
}
}
@ -422,7 +418,6 @@ public class GamesList extends XWListActivity
GameUtils.launchGame( this, path );
}
}
m_invalPath = path;
}
private boolean handleMenuItem( int menuID, int position )
@ -457,7 +452,6 @@ public class GamesList extends XWListActivity
break;
case R.id.list_item_config:
GameUtils.doConfig( this, path, GameConfig.class );
m_invalPath = path;
break;
case R.id.list_item_new_from:

View file

@ -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,7 +82,14 @@ public class RelayService extends Service {
Notification notification =
new Notification( R.drawable.icon48x48, title,
System.currentTimeMillis() );
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,

View file

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