mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
add debug option to allow device to send relay-invitation to
itself. When that's set, in inviter UI add a button that adds own relayID to the list (gross!, but how that whole thing works is TBD), and when receiving invitation don't drop it if there's already a game with the same ID.
This commit is contained in:
parent
03555f2f83
commit
d77914d216
10 changed files with 813 additions and 772 deletions
File diff suppressed because it is too large
Load diff
|
@ -49,6 +49,13 @@
|
|||
android:src="@android:drawable/ic_input_add"
|
||||
android:clickable="false"
|
||||
/>
|
||||
<ImageButton android:id="@+id/add_self_button"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@android:drawable/ic_input_add"
|
||||
android:clickable="false"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
|
|
|
@ -121,6 +121,7 @@
|
|||
<string name="key_enable_dup_invite">key_enable_dup_invite</string>
|
||||
<string name="key_enable_nfc_toself">key_enable_nfc_toself</string>
|
||||
<string name="key_enable_sms_toself">key_enable_sms_toself</string>
|
||||
<string name="key_enable_relay_toself">key_enable_relay_toself</string>
|
||||
<string name="key_nag_intervals">key_nag_intervals</string>
|
||||
<string name="key_download_path">key_download_path</string>
|
||||
<string name="key_got_langdict">key_got_langdict</string>
|
||||
|
|
|
@ -2533,4 +2533,7 @@
|
|||
games. I think it\'s rare that people play with more than two. Let
|
||||
me know if I\'m wrong and I\'ll try harder to make it work.</string>
|
||||
|
||||
<string name="enable_relay_toself_title">Enable relay invites to self</string>
|
||||
<string name="enable_relay_toself_summary">(To aid testing and debugging)</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -394,6 +394,11 @@
|
|||
android:defaultValue="10998"
|
||||
android:numeric="decimal"
|
||||
/>
|
||||
<CheckBoxPreference android:key="@string/key_enable_relay_toself"
|
||||
android:title="@string/enable_relay_toself_title"
|
||||
android:summary="@string/enable_relay_toself_summary"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen android:title="@string/pref_group_l10n_title"
|
||||
|
|
|
@ -2189,4 +2189,6 @@
|
|||
delbaid ,esuaceb rof won ,yawyna hctamer si detimil ot nosrep-owt
|
||||
semag. I kniht ti\'s erar taht elpoep yalp htiw erom naht owt. Tel
|
||||
em wonk fi I\'m gnorw dna I\'ll yrt redrah ot ekam ti krow.</string>
|
||||
<string name="enable_relay_toself_title">Elbane yaler setivni ot fles</string>
|
||||
<string name="enable_relay_toself_summary">oT( dia gnitset dna )gniggubed</string>
|
||||
</resources>
|
||||
|
|
|
@ -2189,4 +2189,6 @@
|
|||
DIABLED BECAUSE, FOR NOW ANYWAY, REMATCH IS LIMITED TO TWO-PERSON
|
||||
GAMES. I THINK IT\'S RARE THAT PEOPLE PLAY WITH MORE THAN TWO. LET
|
||||
ME KNOW IF I\'M WRONG AND I\'LL TRY HARDER TO MAKE IT WORK.</string>
|
||||
<string name="enable_relay_toself_title">ENABLE RELAY INVITES TO SELF</string>
|
||||
<string name="enable_relay_toself_summary">(TO AID TESTING AND DEBUGGING)</string>
|
||||
</resources>
|
||||
|
|
|
@ -95,6 +95,20 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
}
|
||||
} );
|
||||
|
||||
if ( XWPrefs.getRelayInviteToSelfEnabled( m_activity ) ) {
|
||||
ImageButton addMe = (ImageButton)findViewById( R.id.add_self_button );
|
||||
addMe.setVisibility( View.VISIBLE );
|
||||
addMe.setOnClickListener( new View.OnClickListener() {
|
||||
public void onClick( View view ) {
|
||||
int devIDInt = XWPrefs.getRelayDevIDInt( m_activity );
|
||||
String devID = String.format( "%d", devIDInt );
|
||||
DevIDRec rec = new DevIDRec( "self", devID );
|
||||
addChecked( rec );
|
||||
saveAndRebuild();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
getSavedState();
|
||||
rebuildList( true );
|
||||
}
|
||||
|
|
|
@ -243,7 +243,8 @@ public class RelayService extends XWService
|
|||
private void makeGame( NetLaunchInfo nli )
|
||||
{
|
||||
long[] rowids = DBUtils.getRowIDsFor( this, nli.gameID() );
|
||||
if ( null == rowids || 0 == rowids.length ) {
|
||||
if ( (null == rowids || 0 == rowids.length)
|
||||
|| XWPrefs.getRelayInviteToSelfEnabled( this )) {
|
||||
CommsAddrRec addr = nli.makeAddrRec( this );
|
||||
// We can't pass a message sink, meaning we can't let the device
|
||||
// connect to the inviting game, because it needs to be open to
|
||||
|
@ -259,9 +260,6 @@ public class RelayService extends XWService
|
|||
R.string.new_relay_body );
|
||||
GameUtils.postInvitedNotification( this, nli.gameID(), body );
|
||||
}
|
||||
} else {
|
||||
DbgUtils.logf( "RelayService.makeGame(): dropping invite b/c already have"
|
||||
+ " game with gameID: %d", nli.gameID() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,11 @@ public class XWPrefs {
|
|||
return getPrefsBoolean( context, R.string.key_enable_nfc_toself, false );
|
||||
}
|
||||
|
||||
public static boolean getRelayInviteToSelfEnabled( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_enable_relay_toself, false );
|
||||
}
|
||||
|
||||
public static boolean getSMSToSelfEnabled( Context context )
|
||||
{
|
||||
return getPrefsBoolean( context, R.string.key_enable_sms_toself, false );
|
||||
|
|
Loading…
Add table
Reference in a new issue