mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
Merge remote-tracking branch 'origin/android_translate' into android_translate
This commit is contained in:
commit
d14a053e70
3 changed files with 28 additions and 8 deletions
|
@ -24,6 +24,9 @@ import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
@ -37,6 +40,7 @@ public class ChatDelegate extends DelegateBase {
|
||||||
|
|
||||||
private long m_rowid;
|
private long m_rowid;
|
||||||
private Activity m_activity;
|
private Activity m_activity;
|
||||||
|
private EditText mEdit;
|
||||||
|
|
||||||
public ChatDelegate( Delegator delegator, Bundle savedInstanceState )
|
public ChatDelegate( Delegator delegator, Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
|
@ -48,6 +52,17 @@ public class ChatDelegate extends DelegateBase {
|
||||||
protected void init( Bundle savedInstanceState )
|
protected void init( Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
if ( BuildConstants.CHAT_SUPPORTED ) {
|
if ( BuildConstants.CHAT_SUPPORTED ) {
|
||||||
|
mEdit = (EditText)findViewById( R.id.chat_edit );
|
||||||
|
mEdit.addTextChangedListener( new TextWatcher() {
|
||||||
|
public void afterTextChanged( Editable s ) {
|
||||||
|
invalidateOptionsMenuIf();
|
||||||
|
}
|
||||||
|
public void beforeTextChanged( CharSequence s, int st,
|
||||||
|
int cnt, int a ) {}
|
||||||
|
public void onTextChanged( CharSequence s, int start,
|
||||||
|
int before, int count ) {}
|
||||||
|
} );
|
||||||
|
|
||||||
m_rowid = getIntent().getLongExtra( GameUtils.INTENT_KEY_ROWID, -1 );
|
m_rowid = getIntent().getLongExtra( GameUtils.INTENT_KEY_ROWID, -1 );
|
||||||
|
|
||||||
DBUtils.HistoryPair[] pairs = DBUtils.getChatHistory( m_activity, m_rowid );
|
DBUtils.HistoryPair[] pairs = DBUtils.getChatHistory( m_activity, m_rowid );
|
||||||
|
@ -82,6 +97,15 @@ public class ChatDelegate extends DelegateBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu( Menu menu )
|
||||||
|
{
|
||||||
|
String text = mEdit.getText().toString();
|
||||||
|
boolean haveText = null != text && 0 < text.length();
|
||||||
|
Utils.setItemVisible( menu, R.id.chat_menu_send, haveText );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected( MenuItem item )
|
public boolean onOptionsItemSelected( MenuItem item )
|
||||||
{
|
{
|
||||||
|
@ -93,8 +117,7 @@ public class ChatDelegate extends DelegateBase {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.chat_menu_send:
|
case R.id.chat_menu_send:
|
||||||
EditText edit = (EditText)findViewById( R.id.chat_edit );
|
String text = mEdit.getText().toString();
|
||||||
String text = edit.getText().toString();
|
|
||||||
if ( null == text || text.length() == 0 ) {
|
if ( null == text || text.length() == 0 ) {
|
||||||
setResult( Activity.RESULT_CANCELED );
|
setResult( Activity.RESULT_CANCELED );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1092,7 +1092,7 @@ considerMove( EngineCtxt* engine, Tile* tiles, XP_S16 tileLength,
|
||||||
}
|
}
|
||||||
} /* considerMove */
|
} /* considerMove */
|
||||||
|
|
||||||
static XP_Bool
|
static void
|
||||||
countWords( const XP_UCHAR* XP_UNUSED(word), XP_Bool isLegal,
|
countWords( const XP_UCHAR* XP_UNUSED(word), XP_Bool isLegal,
|
||||||
const DictionaryCtxt* XP_UNUSED(dict),
|
const DictionaryCtxt* XP_UNUSED(dict),
|
||||||
#ifdef XWFEATURE_BOARDWORDS
|
#ifdef XWFEATURE_BOARDWORDS
|
||||||
|
|
|
@ -2190,7 +2190,7 @@ typedef struct _FirstWordData {
|
||||||
XP_UCHAR word[32];
|
XP_UCHAR word[32];
|
||||||
} FirstWordData;
|
} FirstWordData;
|
||||||
|
|
||||||
static XP_Bool
|
static void
|
||||||
getFirstWord( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
|
getFirstWord( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
|
||||||
const DictionaryCtxt* XP_UNUSED(dict),
|
const DictionaryCtxt* XP_UNUSED(dict),
|
||||||
#ifdef XWFEATURE_BOARDWORDS
|
#ifdef XWFEATURE_BOARDWORDS
|
||||||
|
@ -2203,7 +2203,6 @@ getFirstWord( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
|
||||||
if ( '\0' == data->word[0] && '\0' != word[0] ) {
|
if ( '\0' == data->word[0] && '\0' != word[0] ) {
|
||||||
XP_STRCAT( data->word, word );
|
XP_STRCAT( data->word, word );
|
||||||
}
|
}
|
||||||
return XP_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2312,7 +2311,7 @@ typedef struct _ListWordsThroughInfo {
|
||||||
XP_U16 nWords;
|
XP_U16 nWords;
|
||||||
} ListWordsThroughInfo;
|
} ListWordsThroughInfo;
|
||||||
|
|
||||||
static XP_Bool
|
static void
|
||||||
listWordsThrough( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
|
listWordsThrough( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
|
||||||
const DictionaryCtxt* XP_UNUSED(dict),
|
const DictionaryCtxt* XP_UNUSED(dict),
|
||||||
const MoveInfo* movei, XP_U16 start, XP_U16 end,
|
const MoveInfo* movei, XP_U16 start, XP_U16 end,
|
||||||
|
@ -2330,8 +2329,6 @@ listWordsThrough( const XP_UCHAR* word, XP_Bool XP_UNUSED(isLegal),
|
||||||
if ( contained ) {
|
if ( contained ) {
|
||||||
appendWithCR( info->stream, word, &info->nWords );
|
appendWithCR( info->stream, word, &info->nWords );
|
||||||
}
|
}
|
||||||
|
|
||||||
return XP_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List every word played that includes the tile on {col,row}.
|
/* List every word played that includes the tile on {col,row}.
|
||||||
|
|
Loading…
Reference in a new issue