invitations: track multiple per device in superclass

This commit is contained in:
Eric House 2016-12-15 07:10:54 -08:00
parent 502888ee03
commit f8bba60798
5 changed files with 12 additions and 14 deletions

View file

@ -142,11 +142,10 @@ public class BTInviteDelegate extends InviteDelegate {
} }
@Override @Override
protected void listSelected( InviterItem[] selected, String[] devs, int[] counts ) protected void listSelected( InviterItem[] selected, String[] devs )
{ {
for ( int ii = 0; ii < selected.length; ++ii ) { for ( int ii = 0; ii < selected.length; ++ii ) {
TwoStringPair rec = (TwoStringPair)selected[ii]; TwoStringPair rec = (TwoStringPair)selected[ii];
counts[ii] = 1; // rec.m_nPlayers;
devs[ii] = rec.str1; devs[ii] = rec.str1;
DbgUtils.logd( TAG, "selecting address %s", devs[ii] ); DbgUtils.logd( TAG, "selecting address %s", devs[ii] );
} }

View file

@ -72,7 +72,7 @@ abstract class InviteDelegate extends ListDelegateBase
// Children implement ... // Children implement ...
abstract void onChildAdded( View child, InviterItem item ); abstract void onChildAdded( View child, InviterItem item );
abstract void listSelected( InviterItem[] selected, String[] devsP, int[] countsP ); abstract void listSelected( InviterItem[] selected, String[] devs );
public static final String DEVS = "DEVS"; public static final String DEVS = "DEVS";
public static final String COUNTS = "COUNTS"; public static final String COUNTS = "COUNTS";
@ -166,9 +166,14 @@ abstract class InviteDelegate extends ListDelegateBase
if ( m_inviteButton == view ) { if ( m_inviteButton == view ) {
int len = m_checked.size(); int len = m_checked.size();
String[] devs = new String[len]; String[] devs = new String[len];
int[] counts = new int[len];
listSelected( getSelItems(), devs, counts ); InviterItem[] items = getSelItems();
listSelected( items, devs );
int[] counts = new int[len];
for ( int ii = 0; ii < len; ++ii ) {
counts[ii] = m_counts.get( items[ii] );
}
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra( DEVS, devs ); intent.putExtra( DEVS, devs );

View file

@ -208,7 +208,7 @@ public class RelayInviteDelegate extends InviteDelegate {
} }
@Override @Override
public void listSelected( InviterItem[] selected, String[] devsP, int[] countsP ) public void listSelected( InviterItem[] selected, String[] devsP )
{ {
Assert.fail(); Assert.fail();
} }

View file

@ -192,12 +192,10 @@ public class SMSInviteDelegate extends InviteDelegate
} }
@Override @Override
protected void listSelected( InviterItem[] selected, String[] devs, protected void listSelected( InviterItem[] selected, String[] devs )
int[] counts )
{ {
for ( int ii = 0; ii < selected.length; ++ii ) { for ( int ii = 0; ii < selected.length; ++ii ) {
PhoneRec rec = (PhoneRec)selected[ii]; PhoneRec rec = (PhoneRec)selected[ii];
counts[ii] = rec.m_nPlayers;
devs[ii] = rec.m_phone; devs[ii] = rec.m_phone;
} }
} }
@ -372,7 +370,6 @@ public class SMSInviteDelegate extends InviteDelegate
public String m_phone; public String m_phone;
public String m_name; public String m_name;
public boolean m_isChecked; public boolean m_isChecked;
public int m_nPlayers;
public PhoneRec( String name, String phone ) public PhoneRec( String name, String phone )
{ {
this( name, phone, false ); this( name, phone, false );
@ -386,7 +383,6 @@ public class SMSInviteDelegate extends InviteDelegate
{ {
m_phone = phone; m_phone = phone;
m_isChecked = checked; m_isChecked = checked;
m_nPlayers = 1;
if ( null == name ) { if ( null == name ) {
name = Utils.phoneToContact( m_activity, phone, false ); name = Utils.phoneToContact( m_activity, phone, false );

View file

@ -86,12 +86,10 @@ public class WiDirInviteDelegate extends InviteDelegate
} }
@Override @Override
protected void listSelected( InviterItem[] selected, String[] devs, protected void listSelected( InviterItem[] selected, String[] devs )
int[] counts )
{ {
for ( int ii = 0; ii < selected.length; ++ii ) { for ( int ii = 0; ii < selected.length; ++ii ) {
TwoStringPair pair = (TwoStringPair)selected[ii]; TwoStringPair pair = (TwoStringPair)selected[ii];
counts[ii] = 1;// rec.m_nPlayers;
devs[ii] = pair.str1; devs[ii] = pair.str1;
} }
} }