mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
add search field and button. Not yet wired to do anything.
This commit is contained in:
parent
ed055b83c6
commit
1741021c3c
3 changed files with 44 additions and 10 deletions
|
@ -7,6 +7,26 @@
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp">
|
android:paddingRight="8dp">
|
||||||
|
|
||||||
|
<LinearLayout android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
>
|
||||||
|
<EditText android:id="@+id/word_edit"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:hint="@string/word_search_hint"
|
||||||
|
android:capitalize="characters"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button android:id="@+id/search_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/button_search"
|
||||||
|
android:layout_weight="0"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ListView android:id="@id/android:list"
|
<ListView android:id="@id/android:list"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
|
@ -1783,5 +1783,8 @@
|
||||||
|
|
||||||
<string name="button_move">Move</string>
|
<string name="button_move">Move</string>
|
||||||
|
|
||||||
|
<string name="button_search">Find</string>
|
||||||
|
<string name="word_search_hint">First letters</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.SectionIndexer;
|
import android.widget.SectionIndexer;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -37,7 +39,8 @@ import junit.framework.Assert;
|
||||||
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
|
import org.eehouse.android.xw4.jni.JNIUtilsImpl;
|
||||||
import org.eehouse.android.xw4.jni.XwJNI;
|
import org.eehouse.android.xw4.jni.XwJNI;
|
||||||
|
|
||||||
public class DictBrowseActivity extends XWListActivity {
|
public class DictBrowseActivity extends XWListActivity
|
||||||
|
implements View.OnClickListener {
|
||||||
|
|
||||||
public static final String DICT_NAME = "DICT_NAME";
|
public static final String DICT_NAME = "DICT_NAME";
|
||||||
|
|
||||||
|
@ -93,12 +96,6 @@ public class DictBrowseActivity extends XWListActivity {
|
||||||
if ( section >= m_indices.length ) {
|
if ( section >= m_indices.length ) {
|
||||||
section = m_indices.length - 1;
|
section = m_indices.length - 1;
|
||||||
}
|
}
|
||||||
// for ( section = 0; section < m_indices.length - 1; ++section ) {
|
|
||||||
// if ( position <= m_indices[section] ) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Utils.logf( "DictBrowseActivity: getSectionForPosition" );
|
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,9 +104,6 @@ public class DictBrowseActivity extends XWListActivity {
|
||||||
String prefs = XwJNI.dict_iter_getPrefixes( m_dictClosure );
|
String prefs = XwJNI.dict_iter_getPrefixes( m_dictClosure );
|
||||||
m_prefixes = TextUtils.split( prefs, "\n" );
|
m_prefixes = TextUtils.split( prefs, "\n" );
|
||||||
m_indices = XwJNI.dict_iter_getIndices( m_dictClosure );
|
m_indices = XwJNI.dict_iter_getIndices( m_dictClosure );
|
||||||
Utils.logf( "len(m_indices): %d; len(m_prefixes): %d",
|
|
||||||
m_indices.length, m_prefixes.length );
|
|
||||||
Assert.assertTrue( m_indices.length == m_prefixes.length );
|
|
||||||
return m_prefixes;
|
return m_prefixes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,11 +122,16 @@ public class DictBrowseActivity extends XWListActivity {
|
||||||
DictUtils.DictPairs pairs = DictUtils.openDicts( this, names );
|
DictUtils.DictPairs pairs = DictUtils.openDicts( this, names );
|
||||||
m_dictClosure = XwJNI.dict_iter_init( pairs.m_bytes[0], pairs.m_paths[0],
|
m_dictClosure = XwJNI.dict_iter_init( pairs.m_bytes[0], pairs.m_paths[0],
|
||||||
JNIUtilsImpl.get() );
|
JNIUtilsImpl.get() );
|
||||||
|
Utils.logf( "calling makeIndex" );
|
||||||
XwJNI.dict_iter_makeIndex( m_dictClosure );
|
XwJNI.dict_iter_makeIndex( m_dictClosure );
|
||||||
|
Utils.logf( "makeIndex done" );
|
||||||
|
|
||||||
setContentView( R.layout.dict_browser );
|
setContentView( R.layout.dict_browser );
|
||||||
setListAdapter( new DictListAdapter() );
|
setListAdapter( new DictListAdapter() );
|
||||||
getListView().setFastScrollEnabled( true );
|
getListView().setFastScrollEnabled( true );
|
||||||
|
|
||||||
|
Button button = (Button)findViewById( R.id.search_button );
|
||||||
|
button.setOnClickListener( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -156,4 +155,16 @@ public class DictBrowseActivity extends XWListActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
// View.OnClickListener interface
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
@Override
|
||||||
|
public void onClick( View view )
|
||||||
|
{
|
||||||
|
EditText edit = (EditText)findViewById( R.id.word_edit );
|
||||||
|
String text = edit.getText().toString();
|
||||||
|
if ( null != text && 0 < text.length() ) {
|
||||||
|
Utils.showf( this, "Not yet ready to search for %s", text );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue