When rematching an Archived game save in default new-game group

This commit is contained in:
Eric House 2019-01-08 09:39:58 -08:00
parent db641c4664
commit c87161307c
3 changed files with 14 additions and 3 deletions

View file

@ -2650,9 +2650,7 @@ public class BoardDelegate extends DelegateBase
private boolean inArchiveGroup() private boolean inArchiveGroup()
{ {
String archiveName = LocUtils long archiveGroup = DBUtils.getArchiveGroup( m_activity );
.getString( m_activity, R.string.group_name_archive );
long archiveGroup = DBUtils.getGroup( m_activity, archiveName );
long curGroup = DBUtils.getGroupForGame( m_activity, m_rowid ); long curGroup = DBUtils.getGroupForGame( m_activity, m_rowid );
return curGroup == archiveGroup; return curGroup == archiveGroup;
} }

View file

@ -1791,6 +1791,14 @@ public class DBUtils {
invalGroupsCache(); invalGroupsCache();
} }
public static long getArchiveGroup( Context context )
{
String archiveName = LocUtils
.getString( context, R.string.group_name_archive );
long archiveGroup = getGroup( context, archiveName );
return archiveGroup;
}
// Change group id of a game // Change group id of a game
public static void moveGame( Context context, long rowid, long groupID ) public static void moveGame( Context context, long rowid, long groupID )
{ {

View file

@ -2246,7 +2246,12 @@ public class GamesListDelegate extends ListDelegateBase
int lang = extras.getInt( REMATCH_LANG_EXTRA, -1 ); int lang = extras.getInt( REMATCH_LANG_EXTRA, -1 );
String json = extras.getString( REMATCH_PREFS_EXTRA ); String json = extras.getString( REMATCH_PREFS_EXTRA );
// Don't save rematch in Archive group
long groupID = DBUtils.getGroupForGame( m_activity, srcRowID ); long groupID = DBUtils.getGroupForGame( m_activity, srcRowID );
if ( groupID == DBUtils.getArchiveGroup( m_activity ) ) {
groupID = XWPrefs.getDefaultNewGameGroup( m_activity );
}
newid = GameUtils.makeNewMultiGame( m_activity, groupID, dict, newid = GameUtils.makeNewMultiGame( m_activity, groupID, dict,
lang, json, addrs, gameName ); lang, json, addrs, gameName );
DBUtils.addRematchInfo( m_activity, newid, btAddr, phone, DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,