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.
This commit is contained in:
Eric House 2019-01-21 16:50:26 -08:00
parent 52d983e0d8
commit 51c7752830

View file

@ -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 )