From 51c7752830c797ac2d9a9f9f978f6c12b8fd5117 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 21 Jan 2019 16:50:26 -0800 Subject: [PATCH] use same launch flags for all self-launches Launching a game in response to a wordlist it needing being downloaded went through a different Intent-creation path from the rest, and resulted in a second instance of the app showing in the launcher. This shoudl fix that. I don't *think* it's the only way I'm getting second instances or stacked GamesLists, but it should get fixed. --- .../org/eehouse/android/xw4/GamesListDelegate.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 2231c14ca..29dbb1fc0 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 @@ -2676,17 +2676,25 @@ public class GamesListDelegate extends ListDelegateBase public static void onGameDictDownload( Context context, Intent intent ) { intent.setClass( context, MainActivity.class ); + addLaunchFlags( intent ); context.startActivity( intent ); } private static Intent makeSelfIntent( Context context ) { - Intent intent = new Intent( context, MainActivity.class ) - .setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP - | Intent.FLAG_ACTIVITY_SINGLE_TOP ); + Intent intent = new Intent( context, MainActivity.class ); + addLaunchFlags( intent ); return intent; } + private static void addLaunchFlags( Intent intent ) + { + intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP + | Intent.FLAG_ACTIVITY_SINGLE_TOP ) + // FLAG_ACTIVITY_CLEAR_TASK -- don't think so + ; + } + public static Intent makeBackgroundIntent( Context context ) { return makeSelfIntent( context )