diff --git a/xwords4/android/XWords4/res/layout/inviter_item_frame.xml b/xwords4/android/XWords4/res/layout/inviter_item_frame.xml index d1e9cdd75..9a05b6aca 100644 --- a/xwords4/android/XWords4/res/layout/inviter_item_frame.xml +++ b/xwords4/android/XWords4/res/layout/inviter_item_frame.xml @@ -22,6 +22,7 @@ diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java index 74298c986..66d6e14c7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java @@ -137,16 +137,6 @@ public class BTInviteDelegate extends InviteDelegate { ((TwoStrsItem)child).setStrings( pair.str2, null/*pair.str1*/ ); } - @Override - protected void listSelected( InviterItem[] selected, String[] devs ) - { - for ( int ii = 0; ii < selected.length; ++ii ) { - TwoStringPair rec = (TwoStringPair)selected[ii]; - devs[ii] = rec.str1; - DbgUtils.logd( TAG, "selecting address %s", devs[ii] ); - } - } - private void scan() { int count = BTService.getPairedCount( m_activity ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java index d8e060532..01167ea3a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java @@ -51,6 +51,7 @@ abstract class InviteDelegate extends ListDelegateBase protected interface InviterItem { boolean equals(InviterItem item); + String getDev(); // the string that identifies this item in results } protected static class TwoStringPair implements InviterItem { @@ -70,6 +71,8 @@ abstract class InviteDelegate extends ListDelegateBase return pairs; } + public String getDev() { return str1; } + public boolean equals( InviterItem item ) { boolean result = false; @@ -86,7 +89,6 @@ abstract class InviteDelegate extends ListDelegateBase // Children implement ... abstract void onChildAdded( View child, InviterItem item ); - abstract void listSelected( InviterItem[] selected, String[] devs ); public static final String DEVS = "DEVS"; public static final String COUNTS = "COUNTS"; @@ -169,6 +171,13 @@ abstract class InviteDelegate extends ListDelegateBase setListAdapter( m_adapter ); } + protected void listSelected( InviterItem[] selected, String[] devs ) + { + for ( int ii = 0; ii < selected.length; ++ii ) { + devs[ii] = selected[ii].getDev(); + } + } + protected void onBarButtonClicked( int id ) { Assert.fail(); // subclass must implement @@ -362,11 +371,10 @@ abstract class InviteDelegate extends ListDelegateBase if ( m_setChecked || m_checked.contains( item ) ) { box.setChecked( true ); - } else if ( null != m_lastDev && m_lastDev.equals( item ) ) { + } else if ( null != m_lastDev && m_lastDev.equals(item.getDev()) ) { m_lastDev = null; box.setChecked( true ); } - // m_items[position] = layout; return layout; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java index 740135682..fcff039ca 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java @@ -207,12 +207,6 @@ public class RelayInviteDelegate extends InviteDelegate { Assert.fail(); } - @Override - public void listSelected( InviterItem[] selected, String[] devsP ) - { - Assert.fail(); - } - // We want to present user with list of previous opponents and devices. We // can easily get list of relayIDs. The relay, if reachable, can convert // that to a (likely shorter) list of devices. Then for each deviceID, @@ -449,6 +443,8 @@ public class RelayInviteDelegate extends InviteDelegate { m_opponent = opponent; } + public String getDev() { return m_devID; } + public boolean equals( InviterItem item ) { return item != null diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java index 8dab4bd25..40b39a8c6 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java @@ -179,15 +179,6 @@ public class SMSInviteDelegate extends InviteDelegate return dialog; } - @Override - protected void listSelected( InviterItem[] selected, String[] devs ) - { - for ( int ii = 0; ii < selected.length; ++ii ) { - PhoneRec rec = (PhoneRec)selected[ii]; - devs[ii] = rec.m_phone; - } - } - @Override protected void onChildAdded( View child, InviterItem data ) { @@ -373,6 +364,8 @@ public class SMSInviteDelegate extends InviteDelegate this( null, phone ); } + public String getDev() { return m_phone; } + public boolean equals( InviterItem item ) { boolean result = false;