mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
invitations: disable remove when nothing checked
Subclass needs to do this one: overrides tryEnable() to handle its button-bar buttons.
This commit is contained in:
parent
216dc757ad
commit
57c71f4c82
2 changed files with 24 additions and 29 deletions
|
@ -25,26 +25,14 @@ import android.app.AlertDialog;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eehouse.android.xw4.DBUtils.SentInvitesInfo;
|
||||
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class BTInviteDelegate extends InviteDelegate {
|
||||
|
@ -137,6 +125,17 @@ public class BTInviteDelegate extends InviteDelegate {
|
|||
((TwoStrsItem)child).setStrings( pair.str2, null/*pair.str1*/ );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tryEnable()
|
||||
{
|
||||
super.tryEnable();
|
||||
|
||||
Button button = (Button)findViewById( R.id.button_clear );
|
||||
if ( null != button ) { // may not be there yet
|
||||
button.setEnabled( 0 < getChecked().size() );
|
||||
}
|
||||
}
|
||||
|
||||
private void scan()
|
||||
{
|
||||
int count = BTService.getPairedCount( m_activity );
|
||||
|
|
|
@ -34,11 +34,6 @@ import android.telephony.PhoneNumberUtils;
|
|||
import android.text.method.DialerKeyListener;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -49,14 +44,12 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
|
||||
public class SMSInviteDelegate extends InviteDelegate
|
||||
implements View.OnClickListener {
|
||||
public class SMSInviteDelegate extends InviteDelegate {
|
||||
private static final String TAG = SMSInviteDelegate.class.getSimpleName();
|
||||
private static int[] BUTTONIDS = {
|
||||
R.id.button_add,
|
||||
|
@ -68,7 +61,6 @@ public class SMSInviteDelegate extends InviteDelegate
|
|||
private static final String SAVE_NUMBER = "SAVE_NUMBER";
|
||||
|
||||
private ArrayList<PhoneRec> m_phoneRecs;
|
||||
private ImageButton m_addButton;
|
||||
private boolean m_immobileConfirmed;
|
||||
private Activity m_activity;
|
||||
|
||||
|
@ -186,6 +178,17 @@ public class SMSInviteDelegate extends InviteDelegate
|
|||
((TwoStrsItem)child).setStrings( rec.m_name, rec.m_phone );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tryEnable()
|
||||
{
|
||||
super.tryEnable();
|
||||
|
||||
Button button = (Button)findViewById( R.id.button_clear );
|
||||
if ( null != button ) { // may not be there yet
|
||||
button.setEnabled( 0 < getChecked().size() );
|
||||
}
|
||||
}
|
||||
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
@Override
|
||||
public void dlgButtonClicked( Action action, int which,
|
||||
|
@ -283,13 +286,6 @@ public class SMSInviteDelegate extends InviteDelegate
|
|||
return rec1.m_name.compareTo(rec2.m_name);
|
||||
}
|
||||
});
|
||||
// String[] phones = new String[m_phoneRecs.size()];
|
||||
// String[] names = new String[m_phoneRecs.size()];
|
||||
// for ( int ii = 0; ii < m_phoneRecs.size(); ++ii ) {
|
||||
// PhoneRec rec = m_phoneRecs.get( ii );
|
||||
// phones[ii] = rec.m_phone;
|
||||
// names[ii] = rec.m_name;
|
||||
// }
|
||||
|
||||
updateListAdapter( m_phoneRecs.toArray( new PhoneRec[m_phoneRecs.size()] ) );
|
||||
tryEnable();
|
||||
|
|
Loading…
Add table
Reference in a new issue