Unverified Commit 0f6b1c3e authored by gsantner's avatar gsantner 🦀
Browse files

Update opoc

parent a686fea1
......@@ -144,8 +144,10 @@ public class ShareUtil {
* @param chooserText The title text for the chooser, or null for default
*/
public void showChooser(final Intent intent, final String chooserText) {
_context.startActivity(Intent.createChooser(intent,
chooserText != null ? chooserText : _chooserTitle));
try {
_context.startActivity(Intent.createChooser(intent, chooserText != null ? chooserText : _chooserTitle));
} catch (Exception ignored) {
}
}
/**
......@@ -445,7 +447,10 @@ public class ShareUtil {
android.content.ClipboardManager cm = ((android.content.ClipboardManager) _context.getSystemService(Context.CLIPBOARD_SERVICE));
if (cm != null) {
ClipData clip = ClipData.newPlainText(_context.getPackageName(), text);
cm.setPrimaryClip(clip);
try {
cm.setPrimaryClip(clip);
} catch (Exception ignored) {
}
return true;
}
}
......@@ -566,19 +571,13 @@ public class ShareUtil {
}
}
// external/ prefix for External storage
if (fileStr.startsWith((tmps = "external/"))) {
File f = new File(Uri.decode(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + fileStr.substring(tmps.length())));
if (f.exists()) {
return f;
}
}
// media/ prefix for External storage
if (fileStr.startsWith((tmps = "media/"))) {
File f = new File(Uri.decode(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + fileStr.substring(tmps.length())));
if (f.exists()) {
return f;
// prefix for External storage (/storage/emulated/0 /// /sdcard/) --> e.g. "content://com.amaze.filemanager/storage_root/file.txt" = "/sdcard/file.txt"
for (String prefix : new String[]{"external/", "media/", "storage_root/"}) {
if (fileStr.startsWith((tmps = prefix))) {
File f = new File(Uri.decode(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + fileStr.substring(tmps.length())));
if (f.exists()) {
return f;
}
}
}
......@@ -1096,7 +1095,11 @@ public class ShareUtil {
for (int i = 0; i < parts.length; i++) {
DocumentFile nextDof = dof.findFile(parts[i]);
if (nextDof == null) {
nextDof = ((i < parts.length - 1) || isDir) ? dof.createDirectory(parts[i]) : dof.createFile("image", parts[i]);
try {
nextDof = ((i < parts.length - 1) || isDir) ? dof.createDirectory(parts[i]) : dof.createFile("image", parts[i]);
} catch (Exception ignored) {
nextDof = null;
}
}
dof = nextDof;
}
......
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