Unverified Commit e5866ffb authored by gsantner's avatar gsantner 🦀
Browse files

Update opoc

parent 97d9bf43
......@@ -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;
}
}
......@@ -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());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment