mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-14 08:01:38 +01:00
add custom view for wordlist dialog so it doesn't get dismissed the
first time you pick a word -- now all can be looked up if desired.
This commit is contained in:
parent
ea3e015a8f
commit
d7a04f87e6
3 changed files with 39 additions and 7 deletions
16
xwords4/android/XWords4/res/layout/wordlist_view.xml
Normal file
16
xwords4/android/XWords4/res/layout/wordlist_view.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<ListView android:id="@+id/words"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawSelectorOnTop="false"
|
||||||
|
android:layout_marginLeft="30dip"
|
||||||
|
android:layout_marginRight="30dip"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1767,6 +1767,7 @@
|
||||||
|
|
||||||
<string name="button_lookup">Lookup word</string>
|
<string name="button_lookup">Lookup word</string>
|
||||||
<string name="title_lookup">Tap to lookup</string>
|
<string name="title_lookup">Tap to lookup</string>
|
||||||
|
<string name="button_done">Done</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,14 @@ import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
@ -316,15 +320,26 @@ public class BoardActivity extends XWActivity
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DLG_WORDPICK:
|
case DLG_WORDPICK:
|
||||||
|
LinearLayout layout =
|
||||||
|
(LinearLayout)Utils.inflate( this, R.layout.wordlist_view );
|
||||||
|
ListView list = (ListView)layout.findViewById( R.id.words );
|
||||||
|
ArrayAdapter<String> adapter =
|
||||||
|
new ArrayAdapter<String>( this,
|
||||||
|
android.R.layout.simple_list_item_1,
|
||||||
|
m_words ) ;
|
||||||
|
list.setAdapter( adapter );
|
||||||
|
OnItemClickListener oicl = new OnItemClickListener() {
|
||||||
|
public void onItemClick(AdapterView<?> parent,
|
||||||
|
View view,
|
||||||
|
int position, long id ) {
|
||||||
|
lookupWord( m_words[position] );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
list.setOnItemClickListener( oicl );
|
||||||
dialog = new AlertDialog.Builder( this )
|
dialog = new AlertDialog.Builder( this )
|
||||||
.setTitle( R.string.title_lookup )
|
.setTitle( R.string.title_lookup )
|
||||||
.setItems( m_words, new DialogInterface.OnClickListener() {
|
.setView( layout )
|
||||||
public void onClick( DialogInterface dialog,
|
.setNegativeButton( R.string.button_done, null )
|
||||||
int item ) {
|
|
||||||
lookupWord( m_words[item] );
|
|
||||||
}
|
|
||||||
} )
|
|
||||||
.setNegativeButton( R.string.button_cancel, null )
|
|
||||||
.create();
|
.create();
|
||||||
Utils.setRemoveOnDismiss( this, dialog, id );
|
Utils.setRemoveOnDismiss( this, dialog, id );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue