mirror of https://github.com/M66B/FairEmail.git
Fixed clear for Android 14
This commit is contained in:
parent
6bda014ba4
commit
415c5d189b
|
@ -19,6 +19,7 @@ package eu.faircode.email;
|
|||
Copyright 2018-2023 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -60,4 +61,9 @@ public class ActivityClear extends ActivityBase {
|
|||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
}
|
||||
|
||||
static PendingIntent getPendingIntent(Context context) {
|
||||
return PendingIntentCompat.getActivity(
|
||||
context, 0, getIntent(context), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,13 @@ import android.os.Build;
|
|||
@TargetApi(Build.VERSION_CODES.N)
|
||||
public class ServiceTileClear extends ServiceTileBase {
|
||||
public void onClick() {
|
||||
startActivityAndCollapse(ActivityClear.getIntent(this));
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
startActivityAndCollapse(ActivityClear.getIntent(this));
|
||||
else
|
||||
startActivityAndCollapse(ActivityClear.getPendingIntent(this));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue