mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
invitations cleanup: layout and reinvite
Fix a layout to be centered when one string not displayed. Fix to pre-check by default the most recent device choice when re-inviting.
This commit is contained in:
parent
f9f872695d
commit
84e8f0927c
5 changed files with 16 additions and 28 deletions
|
@ -22,6 +22,7 @@
|
|||
<FrameLayout android:id="@+id/frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue