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 proguard.cfg
res/drawable*/*gen.png res/drawable*/*gen.png
.idea/ .idea/
*.iml

View file

@ -22,7 +22,7 @@
to come from a domain that you own or have control over. --> to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4" package="org.eehouse.android.xw4"
android:versionCode="99" android:versionCode="100"
android:versionName="@string/app_version" android:versionName="@string/app_version"
> >

View file

@ -19,7 +19,7 @@ android {
buildToolsVersion "22.0.1" buildToolsVersion "22.0.1"
defaultConfig { defaultConfig {
minSdkVersion 7 minSdkVersion 7
targetSdkVersion 22 targetSdkVersion 19
} }
// Rename all output artifacts to include version information // 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> </style>
</head> </head>
<body> <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 <p>This version improves chat display and battery life</p>
settings like "Allow hints."</p>
<div id="survey"> <div id="survey">
<p>Please <a href="https://www.surveymonkey.com/s/GX3XLHR">take <p>Please <a href="https://www.surveymonkey.com/s/GX3XLHR">take
@ -26,11 +25,11 @@
<h3>New with this release</h3> <h3>New with this release</h3>
<ul> <ul>
<li>When creating a game to rematch, preserve the original's <li>Reduce power usage by combining all green-to-red turn-length
settings for hints, board size, timer and phonies</li> timers into one</li>
<li>Fix tiles left of tray divider sometimes being included in hints</li> <li>Include player names in chat display</li>
<li>Unless "View tiles out-of-turn" is enabled, show summary of <li>Revert recent change preventing multiple checks in SMS and
last move when scoreboard entry is tapped</li> Bluetooth invitation dialogs</li>
</ul> </ul>
<p>(The full changelog <p>(The full changelog
@ -38,6 +37,8 @@
<h3>Next up</h3> <h3>Next up</h3>
<ul> <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 <li>Take advantage of Marshmallow's new permissions model (where
the app only asks for them when it needs them.) the app only asks for them when it needs them.)
</ul> </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"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_version">4.4.105</string> <string name="app_version">4.4.106</string>
</resources> </resources>

View file

@ -2020,6 +2020,7 @@
<string name="menu_zoom">Zoom in/out</string> <string name="menu_zoom">Zoom in/out</string>
<!-- --> <!-- -->
<string name="menu_chat">Chat</string> <string name="menu_chat">Chat</string>
<string name="chat_sender_fmt">%1$s:</string>
<!-- --> <!-- -->
<string name="menu_toggle_values">Toggle values</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_zoom">Mooz tuo/ni</string>
<!-- --> <!-- -->
<string name="menu_chat">Tahc</string> <string name="menu_chat">Tahc</string>
<string name="chat_sender_fmt">%1$s:</string>
<!-- --> <!-- -->
<string name="menu_toggle_values">Elggot seulav</string> <string name="menu_toggle_values">Elggot seulav</string>
<!-- board menu for small devices only --> <!-- board menu for small devices only -->

View file

@ -1747,6 +1747,7 @@
<string name="menu_zoom">ZOOM IN/OUT</string> <string name="menu_zoom">ZOOM IN/OUT</string>
<!-- --> <!-- -->
<string name="menu_chat">CHAT</string> <string name="menu_chat">CHAT</string>
<string name="chat_sender_fmt">%1$s:</string>
<!-- --> <!-- -->
<string name="menu_toggle_values">TOGGLE VALUES</string> <string name="menu_toggle_values">TOGGLE VALUES</string>
<!-- board menu for small devices only --> <!-- 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 ); TextView view = (TextView)row.findViewById( R.id.chat_row_text );
view.setText( msg ); view.setText( msg );
view = (TextView)row.findViewById( R.id.chat_row_name ); 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 ); m_layout.addView( row );
scrollDown(); 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(); ContentValues values = new ContentValues();
values.put( column, value ); values.put( column, value );
@ -604,13 +604,13 @@ public class DBUtils {
public static void setMsgFlags( long rowid, int flags ) public static void setMsgFlags( long rowid, int flags )
{ {
setInt( rowid, DBHelper.HASMSGS, flags ); setSummaryInt( rowid, DBHelper.HASMSGS, flags );
notifyListeners( rowid, GameChangeType.GAME_CHANGED ); notifyListeners( rowid, GameChangeType.GAME_CHANGED );
} }
public static void setExpanded( long rowid, boolean expanded ) 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, private static int getInt( Context context, long rowid, String column,
@ -1186,11 +1186,15 @@ public class DBUtils {
HistoryPair[] result = null; HistoryPair[] result = null;
String oldHistory = getChatHistoryStr( context, rowid ); String oldHistory = getChatHistoryStr( context, rowid );
if ( null != oldHistory ) { if ( null != oldHistory ) {
DbgUtils.logdf( "convertChatString(): got string: %s", oldHistory );
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>(); ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
ArrayList<HistoryPair> pairs = new ArrayList<HistoryPair>(); ArrayList<HistoryPair> pairs = new ArrayList<HistoryPair>();
String localPrefix = LocUtils.getString( context, R.string.chat_local_id ); String localPrefix = LocUtils.getString( context, R.string.chat_local_id );
String rmtPrefix = LocUtils.getString( context, R.string.chat_other_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" ); String[] msgs = oldHistory.split( "\n" );
DbgUtils.logdf( "convertChatString(): split into %d", msgs.length );
int localPlayerIndx = -1; int localPlayerIndx = -1;
int remotePlayerIndx = -1; int remotePlayerIndx = -1;
for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) { for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) {
@ -1201,19 +1205,24 @@ public class DBUtils {
} }
} }
for ( String msg : msgs ) { for ( String msg : msgs ) {
DbgUtils.logdf( "convertChatString(): msg: %s", msg );
int indx = -1; int indx = -1;
String prefix = null; String prefix = null;
if ( msg.startsWith( localPrefix ) ) { if ( msg.startsWith( localPrefix ) ) {
DbgUtils.logdf( "convertChatString(): msg: %s starts with %s", msg, localPrefix );
prefix = localPrefix; prefix = localPrefix;
indx = localPlayerIndx; indx = localPlayerIndx;
} else if ( msg.startsWith( rmtPrefix ) ) { } else if ( msg.startsWith( rmtPrefix ) ) {
DbgUtils.logdf( "convertChatString(): msg: %s starts with %s", msg, rmtPrefix );
prefix = rmtPrefix; prefix = rmtPrefix;
indx = remotePlayerIndx; indx = remotePlayerIndx;
} else {
DbgUtils.logdf( "convertChatString(): msg: %s starts with neither", msg );
} }
if ( -1 != indx ) { 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() ); 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 ) ); valuess.add( cvForChat( rowid, msg, indx ) );
HistoryPair pair = new HistoryPair(msg, indx ); HistoryPair pair = new HistoryPair(msg, indx );
@ -1223,7 +1232,7 @@ public class DBUtils {
result = pairs.toArray( new HistoryPair[pairs.size()] ); result = pairs.toArray( new HistoryPair[pairs.size()] );
appendChatHistory( context, valuess ); appendChatHistory( context, valuess );
// saveChatHistory( context, rowid, null ); // clearChatHistoryString( context, rowid );
} }
return result; return result;
} }
@ -1781,6 +1790,14 @@ public class DBUtils {
synchronized( s_dbHelper ) { synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase(); SQLiteDatabase db = s_dbHelper.getWritableDatabase();
db.delete( DBHelper.TABLE_NAME_CHAT, selection, null ); 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(); db.close();
} }
} }
@ -2427,20 +2444,12 @@ public class DBUtils {
BuildConstants.VARIANT ); BuildConstants.VARIANT );
} }
// Chat is independent of the GameLock mechanism because it's not // private static void clearChatHistoryString( Context context, long rowid )
// touching the SNAPSHOT column. // {
private static void saveChatHistory( Context context, long rowid, // ContentValues values = new ContentValues();
String history ) // values.putNull( DBHelper.CHAT_HISTORY );
{ // updateRow( context, DBHelper.TABLE_NAME_SUM, rowid, values );
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 initDB( Context context ) 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, private static void updateRow( Context context, String table,
long rowid, ContentValues values ) long rowid, ContentValues values )
{ {
String selection = String.format( ROW_ID_FMT, rowid );
initDB( context ); initDB( context );
synchronized( s_dbHelper ) { synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase(); SQLiteDatabase db = s_dbHelper.getWritableDatabase();
int result = updateRowImpl( db, table, rowid, values );
int result = db.update( table, values, selection, null );
db.close(); db.close();
if ( 0 == result ) { if ( 0 == result ) {
DbgUtils.logf( "updateRow failed" ); DbgUtils.logf( "updateRow failed" );

View file

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