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
Show 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 {
...
@@ -80,7 +80,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
37
7
versionCode
37
9
versionName
"1.9.7"
versionName
"1.9.7"
}
}
}
}
TMessagesProj/jni/Android.mk
View file @
6c4c5cf3
...
@@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
...
@@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
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 := -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 += -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
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,10 +229,12 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_blurBitmap(JNIEnv *env, jcl
...
@@ -229,10 +229,12 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_blurBitmap(JNIEnv *env, jcl
AndroidBitmap_unlockPixels
(
env
,
bitmap
);
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
;
int
i
;
if
((
i
=
AndroidBitmap_getInfo
(
env
,
bitmap
,
&
info
))
>=
0
)
{
char
*
fileName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
path
,
NULL
);
char
*
fileName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
path
,
NULL
);
FILE
*
infile
;
FILE
*
infile
;
...
@@ -244,8 +246,6 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
...
@@ -244,8 +246,6 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
jerr
.
pub
.
error_exit
=
my_error_exit
;
jerr
.
pub
.
error_exit
=
my_error_exit
;
if
(
!
setjmp
(
jerr
.
setjmp_buffer
))
{
if
(
!
setjmp
(
jerr
.
setjmp_buffer
))
{
unsigned
char
*
bitmapBuf
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
bitmap
,
0
);
if
(
bitmapBuf
)
{
jpeg_create_decompress
(
&
cinfo
);
jpeg_create_decompress
(
&
cinfo
);
jpeg_stdio_src
(
&
cinfo
,
infile
);
jpeg_stdio_src
(
&
cinfo
,
infile
);
...
@@ -257,22 +257,16 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
...
@@ -257,22 +257,16 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
jpeg_start_decompress
(
&
cinfo
);
jpeg_start_decompress
(
&
cinfo
);
int
row_stride
=
cinfo
.
output_width
*
cinfo
.
output_components
;
int
row_stride
=
cinfo
.
output_width
*
cinfo
.
output_components
;
JSAMPARRAY
buffer
=
(
*
cinfo
.
mem
->
alloc_sarray
)
((
j_common_ptr
)
&
cinfo
,
JPOOL_IMAGE
,
row_stride
,
1
);
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
);
unsigned
char
*
pixels
;
int
colCount
=
min
(
cinfo
.
output_width
,
width
);
if
((
i
=
AndroidBitmap_lockPixels
(
env
,
bitmap
,
&
pixels
))
>=
0
)
{
int
rowCount
=
min
(
cinfo
.
output_height
,
info
.
height
);
int
colCount
=
min
(
cinfo
.
output_width
,
info
.
width
);
while
(
cinfo
.
output_scanline
<
rowCount
)
{
while
(
cinfo
.
output_scanline
<
rowCount
)
{
jpeg_read_scanlines
(
&
cinfo
,
buffer
,
1
);
jpeg_read_scanlines
(
&
cinfo
,
buffer
,
1
);
if
(
format
==
0
)
{
if
(
info
.
format
==
ANDROID_BITMAP_FORMAT_RGBA_8888
)
{
if
(
cinfo
.
out_color_space
==
JCS_GRAYSCALE
)
{
if
(
cinfo
.
out_color_space
==
JCS_GRAYSCALE
)
{
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
float
alpha
=
buffer
[
0
][
i
]
/
255
.
0
f
;
float
alpha
=
buffer
[
0
][
i
]
/
255
.
0
f
;
...
@@ -284,24 +278,26 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
...
@@ -284,24 +278,26 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
}
else
{
}
else
{
int
c
=
0
;
int
c
=
0
;
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
for
(
i
=
0
;
i
<
colCount
;
i
++
)
{
pixels
[
i
*
4
]
=
buffer
[
0
][
i
*
3
+
2
];
pixels
[
i
*
4
]
=
buffer
[
0
][
i
*
3
];
pixels
[
i
*
4
+
1
]
=
buffer
[
0
][
i
*
3
+
1
];
pixels
[
i
*
4
+
1
]
=
buffer
[
0
][
i
*
3
+
1
];
pixels
[
i
*
4
+
2
]
=
buffer
[
0
][
i
*
3
];
pixels
[
i
*
4
+
2
]
=
buffer
[
0
][
i
*
3
+
2
];
pixels
[
i
*
4
+
3
]
=
255
;
pixels
[
i
*
4
+
3
]
=
255
;
c
+=
4
;
c
+=
4
;
}
}
}
}
}
else
if
(
format
==
1
)
{
}
else
if
(
info
.
format
==
ANDROID_BITMAP_FORMAT_RGB_565
)
{
}
}
pixels
+=
stride
;
pixels
+=
info
.
stride
;
}
}
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
bitmap
,
bitmapBuf
,
0
);
jpeg_finish_decompress
(
&
cinfo
);
AndroidBitmap_unlockPixels
(
env
,
bitmap
);
}
else
{
}
else
{
throwException
(
env
,
"can't get bitmap buff"
);
throwException
(
env
,
"AndroidBitmap_lockPixels() failed ! error=%d"
,
i
);
}
}
jpeg_finish_decompress
(
&
cinfo
);
}
else
{
}
else
{
throwException
(
env
,
"the JPEG code has signaled an error"
);
throwException
(
env
,
"the JPEG code has signaled an error"
);
}
}
...
@@ -313,4 +309,7 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
...
@@ -313,4 +309,7 @@ JNIEXPORT void Java_org_telegram_messenger_Utilities_loadBitmap(JNIEnv *env, jcl
}
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
path
,
fileName
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
path
,
fileName
);
}
else
{
throwException
(
env
,
"AndroidBitmap_getInfo() failed ! error=%d"
,
i
);
}
}
}
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
...
@@ -13,6 +13,7 @@ import java.io.InputStream;
...
@@ -13,6 +13,7 @@ import java.io.InputStream;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Locale
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Canvas
;
import
android.graphics.Canvas
;
import
android.graphics.ColorFilter
;
import
android.graphics.ColorFilter
;
...
@@ -35,21 +36,8 @@ public class Emoji {
...
@@ -35,21 +36,8 @@ public class Emoji {
private
static
int
drawImgSize
,
bigImgSize
;
private
static
int
drawImgSize
,
bigImgSize
;
private
static
boolean
inited
=
false
;
private
static
boolean
inited
=
false
;
private
static
Paint
placeholderPaint
;
private
static
Paint
placeholderPaint
;
private
static
EmojiBitmap
emojiBmp
[]
=
new
Emoji
Bitmap
[
5
];
private
static
Bitmap
emojiBmp
[]
=
new
Bitmap
[
5
];
private
static
boolean
loadingEmoji
[]
=
new
boolean
[
5
];
private
static
boolean
loadingEmoji
[]
=
new
boolean
[
5
];
private
static
int
emojiFullSize
;
private
static
class
EmojiBitmap
{
public
int
[]
colors
;
public
int
width
;
public
int
height
;
public
EmojiBitmap
(
int
[]
colors
,
int
width
,
int
height
)
{
this
.
colors
=
colors
;
this
.
width
=
width
;
this
.
height
=
height
;
}
}
private
static
final
int
[]
cols
=
{
private
static
final
int
[]
cols
=
{
13
,
10
,
15
,
10
,
14
13
,
10
,
15
,
10
,
14
...
@@ -125,8 +113,8 @@ public class Emoji {
...
@@ -125,8 +113,8 @@ public class Emoji {
0x00000000D83CDF8B
L
,
0x00000000D83CDF89
L
,
0x00000000D83CDF8A
L
,
0x00000000D83CDF88
L
,
0x00000000D83CDF8C
L
,
0x00000000D83DDD2E
L
,
0x00000000D83CDFA5
L
,
0x00000000D83CDF8B
L
,
0x00000000D83CDF89
L
,
0x00000000D83CDF8A
L
,
0x00000000D83CDF88
L
,
0x00000000D83CDF8C
L
,
0x00000000D83DDD2E
L
,
0x00000000D83CDFA5
L
,
0x00000000D83DDCF7
L
,
0x00000000D83DDCF9
L
,
0x00000000D83DDCFC
L
,
0x00000000D83DDCBF
L
,
0x00000000D83DDCC0
L
,
0x00000000D83DDCBD
L
,
0x00000000D83DDCBE
L
,
0x00000000D83DDCF7
L
,
0x00000000D83DDCF9
L
,
0x00000000D83DDCFC
L
,
0x00000000D83DDCBF
L
,
0x00000000D83DDCC0
L
,
0x00000000D83DDCBD
L
,
0x00000000D83DDCBE
L
,
0x00000000D83DDCBB
L
,
0x00000000D83DDCF1
L
,
0x000000000000260E
L
,
0x00000000D83DDCDE
L
,
0x00000000D83DDCDF
L
,
0x00000000D83DDCE0
L
,
0x00000000D83DDCE1
L
,
0x00000000D83DDCBB
L
,
0x00000000D83DDCF1
L
,
0x000000000000260E
L
,
0x00000000D83DDCDE
L
,
0x00000000D83DDCDF
L
,
0x00000000D83DDCE0
L
,
0x00000000D83DDCE1
L
,
0x00000000D83DDCFA
L
,
0x00000000D83DDCFB
L
,
0x00000000D83DDD0A
L
,
0x00000000D83DDD09
L
,
0x00000000D83DDD08
L
,
0x00000000D83DDD07
L
,
0x00000000D83DDD14
L
,
0x00000000D83DDD15
L
,
0x00000000D83DDCFA
L
,
0x00000000D83DDCFB
L
,
0x00000000D83DDD0A
L
,
0x00000000D83DDD09
L
,
0x00000000D83DDD08
L
,
0x00000000D83DDD07
L
,
0x00000000D83DDD14
L
,
0x00000000D83DDCE2
L
,
0x00000000D83DDCE3
L
,
0x00000000000023F3
L
,
0x000000000000231B
L
,
0x00000000000023F0
L
,
0x000000000000231A
L
,
0x00000000D83DD
D15
L
,
0x00000000D83DD
CE2
L
,
0x00000000D83DDCE3
L
,
0x00000000000023F3
L
,
0x000000000000231B
L
,
0x00000000000023F0
L
,
0x000000000000231A
L
,
0x00000000D83DDD13
L
,
0x00000000D83DDD12
L
,
0x00000000D83DDD0F
L
,
0x00000000D83DDD10
L
,
0x00000000D83DDD11
L
,
0x00000000D83DDD0E
L
,
0x00000000D83DDCA1
L
,
0x00000000D83DDD13
L
,
0x00000000D83DDD12
L
,
0x00000000D83DDD0F
L
,
0x00000000D83DDD10
L
,
0x00000000D83DDD11
L
,
0x00000000D83DDD0E
L
,
0x00000000D83DDCA1
L
,
0x00000000D83DDD26
L
,
0x00000000D83DDD06
L
,
0x00000000D83DDD05
L
,
0x00000000D83DDD0C
L
,
0x00000000D83DDD0B
L
,
0x00000000D83DDD0D
L
,
0x00000000D83DDEC1
L
,
0x00000000D83DDEC0
L
,
0x00000000D83DDD26
L
,
0x00000000D83DDD06
L
,
0x00000000D83DDD05
L
,
0x00000000D83DDD0C
L
,
0x00000000D83DDD0B
L
,
0x00000000D83DDD0D
L
,
0x00000000D83DDEC1
L
,
0x00000000D83DDEC0
L
,
0x00000000D83DDEBF
L
,
0x00000000D83DDEBD
L
,
0x00000000D83DDD27
L
,
0x00000000D83DDD29
L
,
0x00000000D83DDD28
L
,
0x00000000D83DDEAA
L
,
0x00000000D83DDEAC
L
,
0x00000000D83DDEBF
L
,
0x00000000D83DDEBD
L
,
0x00000000D83DDD27
L
,
0x00000000D83DDD29
L
,
0x00000000D83DDD28
L
,
0x00000000D83DDEAA
L
,
0x00000000D83DDEAC
L
,
...
@@ -170,20 +158,19 @@ public class Emoji {
...
@@ -170,20 +158,19 @@ public class Emoji {
0xD83CDDF0D83CDDF7
L
,
0xD83CDDE9D83CDDEA
L
,
0xD83CDDE8D83CDDF3
L
,
0xD83CDDFAD83CDDF8
L
,
0xD83CDDEBD83CDDF7
L
,
0xD83CDDEAD83CDDF8
L
,
0xD83CDDEED83CDDF9
L
,
0xD83CDDF0D83CDDF7
L
,
0xD83CDDE9D83CDDEA
L
,
0xD83CDDE8D83CDDF3
L
,
0xD83CDDFAD83CDDF8
L
,
0xD83CDDEBD83CDDF7
L
,
0xD83CDDEAD83CDDF8
L
,
0xD83CDDEED83CDDF9
L
,
0xD83CDDF7D83CDDFA
L
,
0xD83CDDECD83CDDE7
L
},
0xD83CDDF7D83CDDFA
L
,
0xD83CDDECD83CDDE7
L
},
new
long
[]
//209
new
long
[]
//209
{
0x00000000003120E3
L
,
0x00000000003220E3
L
,
0x00000000003320E3
L
,
0x00000000003420E3
L
,
0x00000000003520E3
L
,
0x00000000003620E3
L
,
0x00000000003720E3
L
,
0x00000000003820E3
L
,
{
0x00000000003120E3
L
,
0x00000000003220E3
L
,
0x00000000003320E3
L
,
0x00000000003420E3
L
,
0x00000000003520E3
L
,
0x00000000003620E3
L
,
0x00000000003720E3
L
,
0x00000000003
920E3
L
,
0x00000000003020E3
L
,
0x00000000D83DDD1F
L
,
0x00000000D83DDD22
L
,
0x00000000002320E3
L
,
0x00000000D83DDD23
L
,
0x0000000000002B06
L
,
0x00000000003
820E3
L
,
0x00000000003920E3
L
,
0x00000000003020E3
L
,
0x00000000D83DDD1F
L
,
0x00000000D83DDD22
L
,
0x00000000002320E3
L
,
0x00000000D83DDD23
L
,
0x0000000000002B0
7
L
,
0x0000000000002B05
L
,
0x00000000000027A1
L
,
0x00000000D83DDD20
L
,
0x00000000D83DDD21
L
,
0x00000000D83DDD24
L
,
0x0000000000002197
L
,
0x0000000000002B0
6
L
,
0x0000000000002B07
L
,
0x0000000000002B05
L
,
0x00000000000027A1
L
,
0x00000000D83DDD20
L
,
0x00000000D83DDD21
L
,
0x00000000D83DDD24
L
,
0x000000000000219
6
L
,
0x0000000000002198
L
,
0x0000000000002199
L
,
0x0000000000002194
L
,
0x0000000000002195
L
,
0x00000000D83DDD04
L
,
0x00000000000025C0
L
,
0x000000000000219
7
L
,
0x0000000000002196
L
,
0x0000000000002198
L
,
0x0000000000002199
L
,
0x0000000000002194
L
,
0x0000000000002195
L
,
0x00000000D83DDD04
L
,
0x00000000000025
B6
L
,
0x00000000D83DDD3C
L
,
0x00000000D83DDD3D
L
,
0x00000000000021A9
L
,
0x00000000000021AA
L
,
0x0000000000002139
L
,
0x00000000000023EA
L
,
0x00000000000025
C0
L
,
0x00000000000025B6
L
,
0x00000000D83DDD3C
L
,
0x00000000D83DDD3D
L
,
0x00000000000021A9
L
,
0x00000000000021AA
L
,
0x0000000000002139
L
,
0x00000000000023E
9
L
,
0x00000000000023EB
L
,
0x00000000000023EC
L
,
0x0000000000002935
L
,
0x0000000000002934
L
,
0x00000000D83CDD97
L
,
0x00000000D83DDD00
L
,
0x00000000000023E
A
L
,
0x00000000000023E9
L
,
0x00000000000023EB
L
,
0x00000000000023EC
L
,
0x0000000000002935
L
,
0x0000000000002934
L
,
0x00000000D83CDD97
L
,
0x00000000D83DDD0
1
L
,
0x00000000D83DDD02
L
,
0x00000000D83CDD95
L
,
0x00000000D83CDD99
L
,
0x00000000D83CDD92
L
,
0x00000000D83CDD93
L
,
0x00000000D83CDD96
L
,
0x00000000D83DDD0
0
L
,
0x00000000D83DDD01
L
,
0x00000000D83DDD02
L
,
0x00000000D83CDD95
L
,
0x00000000D83CDD99
L
,
0x00000000D83CDD92
L
,
0x00000000D83CDD93
L
,
0x00000000D83
DDCF6
L
,
0x00000000D83CDFA6
L
,
0x00000000D83CDE01
L
,
0x00000000D83CDE2F
L
,
0x00000000D83CDE33
L
,
0x00000000D83CDE35
L
,
0x00000000D83CDE32
L
,
0x00000000D83
CDD96
L
,
0x00000000D83DDCF6
L
,
0x00000000D83CDFA6
L
,
0x00000000D83CDE01
L
,
0x00000000D83CDE2F
L
,
0x00000000D83CDE33
L
,
0x00000000D83CDE35
L
,
0x00000000D83CDE34
L
,
0x00000000D83CDE50
L
,
0x00000000D83CDE39
L
,
0x00000000D83CDE3A
L
,
0x00000000D83CDE36
L
,
0x00000000D83CDE1A
L
,
0x00000000D83CDE3
2
L
,
0x00000000D83CDE3
4
L
,
0x00000000D83CDE50
L
,
0x00000000D83CDE39
L
,
0x00000000D83CDE3A
L
,
0x00000000D83CDE36
L
,
0x00000000D83CDE1A
L
,
0x00000000D83DDEBB
L
,
0x00000000D83DDEB9
L
,
0x00000000D83DDEBA
L
,
0x00000000D83DDEBC
L
,
0x00000000D83DDEBE
L
,
0x00000000D83DDEB0
L
,
0x00000000D83DDEAE
L
,
0x00000000D83DDEBB
L
,
0x00000000D83DDEB9
L
,
0x00000000D83DDEBA
L
,
0x00000000D83DDEBC
L
,
0x00000000D83DDEBE
L
,
0x00000000D83DDEB0
L
,
0x00000000D83DDEAE
L
,
0x00000000D83CDD7F
L
,
0x000000000000267F
L
,
0x00000000D83DDEAD
L
,
0x00000000D83CDE37
L
,
0x00000000D83CDE38
L
,
0x00000000D83CDE02
L
,
0x00000000000024C2
L
,
0x00000000D83CDD7F
L
,
0x000000000000267F
L
,
0x00000000D83DDEAD
L
,
0x00000000D83CDE37
L
,
0x00000000D83CDE38
L
,
0x00000000D83CDE02
L
,
0x00000000000024C2
L
,
0x00000000D83DDEC2
L
,
0x00000000D83DDEC4
L
,
0x00000000D83DDEC5
L
,
0x00000000D83DDEC3
L
,
0x00000000D83DDEC2
L
,
0x00000000D83DDEC4
L
,
0x00000000D83DDEC5
L
,
0x00000000D83DDEC3
L
,
0x00000000D83CDE51
L
,
0x0000000000003299
L
,
0x0000000000003297
L
,
0x00000000D83CDD91
L
,
0x00000000D83CDD98
L
,
0x00000000D83CDD94
L
,
0x00000000D83DDEAB
L
,
0x00000000D83CDE51
L
,
0x0000000000003299
L
,
0x0000000000003297
L
,
0x00000000D83CDD91
L
,
0x00000000D83CDD98
L
,
0x00000000D83CDD94
L
,
0x00000000D83DDEAB
L
,
0x00000000D83DDD1E
L
,
0x00000000D83DDCF5
L
,
0x00000000D83DDEAF
L
,
0x00000000D83DDEB1
L
,
0x00000000D83DDEB3
L
,
0x00000000D83DDEB7
L
,
0x00000000D83DDEB8
L
,
0x00000000D83DDD1E
L
,
0x00000000D83DDCF5
L
,
0x00000000D83DDEAF
L
,
0x00000000D83DDEB1
L
,
0x00000000D83DDEB3
L
,
0x00000000D83DDEB7
L
,
0x00000000D83DDEB8
L
,
0x00000000000026D4
L
,
0x0000000000002733
L
,
0x0000000000002747
L
,
0x000000000000274E
L
,
0x0000000000002705
L
,
0x0000000000002734
L
,
0x00000000D83DDC9F
L
,
0x00000000000026D4
L
,
0x0000000000002733
L
,
0x0000000000002747
L
,
0x000000000000274E
L
,
0x0000000000002705
L
,
0x0000000000002734
L
,
0x00000000D83DDC9F
L
,
0x00000000D83CDD9A
L
,
0x00000000D83DDCF3
L
,
0x00000000D83DDCF4
L
,
0x00000000D83CDD70
L
,
0x00000000D83CDD71
L
,
0x00000000D83CDD8E
L
,
0x00000000D83CDD7E
L
,
0x00000000D83CDD9A
L
,
0x00000000D83DDCF3
L
,
0x00000000D83DDCF4
L
,
0x00000000D83CDD70
L
,
0x00000000D83CDD71
L
,
0x00000000D83CDD8E
L
,
0x00000000D83CDD7E
L
,
...
@@ -204,6 +191,7 @@ public class Emoji {
...
@@ -204,6 +191,7 @@ public class Emoji {
0x00000000D83DDD34
L
,
0x00000000D83DDD35
L
,
0x00000000D83DDD3B
L
,
0x00000000D83DDD36
L
,
0x00000000D83DDD37
L
,
0x00000000D83DDD38
L
,
0x00000000D83DDD39
L
}};
0x00000000D83DDD34
L
,
0x00000000D83DDD35
L
,
0x00000000D83DDD3B
L
,
0x00000000D83DDD36
L
,
0x00000000D83DDD37
L
,
0x00000000D83DDD38
L
,
0x00000000D83DDD39
L
}};
static
{
static
{
int
emojiFullSize
;
if
(
AndroidUtilities
.
density
<=
1.0f
)
{
if
(
AndroidUtilities
.
density
<=
1.0f
)
{
emojiFullSize
=
30
;
emojiFullSize
=
30
;
}
else
if
(
AndroidUtilities
.
density
<=
1.5f
)
{
}
else
if
(
AndroidUtilities
.
density
<=
1.5f
)
{
...
@@ -222,7 +210,7 @@ public class Emoji {
...
@@ -222,7 +210,7 @@ public class Emoji {
for
(
int
j
=
1
;
j
<
data
.
length
;
j
++)
{
for
(
int
j
=
1
;
j
<
data
.
length
;
j
++)
{
for
(
int
i
=
0
;
i
<
data
[
j
].
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
data
[
j
].
length
;
i
++)
{
Rect
rect
=
new
Rect
((
i
%
cols
[
j
-
1
])
*
emojiFullSize
,
(
i
/
cols
[
j
-
1
])
*
emojiFullSize
,
emojiFullSize
,
emojiFullSize
);
Rect
rect
=
new
Rect
((
i
%
cols
[
j
-
1
])
*
emojiFullSize
,
(
i
/
cols
[
j
-
1
])
*
emojiFullSize
,
(
i
%
cols
[
j
-
1
]
+
1
)
*
emojiFullSize
,
(
i
/
cols
[
j
-
1
]
+
1
)
*
emojiFullSize
);
rects
.
put
(
data
[
j
][
i
],
new
DrawableInfo
(
rect
,
(
byte
)(
j
-
1
)));
rects
.
put
(
data
[
j
][
i
],
new
DrawableInfo
(
rect
,
(
byte
)(
j
-
1
)));
}
}
}
}
...
@@ -258,10 +246,8 @@ public class Emoji {
...
@@ -258,10 +246,8 @@ public class Emoji {
opts
.
inJustDecodeBounds
=
true
;
opts
.
inJustDecodeBounds
=
true
;
BitmapFactory
.
decodeFile
(
imageFile
.
getAbsolutePath
(),
opts
);
BitmapFactory
.
decodeFile
(
imageFile
.
getAbsolutePath
(),
opts
);
int
width
=
opts
.
outWidth
/
imageResize
;
final
Bitmap
bitmap
=
Bitmap
.
createBitmap
(
opts
.
outWidth
/
imageResize
,
opts
.
outHeight
/
imageResize
,
Bitmap
.
Config
.
ARGB_8888
);
int
height
=
opts
.
outHeight
/
imageResize
;
Utilities
.
loadBitmap
(
imageFile
.
getAbsolutePath
(),
bitmap
,
imageResize
);
int
[]
bitmap
=
new
int
[
width
*
height
];
Utilities
.
loadBitmap
(
imageFile
.
getAbsolutePath
(),
bitmap
,
imageResize
,
0
,
width
,
height
);
imageName
=
String
.
format
(
Locale
.
US
,
"emoji%.01fx_a_%d.jpg"
,
scale
,
page
);
imageName
=
String
.
format
(
Locale
.
US
,
"emoji%.01fx_a_%d.jpg"
,
scale
,
page
);
imageFile
=
ApplicationLoader
.
applicationContext
.
getFileStreamPath
(
imageName
);
imageFile
=
ApplicationLoader
.
applicationContext
.
getFileStreamPath
(
imageName
);
...
@@ -271,13 +257,12 @@ public class Emoji {
...
@@ -271,13 +257,12 @@ public class Emoji {
is
.
close
();
is
.
close
();
}
}
Utilities
.
loadBitmap
(
imageFile
.
getAbsolutePath
(),
bitmap
,
imageResize
,
0
,
width
,
height
);
Utilities
.
loadBitmap
(
imageFile
.
getAbsolutePath
(),
bitmap
,
imageResize
);
final
EmojiBitmap
emojiBitmap
=
new
EmojiBitmap
(
bitmap
,
width
,
height
);
AndroidUtilities
.
RunOnUIThread
(
new
Runnable
()
{
AndroidUtilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
emojiBmp
[
page
]
=
emojiB
itmap
;
emojiBmp
[
page
]
=
b
itmap
;
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
emojiDidLoaded
);
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
emojiDidLoaded
);
}
}
});
});
...
@@ -310,7 +295,7 @@ public class Emoji {
...
@@ -310,7 +295,7 @@ public class Emoji {
}
}
}
}
public
static
Drawable
getEmojiDrawable
(
long
code
)
{
public
static
Emoji
Drawable
getEmojiDrawable
(
long
code
)
{
DrawableInfo
info
=
rects
.
get
(
code
);
DrawableInfo
info
=
rects
.
get
(
code
);
if
(
info
==
null
)
{
if
(
info
==
null
)
{
FileLog
.
e
(
"tmessages"
,
"No emoji drawable for code "
+
String
.
format
(
"%016X"
,
code
));
FileLog
.
e
(
"tmessages"
,
"No emoji drawable for code "
+
String
.
format
(
"%016X"
,
code
));
...
@@ -322,7 +307,7 @@ public class Emoji {
...
@@ -322,7 +307,7 @@ public class Emoji {
}
}
public
static
Drawable
getEmojiBigDrawable
(
long
code
)
{
public
static
Drawable
getEmojiBigDrawable
(
long
code
)
{
EmojiDrawable
ed
=
(
EmojiDrawable
)
getEmojiDrawable
(
code
);
EmojiDrawable
ed
=
getEmojiDrawable
(
code
);
if
(
ed
==
null
)
{
if
(
ed
==
null
)
{
return
null
;
return
null
;
}
}
...
@@ -333,39 +318,38 @@ public class Emoji {
...
@@ -333,39 +318,38 @@ public class Emoji {
public
static
class
EmojiDrawable
extends
Drawable
{
public
static
class
EmojiDrawable
extends
Drawable
{
private
DrawableInfo
info
;
private
DrawableInfo
info
;
boolean
fullSize
=
false
;
private
boolean
fullSize
=
false
;
private
static
Paint
paint
;
private
static
Paint
paint
=
new
Paint
(
Paint
.
FILTER_BITMAP_FLAG
|
Paint
.
ANTI_ALIAS_FLAG
);
static
{
paint
=
new
Paint
();
paint
.
setFlags
(
Paint
.
FILTER_BITMAP_FLAG
|
Paint
.
ANTI_ALIAS_FLAG
);
}
public
EmojiDrawable
(
DrawableInfo
i
)
{
public
EmojiDrawable
(
DrawableInfo
i
)
{
info
=
i
;
info
=
i
;
}
}
public
DrawableInfo
getDrawableInfo
()
{
return
info
;
}
public
Rect
getDrawRect
()
{
Rect
b
=
copyBounds
();
int
cX
=
b
.
centerX
(),
cY
=
b
.
centerY
();
b
.
left
=
cX
-
(
fullSize
?
bigImgSize
:
drawImgSize
)
/
2
;
b
.
right
=
cX
+
(
fullSize
?
bigImgSize
:
drawImgSize
)
/
2
;
b
.
top
=
cY
-
(
fullSize
?
bigImgSize
:
drawImgSize
)
/
2
;
b
.
bottom
=
cY
+
(
fullSize
?
bigImgSize
:
drawImgSize
)
/
2
;
return
b
;
}
@Override
@Override
public
void
draw
(
Canvas
canvas
)
{
public
void
draw
(
Canvas
canvas
)
{
EmojiBitmap
bitmap
=
emojiBmp
[
info
.
page
];
if
(
emojiBmp
[
info
.
page
]
==
null
)
{
if
(
bitmap
==
null
)
{
loadEmojiAsync
(
info
.
page
);
loadEmojiAsync
(
info
.
page
);
canvas
.
drawRect
(
getBounds
(),
placeholderPaint
);
canvas
.
drawRect
(
getBounds
(),
placeholderPaint
);
return
;
return
;
}
}
float
scale
=
1
;
Rect
b
=
getDrawRect
();
int
offset
=
0
;
if
(!
canvas
.
quickReject
(
b
.
left
,
b
.
top
,
b
.
right
,
b
.
bottom
,
Canvas
.
EdgeType
.
AA
))
{
if
(
fullSize
)
{
canvas
.
drawBitmap
(
emojiBmp
[
info
.
page
],
info
.
rect
,
b
,
paint
);
scale
=
(
float
)
bigImgSize
/
(
float
)
emojiFullSize
;
offset
=
(
getBounds
().
width
()
-
bigImgSize
)
/
2
;
}
else
{
scale
=
(
float
)
getBounds
().
width
()
/
(
float
)
emojiFullSize
;
}
}
canvas
.
save
();
canvas
.
scale
(
scale
,
scale
);
canvas
.
drawBitmap
(
bitmap
.
colors
,
info
.
rect
.
top
*
bitmap
.
width
+
info
.
rect
.
left
,
bitmap
.
width
,
offset
,
offset
,
info
.
rect
.
right
,
info
.
rect
.
bottom
,
true
,
paint
);
canvas
.
restore
();
}
}
@Override
@Override
...
@@ -424,7 +408,7 @@ public class Emoji {
...
@@ -424,7 +408,7 @@ public class Emoji {
}
else
if
(
buf
>
0
&&
(
c
&
0xF000
)
==
0xD000
)
{
}
else
if
(
buf
>
0
&&
(
c
&
0xF000
)
==
0xD000
)
{
buf
<<=
16
;
buf
<<=
16
;
buf
|=
c
;
buf
|=
c
;
Drawable
d
=
Emoji
.
getEmojiDrawable
(
buf
);
Emoji
Drawable
d
=
Emoji
.
getEmojiDrawable
(
buf
);
if
(
d
!=
null
)
{
if
(
d
!=
null
)
{
EmojiSpan
span
=
new
EmojiSpan
(
d
,
DynamicDrawableSpan
.
ALIGN_BOTTOM
,
size
,
fontMetrics
);
EmojiSpan
span
=
new
EmojiSpan
(
d
,
DynamicDrawableSpan
.
ALIGN_BOTTOM
,
size
,
fontMetrics
);
emojiCount
++;
emojiCount
++;
...
@@ -442,7 +426,7 @@ public class Emoji {
...
@@ -442,7 +426,7 @@ public class Emoji {
buf
=
c2
;
buf
=
c2
;
buf
<<=
16
;
buf
<<=
16
;
buf
|=
c
;
buf
|=
c
;
Drawable
d
=
Emoji
.
getEmojiDrawable
(
buf
);
Emoji
Drawable
d
=
Emoji
.
getEmojiDrawable
(
buf
);
if
(
d
!=
null
)
{
if
(
d
!=
null
)
{
EmojiSpan
span
=
new
EmojiSpan
(
d
,
DynamicDrawableSpan
.
ALIGN_BOTTOM
,
size
,
fontMetrics
);
EmojiSpan
span
=
new
EmojiSpan
(
d
,
DynamicDrawableSpan
.
ALIGN_BOTTOM
,
size
,
fontMetrics
);
emojiCount
++;
emojiCount
++;
...
@@ -452,7 +436,7 @@ public class Emoji {
...
@@ -452,7 +436,7 @@ public class Emoji {
}
}
}
}
}
else
if
(
inArray
(
c
,
emojiChars
))
{
}
else
if
(
inArray
(
c
,
emojiChars
))
{
Drawable
d
=
Emoji
.
getEmojiDrawable
(
c
);
Emoji
Drawable
d
=
Emoji
.
getEmojiDrawable
(
c
);
if
(
d
!=
null
)
{
if
(
d
!=
null
)
{
EmojiSpan
span
=
new
EmojiSpan
(
d
,
DynamicDrawableSpan
.
ALIGN_BOTTOM
,
size
,
fontMetrics
);
EmojiSpan
span
=
new
EmojiSpan
(
d
,
DynamicDrawableSpan
.
ALIGN_BOTTOM
,
size
,
fontMetrics
);
emojiCount
++;
emojiCount
++;
...
@@ -472,9 +456,9 @@ public class Emoji {
...
@@ -472,9 +456,9 @@ public class Emoji {
public
static
class
EmojiSpan
extends
ImageSpan
{
public
static
class
EmojiSpan
extends
ImageSpan
{
private
Paint
.
FontMetricsInt
fontMetrics
=
null
;
private
Paint
.
FontMetricsInt
fontMetrics
=
null
;
int
size
=
AndroidUtilities
.
dp
(
20
);
private
int
size
=
AndroidUtilities
.
dp
(
20
);
public
EmojiSpan
(
Drawable
d
,
int
verticalAlignment
,
int
s
,
Paint
.
FontMetricsInt
original
)
{
public
EmojiSpan
(
Emoji
Drawable
d
,
int
verticalAlignment
,
int
s
,
Paint
.
FontMetricsInt
original
)
{
super
(
d
,
verticalAlignment
);
super
(
d
,
verticalAlignment
);
fontMetrics
=
original
;
fontMetrics
=
original
;
if
(
original
!=
null
)
{
if
(
original
!=
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/android/NativeLoader.java
View file @
6c4c5cf3
...
@@ -23,7 +23,7 @@ import java.util.zip.ZipFile;
...
@@ -23,7 +23,7 @@ import java.util.zip.ZipFile;
public
class
NativeLoader
{
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_NAME
=
"tmessages."
+
LIB_VERSION
;
private
final
static
String
LIB_SO_NAME
=
"lib"
+
LIB_NAME
+
".so"
;
private
final
static
String
LIB_SO_NAME
=
"lib"
+
LIB_NAME
+
".so"
;
private
final
static
String
LOCALE_LIB_SO_NAME
=
"lib"
+
LIB_NAME
+
"loc.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;
...
@@ -25,6 +25,7 @@ import java.text.ParsePosition;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -371,6 +372,38 @@ public class FastDateParser implements DateParser, Serializable {
...
@@ -371,6 +372,38 @@ public class FastDateParser implements DateParser, Serializable {
return
regex
;
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
* Get the short and long values displayed for a field
...
@@ -381,7 +414,7 @@ public class FastDateParser implements DateParser, Serializable {
...
@@ -381,7 +414,7 @@ public class FastDateParser implements DateParser, Serializable {
* @return A Map of the field key / value pairs
* @return A Map of the field key / value pairs
*/
*/
private
static
Map
<
String
,
Integer
>
getDisplayNames
(
final
int
field
,
final
Calendar
definingCalendar
,
final
Locale
locale
)
{
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;
...
@@ -14,6 +14,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.os.Environment
;
...
@@ -107,7 +108,7 @@ public class Utilities {
...
@@ -107,7 +108,7 @@ public class Utilities {
}
}
public
native
static
long
doPQNative
(
long
_what
);
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
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
);
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
);
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;
...
@@ -21,6 +21,7 @@ import android.content.pm.PackageManager;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.PowerManager
;
import
android.os.PowerManager
;
...
@@ -112,14 +113,17 @@ public class ApplicationLoader extends Application {
...
@@ -112,14 +113,17 @@ public class ApplicationLoader extends Application {
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
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
();
applicationContext
=
getApplicationContext
();
NativeLoader
.
initNativeLibs
(
ApplicationLoader
.
applicationContext
);
NativeLoader
.
initNativeLibs
(
ApplicationLoader
.
applicationContext
);
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv4Stack"
,
"true"
);
java
.
lang
.
System
.
setProperty
(
"java.net.preferIPv6Addresses"
,
"false"
);
startPushService
();
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
...
@@ -1321,7 +1321,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return
5
;
return
5
;
}
}
}
}
//return 4;
if
(
messageObject
.
messageOwner
.
ttl
<=
0
)
{
return
4
;
}
}
}
}
}
return
2
;
return
2
;
...
@@ -2667,7 +2669,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2667,7 +2669,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
else
{
}
else
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
processSelectedOption
(
4
);
}
else
if
(
i
==
1
)
{
}
else
if
(
i
==
1
)
{
processSelectedOption
(
1
);
processSelectedOption
(
1
);
}
}
...
@@ -2768,6 +2770,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2768,6 +2770,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
else
if
(
option
==
4
)
{
}
else
if
(
option
==
4
)
{
String
fileName
=
selectedObject
.
getFileName
();
String
fileName
=
selectedObject
.
getFileName
();
String
path
=
selectedObject
.
messageOwner
.
attachPath
;
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
)
{
if
(
path
==
null
||
path
.
length
()
==
0
)
{
path
=
FileLoader
.
getPathToMessage
(
selectedObject
.
messageOwner
).
toString
();
path
=
FileLoader
.
getPathToMessage
(
selectedObject
.
messageOwner
).
toString
();
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
View file @
6c4c5cf3
...
@@ -199,6 +199,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -199,6 +199,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private
int
backgroundState
=
-
1
;
private
int
backgroundState
=
-
1
;
private
View
parent
=
null
;
private
View
parent
=
null
;
private
int
size
=
AndroidUtilities
.
dp
(
64
);
private
int
size
=
AndroidUtilities
.
dp
(
64
);
private
int
previousBackgroundState
=
-
2
;
private
float
animatedAlphaValue
=
1.0f
;
private
static
DecelerateInterpolator
decelerateInterpolator
=
null
;
private
static
DecelerateInterpolator
decelerateInterpolator
=
null
;
private
static
Paint
progressPaint
=
null
;
private
static
Paint
progressPaint
=
null
;
...
@@ -220,6 +222,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -220,6 +222,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
long
dt
=
newTime
-
lastUpdateTime
;
long
dt
=
newTime
-
lastUpdateTime
;
lastUpdateTime
=
newTime
;
lastUpdateTime
=
newTime
;
if
(
animatedProgressValue
!=
1
)
{
radOffset
+=
360
*
dt
/
3000.0f
;
radOffset
+=
360
*
dt
/
3000.0f
;
float
progressDiff
=
currentProgress
-
animationProgressStart
;
float
progressDiff
=
currentProgress
-
animationProgressStart
;
if
(
progressDiff
>
0
)
{
if
(
progressDiff
>
0
)
{
...
@@ -232,9 +235,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -232,9 +235,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animatedProgressValue
=
animationProgressStart
+
progressDiff
*
decelerateInterpolator
.
getInterpolation
(
currentProgressTime
/
300.0f
);
animatedProgressValue
=
animationProgressStart
+
progressDiff
*
decelerateInterpolator
.
getInterpolation
(
currentProgressTime
/
300.0f
);
}
}
}
}
parent
.
invalidate
();
parent
.
invalidate
();
}
}
if
(
animatedProgressValue
>=
1
&&
previousBackgroundState
!=
-
2
)
{
animatedAlphaValue
-=
dt
/
200.0f
;
if
(
animatedAlphaValue
<=
0
)
{
animatedAlphaValue
=
0.0f
;
previousBackgroundState
=
-
2
;
}
parent
.
invalidate
();
}
}
public
float
getRadOffset
()
{
public
float
getRadOffset
()
{
return
radOffset
;
return
radOffset
;
...
@@ -255,28 +266,51 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -255,28 +266,51 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
currentProgressTime
=
0
;
currentProgressTime
=
0
;
}
}
public
void
setBackgroundState
(
int
state
)
{
public
void
setBackgroundState
(
int
state
,
boolean
animated
)
{
lastUpdateTime
=
System
.
currentTimeMillis
();
lastUpdateTime
=
System
.
currentTimeMillis
();
if
(
animated
&&
backgroundState
!=
state
)
{
previousBackgroundState
=
backgroundState
;
animatedAlphaValue
=
1.0f
;
}
else
{
previousBackgroundState
=
-
2
;
}
backgroundState
=
state
;
backgroundState
=
state
;
parent
.
invalidate
();
parent
.
invalidate
();
}
}
public
void
onDraw
(
Canvas
canvas
)
{
public
void
onDraw
(
Canvas
canvas
)
{
if
(
backgroundState
<
0
||
backgroundState
>
3
)
{
return
;
}
int
x
=
(
canvas
.
getWidth
()
-
size
)
/
2
;
int
x
=
(
canvas
.
getWidth
()
-
size
)
/
2
;
int
y
=
(
canvas
.
getHeight
()
-
size
)
/
2
;
int
y
=
(
canvas
.
getHeight
()
-
size
)
/
2
;
if
(
previousBackgroundState
>=
0
&&
previousBackgroundState
<
4
)
{
Drawable
drawable
=
progressDrawables
[
previousBackgroundState
];
if
(
drawable
!=
null
)
{
drawable
.
setAlpha
((
int
)(
255
*
animatedAlphaValue
));
drawable
.
setBounds
(
x
,
y
,
x
+
size
,
y
+
size
);
drawable
.
draw
(
canvas
);
}
}
if
(
backgroundState
>=
0
&&
backgroundState
<
4
)
{
Drawable
drawable
=
progressDrawables
[
backgroundState
];
Drawable
drawable
=
progressDrawables
[
backgroundState
];
if
(
drawable
!=
null
)
{
if
(
drawable
!=
null
)
{
if
(
previousBackgroundState
!=
-
2
)
{
drawable
.
setAlpha
((
int
)(
255
*
(
1.0f
-
animatedAlphaValue
)));
}
else
{
drawable
.
setAlpha
(
255
);
}
drawable
.
setBounds
(
x
,
y
,
x
+
size
,
y
+
size
);
drawable
.
setBounds
(
x
,
y
,
x
+
size
,
y
+
size
);
drawable
.
draw
(
canvas
);
drawable
.
draw
(
canvas
);
}
}
}
if
(
backgroundState
==
0
||
backgroundState
==
1
)
{
if
(
backgroundState
==
0
||
backgroundState
==
1
||
previousBackgroundState
==
0
||
previousBackgroundState
==
1
)
{
int
diff
=
AndroidUtilities
.
dp
(
1
);
int
diff
=
AndroidUtilities
.
dp
(
1
);
if
(
previousBackgroundState
!=
-
2
)
{
progressPaint
.
setAlpha
((
int
)(
255
*
animatedAlphaValue
));
}
else
{
progressPaint
.
setAlpha
(
255
);
}
progressRect
.
set
(
x
+
diff
,
y
+
diff
,
x
+
size
-
diff
,
y
+
size
-
diff
);
progressRect
.
set
(
x
+
diff
,
y
+
diff
,
x
+
size
-
diff
,
y
+
size
-
diff
);
canvas
.
drawArc
(
progressRect
,
-
90
+
radOffset
,
Math
.
max
(
4
,
360
*
animatedProgressValue
),
false
,
progressPaint
);
canvas
.
drawArc
(
progressRect
,
-
90
+
radOffset
,
Math
.
max
(
4
,
360
*
animatedProgressValue
),
false
,
progressPaint
);
updateAnimation
();
updateAnimation
();
...
@@ -364,7 +398,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -364,7 +398,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
String
location
=
(
String
)
args
[
0
];
String
location
=
(
String
)
args
[
0
];
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
if
(
currentFileNames
[
a
]
!=
null
&&
currentFileNames
[
a
].
equals
(
location
))
{
if
(
currentFileNames
[
a
]
!=
null
&&
currentFileNames
[
a
].
equals
(
location
))
{
checkProgress
(
a
);
radialProgressViews
[
a
].
setProgress
(
1.0f
,
true
);
checkProgress
(
a
,
true
);
break
;
break
;
}
}
}
}
...
@@ -372,7 +407,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -372,7 +407,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
String
location
=
(
String
)
args
[
0
];
String
location
=
(
String
)
args
[
0
];
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
if
(
currentFileNames
[
a
]
!=
null
&&
currentFileNames
[
a
].
equals
(
location
))
{
if
(
currentFileNames
[
a
]
!=
null
&&
currentFileNames
[
a
].
equals
(
location
))
{
checkProgress
(
a
);
radialProgressViews
[
a
].
setProgress
(
1.0f
,
true
);
checkProgress
(
a
,
true
);
break
;
break
;
}
}
}
}
...
@@ -671,11 +707,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -671,11 +707,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
bottomLayout
.
setBackgroundColor
(
0x7F000000
);
bottomLayout
.
setBackgroundColor
(
0x7F000000
);
radialProgressViews
[
0
]
=
new
RadialProgressView
(
containerView
.
getContext
(),
containerView
);
radialProgressViews
[
0
]
=
new
RadialProgressView
(
containerView
.
getContext
(),
containerView
);
radialProgressViews
[
0
].
setBackgroundState
(
0
);
radialProgressViews
[
0
].
setBackgroundState
(
0
,
false
);
radialProgressViews
[
1
]
=
new
RadialProgressView
(
containerView
.
getContext
(),
containerView
);
radialProgressViews
[
1
]
=
new
RadialProgressView
(
containerView
.
getContext
(),
containerView
);
radialProgressViews
[
1
].
setBackgroundState
(
0
);
radialProgressViews
[
1
].
setBackgroundState
(
0
,
false
);
radialProgressViews
[
2
]
=
new
RadialProgressView
(
containerView
.
getContext
(),
containerView
);
radialProgressViews
[
2
]
=
new
RadialProgressView
(
containerView
.
getContext
(),
containerView
);
radialProgressViews
[
2
].
setBackgroundState
(
0
);
radialProgressViews
[
2
].
setBackgroundState
(
0
,
false
);
shareButton
=
new
ImageView
(
containerView
.
getContext
());
shareButton
=
new
ImageView
(
containerView
.
getContext
());
shareButton
.
setImageResource
(
R
.
drawable
.
ic_ab_share_white
);
shareButton
.
setImageResource
(
R
.
drawable
.
ic_ab_share_white
);
...
@@ -1148,7 +1184,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1148,7 +1184,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
pickerView
.
setVisibility
(
View
.
GONE
);
pickerView
.
setVisibility
(
View
.
GONE
);
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
if
(
radialProgressViews
[
a
]
!=
null
)
{
if
(
radialProgressViews
[
a
]
!=
null
)
{
radialProgressViews
[
a
].
setBackgroundState
(-
1
);
radialProgressViews
[
a
].
setBackgroundState
(-
1
,
false
);
}
}
}
}
...
@@ -1373,11 +1409,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1373,11 +1409,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
checkProgress
(
a
);
checkProgress
(
a
,
false
);
}
}
}
}
private
void
checkProgress
(
int
a
)
{
private
void
checkProgress
(
int
a
,
boolean
animated
)
{
if
(
currentFileNames
[
a
]
!=
null
)
{
if
(
currentFileNames
[
a
]
!=
null
)
{
int
index
=
currentIndex
;
int
index
=
currentIndex
;
if
(
a
==
1
)
{
if
(
a
==
1
)
{
...
@@ -1395,19 +1431,19 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1395,19 +1431,19 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
if
(
f
!=
null
&&
f
.
exists
())
{
if
(
f
!=
null
&&
f
.
exists
())
{
if
(
currentFileNames
[
a
].
endsWith
(
"mp4"
))
{
if
(
currentFileNames
[
a
].
endsWith
(
"mp4"
))
{
radialProgressViews
[
a
].
setBackgroundState
(
3
);
radialProgressViews
[
a
].
setBackgroundState
(
3
,
animated
);
}
else
{
}
else
{
radialProgressViews
[
a
].
setBackgroundState
(-
1
);
radialProgressViews
[
a
].
setBackgroundState
(-
1
,
animated
);
}
}
}
else
{
}
else
{
if
(
currentFileNames
[
a
].
endsWith
(
"mp4"
))
{
if
(
currentFileNames
[
a
].
endsWith
(
"mp4"
))
{
if
(!
FileLoader
.
getInstance
().
isLoadingFile
(
currentFileNames
[
a
]))
{
if
(!
FileLoader
.
getInstance
().
isLoadingFile
(
currentFileNames
[
a
]))
{
radialProgressViews
[
a
].
setBackgroundState
(
2
);
radialProgressViews
[
a
].
setBackgroundState
(
2
,
false
);
}
else
{
}
else
{
radialProgressViews
[
a
].
setBackgroundState
(
1
);
radialProgressViews
[
a
].
setBackgroundState
(
1
,
false
);
}
}
}
else
{
}
else
{
radialProgressViews
[
a
].
setBackgroundState
(
0
);
radialProgressViews
[
a
].
setBackgroundState
(
0
,
animated
);
}
}
Float
progress
=
FileLoader
.
getInstance
().
getFileProgress
(
currentFileNames
[
a
]);
Float
progress
=
FileLoader
.
getInstance
().
getFileProgress
(
currentFileNames
[
a
]);
if
(
progress
==
null
)
{
if
(
progress
==
null
)
{
...
@@ -1419,7 +1455,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1419,7 +1455,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
canZoom
=
currentFileNames
[
0
]
!=
null
&&
!
currentFileNames
[
0
].
endsWith
(
"mp4"
)
&&
radialProgressViews
[
0
].
backgroundState
!=
0
;
canZoom
=
currentFileNames
[
0
]
!=
null
&&
!
currentFileNames
[
0
].
endsWith
(
"mp4"
)
&&
radialProgressViews
[
0
].
backgroundState
!=
0
;
}
}
}
else
{
}
else
{
radialProgressViews
[
a
].
setBackgroundState
(-
1
);
radialProgressViews
[
a
].
setBackgroundState
(-
1
,
animated
);
}
}
}
}
...
@@ -1887,7 +1923,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1887,7 +1923,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
currentThumb
=
null
;
currentThumb
=
null
;
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
for
(
int
a
=
0
;
a
<
3
;
a
++)
{
if
(
radialProgressViews
[
a
]
!=
null
)
{
if
(
radialProgressViews
[
a
]
!=
null
)
{
radialProgressViews
[
a
].
setBackgroundState
(-
1
);
radialProgressViews
[
a
].
setBackgroundState
(-
1
,
false
);
}
}
}
}
centerImage
.
setImageBitmap
((
Bitmap
)
null
);
centerImage
.
setImageBitmap
((
Bitmap
)
null
);
...
@@ -2434,7 +2470,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -2434,7 +2470,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if
(
x
>=
(
containerView
.
getWidth
()
-
AndroidUtilities
.
dp
(
64
))
/
2.0f
&&
x
<=
(
containerView
.
getWidth
()
+
AndroidUtilities
.
dp
(
64
))
/
2.0f
&&
if
(
x
>=
(
containerView
.
getWidth
()
-
AndroidUtilities
.
dp
(
64
))
/
2.0f
&&
x
<=
(
containerView
.
getWidth
()
+
AndroidUtilities
.
dp
(
64
))
/
2.0f
&&
y
>=
(
containerView
.
getHeight
()
-
AndroidUtilities
.
dp
(
64
))
/
2.0f
&&
y
<=
(
containerView
.
getHeight
()
+
AndroidUtilities
.
dp
(
64
))
/
2.0f
)
{
y
>=
(
containerView
.
getHeight
()
-
AndroidUtilities
.
dp
(
64
))
/
2.0f
&&
y
<=
(
containerView
.
getHeight
()
+
AndroidUtilities
.
dp
(
64
))
/
2.0f
)
{
onActionClick
();
onActionClick
();
checkProgress
(
0
);
checkProgress
(
0
,
true
);
return
true
;
return
true
;
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java
View file @
6c4c5cf3
...
@@ -319,9 +319,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
...
@@ -319,9 +319,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
public
boolean
processSendingText
(
String
text
)
{
public
boolean
processSendingText
(
String
text
)
{
text
=
getTrimmedString
(
text
);
text
=
getTrimmedString
(
text
);
if
(
text
.
length
()
!=
0
)
{
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
++)
{
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
);
SendMessagesHelper
.
getInstance
().
sendMessage
(
mess
,
dialog_id
);
}
}
return
true
;
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