Merge branch 'android_branch' into android_browsedict

Conflicts:
	xwords4/common/dictiter.c
	xwords4/linux/linuxmain.c
This commit is contained in:
Eric House 2011-11-03 21:32:04 -07:00
commit adb9473a87
12 changed files with 111 additions and 80 deletions

View file

@ -22,7 +22,7 @@
to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4"
android:versionCode="29"
android:versionCode="30"
android:versionName="@string/app_version"
>
@ -118,7 +118,9 @@
</activity>
<activity android:name="RelayGameActivity"/>
<activity android:name="DictBrowseActivity"/>
<activity android:name="DictBrowseActivity"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="ChatActivity"/>
<service android:name="RelayService"/>

View file

@ -1450,10 +1450,9 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getStartsWith
XP_U16 nTiles = VSIZE(tiles);
const char* prefix = (*env)->GetStringUTFChars( env, jprefix, NULL );
if ( dict_tilesForString( data->dict, prefix, tiles, &nTiles ) ) {
IndexData* idata = NULL;
DictPosition pos = dict_findStartsWith( &data->iter, idata, tiles,
nTiles );
result = pos;
if ( dict_findStartsWith( &data->iter, NULL, tiles, nTiles ) ) {
result = dict_getPosition( &data->iter );
}
}
(*env)->ReleaseStringUTFChars( env, jprefix, prefix );
}

View file

@ -35,38 +35,47 @@
/>
</LinearLayout>
<LinearLayout android:id="@+id/toolbar_horizontal"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageButton android:id="@+id/prevhint_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/prev_hint"
/>
<ImageButton android:id="@+id/nexthint_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/next_hint"
/>
<ImageButton android:id="@+id/shuffle_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/shuffle"
/>
<ImageButton android:id="@+id/flip_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/flip"
/>
<ImageButton android:id="@+id/zoom_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/zoom"
/>
<ImageButton android:id="@+id/undo_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/undo"
/>
<ImageButton android:id="@+id/chat_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/stat_notify_chat"
/>
</LinearLayout>
<HorizontalScrollView android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout android:id="@+id/toolbar_horizontal"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageButton android:id="@+id/dictlist_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/dicticon"
/>
<ImageButton android:id="@+id/prevhint_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/prev_hint"
/>
<ImageButton android:id="@+id/nexthint_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/next_hint"
/>
<ImageButton android:id="@+id/shuffle_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/shuffle"
/>
<ImageButton android:id="@+id/flip_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/flip"
/>
<ImageButton android:id="@+id/zoom_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/zoom"
/>
<ImageButton android:id="@+id/undo_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/undo"
/>
<ImageButton android:id="@+id/chat_button_horizontal"
style="@style/toolbar_button"
android:src="@drawable/stat_notify_chat"
/>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>

View file

@ -6,17 +6,29 @@
</head>
<body>
<b>Crosswords 4.4 beta 37 release</b>
<b>Crosswords 4.4 beta 38 release</b>
<ul>
<li>Added a wordlist browser, which you can get to by tapping a
wordlist in the Wordlist screen, or by using the wordlist
button at the bottom of the game board. Eventually you'll be
able to filter based on length, chosen tiles, etc. Right now
you can scroll through all the words (even 2.7 million of them
if you're playing in Polish.)</li>
<li>Extend ability to look up words to include those already on the
board. Hold your finger on any played tile to look up any of the
words that use it. </li>
<li>Added the "download directory" to locations I search for
wordlists. This means that if you're using a browser like
Opera that doesn't respect apps' registering for certain types
of data you can still use a wordlist you've downloaded.</li>
<li>Fix password dialog crashes</li>
<li>Added "Pick tiles face up" option, settable when you create a
game. This is primarily useful if you want to populate a
board to match a game that already exists, say in a newspaper
puzzle or online wordgame.</li>
<li>Show wordlist along with player name in Game Config screen, and
move below Language since it changes when language changes.</li>
<!--
TODO: test various bogus dicts in downloads/
test that opera-downloaded dicts openable/moveable
-->
</ul>

View file

@ -3,7 +3,7 @@
<!-- Resources in this file do not require localization -->
<resources>
<string name="app_version">4.4 beta 37</string>
<string name="app_version">4.4 beta 38</string>
<!-- prefs keys -->
<string name="key_color_tiles">key_color_tiles</string>
@ -75,6 +75,7 @@
<string name="key_notagain_newfrom">key_notagain_newfrom</string>
<string name="key_notagain_trading">key_notagain_trading</string>
<string name="key_na_lookup">key_na_lookup</string>
<string name="key_na_browse">key_na_browse</string>
<!-- Name is not localized -->
<string name="app_name">Crosswords</string>

View file

@ -1787,6 +1787,7 @@
<string name="dict_browse_titlef">%1$s (%2$d words)</string>
<string name="dict_browse_nowordsf">No word in %1$s starts with
%2$s.</string>
<string name="not_again_browse">This button opens the wordlist
browser on the current player\'s wordlist.</string>
</resources>

View file

@ -92,6 +92,7 @@ public class BoardActivity extends XWActivity
private static final int CHAT_ACTION = 12;
private static final int START_TRADE_ACTION = 13;
private static final int LOOKUP_ACTION = 14;
private static final int BUTTON_BROWSE_ACTION = 15;
private static final String DLG_TITLE = "DLG_TITLE";
private static final String DLG_TITLESTR = "DLG_TITLESTR";
@ -620,6 +621,7 @@ public class BoardActivity extends XWActivity
m_jniThread.handle( JNIThread.JNICmd.CMD_REMAINING,
R.string.tiles_left_title );
break;
case R.id.board_menu_game_history:
m_jniThread.handle( JNIThread.JNICmd.CMD_HISTORY,
R.string.history_title );
@ -691,6 +693,10 @@ public class BoardActivity extends XWActivity
Toast.LENGTH_SHORT).show();
m_toastStr = null;
break;
case BUTTON_BROWSE_ACTION:
String dictName = m_gi.dictName( m_view.getCurPlayer() );
DictBrowseActivity.launch( this, dictName );
break;
case PREV_HINT_ACTION:
cmd = JNIThread.JNICmd.CMD_PREV_HINT;
break;
@ -1410,6 +1416,10 @@ public class BoardActivity extends XWActivity
private void populateToolbar()
{
m_toolbar.setListener( Toolbar.BUTTON_BROWSE_DICT,
R.string.not_again_browse,
R.string.key_na_browse,
BUTTON_BROWSE_ACTION );
m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV,
R.string.not_again_hintprev,
R.string.key_notagain_hintprev,

View file

@ -338,6 +338,11 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
m_jniThread.handle( JNIThread.JNICmd.CMD_INVALALL );
}
public int getCurPlayer()
{
return m_trayOwner;
}
public int curPending()
{
return m_pendingScore;

View file

@ -20,6 +20,7 @@
package org.eehouse.android.xw4;
import android.content.Context;
import android.content.Intent;
import android.database.DataSetObserver;
import android.os.Bundle;
@ -48,6 +49,7 @@ public class DictBrowseActivity extends XWListActivity
private int m_lang;
private String m_name;
private int m_nWords;
private float m_textSize;
// - Steps to reproduce the problem:
// Create ListView, set custom adapter which implements ListAdapter and
@ -68,7 +70,7 @@ public class DictBrowseActivity extends XWListActivity
if ( null != str ) {
text.setText( str );
text.setOnClickListener( DictBrowseActivity.this );
text.setTextSize( text.getTextSize() + 2.0f );
text.setTextSize( m_textSize );
}
return text;
}
@ -123,6 +125,8 @@ public class DictBrowseActivity extends XWListActivity
m_name = name;
m_lang = DictLangCache.getDictLangCode( this, name );
m_textSize = 2.0f + new TextView( this ).getTextSize();
String[] names = { name };
DictUtils.DictPairs pairs = DictUtils.openDicts( this, names );
m_dictClosure = XwJNI.dict_iter_init( pairs.m_bytes[0],
@ -197,4 +201,11 @@ public class DictBrowseActivity extends XWListActivity
}
}
}
public static void launch( Context caller, String name )
{
Intent intent = new Intent( caller, DictBrowseActivity.class );
intent.putExtra( DICT_NAME, name );
caller.startActivity( intent );
}
}

View file

@ -462,9 +462,7 @@ public class DictsActivity extends ExpandableListActivity
askStartDownload( 0, null );
} else {
XWListItem item = (XWListItem)view;
Intent intent = new Intent( this, DictBrowseActivity.class );
intent.putExtra( DictBrowseActivity.DICT_NAME, item.getText() );
startActivity( intent );
DictBrowseActivity.launch( this, item.getText() );
}
}

View file

@ -39,15 +39,18 @@ public class Toolbar {
public int m_id;
}
public static final int BUTTON_HINT_PREV = 0;
public static final int BUTTON_HINT_NEXT = 1;
public static final int BUTTON_FLIP = 2;
public static final int BUTTON_JUGGLE = 3;
public static final int BUTTON_ZOOM = 4;
public static final int BUTTON_UNDO = 5;
public static final int BUTTON_CHAT = 6;
public static final int BUTTON_BROWSE_DICT = 0;
public static final int BUTTON_HINT_PREV = 1;
public static final int BUTTON_HINT_NEXT = 2;
public static final int BUTTON_FLIP = 3;
public static final int BUTTON_JUGGLE = 4;
public static final int BUTTON_ZOOM = 5;
public static final int BUTTON_UNDO = 6;
public static final int BUTTON_CHAT = 7;
private static TBButtonInfo[] s_buttonInfo = {
// BUTTON_BROWSE_DICT
new TBButtonInfo(R.id.dictlist_button_horizontal ),
// BUTTON_HINT_PREV
new TBButtonInfo(R.id.prevhint_button_horizontal ),
// BUTTON_HINT_NEXT

View file

@ -951,26 +951,6 @@ walk_dict_test( const LaunchParams* params, const DictionaryCtxt* dict,
long jj;
XP_Bool gotOne;
/* XP_U32 count = dict_getWordCount( dict ); */
/* XP_ASSERT( count > 0 ); */
/* char** words = g_malloc( count * sizeof(char*) ); */
/* XP_ASSERT( !!words ); */
/* // # define PRINT_ALL */
/* /\* if ( dict_firstWord( dict, &word ) *\/ */
/* /\* && dict_getNextWord( dict, &word ) *\/ */
/* /\* && dict_getPrevWord( dict, &word ) ) { *\/ */
/* /\* fprintf( stderr, "yay!: dict_getPrevWord returned\n" ); *\/ */
/* /\* } *\/ */
/* /\* exit( 0 ); *\/ */
/* dict_initIter( dict, &iter ); */
/* for ( jj = 0, gotOne = dict_firstWord( &iter ); */
/* gotOne; */
/* ++jj, gotOne = dict_getNextWord( &iter ) ) { */
/* XP_ASSERT( dict_getPosition( &iter ) == jj ); */
/* XP_UCHAR buf[64]; */
/* dict_wordToString( &iter, buf, VSIZE(buf) ); */
XP_U16 min, max;
if ( !testMinMax || !parsePair( testMinMax, &min, &max ) ) {
min = 0;