mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-07 20:46:17 +01:00
Merge branch 'from_android_beta_65' into android_branch
This commit is contained in:
commit
ae79da9842
3 changed files with 66 additions and 52 deletions
|
@ -12,8 +12,8 @@
|
||||||
<li>Fix menu missing on some tablets</li>
|
<li>Fix menu missing on some tablets</li>
|
||||||
|
|
||||||
<li>Disable in-game Chat feature. (It has bugs that cause games to
|
<li>Disable in-game Chat feature. (It has bugs that cause games to
|
||||||
stop syncing moves. I&ll fix eventually. Let me know if you
|
stop syncing moves. I'll fix eventually. Let me know if you
|
||||||
use this feature and I&ll up the priority.)</li>
|
use this feature and I'll up the priority.)</li>
|
||||||
|
|
||||||
<li>Fix crash triggered by resignation</li>
|
<li>Fix crash triggered by resignation</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class ChatActivity extends XWActivity implements View.OnClickListener {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate( Bundle savedInstanceState )
|
public void onCreate( Bundle savedInstanceState )
|
||||||
{
|
{
|
||||||
|
if ( XWApp.CHAT_SUPPORTED ) {
|
||||||
super.onCreate( savedInstanceState );
|
super.onCreate( savedInstanceState );
|
||||||
|
|
||||||
setContentView( R.layout.chat );
|
setContentView( R.layout.chat );
|
||||||
|
@ -48,12 +49,13 @@ public class ChatActivity extends XWActivity implements View.OnClickListener {
|
||||||
|
|
||||||
DBUtils.HistoryPair[] pairs = DBUtils.getChatHistory( this, m_rowid );
|
DBUtils.HistoryPair[] pairs = DBUtils.getChatHistory( this, m_rowid );
|
||||||
if ( null != pairs ) {
|
if ( null != pairs ) {
|
||||||
LinearLayout layout = (LinearLayout)findViewById( R.id.chat_history );
|
LinearLayout layout = (LinearLayout)
|
||||||
|
findViewById( R.id.chat_history );
|
||||||
LayoutInflater factory = LayoutInflater.from( this );
|
LayoutInflater factory = LayoutInflater.from( this );
|
||||||
|
|
||||||
for ( DBUtils.HistoryPair pair : pairs ) {
|
for ( DBUtils.HistoryPair pair : pairs ) {
|
||||||
TextView view =
|
TextView view = (TextView)factory
|
||||||
(TextView)factory.inflate( pair.sourceLocal
|
.inflate( pair.sourceLocal
|
||||||
? R.layout.chat_history_local
|
? R.layout.chat_history_local
|
||||||
: R.layout.chat_history_remote,
|
: R.layout.chat_history_remote,
|
||||||
null );
|
null );
|
||||||
|
@ -62,10 +64,15 @@ public class ChatActivity extends XWActivity implements View.OnClickListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
((Button)findViewById( R.id.send_button )).setOnClickListener( this );
|
((Button)findViewById( R.id.send_button ))
|
||||||
|
.setOnClickListener( this );
|
||||||
|
|
||||||
setTitle( getString( R.string.chat_titlef,
|
setTitle( getString( R.string.chat_titlef,
|
||||||
GameUtils.getName( this, m_rowid ) ) );
|
GameUtils.getName( this, m_rowid ) ) );
|
||||||
|
} else {
|
||||||
|
// Should really assert....
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -855,6 +855,7 @@ public class DBUtils {
|
||||||
public static HistoryPair[] getChatHistory( Context context, long rowid )
|
public static HistoryPair[] getChatHistory( Context context, long rowid )
|
||||||
{
|
{
|
||||||
HistoryPair[] result = null;
|
HistoryPair[] result = null;
|
||||||
|
if ( XWApp.CHAT_SUPPORTED ) {
|
||||||
final String localPrefix = context.getString( R.string.chat_local_id );
|
final String localPrefix = context.getString( R.string.chat_local_id );
|
||||||
String history = getChatHistoryStr( context, rowid );
|
String history = getChatHistoryStr( context, rowid );
|
||||||
if ( null != history ) {
|
if ( null != history ) {
|
||||||
|
@ -866,6 +867,7 @@ public class DBUtils {
|
||||||
result[ii] = new HistoryPair( msg, isLocal );
|
result[ii] = new HistoryPair( msg, isLocal );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,6 +1117,7 @@ public class DBUtils {
|
||||||
private static String getChatHistoryStr( Context context, long rowid )
|
private static String getChatHistoryStr( Context context, long rowid )
|
||||||
{
|
{
|
||||||
String result = null;
|
String result = null;
|
||||||
|
if ( XWApp.CHAT_SUPPORTED ) {
|
||||||
initDB( context );
|
initDB( context );
|
||||||
synchronized( s_dbHelper ) {
|
synchronized( s_dbHelper ) {
|
||||||
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
|
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
|
||||||
|
@ -1126,17 +1129,20 @@ public class DBUtils {
|
||||||
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
|
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
|
||||||
result =
|
result =
|
||||||
cursor.getString( cursor
|
cursor.getString( cursor
|
||||||
.getColumnIndex(DBHelper.CHAT_HISTORY));
|
.getColumnIndex(DBHelper
|
||||||
|
.CHAT_HISTORY));
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
db.close();
|
db.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void appendChatHistory( Context context, long rowid,
|
public static void appendChatHistory( Context context, long rowid,
|
||||||
String msg, boolean local )
|
String msg, boolean local )
|
||||||
{
|
{
|
||||||
|
if ( XWApp.CHAT_SUPPORTED ) {
|
||||||
Assert.assertNotNull( msg );
|
Assert.assertNotNull( msg );
|
||||||
int id = local ? R.string.chat_local_id : R.string.chat_other_id;
|
int id = local ? R.string.chat_local_id : R.string.chat_other_id;
|
||||||
msg = context.getString( id ) + msg;
|
msg = context.getString( id ) + msg;
|
||||||
|
@ -1147,6 +1153,7 @@ public class DBUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveChatHistory( context, rowid, msg );
|
saveChatHistory( context, rowid, msg );
|
||||||
|
}
|
||||||
} // appendChatHistory
|
} // appendChatHistory
|
||||||
|
|
||||||
public static void clearChatHistory( Context context, long rowid )
|
public static void clearChatHistory( Context context, long rowid )
|
||||||
|
|
Loading…
Add table
Reference in a new issue