mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +01:00
add name field to manual sms contacts entry
This commit is contained in:
parent
b33df6b222
commit
6de5d307b3
3 changed files with 66 additions and 13 deletions
|
@ -34,6 +34,7 @@ import android.telephony.PhoneNumberUtils;
|
||||||
import android.text.method.DialerKeyListener;
|
import android.text.method.DialerKeyListener;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
@ -143,25 +144,30 @@ public class SMSInviteDelegate extends InviteDelegate {
|
||||||
DialogInterface.OnClickListener lstnr;
|
DialogInterface.OnClickListener lstnr;
|
||||||
switch( alert.getDlgID() ) {
|
switch( alert.getDlgID() ) {
|
||||||
case GET_NUMBER: {
|
case GET_NUMBER: {
|
||||||
final GameNamer namerView =
|
final View getNumView = inflate( R.layout.get_sms );
|
||||||
(GameNamer)inflate( R.layout.rename_game );
|
((EditText)getNumView.findViewById( R.id.num_field )).setKeyListener(DialerKeyListener.getInstance());
|
||||||
namerView.setLabel( R.string.get_sms_number );
|
|
||||||
namerView.setKeyListener(DialerKeyListener.getInstance());
|
|
||||||
lstnr = new DialogInterface.OnClickListener() {
|
lstnr = new DialogInterface.OnClickListener() {
|
||||||
public void onClick( DialogInterface dlg, int item ) {
|
public void onClick( DialogInterface dlg, int item ) {
|
||||||
String number = namerView.getName();
|
String number
|
||||||
PhoneRec rec = new PhoneRec( number );
|
= ((EditText)getNumView.findViewById(R.id.num_field))
|
||||||
|
.getText().toString();
|
||||||
|
if ( null != number && 0 < number.length() ) {
|
||||||
|
String name
|
||||||
|
= ((EditText)getNumView.findViewById(R.id.name_field))
|
||||||
|
.getText().toString();
|
||||||
makeConfirmThenBuilder( R.string.warn_unlimited,
|
makeConfirmThenBuilder( R.string.warn_unlimited,
|
||||||
Action.POST_WARNING_ACTION )
|
Action.POST_WARNING_ACTION )
|
||||||
.setPosButton( R.string.button_yes )
|
.setPosButton( R.string.button_yes )
|
||||||
.setParams( number, null )
|
.setParams( number, name )
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
dialog = makeAlertBuilder()
|
dialog = makeAlertBuilder()
|
||||||
|
.setTitle( R.string.get_sms_title )
|
||||||
|
.setView( getNumView )
|
||||||
.setPositiveButton( android.R.string.ok, lstnr )
|
.setPositiveButton( android.R.string.ok, lstnr )
|
||||||
.setNegativeButton( android.R.string.cancel, null )
|
.setNegativeButton( android.R.string.cancel, null )
|
||||||
.setView( namerView )
|
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
45
xwords4/android/app/src/main/res/layout/get_sms.xml
Normal file
45
xwords4/android/app/src/main/res/layout/get_sms.xml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView android:text="@string/get_sms_name"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginLeft="20dip"
|
||||||
|
android:layout_marginRight="20dip"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
/>
|
||||||
|
<EditText android:id="@+id/name_field"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_marginLeft="30dip"
|
||||||
|
android:layout_marginRight="30dip"
|
||||||
|
android:autoText="false"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView android:text="@string/get_sms_number"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginLeft="20dip"
|
||||||
|
android:layout_marginRight="20dip"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
/>
|
||||||
|
<EditText android:id="@+id/num_field"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_marginLeft="30dip"
|
||||||
|
android:layout_marginRight="30dip"
|
||||||
|
android:autoText="false"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1919,7 +1919,9 @@
|
||||||
empty. Use the \"Scan games\" button to scan your old games
|
empty. Use the \"Scan games\" button to scan your old games
|
||||||
for opponents. Use the \"+\" button to enter device IDs directly.</string>
|
for opponents. Use the \"+\" button to enter device IDs directly.</string>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<string name="get_sms_number">Enter phone number:</string>
|
<string name="get_sms_title">Manual entry</string>
|
||||||
|
<string name="get_sms_number">Device phone number:</string>
|
||||||
|
<string name="get_sms_name">Contact name (optional):</string>
|
||||||
<string name="get_relay_number">Enter device ID:</string>
|
<string name="get_relay_number">Enter device ID:</string>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<plurals name="confirm_clear_sms_fmt">
|
<plurals name="confirm_clear_sms_fmt">
|
||||||
|
|
Loading…
Add table
Reference in a new issue