Commit 05471c43 authored by DrKLO's avatar DrKLO

Fixed sharing gif files from gallery

parent ec533c5f
......@@ -82,7 +82,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 220
versionCode 221
versionName "1.4.10"
}
}
......@@ -684,6 +684,7 @@ public class Utilities {
}
public static String getPath(final Uri uri) {
try {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
if (isKitKat && DocumentsContract.isDocumentUri(ApplicationLoader.applicationContext, uri)) {
if (isExternalStorageDocument(uri)) {
......@@ -723,7 +724,9 @@ public class Utilities {
} else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
return null;
}
......
......@@ -1535,10 +1535,15 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
processSendingPhoto(currentPicturePath, null);
currentPicturePath = null;
} else if (requestCode == 1) {
if (data == null) {
if (data == null || data.getData() == null) {
return;
}
String tempPath = Utilities.getPath(data.getData());
if (tempPath != null && tempPath.endsWith(".gif")) {
processSendingDocument(tempPath);
} else {
processSendingPhoto(null, data.getData());
}
} else if (requestCode == 2) {
String videoPath = null;
if (data != null) {
......
......@@ -329,7 +329,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
parcelable = Uri.parse(parcelable.toString());
}
if (parcelable != null && type != null && type.startsWith("image/")) {
if (type.equals("image/gif")) {
String tempPath = Utilities.getPath((Uri)parcelable);
if (type.equals("image/gif") || tempPath != null && tempPath.endsWith(".gif")) {
try {
documentPath = Utilities.getPath((Uri)parcelable);
} catch (Exception e) {
......@@ -371,7 +372,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
if (!(parcelable instanceof Uri)) {
parcelable = Uri.parse(parcelable.toString());
}
if (type.equals("image/gif")) {
String tempPath = Utilities.getPath((Uri)parcelable);
if (type.equals("image/gif") || tempPath != null && tempPath.endsWith(".gif")) {
if (documentsPathArray == null) {
documentsPathArray = new ArrayList<String>();
}
......
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