1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-21 11:52:07 +01:00

Update opoc

This commit is contained in:
Gregor Santner 2021-01-18 21:32:50 +01:00
parent 97d9bf434e
commit e5866ffb2b
No known key found for this signature in database
GPG key ID: 161767F3E5A5E6CF
2 changed files with 21 additions and 1 deletions

View file

@ -11,8 +11,10 @@
package net.gsantner.opoc.util;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -37,6 +39,8 @@ import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.ScrollView;
import java.util.List;
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "rawtypes", "UnusedReturnValue"})
public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
@ -324,4 +328,20 @@ public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
} catch (Exception ignored) {
}
}
// Make activity/app not show up in the recents history - call before finish / System.exit
public ActivityUtils removeActivityFromHistory() {
try {
ActivityManager am = (ActivityManager) _activity.getSystemService(Context.ACTIVITY_SERVICE);
if (am != null && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
List<ActivityManager.AppTask> tasks = am.getAppTasks();
if (tasks != null && !tasks.isEmpty()) {
tasks.get(0).setExcludeFromRecents(true);
}
}
} catch (Exception ignored) {
}
return this;
}
}

View file

@ -1148,7 +1148,7 @@ public class ShareUtil {
if (isDirectory) {
// Nothing to do
} else {
pfd = _context.getContentResolver().openFileDescriptor(dof.getUri(), "rw");
pfd = _context.getContentResolver().openFileDescriptor(dof.getUri(), "rwt");
fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
}
}