mirror of
https://github.com/gsantner/dandelion
synced 2024-11-24 21:32:07 +01:00
Update opoc
This commit is contained in:
parent
97d9bf434e
commit
e5866ffb2b
2 changed files with 21 additions and 1 deletions
|
@ -11,8 +11,10 @@
|
||||||
package net.gsantner.opoc.util;
|
package net.gsantner.opoc.util;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManager;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
@ -37,6 +39,8 @@ import android.view.inputmethod.InputMethodManager;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "rawtypes", "UnusedReturnValue"})
|
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "rawtypes", "UnusedReturnValue"})
|
||||||
public class ActivityUtils extends net.gsantner.opoc.util.ContextUtils {
|
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) {
|
} 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) {
|
if (isDirectory) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
} else {
|
} else {
|
||||||
pfd = _context.getContentResolver().openFileDescriptor(dof.getUri(), "rw");
|
pfd = _context.getContentResolver().openFileDescriptor(dof.getUri(), "rwt");
|
||||||
fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
|
fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue