Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
05471c43
Commit
05471c43
authored
Apr 04, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed sharing gif files from gallery
parent
ec533c5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
41 deletions
+51
-41
build.gradle
TMessagesProj/build.gradle
+1
-1
Utilities.java
...sProj/src/main/java/org/telegram/messenger/Utilities.java
+39
-36
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+7
-2
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+4
-2
No files found.
TMessagesProj/build.gradle
View file @
05471c43
...
...
@@ -82,7 +82,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
19
versionCode
22
0
versionCode
22
1
versionName
"1.4.10"
}
}
TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
View file @
05471c43
...
...
@@ -684,46 +684,49 @@ public class Utilities {
}
public
static
String
getPath
(
final
Uri
uri
)
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
ApplicationLoader
.
applicationContext
,
uri
))
{
if
(
isExternalStorageDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
type
=
split
[
0
];
if
(
"primary"
.
equalsIgnoreCase
(
type
))
{
return
Environment
.
getExternalStorageDirectory
()
+
"/"
+
split
[
1
];
}
}
else
if
(
isDownloadsDocument
(
uri
))
{
final
String
id
=
DocumentsContract
.
getDocumentId
(
uri
);
final
Uri
contentUri
=
ContentUris
.
withAppendedId
(
Uri
.
parse
(
"content://downloads/public_downloads"
),
Long
.
valueOf
(
id
));
return
getDataColumn
(
ApplicationLoader
.
applicationContext
,
contentUri
,
null
,
null
);
}
else
if
(
isMediaDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
type
=
split
[
0
];
Uri
contentUri
=
null
;
if
(
"image"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"video"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"audio"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
;
}
try
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
ApplicationLoader
.
applicationContext
,
uri
))
{
if
(
isExternalStorageDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
type
=
split
[
0
];
if
(
"primary"
.
equalsIgnoreCase
(
type
))
{
return
Environment
.
getExternalStorageDirectory
()
+
"/"
+
split
[
1
];
}
}
else
if
(
isDownloadsDocument
(
uri
))
{
final
String
id
=
DocumentsContract
.
getDocumentId
(
uri
);
final
Uri
contentUri
=
ContentUris
.
withAppendedId
(
Uri
.
parse
(
"content://downloads/public_downloads"
),
Long
.
valueOf
(
id
));
return
getDataColumn
(
ApplicationLoader
.
applicationContext
,
contentUri
,
null
,
null
);
}
else
if
(
isMediaDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
type
=
split
[
0
];
Uri
contentUri
=
null
;
if
(
"image"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"video"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"audio"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
;
}
final
String
selection
=
"_id=?"
;
final
String
[]
selectionArgs
=
new
String
[]
{
split
[
1
]
};
final
String
selection
=
"_id=?"
;
final
String
[]
selectionArgs
=
new
String
[]
{
split
[
1
]
};
return
getDataColumn
(
ApplicationLoader
.
applicationContext
,
contentUri
,
selection
,
selectionArgs
);
return
getDataColumn
(
ApplicationLoader
.
applicationContext
,
contentUri
,
selection
,
selectionArgs
);
}
}
else
if
(
"content"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
getDataColumn
(
ApplicationLoader
.
applicationContext
,
uri
,
null
,
null
);
}
else
if
(
"file"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
uri
.
getPath
();
}
}
else
if
(
"content"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
getDataColumn
(
ApplicationLoader
.
applicationContext
,
uri
,
null
,
null
);
}
else
if
(
"file"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
uri
.
getPath
();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
return
null
;
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
05471c43
...
...
@@ -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
;
}
processSendingPhoto
(
null
,
data
.
getData
());
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
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
05471c43
...
...
@@ -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
>();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment