From c87161307c07a71e2e9a27709d6df145871f043f Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 8 Jan 2019 09:39:58 -0800 Subject: [PATCH] When rematching an Archived game save in default new-game group --- .../main/java/org/eehouse/android/xw4/BoardDelegate.java | 4 +--- .../src/main/java/org/eehouse/android/xw4/DBUtils.java | 8 ++++++++ .../java/org/eehouse/android/xw4/GamesListDelegate.java | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index b71fb3592..b2a8c3bf1 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -2650,9 +2650,7 @@ public class BoardDelegate extends DelegateBase private boolean inArchiveGroup() { - String archiveName = LocUtils - .getString( m_activity, R.string.group_name_archive ); - long archiveGroup = DBUtils.getGroup( m_activity, archiveName ); + long archiveGroup = DBUtils.getArchiveGroup( m_activity ); long curGroup = DBUtils.getGroupForGame( m_activity, m_rowid ); return curGroup == archiveGroup; } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index e0f9a1438..d4ff2b8e2 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -1791,6 +1791,14 @@ public class DBUtils { 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 public static void moveGame( Context context, long rowid, long groupID ) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java index 675c25ea4..6dfe22f22 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/GamesListDelegate.java @@ -2246,7 +2246,12 @@ public class GamesListDelegate extends ListDelegateBase int lang = extras.getInt( REMATCH_LANG_EXTRA, -1 ); String json = extras.getString( REMATCH_PREFS_EXTRA ); + // Don't save rematch in Archive group 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, lang, json, addrs, gameName ); DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,