Merge branch 'android_beta_106_branch' into android_branch

Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatDelegate.java
This commit is contained in:
Eric House 2016-03-13 17:16:47 -07:00
commit 61ff6a6c33
13 changed files with 359 additions and 339 deletions

View file

@ -18,3 +18,4 @@ obj
proguard.cfg
res/drawable*/*gen.png
.idea/
*.iml

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="99"
android:versionCode="100"
android:versionName="@string/app_version"
>

View file

@ -19,7 +19,7 @@ android {
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 22
targetSdkVersion 19
}
// Rename all output artifacts to include version information

File diff suppressed because it is too large Load diff

View file

@ -13,10 +13,9 @@
</style>
</head>
<body>
<h2>Crosswords 4.4.105 release</h2>
<h2>Crosswords 4.4.106 release</h2>
<p>This release fixes a problem with rematches not preserving game
settings like "Allow hints."</p>
<p>This version improves chat display and battery life</p>
<div id="survey">
<p>Please <a href="https://www.surveymonkey.com/s/GX3XLHR">take
@ -26,11 +25,11 @@
<h3>New with this release</h3>
<ul>
<li>When creating a game to rematch, preserve the original's
settings for hints, board size, timer and phonies</li>
<li>Fix tiles left of tray divider sometimes being included in hints</li>
<li>Unless "View tiles out-of-turn" is enabled, show summary of
last move when scoreboard entry is tapped</li>
<li>Reduce power usage by combining all green-to-red turn-length
timers into one</li>
<li>Include player names in chat display</li>
<li>Revert recent change preventing multiple checks in SMS and
Bluetooth invitation dialogs</li>
</ul>
<p>(The full changelog
@ -38,6 +37,8 @@
<h3>Next up</h3>
<ul>
<li>More chat improvements, especially allowing to send and
receive without closing the chat window</li>
<li>Take advantage of Marshmallow's new permissions model (where
the app only asks for them when it needs them.)
</ul>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_version">4.4.105</string>
<string name="app_version">4.4.106</string>
</resources>

View file

@ -2020,6 +2020,7 @@
<string name="menu_zoom">Zoom in/out</string>
<!-- -->
<string name="menu_chat">Chat</string>
<string name="chat_sender_fmt">%1$s:</string>
<!-- -->
<string name="menu_toggle_values">Toggle values</string>

View file

@ -1747,6 +1747,7 @@
<string name="menu_zoom">Mooz tuo/ni</string>
<!-- -->
<string name="menu_chat">Tahc</string>
<string name="chat_sender_fmt">%1$s:</string>
<!-- -->
<string name="menu_toggle_values">Elggot seulav</string>
<!-- board menu for small devices only -->

View file

@ -1747,6 +1747,7 @@
<string name="menu_zoom">ZOOM IN/OUT</string>
<!-- -->
<string name="menu_chat">CHAT</string>
<string name="chat_sender_fmt">%1$s:</string>
<!-- -->
<string name="menu_toggle_values">TOGGLE VALUES</string>
<!-- board menu for small devices only -->

View file

@ -120,7 +120,8 @@ public class ChatDelegate extends DelegateBase {
TextView view = (TextView)row.findViewById( R.id.chat_row_text );
view.setText( msg );
view = (TextView)row.findViewById( R.id.chat_row_name );
view.setText( m_names[playerIndx] );
view.setText( getString( R.string.chat_sender_fmt,
m_names[playerIndx] ) );
m_layout.addView( row );
scrollDown();

View file

@ -595,7 +595,7 @@ public class DBUtils {
}
private static void setInt( long rowid, String column, int value )
private static void setSummaryInt( long rowid, String column, int value )
{
ContentValues values = new ContentValues();
values.put( column, value );
@ -604,13 +604,13 @@ public class DBUtils {
public static void setMsgFlags( long rowid, int flags )
{
setInt( rowid, DBHelper.HASMSGS, flags );
setSummaryInt( rowid, DBHelper.HASMSGS, flags );
notifyListeners( rowid, GameChangeType.GAME_CHANGED );
}
public static void setExpanded( long rowid, boolean expanded )
{
setInt( rowid, DBHelper.CONTRACTED, expanded?0:1 );
setSummaryInt( rowid, DBHelper.CONTRACTED, expanded?0:1 );
}
private static int getInt( Context context, long rowid, String column,
@ -1186,11 +1186,15 @@ public class DBUtils {
HistoryPair[] result = null;
String oldHistory = getChatHistoryStr( context, rowid );
if ( null != oldHistory ) {
DbgUtils.logdf( "convertChatString(): got string: %s", oldHistory );
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
ArrayList<HistoryPair> pairs = new ArrayList<HistoryPair>();
String localPrefix = LocUtils.getString( context, R.string.chat_local_id );
String rmtPrefix = LocUtils.getString( context, R.string.chat_other_id );
DbgUtils.logdf( "convertChatString(): prefixes: \"%s\" and \"%s\"", localPrefix, rmtPrefix );
String[] msgs = oldHistory.split( "\n" );
DbgUtils.logdf( "convertChatString(): split into %d", msgs.length );
int localPlayerIndx = -1;
int remotePlayerIndx = -1;
for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) {
@ -1201,19 +1205,24 @@ public class DBUtils {
}
}
for ( String msg : msgs ) {
DbgUtils.logdf( "convertChatString(): msg: %s", msg );
int indx = -1;
String prefix = null;
if ( msg.startsWith( localPrefix ) ) {
DbgUtils.logdf( "convertChatString(): msg: %s starts with %s", msg, localPrefix );
prefix = localPrefix;
indx = localPlayerIndx;
} else if ( msg.startsWith( rmtPrefix ) ) {
DbgUtils.logdf( "convertChatString(): msg: %s starts with %s", msg, rmtPrefix );
prefix = rmtPrefix;
indx = remotePlayerIndx;
} else {
DbgUtils.logdf( "convertChatString(): msg: %s starts with neither", msg );
}
if ( -1 != indx ) {
DbgUtils.logf( "removing substring %s; was: %s", prefix, msg );
DbgUtils.logdf( "convertChatString(): removing substring %s; was: %s", prefix, msg );
msg = msg.substring( prefix.length(), msg.length() );
DbgUtils.logf( "removED substring; now %s", msg );
DbgUtils.logdf( "convertChatString(): removED substring; now %s", msg );
valuess.add( cvForChat( rowid, msg, indx ) );
HistoryPair pair = new HistoryPair(msg, indx );
@ -1223,7 +1232,7 @@ public class DBUtils {
result = pairs.toArray( new HistoryPair[pairs.size()] );
appendChatHistory( context, valuess );
// saveChatHistory( context, rowid, null );
// clearChatHistoryString( context, rowid );
}
return result;
}
@ -1781,6 +1790,14 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
db.delete( DBHelper.TABLE_NAME_CHAT, selection, null );
// for now, remove any old-format history too. Later when it's
// removed once converted (after that process is completely
// debugged), this can be removed.
ContentValues values = new ContentValues();
values.putNull( DBHelper.CHAT_HISTORY );
updateRowImpl( db, DBHelper.TABLE_NAME_SUM, rowid, values );
db.close();
}
}
@ -2427,20 +2444,12 @@ public class DBUtils {
BuildConstants.VARIANT );
}
// Chat is independent of the GameLock mechanism because it's not
// touching the SNAPSHOT column.
private static void saveChatHistory( Context context, long rowid,
String history )
{
ContentValues values = new ContentValues();
if ( null != history ) {
values.put( DBHelper.CHAT_HISTORY, history );
} else {
values.putNull( DBHelper.CHAT_HISTORY );
}
values.put( DBHelper.LASTPLAY_TIME, new Date().getTime() );
updateRow( context, DBHelper.TABLE_NAME_SUM, rowid, values );
}
// private static void clearChatHistoryString( Context context, long rowid )
// {
// ContentValues values = new ContentValues();
// values.putNull( DBHelper.CHAT_HISTORY );
// updateRow( context, DBHelper.TABLE_NAME_SUM, rowid, values );
// }
private static void initDB( Context context )
{
@ -2452,16 +2461,21 @@ public class DBUtils {
}
}
private static int updateRowImpl( SQLiteDatabase db, String table,
long rowid, ContentValues values )
{
String selection = String.format( ROW_ID_FMT, rowid );
return db.update( table, values, selection, null );
}
private static void updateRow( Context context, String table,
long rowid, ContentValues values )
{
String selection = String.format( ROW_ID_FMT, rowid );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
int result = db.update( table, values, selection, null );
int result = updateRowImpl( db, table, rowid, values );
db.close();
if ( 0 == result ) {
DbgUtils.logf( "updateRow failed" );

View file

@ -214,7 +214,7 @@ public class Utils {
PendingIntent.FLAG_ONE_SHOT );
Notification notification =
new Notification( R.drawable.notify, title,
new Notification( R.drawable.icon48x48, title,
System.currentTimeMillis() );
notification.flags |= Notification.FLAG_AUTO_CANCEL;