mirror of
https://github.com/gsantner/dandelion
synced 2024-11-24 05:12:09 +01:00
Update opoc
This commit is contained in:
parent
a686fea141
commit
0f6b1c3ec3
1 changed files with 20 additions and 17 deletions
|
@ -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);
|
||||
try {
|
||||
cm.setPrimaryClip(clip);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -566,20 +571,14 @@ public class ShareUtil {
|
|||
}
|
||||
}
|
||||
|
||||
// external/ prefix for External storage
|
||||
if (fileStr.startsWith((tmps = "external/"))) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Next/OwnCloud Fileprovider
|
||||
|
@ -1096,7 +1095,11 @@ public class ShareUtil {
|
|||
for (int i = 0; i < parts.length; i++) {
|
||||
DocumentFile nextDof = dof.findFile(parts[i]);
|
||||
if (nextDof == null) {
|
||||
try {
|
||||
nextDof = ((i < parts.length - 1) || isDir) ? dof.createDirectory(parts[i]) : dof.createFile("image", parts[i]);
|
||||
} catch (Exception ignored) {
|
||||
nextDof = null;
|
||||
}
|
||||
}
|
||||
dof = nextDof;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue