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
6c4c5cf3
Commit
6c4c5cf3
authored
Oct 31, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
4ddfda63
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
235 additions
and
170 deletions
+235
-170
build.gradle
TMessagesProj/build.gradle
+1
-1
Android.mk
TMessagesProj/jni/Android.mk
+1
-1
image.c
TMessagesProj/jni/image.c
+52
-53
libtmessages.2.so
TMessagesProj/libs/armeabi-v7a/libtmessages.2.so
+0
-0
libtmessages.2.so
TMessagesProj/libs/armeabi/libtmessages.2.so
+0
-0
libtmessages.2.so
TMessagesProj/libs/x86/libtmessages.2.so
+0
-0
Emoji.java
TMessagesProj/src/main/java/org/telegram/android/Emoji.java
+51
-67
NativeLoader.java
...Proj/src/main/java/org/telegram/android/NativeLoader.java
+1
-1
FastDateParser.java
...c/main/java/org/telegram/android/time/FastDateParser.java
+34
-1
Utilities.java
...sProj/src/main/java/org/telegram/messenger/Utilities.java
+2
-1
ApplicationLoader.java
...Proj/src/main/java/org/telegram/ui/ApplicationLoader.java
+7
-3
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+10
-2
PhotoViewer.java
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
+74
-38
ChatActivityEnterView.java
...ain/java/org/telegram/ui/Views/ChatActivityEnterView.java
+2
-2
No files found.
TMessagesProj/build.gradle
View file @
6c4c5cf3
...
...
@@ -80,7 +80,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
19
versionCode
37
7
versionCode
37
9
versionName
"1.9.7"
}
}
TMessagesProj/jni/Android.mk
View file @
6c4c5cf3
...
...
@@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := tmessages.
1
LOCAL_MODULE := tmessages.
2
LOCAL_CFLAGS := -w -std=gnu99 -O2 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -DHAVE_STRCHRNUL=0
...
...
TMessagesProj/jni/image.c
View file @
6c4c5cf3
...
...
@@ -229,23 +229,23 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_blurBitmap(JNIEnv *env, jcl
AndroidBitmap_unlockPixels
(
env
,
bitmap
);
}
JNIEXPORT
void
Java_org_telegram_messenger_Utilities_loadBitmap
(
JNIEnv
*
env
,
jclass
class
,
jstring
path
,
j
intArray
bitmap
,
int
scale
,
int
format
,
int
width
,
int
height
)
{
JNIEXPORT
void
Java_org_telegram_messenger_Utilities_loadBitmap
(
JNIEnv
*
env
,
jclass
class
,
jstring
path
,
j
object
bitmap
,
int
scale
)
{
AndroidBitmapInfo
info
;
int
i
;
char
*
fileName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
path
,
NULL
);
FILE
*
infile
;
if
((
infile
=
fopen
(
fileName
,
"rb"
)))
{
struct
my_error_mgr
jerr
;
struct
jpeg_decompress_struct
cinfo
;
cinfo
.
err
=
jpeg_std_error
(
&
jerr
.
pub
);
jerr
.
pub
.
error_exit
=
my_error_exit
;
if
((
i
=
AndroidBitmap_getInfo
(
env
,
bitmap
,
&
info
))
>=
0
)
{
char
*
fileName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
path
,
NULL
);
FILE
*
infile
;
if
(
!
setjmp
(
jerr
.
setjmp_buffer
))
{
unsigned
char
*
bitmapBuf
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
bitmap
,
0
);
if
(
bitmapBuf
)
{
if
((
infile
=
fopen
(
fileName
,
"rb"
)))
{
struct
my_error_mgr
jerr
;
struct
jpeg_decompress_struct
cinfo
;
cinfo
.
err
=
jpeg_std_error
(
&
jerr
.
pub
);
jerr
.
pub
.
error_exit
=
my_error_exit
;
if
(
!
setjmp
(
jerr
.
setjmp_buffer
))
{
jpeg_create_decompress
(
&
cinfo
);
jpeg_stdio_src
(
&
cinfo
,
infile
);
...
...
@@ -257,60 +257,59 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
jpeg_start_decompress
(
&
cinfo
);
int
row_stride
=
cinfo
.
output_width
*
cinfo
.
output_components
;
JSAMPARRAY
buffer
=
(
*
cinfo
.
mem
->
alloc_sarray
)
((
j_common_ptr
)
&
cinfo
,
JPOOL_IMAGE
,
row_stride
,
1
);
int
stride
=
width
;
if
(
format
==
0
)
{
stride
*=
4
;
}
else
if
(
format
==
1
)
{
stride
*=
2
;
}
unsigned
char
*
pixels
=
bitmapBuf
;
int
rowCount
=
min
(
cinfo
.
output_height
,
height
);
int
colCount
=
min
(
cinfo
.
output_width
,
width
);
while
(
cinfo
.
output_scanline
<
rowCount
)
{
jpeg_read_scanlines
(
&
cinfo
,
buffer
,
1
);
unsigned
char
*
pixels
;
if
((
i
=
AndroidBitmap_lockPixels
(
env
,
bitmap
,
&
pixels
))
>=
0
)
{
int
rowCount
=
min
(
cinfo
.
output_height
,
info
.
height
);
int
colCount
=
min
(
cinfo
.
output_width
,
info
.
width
);
if
(
format
==
0
)
{
if
(
cinfo
.
out_color_space
==
JCS_GRAYSCALE
)
{
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
float
alpha
=
buffer
[
0
][
i
]
/
255
.
0
f
;
pixels
[
i
*
4
]
*=
alpha
;
pixels
[
i
*
4
+
1
]
*=
alpha
;
pixels
[
i
*
4
+
2
]
*=
alpha
;
pixels
[
i
*
4
+
3
]
=
buffer
[
0
][
i
];
}
}
else
{
int
c
=
0
;
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
pixels
[
i
*
4
]
=
buffer
[
0
][
i
*
3
+
2
];
pixels
[
i
*
4
+
1
]
=
buffer
[
0
][
i
*
3
+
1
];
pixels
[
i
*
4
+
2
]
=
buffer
[
0
][
i
*
3
];
pixels
[
i
*
4
+
3
]
=
255
;
c
+=
4
;
while
(
cinfo
.
output_scanline
<
rowCount
)
{
jpeg_read_scanlines
(
&
cinfo
,
buffer
,
1
);
if
(
info
.
format
==
ANDROID_BITMAP_FORMAT_RGBA_8888
)
{
if
(
cinfo
.
out_color_space
==
JCS_GRAYSCALE
)
{
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
float
alpha
=
buffer
[
0
][
i
]
/
255
.
0
f
;
pixels
[
i
*
4
]
*=
alpha
;
pixels
[
i
*
4
+
1
]
*=
alpha
;
pixels
[
i
*
4
+
2
]
*=
alpha
;
pixels
[
i
*
4
+
3
]
=
buffer
[
0
][
i
];
}
}
else
{
int
c
=
0
;
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
pixels
[
i
*
4
]
=
buffer
[
0
][
i
*
3
];
pixels
[
i
*
4
+
1
]
=
buffer
[
0
][
i
*
3
+
1
];
pixels
[
i
*
4
+
2
]
=
buffer
[
0
][
i
*
3
+
2
];
pixels
[
i
*
4
+
3
]
=
255
;
c
+=
4
;
}
}
}
else
if
(
info
.
format
==
ANDROID_BITMAP_FORMAT_RGB_565
)
{
}
}
else
if
(
format
==
1
)
{
pixels
+=
info
.
stride
;
}
pixels
+=
stride
;
AndroidBitmap_unlockPixels
(
env
,
bitmap
);
}
else
{
throwException
(
env
,
"AndroidBitmap_lockPixels() failed ! error=%d"
,
i
);
}
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
bitmap
,
bitmapBuf
,
0
);
jpeg_finish_decompress
(
&
cinfo
);
}
else
{
throwException
(
env
,
"
can't get bitmap buff
"
);
throwException
(
env
,
"
the JPEG code has signaled an error
"
);
}
jpeg_destroy_decompress
(
&
cinfo
);
fclose
(
infile
);
}
else
{
throwException
(
env
,
"
the JPEG code has signaled an error"
);
throwException
(
env
,
"
can't open %s"
,
fileName
);
}
jpeg_destroy_decompress
(
&
cinfo
);
fclose
(
infile
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
path
,
fileName
);
}
else
{
throwException
(
env
,
"
can't open %s"
,
fileName
);
throwException
(
env
,
"
AndroidBitmap_getInfo() failed ! error=%d"
,
i
);
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
path
,
fileName
);
}
TMessagesProj/libs/armeabi-v7a/libtmessages.
1
.so
→
TMessagesProj/libs/armeabi-v7a/libtmessages.
2
.so
View file @
6c4c5cf3
No preview for this file type
TMessagesProj/libs/armeabi/libtmessages.
1
.so
→
TMessagesProj/libs/armeabi/libtmessages.
2
.so
View file @
6c4c5cf3
No preview for this file type
TMessagesProj/libs/x86/libtmessages.
1
.so
→
TMessagesProj/libs/x86/libtmessages.
2
.so
View file @
6c4c5cf3
No preview for this file type
TMessagesProj/src/main/java/org/telegram/android/Emoji.java
View file @
6c4c5cf3
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/android/NativeLoader.java
View file @
6c4c5cf3
...
...
@@ -23,7 +23,7 @@ import java.util.zip.ZipFile;
public
class
NativeLoader
{
private
final
static
int
LIB_VERSION
=
1
;
private
final
static
int
LIB_VERSION
=
2
;
private
final
static
String
LIB_NAME
=
"tmessages."
+
LIB_VERSION
;
private
final
static
String
LIB_SO_NAME
=
"lib"
+
LIB_NAME
+
".so"
;
private
final
static
String
LOCALE_LIB_SO_NAME
=
"lib"
+
LIB_NAME
+
"loc.so"
;
...
...
TMessagesProj/src/main/java/org/telegram/android/time/FastDateParser.java
View file @
6c4c5cf3
...
...
@@ -25,6 +25,7 @@ import java.text.ParsePosition;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
...
...
@@ -371,6 +372,38 @@ public class FastDateParser implements DateParser, Serializable {
return
regex
;
}
private
static
String
[]
getDisplayNameArray
(
int
field
,
boolean
isLong
,
Locale
locale
)
{
DateFormatSymbols
dfs
=
new
DateFormatSymbols
(
locale
);
switch
(
field
)
{
case
Calendar
.
AM_PM
:
return
dfs
.
getAmPmStrings
();
case
Calendar
.
DAY_OF_WEEK
:
return
isLong
?
dfs
.
getWeekdays
()
:
dfs
.
getShortWeekdays
();
case
Calendar
.
ERA
:
return
dfs
.
getEras
();
case
Calendar
.
MONTH
:
return
isLong
?
dfs
.
getMonths
()
:
dfs
.
getShortMonths
();
}
return
null
;
}
private
static
void
insertValuesInMap
(
Map
<
String
,
Integer
>
map
,
String
[]
values
)
{
if
(
values
==
null
)
{
return
;
}
for
(
int
i
=
0
;
i
<
values
.
length
;
++
i
)
{
if
(
values
[
i
]
!=
null
&&
values
[
i
].
length
()
>
0
)
{
map
.
put
(
values
[
i
],
i
);
}
}
}
private
static
Map
<
String
,
Integer
>
getDisplayNames
(
int
field
,
Locale
locale
)
{
Map
<
String
,
Integer
>
result
=
new
HashMap
<
String
,
Integer
>();
insertValuesInMap
(
result
,
getDisplayNameArray
(
field
,
false
,
locale
));
insertValuesInMap
(
result
,
getDisplayNameArray
(
field
,
true
,
locale
));
return
result
.
isEmpty
()
?
null
:
result
;
}
/**
* Get the short and long values displayed for a field
...
...
@@ -381,7 +414,7 @@ public class FastDateParser implements DateParser, Serializable {
* @return A Map of the field key / value pairs
*/
private
static
Map
<
String
,
Integer
>
getDisplayNames
(
final
int
field
,
final
Calendar
definingCalendar
,
final
Locale
locale
)
{
return
definingCalendar
.
getDisplayNames
(
field
,
Calendar
.
ALL_STYLES
,
locale
);
return
getDisplayNames
(
field
,
locale
);
}
/**
...
...
TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
View file @
6c4c5cf3
...
...
@@ -14,6 +14,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.database.Cursor
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Environment
;
...
...
@@ -107,7 +108,7 @@ public class Utilities {
}
public
native
static
long
doPQNative
(
long
_what
);
public
native
static
void
loadBitmap
(
String
path
,
int
[]
bitmap
,
int
scale
,
int
format
,
int
width
,
int
height
);
public
native
static
void
loadBitmap
(
String
path
,
Bitmap
bitmap
,
int
scale
);
public
native
static
void
blurBitmap
(
Object
bitmap
,
int
radius
);
public
native
static
int
convertVideoFrame
(
ByteBuffer
src
,
ByteBuffer
dest
,
int
destFormat
,
int
width
,
int
height
,
int
padding
,
int
swap
);
private
native
static
void
aesIgeEncryption
(
ByteBuffer
buffer
,
byte
[]
key
,
byte
[]
iv
,
boolean
encrypt
,
int
offset
,
int
length
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java
View file @
6c4c5cf3
...
...
@@ -21,6 +21,7 @@ import android.content.pm.PackageManager;
import
android.content.res.Configuration
;
import
android.graphics.drawable.Drawable
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.PowerManager
;
...
...
@@ -112,14 +113,17 @@ public class ApplicationLoader extends Application {
@Override
public
void
onCreate
()
{
super
.
onCreate
();
if
(
Build
.
VERSION
.
SDK_INT
<
11
)
{
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv4Stack"
,
"true"
);
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv6Addresses"
,
"false"
);
}
applicationContext
=
getApplicationContext
();
NativeLoader
.
initNativeLibs
(
ApplicationLoader
.
applicationContext
);
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv4Stack"
,
"true"
);
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv6Addresses"
,
"false"
);
startPushService
();
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
6c4c5cf3
...
...
@@ -1321,7 +1321,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return
5
;
}
}
//return 4;
if
(
messageObject
.
messageOwner
.
ttl
<=
0
)
{
return
4
;
}
}
}
return
2
;
...
...
@@ -2667,7 +2669,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
else
{
if
(
i
==
0
)
{
processSelectedOption
(
4
);
}
else
if
(
i
==
1
)
{
processSelectedOption
(
1
);
}
...
...
@@ -2768,6 +2770,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
else
if
(
option
==
4
)
{
String
fileName
=
selectedObject
.
getFileName
();
String
path
=
selectedObject
.
messageOwner
.
attachPath
;
if
(
path
!=
null
&&
path
.
length
()
>
0
)
{
File
temp
=
new
File
(
path
);
if
(!
temp
.
exists
())
{
path
=
null
;
}
}
if
(
path
==
null
||
path
.
length
()
==
0
)
{
path
=
FileLoader
.
getPathToMessage
(
selectedObject
.
messageOwner
).
toString
();
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
View file @
6c4c5cf3
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java
View file @
6c4c5cf3
...
...
@@ -319,9 +319,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
public
boolean
processSendingText
(
String
text
)
{
text
=
getTrimmedString
(
text
);
if
(
text
.
length
()
!=
0
)
{
int
count
=
(
int
)
Math
.
ceil
(
text
.
length
()
/
2048
.0f
);
int
count
=
(
int
)
Math
.
ceil
(
text
.
length
()
/
4096
.0f
);
for
(
int
a
=
0
;
a
<
count
;
a
++)
{
String
mess
=
text
.
substring
(
a
*
2048
,
Math
.
min
((
a
+
1
)
*
2048
,
text
.
length
()));
String
mess
=
text
.
substring
(
a
*
4096
,
Math
.
min
((
a
+
1
)
*
4096
,
text
.
length
()));
SendMessagesHelper
.
getInstance
().
sendMessage
(
mess
,
dialog_id
);
}
return
true
;
...
...
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