mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Refactoring
This commit is contained in:
parent
582da4f853
commit
ddf193cce4
2 changed files with 11 additions and 10 deletions
|
@ -19,8 +19,6 @@ package eu.faircode.email;
|
|||
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -34,7 +32,6 @@ import androidx.fragment.app.FragmentManager;
|
|||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ActivityCompose extends ActivityBase implements FragmentManager.OnBackStackChangedListener {
|
||||
|
@ -88,13 +85,7 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|||
Bundle args;
|
||||
String action = intent.getAction();
|
||||
if (isShared(action)) {
|
||||
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (am != null) {
|
||||
List<ActivityManager.AppTask> tasks = am.getAppTasks();
|
||||
if (tasks != null && tasks.size() > 0) {
|
||||
tasks.get(0).setExcludeFromRecents(true);
|
||||
}
|
||||
}
|
||||
Helper.excludeFromRecents(this);
|
||||
|
||||
args = new Bundle();
|
||||
args.putString("action", "new");
|
||||
|
|
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
|||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
|
@ -765,6 +766,15 @@ public class Helper {
|
|||
ToastEx.makeText(context, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
static void excludeFromRecents(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (am != null) {
|
||||
List<ActivityManager.AppTask> tasks = am.getAppTasks();
|
||||
if (tasks != null && tasks.size() > 0)
|
||||
tasks.get(0).setExcludeFromRecents(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Graphics
|
||||
|
||||
static int dp2pixels(Context context, int dp) {
|
||||
|
|
Loading…
Reference in a new issue