mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Do not use the new AttachmentsContentProvider for pulic URLs as used when attaching local files.
This commit is contained in:
@@ -225,19 +225,6 @@ public class AndroidUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isKeyboardShowed(View view) {
|
||||
if (view == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
InputMethodManager inputManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
return inputManager.isActive(view);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void hideKeyboard(View view) {
|
||||
if (view == null) {
|
||||
return;
|
||||
@@ -399,19 +386,6 @@ public class AndroidUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setProgressBarAnimationDuration(ProgressBar progressBar, int duration) {
|
||||
if (progressBar == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Field mCursorDrawableRes = ProgressBar.class.getDeclaredField("mDuration");
|
||||
mCursorDrawableRes.setAccessible(true);
|
||||
mCursorDrawableRes.setInt(progressBar, duration);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("messenger", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Intent createShortcutIntent(int did, Bitmap bitmap) {
|
||||
Intent shortcutIntent = new Intent(ApplicationLoader.applicationContext, OpenChatReceiver.class);
|
||||
|
||||
@@ -1000,13 +974,20 @@ public class AndroidUtilities {
|
||||
|
||||
public static void openForView(MessageObject message, Activity activity) throws Exception
|
||||
{
|
||||
String fileName = message.messageOwner.media.document.file_name;
|
||||
Uri toOpen = Uri.parse("content://" + BuildConfig.APPLICATION_ID + ".attachments/" + fileName);
|
||||
String path = message.messageOwner.media.document.mr_path;
|
||||
File file = new File(path);
|
||||
Uri uri;
|
||||
if( path.startsWith(MrMailbox.getBlobdir()) ) {
|
||||
uri = Uri.parse("content://" + BuildConfig.APPLICATION_ID + ".attachments/" + file.getName());
|
||||
}
|
||||
else {
|
||||
uri = Uri.fromFile(file);
|
||||
}
|
||||
|
||||
String mimeType = getMimetypeForView(message);
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(toOpen, mimeType);
|
||||
intent.setDataAndType(uri, mimeType);
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user