mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
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:
parent
52d983e0d8
commit
51c7752830
1 changed files with 11 additions and 3 deletions
|
@ -2676,17 +2676,25 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
public static void onGameDictDownload( Context context, Intent intent )
|
public static void onGameDictDownload( Context context, Intent intent )
|
||||||
{
|
{
|
||||||
intent.setClass( context, MainActivity.class );
|
intent.setClass( context, MainActivity.class );
|
||||||
|
addLaunchFlags( intent );
|
||||||
context.startActivity( intent );
|
context.startActivity( intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Intent makeSelfIntent( Context context )
|
private static Intent makeSelfIntent( Context context )
|
||||||
{
|
{
|
||||||
Intent intent = new Intent( context, MainActivity.class )
|
Intent intent = new Intent( context, MainActivity.class );
|
||||||
.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP
|
addLaunchFlags( intent );
|
||||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP );
|
|
||||||
return 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 )
|
public static Intent makeBackgroundIntent( Context context )
|
||||||
{
|
{
|
||||||
return makeSelfIntent( context )
|
return makeSelfIntent( context )
|
||||||
|
|
Loading…
Reference in a new issue