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
bd4152dc
Commit
bd4152dc
authored
Apr 01, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore photo attach long press, bug fixes
parent
ebe7ab78
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
402 additions
and
251 deletions
+402
-251
build.gradle
TMessagesProj/build.gradle
+1
-1
gif.c
TMessagesProj/jni/gif.c
+1
-1
jni.c
TMessagesProj/jni/jni.c
+3
-5
sqlite_statement.c
TMessagesProj/jni/sqlite_statement.c
+1
-1
libtmessages.so
TMessagesProj/libs/armeabi-v7a/libtmessages.so
+0
-0
libtmessages.so
TMessagesProj/libs/armeabi/libtmessages.so
+0
-0
libtmessages.so
TMessagesProj/libs/x86/libtmessages.so
+0
-0
LocaleController.java
...rc/main/java/org/telegram/messenger/LocaleController.java
+11
-0
NativeLoader.java
...oj/src/main/java/org/telegram/messenger/NativeLoader.java
+10
-10
ApplicationLoader.java
...Proj/src/main/java/org/telegram/ui/ApplicationLoader.java
+6
-6
ChatBaseCell.java
...roj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java
+124
-32
ChatMediaCell.java
...oj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java
+135
-115
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+62
-51
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+48
-20
ImageReceiver.java
...oj/src/main/java/org/telegram/ui/Views/ImageReceiver.java
+0
-9
No files found.
TMessagesProj/build.gradle
View file @
bd4152dc
...
@@ -82,7 +82,7 @@ android {
...
@@ -82,7 +82,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
21
3
versionCode
21
5
versionName
"1.4.9"
versionName
"1.4.9"
}
}
}
}
TMessagesProj/jni/gif.c
View file @
bd4152dc
...
@@ -113,7 +113,7 @@ jint gifOnJNILoad(JavaVM *vm, void *reserved, JNIEnv *env) {
...
@@ -113,7 +113,7 @@ jint gifOnJNILoad(JavaVM *vm, void *reserved, JNIEnv *env) {
if
(
defaultCmap
==
NULL
)
{
if
(
defaultCmap
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
return
JNI_VERSION_1_
6
;
return
JNI_VERSION_1_
4
;
}
}
void
gifOnJNIUnload
(
JavaVM
*
vm
,
void
*
reserved
)
{
void
gifOnJNIUnload
(
JavaVM
*
vm
,
void
*
reserved
)
{
...
...
TMessagesProj/jni/jni.c
View file @
bd4152dc
...
@@ -13,7 +13,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
...
@@ -13,7 +13,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv
*
env
=
0
;
JNIEnv
*
env
=
0
;
srand
(
time
(
NULL
));
srand
(
time
(
NULL
));
if
((
*
vm
)
->
GetEnv
(
vm
,
(
void
**
)
&
env
,
JNI_VERSION_1_6
)
!=
JNI_OK
)
{
if
((
*
vm
)
->
GetEnv
(
vm
,
(
void
**
)
&
env
,
JNI_VERSION_1_4
)
!=
JNI_OK
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -21,11 +21,9 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
...
@@ -21,11 +21,9 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return
-
1
;
return
-
1
;
}
}
if
(
gifOnJNILoad
(
vm
,
reserved
,
env
)
==
-
1
)
{
gifOnJNILoad
(
vm
,
reserved
,
env
);
return
-
1
;
}
return
JNI_VERSION_1_
6
;
return
JNI_VERSION_1_
4
;
}
}
void
JNI_OnUnload
(
JavaVM
*
vm
,
void
*
reserved
)
{
void
JNI_OnUnload
(
JavaVM
*
vm
,
void
*
reserved
)
{
...
...
TMessagesProj/jni/sqlite_statement.c
View file @
bd4152dc
...
@@ -5,7 +5,7 @@ jfieldID queryArgsCountField;
...
@@ -5,7 +5,7 @@ jfieldID queryArgsCountField;
jint
sqliteOnJNILoad
(
JavaVM
*
vm
,
void
*
reserved
,
JNIEnv
*
env
)
{
jint
sqliteOnJNILoad
(
JavaVM
*
vm
,
void
*
reserved
,
JNIEnv
*
env
)
{
jclass
class
=
(
*
env
)
->
FindClass
(
env
,
"org/telegram/SQLite/SQLitePreparedStatement"
);
jclass
class
=
(
*
env
)
->
FindClass
(
env
,
"org/telegram/SQLite/SQLitePreparedStatement"
);
queryArgsCountField
=
(
*
env
)
->
GetFieldID
(
env
,
class
,
"queryArgsCount"
,
"I"
);
queryArgsCountField
=
(
*
env
)
->
GetFieldID
(
env
,
class
,
"queryArgsCount"
,
"I"
);
return
JNI_VERSION_1_
6
;
return
JNI_VERSION_1_
4
;
}
}
int
Java_org_telegram_SQLite_SQLitePreparedStatement_step
(
JNIEnv
*
env
,
jobject
object
,
int
statementHandle
)
{
int
Java_org_telegram_SQLite_SQLitePreparedStatement_step
(
JNIEnv
*
env
,
jobject
object
,
int
statementHandle
)
{
...
...
TMessagesProj/libs/armeabi-v7a/libtmessages.so
View file @
bd4152dc
No preview for this file type
TMessagesProj/libs/armeabi/libtmessages.so
View file @
bd4152dc
No preview for this file type
TMessagesProj/libs/x86/libtmessages.so
View file @
bd4152dc
No preview for this file type
TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
View file @
bd4152dc
...
@@ -50,6 +50,7 @@ public class LocaleController {
...
@@ -50,6 +50,7 @@ public class LocaleController {
public
String
name
;
public
String
name
;
public
String
nameEnglish
;
public
String
nameEnglish
;
public
String
shortName
;
public
String
shortName
;
public
boolean
embededLang
;
}
}
public
ArrayList
<
LocaleInfo
>
sortedLanguages
=
new
ArrayList
<
LocaleController
.
LocaleInfo
>();
public
ArrayList
<
LocaleInfo
>
sortedLanguages
=
new
ArrayList
<
LocaleController
.
LocaleInfo
>();
...
@@ -74,6 +75,7 @@ public class LocaleController {
...
@@ -74,6 +75,7 @@ public class LocaleController {
localeInfo
.
name
=
"English"
;
localeInfo
.
name
=
"English"
;
localeInfo
.
nameEnglish
=
"English"
;
localeInfo
.
nameEnglish
=
"English"
;
localeInfo
.
shortName
=
"en"
;
localeInfo
.
shortName
=
"en"
;
localeInfo
.
embededLang
=
true
;
sortedLanguages
.
add
(
localeInfo
);
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
...
@@ -81,6 +83,7 @@ public class LocaleController {
...
@@ -81,6 +83,7 @@ public class LocaleController {
localeInfo
.
name
=
"Italiano"
;
localeInfo
.
name
=
"Italiano"
;
localeInfo
.
nameEnglish
=
"Italian"
;
localeInfo
.
nameEnglish
=
"Italian"
;
localeInfo
.
shortName
=
"it"
;
localeInfo
.
shortName
=
"it"
;
localeInfo
.
embededLang
=
true
;
sortedLanguages
.
add
(
localeInfo
);
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
...
@@ -95,6 +98,7 @@ public class LocaleController {
...
@@ -95,6 +98,7 @@ public class LocaleController {
localeInfo
.
name
=
"Deutsch"
;
localeInfo
.
name
=
"Deutsch"
;
localeInfo
.
nameEnglish
=
"German"
;
localeInfo
.
nameEnglish
=
"German"
;
localeInfo
.
shortName
=
"de"
;
localeInfo
.
shortName
=
"de"
;
localeInfo
.
embededLang
=
true
;
sortedLanguages
.
add
(
localeInfo
);
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
...
@@ -102,6 +106,7 @@ public class LocaleController {
...
@@ -102,6 +106,7 @@ public class LocaleController {
localeInfo
.
name
=
"Nederlands"
;
localeInfo
.
name
=
"Nederlands"
;
localeInfo
.
nameEnglish
=
"Dutch"
;
localeInfo
.
nameEnglish
=
"Dutch"
;
localeInfo
.
shortName
=
"nl"
;
localeInfo
.
shortName
=
"nl"
;
localeInfo
.
embededLang
=
true
;
sortedLanguages
.
add
(
localeInfo
);
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
...
@@ -109,6 +114,7 @@ public class LocaleController {
...
@@ -109,6 +114,7 @@ public class LocaleController {
localeInfo
.
name
=
"العربية"
;
localeInfo
.
name
=
"العربية"
;
localeInfo
.
nameEnglish
=
"Arabic"
;
localeInfo
.
nameEnglish
=
"Arabic"
;
localeInfo
.
shortName
=
"ar"
;
localeInfo
.
shortName
=
"ar"
;
localeInfo
.
embededLang
=
true
;
sortedLanguages
.
add
(
localeInfo
);
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
...
@@ -123,6 +129,7 @@ public class LocaleController {
...
@@ -123,6 +129,7 @@ public class LocaleController {
localeInfo
.
name
=
"System default"
;
localeInfo
.
name
=
"System default"
;
localeInfo
.
nameEnglish
=
"System default"
;
localeInfo
.
nameEnglish
=
"System default"
;
localeInfo
.
shortName
=
null
;
localeInfo
.
shortName
=
null
;
localeInfo
.
embededLang
=
true
;
sortedLanguages
.
add
(
0
,
localeInfo
);
sortedLanguages
.
add
(
0
,
localeInfo
);
systemDefaultLocale
=
Locale
.
getDefault
();
systemDefaultLocale
=
Locale
.
getDefault
();
...
@@ -197,6 +204,7 @@ public class LocaleController {
...
@@ -197,6 +204,7 @@ public class LocaleController {
localeInfo
.
name
=
languageName
;
localeInfo
.
name
=
languageName
;
localeInfo
.
nameEnglish
=
languageNameInEnglish
;
localeInfo
.
nameEnglish
=
languageNameInEnglish
;
localeInfo
.
shortName
=
languageCode
;
localeInfo
.
shortName
=
languageCode
;
localeInfo
.
embededLang
=
false
;
sortedLanguages
.
add
(
localeInfo
);
sortedLanguages
.
add
(
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
languagesDict
.
put
(
localeInfo
.
shortName
,
localeInfo
);
...
@@ -248,6 +256,9 @@ public class LocaleController {
...
@@ -248,6 +256,9 @@ public class LocaleController {
editor
.
commit
();
editor
.
commit
();
}
}
if
(
newLocale
!=
null
)
{
if
(
newLocale
!=
null
)
{
if
(
localeInfo
.
embededLang
)
{
localeValues
.
clear
();
}
currentLocale
=
newLocale
;
currentLocale
=
newLocale
;
currentLocaleInfo
=
localeInfo
;
currentLocaleInfo
=
localeInfo
;
changingConfiguration
=
true
;
changingConfiguration
=
true
;
...
...
TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java
View file @
bd4152dc
...
@@ -10,7 +10,6 @@ package org.telegram.messenger;
...
@@ -10,7 +10,6 @@ package org.telegram.messenger;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
import
android.os.Build
;
import
android.util.Log
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
...
@@ -35,7 +34,7 @@ public class NativeLoader {
...
@@ -35,7 +34,7 @@ public class NativeLoader {
return
;
return
;
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
10
)
{
try
{
try
{
String
folder
=
null
;
String
folder
=
null
;
long
libSize
=
0
;
long
libSize
=
0
;
...
@@ -48,6 +47,7 @@ public class NativeLoader {
...
@@ -48,6 +47,7 @@ public class NativeLoader {
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"armeabi"
))
{
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"armeabi"
))
{
folder
=
"armeabi"
;
folder
=
"armeabi"
;
libSize
=
sizes
[
0
];
libSize
=
sizes
[
0
];
libSize2
=
sizes
[
1
];
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"x86"
))
{
}
else
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
"x86"
))
{
folder
=
"x86"
;
folder
=
"x86"
;
libSize
=
sizes
[
2
];
libSize
=
sizes
[
2
];
...
@@ -57,13 +57,13 @@ public class NativeLoader {
...
@@ -57,13 +57,13 @@ public class NativeLoader {
}
else
{
}
else
{
System
.
loadLibrary
(
"tmessages"
);
System
.
loadLibrary
(
"tmessages"
);
nativeLoaded
=
true
;
nativeLoaded
=
true
;
Log
.
e
(
"tmessages"
,
"Unsupported arch: "
+
Build
.
CPU_ABI
);
File
Log
.
e
(
"tmessages"
,
"Unsupported arch: "
+
Build
.
CPU_ABI
);
return
;
return
;
}
}
File
destFile
=
new
File
(
context
.
getApplicationInfo
().
nativeLibraryDir
+
"/libtmessages.so"
);
File
destFile
=
new
File
(
context
.
getApplicationInfo
().
nativeLibraryDir
+
"/libtmessages.so"
);
if
(
destFile
.
exists
()
&&
(
destFile
.
length
()
==
libSize
||
libSize2
!=
0
&&
destFile
.
length
()
==
libSize2
))
{
if
(
destFile
.
exists
()
&&
(
destFile
.
length
()
==
libSize
||
libSize2
!=
0
&&
destFile
.
length
()
==
libSize2
))
{
Log
.
d
(
"tmessages"
,
"Load normal lib"
);
File
Log
.
d
(
"tmessages"
,
"Load normal lib"
);
try
{
try
{
System
.
loadLibrary
(
"tmessages"
);
System
.
loadLibrary
(
"tmessages"
);
nativeLoaded
=
true
;
nativeLoaded
=
true
;
...
@@ -77,7 +77,7 @@ public class NativeLoader {
...
@@ -77,7 +77,7 @@ public class NativeLoader {
if
(
destLocalFile
.
exists
())
{
if
(
destLocalFile
.
exists
())
{
if
(
destLocalFile
.
length
()
==
libSize
)
{
if
(
destLocalFile
.
length
()
==
libSize
)
{
try
{
try
{
Log
.
d
(
"tmessages"
,
"Load local lib"
);
File
Log
.
d
(
"tmessages"
,
"Load local lib"
);
System
.
load
(
destLocalFile
.
getAbsolutePath
());
System
.
load
(
destLocalFile
.
getAbsolutePath
());
nativeLoaded
=
true
;
nativeLoaded
=
true
;
return
;
return
;
...
@@ -89,7 +89,7 @@ public class NativeLoader {
...
@@ -89,7 +89,7 @@ public class NativeLoader {
}
}
}
}
Log
.
e
(
"tmessages"
,
"Library not found, arch = "
+
folder
);
File
Log
.
e
(
"tmessages"
,
"Library not found, arch = "
+
folder
);
ZipFile
zipFile
=
null
;
ZipFile
zipFile
=
null
;
InputStream
stream
=
null
;
InputStream
stream
=
null
;
...
@@ -114,25 +114,25 @@ public class NativeLoader {
...
@@ -114,25 +114,25 @@ public class NativeLoader {
nativeLoaded
=
true
;
nativeLoaded
=
true
;
return
;
return
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
}
finally
{
if
(
stream
!=
null
)
{
if
(
stream
!=
null
)
{
try
{
try
{
stream
.
close
();
stream
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
if
(
zipFile
!=
null
)
{
if
(
zipFile
!=
null
)
{
try
{
try
{
zipFile
.
close
();
zipFile
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ApplicationLoader.java
View file @
bd4152dc
...
@@ -67,6 +67,12 @@ public class ApplicationLoader extends Application {
...
@@ -67,6 +67,12 @@ public class ApplicationLoader extends Application {
NativeLoader
.
initNativeLibs
(
applicationContext
);
NativeLoader
.
initNativeLibs
(
applicationContext
);
try
{
LocaleController
.
getInstance
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
try
{
try
{
final
IntentFilter
filter
=
new
IntentFilter
(
Intent
.
ACTION_SCREEN_ON
);
final
IntentFilter
filter
=
new
IntentFilter
(
Intent
.
ACTION_SCREEN_ON
);
filter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
);
filter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
);
...
@@ -119,12 +125,6 @@ public class ApplicationLoader extends Application {
...
@@ -119,12 +125,6 @@ public class ApplicationLoader extends Application {
super
.
onCreate
();
super
.
onCreate
();
lastPauseTime
=
System
.
currentTimeMillis
();
lastPauseTime
=
System
.
currentTimeMillis
();
applicationContext
=
getApplicationContext
();
applicationContext
=
getApplicationContext
();
NativeLoader
.
initNativeLibs
(
this
);
try
{
LocaleController
.
getInstance
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
applicationHandler
=
new
Handler
(
applicationContext
.
getMainLooper
());
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java
View file @
bd4152dc
...
@@ -17,9 +17,11 @@ import android.text.Layout;
...
@@ -17,9 +17,11 @@ import android.text.Layout;
import
android.text.StaticLayout
;
import
android.text.StaticLayout
;
import
android.text.TextPaint
;
import
android.text.TextPaint
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.HapticFeedbackConstants
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.SoundEffectConstants
;
import
android.view.SoundEffectConstants
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewConfiguration
;
import
org.telegram.messenger.LocaleController
;
import
org.telegram.messenger.LocaleController
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.TLRPC
;
...
@@ -28,6 +30,7 @@ import org.telegram.messenger.R;
...
@@ -28,6 +30,7 @@ import org.telegram.messenger.R;
import
org.telegram.messenger.Utilities
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.objects.MessageObject
;
import
org.telegram.objects.MessageObject
;
import
org.telegram.ui.Views.ImageReceiver
;
import
org.telegram.ui.Views.ImageReceiver
;
import
org.telegram.ui.Views.OnSwipeTouchListener
;
import
java.lang.ref.WeakReference
;
import
java.lang.ref.WeakReference
;
...
@@ -36,6 +39,10 @@ public class ChatBaseCell extends BaseCell {
...
@@ -36,6 +39,10 @@ public class ChatBaseCell extends BaseCell {
public
static
interface
ChatBaseCellDelegate
{
public
static
interface
ChatBaseCellDelegate
{
public
abstract
void
didPressedUserAvatar
(
ChatBaseCell
cell
,
TLRPC
.
User
user
);
public
abstract
void
didPressedUserAvatar
(
ChatBaseCell
cell
,
TLRPC
.
User
user
);
public
abstract
void
didPressedCanceSendButton
(
ChatBaseCell
cell
);
public
abstract
void
didPressedCanceSendButton
(
ChatBaseCell
cell
);
public
abstract
void
didLongPressed
(
ChatBaseCell
cell
);
public
abstract
boolean
canPerformActions
();
public
boolean
onSwipeLeft
();
public
boolean
onSwipeRight
();
}
}
public
boolean
isChat
=
false
;
public
boolean
isChat
=
false
;
...
@@ -107,12 +114,62 @@ public class ChatBaseCell extends BaseCell {
...
@@ -107,12 +114,62 @@ public class ChatBaseCell extends BaseCell {
protected
int
namesOffset
=
0
;
protected
int
namesOffset
=
0
;
private
boolean
checkingForLongPress
=
false
;
private
int
pressCount
=
0
;
private
CheckForLongPress
pendingCheckForLongPress
=
null
;
private
CheckForTap
pendingCheckForTap
=
null
;
private
OnSwipeTouchListener
onSwipeTouchListener
;
private
final
class
CheckForTap
implements
Runnable
{
public
void
run
()
{
if
(
pendingCheckForLongPress
==
null
)
{
pendingCheckForLongPress
=
new
CheckForLongPress
();
}
pendingCheckForLongPress
.
currentPressCount
=
++
pressCount
;
postDelayed
(
pendingCheckForLongPress
,
ViewConfiguration
.
getLongPressTimeout
()
-
ViewConfiguration
.
getTapTimeout
());
}
}
class
CheckForLongPress
implements
Runnable
{
public
int
currentPressCount
;
public
void
run
()
{
if
(
checkingForLongPress
&&
getParent
()
!=
null
&&
currentPressCount
==
pressCount
)
{
if
(
delegate
!=
null
)
{
checkingForLongPress
=
false
;
MotionEvent
event
=
MotionEvent
.
obtain
(
0
,
0
,
MotionEvent
.
ACTION_CANCEL
,
0
,
0
,
0
);
onTouchEvent
(
event
);
event
.
recycle
();
performHapticFeedback
(
HapticFeedbackConstants
.
LONG_PRESS
);
delegate
.
didLongPressed
(
ChatBaseCell
.
this
);
}
}
}
}
public
ChatBaseCell
(
Context
context
,
boolean
isMedia
)
{
public
ChatBaseCell
(
Context
context
,
boolean
isMedia
)
{
super
(
context
);
super
(
context
);
init
();
init
();
media
=
isMedia
;
media
=
isMedia
;
avatarImage
=
new
ImageReceiver
();
avatarImage
=
new
ImageReceiver
();
avatarImage
.
parentView
=
new
WeakReference
<
View
>(
this
);
avatarImage
.
parentView
=
new
WeakReference
<
View
>(
this
);
onSwipeTouchListener
=
new
OnSwipeTouchListener
()
{
public
void
onSwipeRight
()
{
if
(
delegate
!=
null
&&
delegate
.
onSwipeRight
())
{
MotionEvent
event
=
MotionEvent
.
obtain
(
0
,
0
,
MotionEvent
.
ACTION_CANCEL
,
0
,
0
,
0
);
onTouchEvent
(
event
);
event
.
recycle
();
}
}
public
void
onSwipeLeft
()
{
if
(
delegate
!=
null
&&
delegate
.
onSwipeLeft
())
{
MotionEvent
event
=
MotionEvent
.
obtain
(
0
,
0
,
MotionEvent
.
ACTION_CANCEL
,
0
,
0
,
0
);
onTouchEvent
(
event
);
event
.
recycle
();
}
}
};
}
}
@Override
@Override
...
@@ -158,7 +215,6 @@ public class ChatBaseCell extends BaseCell {
...
@@ -158,7 +215,6 @@ public class ChatBaseCell extends BaseCell {
forwardNamePaint
=
new
TextPaint
(
TextPaint
.
ANTI_ALIAS_FLAG
);
forwardNamePaint
=
new
TextPaint
(
TextPaint
.
ANTI_ALIAS_FLAG
);
forwardNamePaint
.
setTextSize
(
Utilities
.
dp
(
14
));
forwardNamePaint
.
setTextSize
(
Utilities
.
dp
(
14
));
}
}
}
}
...
@@ -210,6 +266,7 @@ public class ChatBaseCell extends BaseCell {
...
@@ -210,6 +266,7 @@ public class ChatBaseCell extends BaseCell {
currentMessageObject
=
messageObject
;
currentMessageObject
=
messageObject
;
isPressed
=
false
;
isPressed
=
false
;
isCheckPressed
=
true
;
isCheckPressed
=
true
;
isAvatarVisible
=
false
;
wasLayout
=
false
;
wasLayout
=
false
;
if
(
currentMessageObject
.
messageOwner
.
id
<
0
&&
currentMessageObject
.
messageOwner
.
send_state
!=
MessagesController
.
MESSAGE_SEND_STATE_SEND_ERROR
&&
currentMessageObject
.
messageOwner
.
send_state
!=
MessagesController
.
MESSAGE_SEND_STATE_SENT
)
{
if
(
currentMessageObject
.
messageOwner
.
id
<
0
&&
currentMessageObject
.
messageOwner
.
send_state
!=
MessagesController
.
MESSAGE_SEND_STATE_SEND_ERROR
&&
currentMessageObject
.
messageOwner
.
send_state
!=
MessagesController
.
MESSAGE_SEND_STATE_SENT
)
{
...
@@ -304,47 +361,82 @@ public class ChatBaseCell extends BaseCell {
...
@@ -304,47 +361,82 @@ public class ChatBaseCell extends BaseCell {
return
backgroundWidth
-
Utilities
.
dp
(
8
);
return
backgroundWidth
-
Utilities
.
dp
(
8
);
}
}
protected
void
startCheckLongPress
()
{
if
(
checkingForLongPress
)
{
return
;
}
checkingForLongPress
=
true
;
if
(
pendingCheckForTap
==
null
)
{
pendingCheckForTap
=
new
CheckForTap
();
}
postDelayed
(
pendingCheckForTap
,
ViewConfiguration
.
getTapTimeout
());
}
protected
void
cancelCheckLongPress
()
{
checkingForLongPress
=
false
;
if
(
pendingCheckForLongPress
!=
null
)
{
removeCallbacks
(
pendingCheckForLongPress
);
}
if
(
pendingCheckForTap
!=
null
)
{
removeCallbacks
(
pendingCheckForTap
);
}
}
protected
void
checkSwipes
(
MotionEvent
event
)
{
onSwipeTouchListener
.
onTouch
(
this
,
event
);
}
@Override
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
boolean
result
=
false
;
boolean
result
=
false
;
float
x
=
event
.
getX
();
float
x
=
event
.
getX
();
float
y
=
event
.
getY
();
float
y
=
event
.
getY
();
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_DOWN
)
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_DOWN
)
{
if
(
isAvatarVisible
&&
x
>=
avatarImage
.
imageX
&&
x
<=
avatarImage
.
imageX
+
avatarImage
.
imageW
&&
y
>=
avatarImage
.
imageY
&&
y
<=
avatarImage
.
imageY
+
avatarImage
.
imageH
)
{
if
(
delegate
==
null
||
delegate
.
canPerformActions
())
{
avatarPressed
=
true
;
if
(
isAvatarVisible
&&
x
>=
avatarImage
.
imageX
&&
x
<=
avatarImage
.
imageX
+
avatarImage
.
imageW
&&
y
>=
avatarImage
.
imageY
&&
y
<=
avatarImage
.
imageY
+
avatarImage
.
imageH
)
{
result
=
true
;
avatarPressed
=
true
;
}
else
if
(
drawForwardedName
&&
forwardedNameLayout
!=
null
)
{
if
(
x
>=
forwardNameX
&&
x
<=
forwardNameX
+
forwardedNameWidth
&&
y
>=
forwardNameY
&&
y
<=
forwardNameY
+
Utilities
.
dp
(
32
))
{
forwardNamePressed
=
true
;
result
=
true
;
result
=
true
;
}
else
if
(
drawForwardedName
&&
forwardedNameLayout
!=
null
)
{
if
(
x
>=
forwardNameX
&&
x
<=
forwardNameX
+
forwardedNameWidth
&&
y
>=
forwardNameY
&&
y
<=
forwardNameY
+
Utilities
.
dp
(
32
))
{
forwardNamePressed
=
true
;
result
=
true
;
}
}
}
}
if
(
result
)
{
}
else
if
(
avatarPressed
)
{
startCheckLongPress
();
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
avatarPressed
=
false
;
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
if
(
delegate
!=
null
)
{
delegate
.
didPressedUserAvatar
(
this
,
currentUser
);
}
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
avatarPressed
=
false
;
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(
isAvatarVisible
&&
!(
x
>=
avatarImage
.
imageX
&&
x
<=
avatarImage
.
imageX
+
avatarImage
.
imageW
&&
y
>=
avatarImage
.
imageY
&&
y
<=
avatarImage
.
imageY
+
avatarImage
.
imageH
))
{
avatarPressed
=
false
;
}
}
}
}
}
else
if
(
forwardNamePressed
)
{
}
else
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
if
(
event
.
getAction
()
!=
MotionEvent
.
ACTION_MOVE
)
{
forwardNamePressed
=
false
;
cancelCheckLongPress
();
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
}
if
(
delegate
!=
null
)
{
if
(
avatarPressed
)
{
delegate
.
didPressedUserAvatar
(
this
,
currentForwardUser
);
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
avatarPressed
=
false
;
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
if
(
delegate
!=
null
)
{
delegate
.
didPressedUserAvatar
(
this
,
currentUser
);
}
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
avatarPressed
=
false
;
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(
isAvatarVisible
&&
!(
x
>=
avatarImage
.
imageX
&&
x
<=
avatarImage
.
imageX
+
avatarImage
.
imageW
&&
y
>=
avatarImage
.
imageY
&&
y
<=
avatarImage
.
imageY
+
avatarImage
.
imageH
))
{
avatarPressed
=
false
;
}
}
}
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
}
else
if
(
forwardNamePressed
)
{
forwardNamePressed
=
false
;
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(!(
x
>=
forwardNameX
&&
x
<=
forwardNameX
+
forwardedNameWidth
&&
y
>=
forwardNameY
&&
y
<=
forwardNameY
+
Utilities
.
dp
(
32
)))
{
forwardNamePressed
=
false
;
forwardNamePressed
=
false
;
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
if
(
delegate
!=
null
)
{
delegate
.
didPressedUserAvatar
(
this
,
currentForwardUser
);
}
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
forwardNamePressed
=
false
;
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(!(
x
>=
forwardNameX
&&
x
<=
forwardNameX
+
forwardedNameWidth
&&
y
>=
forwardNameY
&&
y
<=
forwardNameY
+
Utilities
.
dp
(
32
)))
{
forwardNamePressed
=
false
;
}
}
}
}
}
}
}
...
@@ -401,7 +493,7 @@ public class ChatBaseCell extends BaseCell {
...
@@ -401,7 +493,7 @@ public class ChatBaseCell extends BaseCell {
}
}
if
(!
wasLayout
)
{
if
(!
wasLayout
)
{
request
Focus
();
request
Layout
();
return
;
return
;
}
}
...
@@ -547,7 +639,7 @@ public class ChatBaseCell extends BaseCell {
...
@@ -547,7 +639,7 @@ public class ChatBaseCell extends BaseCell {
setDrawableBounds
(
halfCheckDrawable
,
layoutWidth
-
Utilities
.
dp
(
18
)
-
halfCheckDrawable
.
getIntrinsicWidth
(),
layoutHeight
-
Utilities
.
dpf
(
8.5f
)
-
halfCheckDrawable
.
getIntrinsicHeight
());
setDrawableBounds
(
halfCheckDrawable
,
layoutWidth
-
Utilities
.
dp
(
18
)
-
halfCheckDrawable
.
getIntrinsicWidth
(),
layoutHeight
-
Utilities
.
dpf
(
8.5f
)
-
halfCheckDrawable
.
getIntrinsicHeight
());
halfCheckDrawable
.
draw
(
canvas
);
halfCheckDrawable
.
draw
(
canvas
);
}
else
{
}
else
{
setDrawableBounds
(
halfCheckMediaDrawable
,
layoutWidth
-
Utilities
.
dpf
(
20.5f
)
-
halfCheckMediaDrawable
.
getIntrinsicWidth
(),
layoutHeight
-
Utilities
.
dpf
(
13.
5
f
)
-
halfCheckMediaDrawable
.
getIntrinsicHeight
());
setDrawableBounds
(
halfCheckMediaDrawable
,
layoutWidth
-
Utilities
.
dpf
(
20.5f
)
-
halfCheckMediaDrawable
.
getIntrinsicWidth
(),
layoutHeight
-
Utilities
.
dpf
(
13.
0
f
)
-
halfCheckMediaDrawable
.
getIntrinsicHeight
());
halfCheckMediaDrawable
.
draw
(
canvas
);
halfCheckMediaDrawable
.
draw
(
canvas
);
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java
View file @
bd4152dc
...
@@ -108,9 +108,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -108,9 +108,10 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
@Override
@Override
protected
void
onDetachedFromWindow
()
{
protected
void
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
();
super
.
onDetachedFromWindow
();
//if (photoImage != null) {
if
(
photoImage
!=
null
)
{
// photoImage.clearImage();
photoImage
.
clearImage
();
//}
currentPhotoObject
=
null
;
}
if
(
gifDrawable
!=
null
)
{
if
(
gifDrawable
!=
null
)
{
MediaController
.
getInstance
().
clearGifDrawable
(
this
);
MediaController
.
getInstance
().
clearGifDrawable
(
this
);
gifDrawable
=
null
;
gifDrawable
=
null
;
...
@@ -125,43 +126,54 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -125,43 +126,54 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
boolean
result
=
false
;
boolean
result
=
false
;
int
side
=
Utilities
.
dp
(
44
);
int
side
=
Utilities
.
dp
(
44
);
checkSwipes
(
event
);
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_DOWN
)
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_DOWN
)
{
if
(
buttonState
!=
-
1
&&
x
>=
buttonX
&&
x
<=
buttonX
+
side
&&
y
>=
buttonY
&&
y
<=
buttonY
+
side
)
{
if
(
delegate
==
null
||
delegate
.
canPerformActions
())
{
buttonPressed
=
1
;
if
(
buttonState
!=
-
1
&&
x
>=
buttonX
&&
x
<=
buttonX
+
side
&&
y
>=
buttonY
&&
y
<=
buttonY
+
side
)
{
invalidate
();
buttonPressed
=
1
;
result
=
true
;
invalidate
();
}
else
if
(
x
>=
photoImage
.
imageX
&&
x
<=
photoImage
.
imageX
+
photoImage
.
imageW
&&
y
>=
photoImage
.
imageY
&&
y
<=
photoImage
.
imageY
+
photoImage
.
imageH
)
{
result
=
true
;
imagePressed
=
true
;
}
else
if
(
x
>=
photoImage
.
imageX
&&
x
<=
photoImage
.
imageX
+
photoImage
.
imageW
&&
y
>=
photoImage
.
imageY
&&
y
<=
photoImage
.
imageY
+
photoImage
.
imageH
)
{
result
=
true
;
imagePressed
=
true
;
result
=
true
;
}
if
(
result
)
{
startCheckLongPress
();
}
}
}
}
else
if
(
buttonPressed
==
1
)
{
}
else
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
if
(
event
.
getAction
()
!=
MotionEvent
.
ACTION_MOVE
)
{
buttonPressed
=
0
;
cancelCheckLongPress
();
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
}
didPressedButton
();
if
(
buttonPressed
==
1
)
{
invalidate
();
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
buttonPressed
=
0
;
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(!(
x
>=
buttonX
&&
x
<=
buttonX
+
side
&&
y
>=
buttonY
&&
y
<=
buttonY
+
side
))
{
buttonPressed
=
0
;
buttonPressed
=
0
;
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
didPressedButton
();
invalidate
();
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
buttonPressed
=
0
;
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(!(
x
>=
buttonX
&&
x
<=
buttonX
+
side
&&
y
>=
buttonY
&&
y
<=
buttonY
+
side
))
{
buttonPressed
=
0
;
invalidate
();
}
}
}
}
}
else
if
(
imagePressed
)
{
}
else
if
(
imagePressed
)
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
imagePressed
=
false
;
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
didPressedImage
();
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
imagePressed
=
false
;
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(!(
x
>=
photoImage
.
imageX
&&
x
<=
photoImage
.
imageX
+
photoImage
.
imageW
&&
y
>=
photoImage
.
imageY
&&
y
<=
photoImage
.
imageY
+
photoImage
.
imageH
))
{
imagePressed
=
false
;
imagePressed
=
false
;
playSoundEffect
(
SoundEffectConstants
.
CLICK
);
didPressedImage
();
invalidate
();
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_CANCEL
)
{
imagePressed
=
false
;
invalidate
();
}
else
if
(
event
.
getAction
()
==
MotionEvent
.
ACTION_MOVE
)
{
if
(!(
x
>=
photoImage
.
imageX
&&
x
<=
photoImage
.
imageX
+
photoImage
.
imageW
&&
y
>=
photoImage
.
imageY
&&
y
<=
photoImage
.
imageY
+
photoImage
.
imageH
))
{
imagePressed
=
false
;
invalidate
();
}
}
}
}
}
}
}
...
@@ -237,110 +249,118 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -237,110 +249,118 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
}
}
@Override
@Override
public
void
setMessageObject
(
MessageObject
messageObject
)
{
protected
boolean
isUserDataChanged
()
{
super
.
setMessageObject
(
messageObject
);
return
currentPhotoObject
==
null
||
super
.
isUserDataChanged
();
}
progressVisible
=
false
;
buttonState
=
-
1
;
gifDrawable
=
null
;
if
(
messageObject
.
type
==
8
)
{
@Override
gifDrawable
=
MediaController
.
getInstance
().
getGifDrawable
(
this
,
false
);
public
void
setMessageObject
(
MessageObject
messageObject
)
{
if
(
currentMessageObject
!=
messageObject
||
isUserDataChanged
())
{
super
.
setMessageObject
(
messageObject
);
String
str
=
Utilities
.
formatFileSize
(
messageObject
.
messageOwner
.
media
.
document
.
size
);
progressVisible
=
false
;
if
(
currentInfoString
==
null
||
!
currentInfoString
.
equals
(
str
))
{
buttonState
=
-
1
;
currentInfoString
=
str
;
gifDrawable
=
null
;
infoWidth
=
(
int
)
Math
.
ceil
(
infoPaint
.
measureText
(
currentInfoString
));
infoLayout
=
new
StaticLayout
(
currentInfoString
,
infoPaint
,
infoWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
}
}
else
{
currentInfoString
=
null
;
infoLayout
=
null
;
}
photoWidth
=
(
int
)
(
Math
.
min
(
Utilities
.
displaySize
.
x
,
Utilities
.
displaySize
.
y
)
*
0.7f
);
if
(
messageObject
.
type
==
8
)
{
photoHeight
=
photoWidth
+
Utilities
.
dp
(
100
);
gifDrawable
=
MediaController
.
getInstance
().
getGifDrawable
(
this
,
false
);
if
(
messageObject
.
type
==
6
||
messageObject
.
type
==
7
)
{
photoWidth
=
(
int
)
(
Math
.
min
(
Utilities
.
displaySize
.
x
,
Utilities
.
displaySize
.
y
)
/
2.5f
);
photoHeight
=
photoWidth
+
100
;
}
if
(
photoWidth
>
800
)
{
photoWidth
=
800
;
}
if
(
photoHeight
>
800
)
{
photoHeight
=
800
;
}
currentPhotoObject
=
PhotoObject
.
getClosestImageWithSize
(
messageObject
.
photoThumbs
,
photoWidth
,
photoHeight
);
String
str
=
Utilities
.
formatFileSize
(
messageObject
.
messageOwner
.
media
.
document
.
size
);
if
(
currentPhotoObject
!=
null
)
{
if
(
currentInfoString
==
null
||
!
currentInfoString
.
equals
(
str
))
{
float
scale
=
(
float
)
currentPhotoObject
.
photoOwner
.
w
/
(
float
)
photoWidth
;
currentInfoString
=
str
;
infoWidth
=
(
int
)
Math
.
ceil
(
infoPaint
.
measureText
(
currentInfoString
));
int
w
=
(
int
)
(
currentPhotoObject
.
photoOwner
.
w
/
scale
);
infoLayout
=
new
StaticLayout
(
currentInfoString
,
infoPaint
,
infoWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
int
h
=
(
int
)
(
currentPhotoObject
.
photoOwner
.
h
/
scale
);
if
(
h
>
photoHeight
)
{
float
scale2
=
h
;
h
=
photoHeight
;
scale2
/=
h
;
w
=
(
int
)
(
w
/
scale2
);
}
else
if
(
h
<
Utilities
.
dp
(
120
))
{
h
=
Utilities
.
dp
(
120
);
float
hScale
=
(
float
)
currentPhotoObject
.
photoOwner
.
h
/
h
;
if
(
currentPhotoObject
.
photoOwner
.
w
/
hScale
<
photoWidth
)
{
w
=
(
int
)
(
currentPhotoObject
.
photoOwner
.
w
/
hScale
);
}
}
}
else
{
currentInfoString
=
null
;
infoLayout
=
null
;
}
}
photoWidth
=
w
;
photoWidth
=
(
int
)
(
Math
.
min
(
Utilities
.
displaySize
.
x
,
Utilities
.
displaySize
.
y
)
*
0.7f
);
photoHeight
=
h
;
photoHeight
=
photoWidth
+
Utilities
.
dp
(
100
);
backgroundWidth
=
w
+
Utilities
.
dp
(
12
);
if
(
messageObject
.
type
==
6
||
messageObject
.
type
==
7
)
{
currentPhotoFilter
=
String
.
format
(
Locale
.
US
,
"%d_%d"
,
(
int
)
(
w
/
Utilities
.
density
),
(
int
)
(
h
/
Utilities
.
density
));
photoWidth
=
(
int
)
(
Math
.
min
(
Utilities
.
displaySize
.
x
,
Utilities
.
displaySize
.
y
)
/
2.5f
);
photoHeight
=
photoWidth
+
100
;
}
if
(
photoWidth
>
800
)
{
photoWidth
=
800
;
}
if
(
photoHeight
>
800
)
{
photoHeight
=
800
;
}
if
(
currentPhotoObject
.
image
!=
null
)
{
currentPhotoObject
=
PhotoObject
.
getClosestImageWithSize
(
messageObject
.
photoThumbs
,
photoWidth
,
photoHeight
);
photoImage
.
setImageBitmap
(
currentPhotoObject
.
image
);
if
(
currentPhotoObject
!=
null
)
{
}
else
{
float
scale
=
(
float
)
currentPhotoObject
.
photoOwner
.
w
/
(
float
)
photoWidth
;
boolean
photoExist
=
true
;
String
fileName
=
MessageObject
.
getAttachFileName
(
currentPhotoObject
.
photoOwner
);
int
w
=
(
int
)
(
currentPhotoObject
.
photoOwner
.
w
/
scale
);
if
(
messageObject
.
type
==
1
)
{
int
h
=
(
int
)
(
currentPhotoObject
.
photoOwner
.
h
/
scale
);
File
cacheFile
=
new
File
(
Utilities
.
getCacheDir
(),
fileName
);
if
(
h
>
photoHeight
)
{
if
(!
cacheFile
.
exists
())
{
float
scale2
=
h
;
photoExist
=
false
;
h
=
photoHeight
;
}
else
{
scale2
/=
h
;
MediaController
.
getInstance
().
removeLoadingFileObserver
(
this
);
w
=
(
int
)
(
w
/
scale2
);
}
else
if
(
h
<
Utilities
.
dp
(
120
))
{
h
=
Utilities
.
dp
(
120
);
float
hScale
=
(
float
)
currentPhotoObject
.
photoOwner
.
h
/
h
;
if
(
currentPhotoObject
.
photoOwner
.
w
/
hScale
<
photoWidth
)
{
w
=
(
int
)
(
currentPhotoObject
.
photoOwner
.
w
/
hScale
);
}
}
}
}
if
(
photoExist
||
downloadPhotos
)
{
if
(
messageObject
.
imagePreview
!=
null
)
{
photoWidth
=
w
;
photoImage
.
setImage
(
currentPhotoObject
.
photoOwner
.
location
,
currentPhotoFilter
,
new
BitmapDrawable
(
messageObject
.
imagePreview
),
currentPhotoObject
.
photoOwner
.
size
);
photoHeight
=
h
;
}
else
{
backgroundWidth
=
w
+
Utilities
.
dp
(
12
);
photoImage
.
setImage
(
currentPhotoObject
.
photoOwner
.
location
,
currentPhotoFilter
,
messageObject
.
messageOwner
.
out
?
placeholderOutDrawable
:
placeholderInDrawable
,
currentPhotoObject
.
photoOwner
.
size
);
currentPhotoFilter
=
String
.
format
(
Locale
.
US
,
"%d_%d"
,
(
int
)
(
w
/
Utilities
.
density
),
(
int
)
(
h
/
Utilities
.
density
));
}
if
(
currentPhotoObject
.
image
!=
null
)
{
photoImage
.
setImageBitmap
(
currentPhotoObject
.
image
);
}
else
{
}
else
{
if
(
messageObject
.
imagePreview
!=
null
)
{
boolean
photoExist
=
true
;
photoImage
.
setImageBitmap
(
messageObject
.
imagePreview
);
String
fileName
=
MessageObject
.
getAttachFileName
(
currentPhotoObject
.
photoOwner
);
if
(
messageObject
.
type
==
1
)
{
File
cacheFile
=
new
File
(
Utilities
.
getCacheDir
(),
fileName
);
if
(!
cacheFile
.
exists
())
{
photoExist
=
false
;
}
else
{
MediaController
.
getInstance
().
removeLoadingFileObserver
(
this
);
}
}
if
(
photoExist
||
downloadPhotos
)
{
if
(
messageObject
.
imagePreview
!=
null
)
{
photoImage
.
setImage
(
currentPhotoObject
.
photoOwner
.
location
,
currentPhotoFilter
,
new
BitmapDrawable
(
messageObject
.
imagePreview
),
currentPhotoObject
.
photoOwner
.
size
);
}
else
{
photoImage
.
setImage
(
currentPhotoObject
.
photoOwner
.
location
,
currentPhotoFilter
,
messageObject
.
messageOwner
.
out
?
placeholderOutDrawable
:
placeholderInDrawable
,
currentPhotoObject
.
photoOwner
.
size
);
}
}
else
{
}
else
{
photoImage
.
setImageBitmap
(
messageObject
.
messageOwner
.
out
?
placeholderOutDrawable
:
placeholderInDrawable
);
if
(
messageObject
.
imagePreview
!=
null
)
{
photoImage
.
setImageBitmap
(
messageObject
.
imagePreview
);
}
else
{
photoImage
.
setImageBitmap
(
messageObject
.
messageOwner
.
out
?
placeholderOutDrawable
:
placeholderInDrawable
);
}
}
}
}
}
}
else
{
photoImage
.
setImageBitmap
(
messageObject
.
messageOwner
.
out
?
placeholderOutDrawable
:
placeholderInDrawable
);
}
}
}
else
{
photoImage
.
setImageBitmap
(
messageObject
.
messageOwner
.
out
?
placeholderOutDrawable
:
placeholderInDrawable
);
}
/*if ((type == 6 || type == 7) && videoTimeText != null) {
int duration = message.messageOwner.media.video.duration;
int minutes = duration / 60;
int seconds = duration - minutes * 60;
videoTimeText.setText(String.format("%d:%02d", minutes, seconds));
}*/
/*if ((type == 6 || type == 7) && videoTimeText != null) {
int duration = message.messageOwner.media.video.duration;
int minutes = duration / 60;
int seconds = duration - minutes * 60;
videoTimeText.setText(String.format("%d:%02d", minutes, seconds));
}*/
}
updateButtonState
();
updateButtonState
();
invalidate
();
}
}
public
void
updateButtonState
()
{
public
void
updateButtonState
()
{
String
fileName
=
null
;
String
fileName
=
null
;
File
cacheFile
=
null
;
File
cacheFile
=
null
;
if
(
currentMessageObject
.
type
==
1
)
{
if
(
currentMessageObject
.
type
==
1
)
{
if
(
currentPhotoObject
==
null
)
{
return
;
}
fileName
=
MessageObject
.
getAttachFileName
(
currentPhotoObject
.
photoOwner
);
fileName
=
MessageObject
.
getAttachFileName
(
currentPhotoObject
.
photoOwner
);
cacheFile
=
new
File
(
Utilities
.
getCacheDir
(),
fileName
);
cacheFile
=
new
File
(
Utilities
.
getCacheDir
(),
fileName
);
}
else
if
(
currentMessageObject
.
type
==
8
)
{
}
else
if
(
currentMessageObject
.
type
==
8
)
{
...
@@ -405,7 +425,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -405,7 +425,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
}
else
{
}
else
{
MediaController
.
getInstance
().
removeLoadingFileObserver
(
this
);
MediaController
.
getInstance
().
removeLoadingFileObserver
(
this
);
progressVisible
=
false
;
progressVisible
=
false
;
if
(
currentMessageObject
.
type
==
8
&&
gifDrawable
==
null
)
{
if
(
currentMessageObject
.
type
==
8
&&
(
gifDrawable
==
null
||
gifDrawable
!=
null
&&
!
gifDrawable
.
isRunning
())
)
{
buttonState
=
2
;
buttonState
=
2
;
}
else
{
}
else
{
buttonState
=
-
1
;
buttonState
=
-
1
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
bd4152dc
...
@@ -93,7 +93,6 @@ import org.telegram.ui.Cells.ChatMessageCell;
...
@@ -93,7 +93,6 @@ import org.telegram.ui.Cells.ChatMessageCell;
import
org.telegram.ui.Views.BackupImageView
;
import
org.telegram.ui.Views.BackupImageView
;
import
org.telegram.ui.Views.BaseFragment
;
import
org.telegram.ui.Views.BaseFragment
;
import
org.telegram.ui.Views.EmojiView
;
import
org.telegram.ui.Views.EmojiView
;
import
org.telegram.ui.Views.GifDrawable
;
import
org.telegram.ui.Views.LayoutListView
;
import
org.telegram.ui.Views.LayoutListView
;
import
org.telegram.ui.Views.MessageActionLayout
;
import
org.telegram.ui.Views.MessageActionLayout
;
import
org.telegram.ui.Views.OnSwipeTouchListener
;
import
org.telegram.ui.Views.OnSwipeTouchListener
;
...
@@ -883,49 +882,21 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -883,49 +882,21 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
chatListView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
chatListView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
public
void
onSwipeRight
()
{
public
void
onSwipeRight
()
{
try
{
ChatActivity
.
this
.
onSwipeRight
();
if
(
visibleDialog
!=
null
)
{
visibleDialog
.
dismiss
();
visibleDialog
=
null
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
finishFragment
(
true
);
}
}
public
void
onSwipeLeft
()
{
public
void
onSwipeLeft
()
{
if
(
swipeOpening
)
{
ChatActivity
.
this
.
onSwipeLeft
();
return
;
}
try
{
if
(
visibleDialog
!=
null
)
{
visibleDialog
.
dismiss
();
visibleDialog
=
null
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(
avatarImageView
!=
null
)
{
swipeOpening
=
true
;
avatarImageView
.
performClick
();
}
}
}
});
});
emptyView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
emptyView
.
setOnTouchListener
(
new
OnSwipeTouchListener
()
{
public
void
onSwipeRight
()
{
public
void
onSwipeRight
()
{
finishFragment
(
true
);
ChatActivity
.
this
.
onSwipeRight
(
);
}
}
public
void
onSwipeLeft
()
{
public
void
onSwipeLeft
()
{
if
(
swipeOpening
)
{
ChatActivity
.
this
.
onSwipeLeft
();
return
;
}
if
(
avatarImageView
!=
null
)
{
swipeOpening
=
true
;
avatarImageView
.
performClick
();
}
}
}
});
});
if
(
currentChat
!=
null
&&
(
currentChat
instanceof
TLRPC
.
TL_chatForbidden
||
currentChat
.
left
))
{
if
(
currentChat
!=
null
&&
(
currentChat
instanceof
TLRPC
.
TL_chatForbidden
||
currentChat
.
left
))
{
...
@@ -942,6 +913,38 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -942,6 +913,38 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
return
fragmentView
;
return
fragmentView
;
}
}
private
boolean
onSwipeLeft
()
{
if
(
swipeOpening
)
{
return
false
;
}
try
{
if
(
visibleDialog
!=
null
)
{
visibleDialog
.
dismiss
();
visibleDialog
=
null
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(
avatarImageView
!=
null
)
{
swipeOpening
=
true
;
avatarImageView
.
performClick
();
}
return
true
;
}
private
boolean
onSwipeRight
()
{
try
{
if
(
visibleDialog
!=
null
)
{
visibleDialog
.
dismiss
();
visibleDialog
=
null
;
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
finishFragment
(
true
);
return
true
;
}
private
void
checkSendButton
()
{
private
void
checkSendButton
()
{
String
message
=
messsageEditText
.
getText
().
toString
().
trim
();
String
message
=
messsageEditText
.
getText
().
toString
().
trim
();
message
=
message
.
replaceAll
(
"\n\n+"
,
"\n\n"
);
message
=
message
.
replaceAll
(
"\n\n+"
,
"\n\n"
);
...
@@ -1247,7 +1250,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -1247,7 +1250,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
if
(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaDocument
)
{
if
(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaDocument
)
{
String
mime
=
messageObject
.
messageOwner
.
media
.
document
.
mime_type
;
String
mime
=
messageObject
.
messageOwner
.
media
.
document
.
mime_type
;
if
(
mime
!=
null
&&
mime
.
equals
(
"text/xml"
))
{
if
(
mime
!=
null
&&
mime
.
equals
(
"text/xml"
))
{
return
5
;
return
4
;
}
}
}
}
return
4
;
return
4
;
...
@@ -1291,7 +1294,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -1291,7 +1294,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
if
(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaDocument
)
{
if
(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaDocument
)
{
String
mime
=
messageObject
.
messageOwner
.
media
.
document
.
mime_type
;
String
mime
=
messageObject
.
messageOwner
.
media
.
document
.
mime_type
;
if
(
mime
!=
null
&&
mime
.
equals
(
"text/xml"
))
{
if
(
mime
!=
null
&&
mime
.
equals
(
"text/xml"
))
{
return
5
;
return
4
;
}
}
}
}
//return 4;
//return 4;
...
@@ -1615,7 +1618,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -1615,7 +1618,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
String
ext
=
""
;
String
ext
=
""
;
int
idx
=
documentFilePath
.
lastIndexOf
(
"."
);
int
idx
=
documentFilePath
.
lastIndexOf
(
"."
);
if
(
idx
!=
-
1
)
{
if
(
idx
!=
-
1
)
{
ext
=
documentFilePath
.
substring
(
idx
);
ext
=
documentFilePath
.
substring
(
idx
+
1
);
}
}
TLRPC
.
TL_document
document
=
new
TLRPC
.
TL_document
();
TLRPC
.
TL_document
document
=
new
TLRPC
.
TL_document
();
document
.
id
=
0
;
document
.
id
=
0
;
...
@@ -1637,19 +1640,13 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -1637,19 +1640,13 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
document
.
mime_type
=
"application/octet-stream"
;
document
.
mime_type
=
"application/octet-stream"
;
}
}
if
(
document
.
mime_type
.
equals
(
"image/gif"
))
{
if
(
document
.
mime_type
.
equals
(
"image/gif"
))
{
GifDrawable
gifDrawable
=
null
;
try
{
try
{
gifDrawable
=
new
GifDrawable
(
f
);
Bitmap
bitmap
=
FileLoader
.
loadBitmap
(
f
.
getAbsolutePath
(),
null
,
90
,
90
);
Bitmap
bitmap
=
gifDrawable
.
getBitmap
();
if
(
bitmap
!=
null
)
{
if
(
bitmap
!=
null
)
{
document
.
thumb
=
FileLoader
.
scaleAndSaveImage
(
bitmap
,
90
,
90
,
55
,
currentEncryptedChat
!=
null
);
document
.
thumb
=
FileLoader
.
scaleAndSaveImage
(
bitmap
,
90
,
90
,
55
,
currentEncryptedChat
!=
null
);
document
.
thumb
.
type
=
"s"
;
document
.
thumb
.
type
=
"s"
;
}
}
gifDrawable
.
recycle
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
gifDrawable
!=
null
)
{
gifDrawable
.
recycle
();
}
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
...
@@ -3187,19 +3184,13 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -3187,19 +3184,13 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
document
.
mime_type
=
"application/octet-stream"
;
document
.
mime_type
=
"application/octet-stream"
;
}
}
if
(
document
.
mime_type
.
equals
(
"image/gif"
))
{
if
(
document
.
mime_type
.
equals
(
"image/gif"
))
{
GifDrawable
gifDrawable
=
null
;
try
{
try
{
gifDrawable
=
new
GifDrawable
(
path
);
Bitmap
bitmap
=
FileLoader
.
loadBitmap
(
path
,
null
,
90
,
90
);
Bitmap
bitmap
=
gifDrawable
.
getBitmap
();
if
(
bitmap
!=
null
)
{
if
(
bitmap
!=
null
)
{
document
.
thumb
=
FileLoader
.
scaleAndSaveImage
(
bitmap
,
90
,
90
,
55
,
currentEncryptedChat
!=
null
);
document
.
thumb
=
FileLoader
.
scaleAndSaveImage
(
bitmap
,
90
,
90
,
80
,
currentEncryptedChat
!=
null
);
document
.
thumb
.
type
=
"s"
;
document
.
thumb
.
type
=
"s"
;
}
}
gifDrawable
.
recycle
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
gifDrawable
!=
null
)
{
gifDrawable
.
recycle
();
}
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
}
...
@@ -3661,6 +3652,26 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -3661,6 +3652,26 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
MessagesController
.
getInstance
().
cancelSendingMessage
(
message
);
MessagesController
.
getInstance
().
cancelSendingMessage
(
message
);
}
}
}
}
@Override
public
void
didLongPressed
(
ChatBaseCell
cell
)
{
createMenu
(
cell
,
false
);
}
@Override
public
boolean
canPerformActions
()
{
return
mActionMode
==
null
;
}
@Override
public
boolean
onSwipeLeft
()
{
return
ChatActivity
.
this
.
onSwipeLeft
();
}
@Override
public
boolean
onSwipeRight
()
{
return
ChatActivity
.
this
.
onSwipeRight
();
}
};
};
if
(
view
instanceof
ChatMediaCell
)
{
if
(
view
instanceof
ChatMediaCell
)
{
((
ChatMediaCell
)
view
).
mediaDelegate
=
new
ChatMediaCell
.
ChatMediaCellDelegate
()
{
((
ChatMediaCell
)
view
).
mediaDelegate
=
new
ChatMediaCell
.
ChatMediaCellDelegate
()
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
bd4152dc
...
@@ -65,8 +65,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
...
@@ -65,8 +65,8 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
private
String
videoPath
=
null
;
private
String
videoPath
=
null
;
private
String
sendingText
=
null
;
private
String
sendingText
=
null
;
private
String
documentPath
=
null
;
private
String
documentPath
=
null
;
private
Uri
[]
imagesPathArray
=
null
;
private
ArrayList
<
Uri
>
imagesPathArray
=
null
;
private
String
[]
documentsPathArray
=
null
;
private
ArrayList
<
String
>
documentsPathArray
=
null
;
private
ArrayList
<
TLRPC
.
User
>
contactsToSend
=
null
;
private
ArrayList
<
TLRPC
.
User
>
contactsToSend
=
null
;
private
int
currentConnectionState
;
private
int
currentConnectionState
;
private
View
statusView
;
private
View
statusView
;
...
@@ -329,7 +329,18 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
...
@@ -329,7 +329,18 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
parcelable
=
Uri
.
parse
(
parcelable
.
toString
());
parcelable
=
Uri
.
parse
(
parcelable
.
toString
());
}
}
if
(
parcelable
!=
null
&&
type
!=
null
&&
type
.
startsWith
(
"image/"
))
{
if
(
parcelable
!=
null
&&
type
!=
null
&&
type
.
startsWith
(
"image/"
))
{
photoPath
=
(
Uri
)
parcelable
;
if
(
type
.
equals
(
"image/gif"
))
{
try
{
documentPath
=
Utilities
.
getPath
((
Uri
)
parcelable
);
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(
documentPath
==
null
)
{
photoPath
=
(
Uri
)
parcelable
;
}
}
else
{
photoPath
=
(
Uri
)
parcelable
;
}
}
else
{
}
else
{
path
=
Utilities
.
getPath
((
Uri
)
parcelable
);
path
=
Utilities
.
getPath
((
Uri
)
parcelable
);
if
(
path
!=
null
)
{
if
(
path
!=
null
)
{
...
@@ -356,31 +367,42 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
...
@@ -356,31 +367,42 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
String
type
=
intent
.
getType
();
String
type
=
intent
.
getType
();
if
(
uris
!=
null
)
{
if
(
uris
!=
null
)
{
if
(
type
!=
null
&&
type
.
startsWith
(
"image/"
))
{
if
(
type
!=
null
&&
type
.
startsWith
(
"image/"
))
{
Uri
[]
uris2
=
new
Uri
[
uris
.
size
()];
for
(
Parcelable
parcelable
:
uris
)
{
for
(
int
i
=
0
;
i
<
uris2
.
length
;
i
++)
{
Parcelable
parcelable
=
uris
.
get
(
i
);
if
(!(
parcelable
instanceof
Uri
))
{
if
(!(
parcelable
instanceof
Uri
))
{
parcelable
=
Uri
.
parse
(
parcelable
.
toString
());
parcelable
=
Uri
.
parse
(
parcelable
.
toString
());
}
}
uris2
[
i
]
=
(
Uri
)
parcelable
;
if
(
type
.
equals
(
"image/gif"
))
{
if
(
documentsPathArray
==
null
)
{
documentsPathArray
=
new
ArrayList
<
String
>();
}
try
{
documentsPathArray
.
add
(
Utilities
.
getPath
((
Uri
)
parcelable
));
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
else
{
if
(
imagesPathArray
==
null
)
{
imagesPathArray
=
new
ArrayList
<
Uri
>();
}
imagesPathArray
.
add
((
Uri
)
parcelable
);
}
}
}
imagesPathArray
=
uris2
;
}
else
{
}
else
{
String
[]
uris2
=
new
String
[
uris
.
size
()];
for
(
Parcelable
parcelable
:
uris
)
{
for
(
int
i
=
0
;
i
<
uris2
.
length
;
i
++)
{
Parcelable
parcelable
=
uris
.
get
(
i
);
if
(!(
parcelable
instanceof
Uri
))
{
if
(!(
parcelable
instanceof
Uri
))
{
parcelable
=
Uri
.
parse
(
parcelable
.
toString
());
parcelable
=
Uri
.
parse
(
parcelable
.
toString
());
}
}
String
path
=
Utilities
.
getPath
((
Uri
)
parcelable
);
String
path
=
Utilities
.
getPath
((
Uri
)
parcelable
);
if
(
path
!=
null
)
{
if
(
path
!=
null
)
{
if
(
path
.
startsWith
(
"file:"
))
{
if
(
path
.
startsWith
(
"file:"
))
{
path
=
path
.
replace
(
"file://"
,
""
);
path
=
path
.
replace
(
"file://"
,
""
);
}
}
uris2
[
i
]
=
path
;
if
(
documentsPathArray
==
null
)
{
documentsPathArray
=
new
ArrayList
<
String
>();
}
documentsPathArray
.
add
(
path
);
}
}
}
}
documentsPathArray
=
uris2
;
}
}
}
else
{
}
else
{
error
=
true
;
error
=
true
;
...
@@ -537,21 +559,27 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
...
@@ -537,21 +559,27 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
}
}
if
(
photoPath
!=
null
)
{
if
(
photoPath
!=
null
)
{
fragment
.
processSendingPhoto
(
null
,
photoPath
);
fragment
.
processSendingPhoto
(
null
,
photoPath
);
}
else
if
(
videoPath
!=
null
)
{
}
if
(
videoPath
!=
null
)
{
fragment
.
processSendingVideo
(
videoPath
);
fragment
.
processSendingVideo
(
videoPath
);
}
else
if
(
sendingText
!=
null
)
{
}
if
(
sendingText
!=
null
)
{
fragment
.
processSendingText
(
sendingText
);
fragment
.
processSendingText
(
sendingText
);
}
else
if
(
documentPath
!=
null
)
{
}
if
(
documentPath
!=
null
)
{
fragment
.
processSendingDocument
(
documentPath
);
fragment
.
processSendingDocument
(
documentPath
);
}
else
if
(
imagesPathArray
!=
null
)
{
}
if
(
imagesPathArray
!=
null
)
{
for
(
Uri
path
:
imagesPathArray
)
{
for
(
Uri
path
:
imagesPathArray
)
{
fragment
.
processSendingPhoto
(
null
,
path
);
fragment
.
processSendingPhoto
(
null
,
path
);
}
}
}
else
if
(
documentsPathArray
!=
null
)
{
}
if
(
documentsPathArray
!=
null
)
{
for
(
String
path
:
documentsPathArray
)
{
for
(
String
path
:
documentsPathArray
)
{
fragment
.
processSendingDocument
(
path
);
fragment
.
processSendingDocument
(
path
);
}
}
}
else
if
(
contactsToSend
!=
null
&&
!
contactsToSend
.
isEmpty
())
{
}
if
(
contactsToSend
!=
null
&&
!
contactsToSend
.
isEmpty
())
{
for
(
TLRPC
.
User
user
:
contactsToSend
)
{
for
(
TLRPC
.
User
user
:
contactsToSend
)
{
MessagesController
.
getInstance
().
sendMessage
(
user
,
dialog_id
);
MessagesController
.
getInstance
().
sendMessage
(
user
,
dialog_id
);
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ImageReceiver.java
View file @
bd4152dc
...
@@ -143,15 +143,6 @@ public class ImageReceiver {
...
@@ -143,15 +143,6 @@ public class ImageReceiver {
recycleBitmap
(
null
);
recycleBitmap
(
null
);
}
}
@Override
protected
void
finalize
()
throws
Throwable
{
try
{
clearImage
();
}
finally
{
super
.
finalize
();
}
}
private
void
recycleBitmap
(
Bitmap
newBitmap
)
{
private
void
recycleBitmap
(
Bitmap
newBitmap
)
{
if
(
currentImage
==
null
||
isPlaceholder
)
{
if
(
currentImage
==
null
||
isPlaceholder
)
{
return
;
return
;
...
...
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