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
fc14e8b4
Commit
fc14e8b4
authored
Jun 13, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
ad0188ba
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
257 additions
and
162 deletions
+257
-162
build.gradle
TMessagesProj/build.gradle
+2
-2
BuffersStorage.java
.../src/main/java/org/telegram/messenger/BuffersStorage.java
+15
-5
ConnectionsManager.java
.../main/java/org/telegram/messenger/ConnectionsManager.java
+10
-6
DispatchQueue.java
...j/src/main/java/org/telegram/messenger/DispatchQueue.java
+6
-1
Emoji.java
...sagesProj/src/main/java/org/telegram/messenger/Emoji.java
+45
-40
MessagesStorage.java
...src/main/java/org/telegram/messenger/MessagesStorage.java
+21
-0
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+9
-7
PhotoPickerActivity.java
...oj/src/main/java/org/telegram/ui/PhotoPickerActivity.java
+1
-1
ActionBarActivity.java
...va/org/telegram/ui/Views/ActionBar/ActionBarActivity.java
+79
-38
ActionBarMenuItem.java
...va/org/telegram/ui/Views/ActionBar/ActionBarMenuItem.java
+2
-1
ActionBarPopupWindow.java
...org/telegram/ui/Views/ActionBar/ActionBarPopupWindow.java
+1
-0
BaseFragment.java
...in/java/org/telegram/ui/Views/ActionBar/BaseFragment.java
+15
-6
EmojiView.java
...esProj/src/main/java/org/telegram/ui/Views/EmojiView.java
+51
-55
No files found.
TMessagesProj/build.gradle
View file @
fc14e8b4
...
@@ -81,7 +81,7 @@ android {
...
@@ -81,7 +81,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
25
1
versionCode
25
2
versionName
"1.5.
0
"
versionName
"1.5.
1
"
}
}
}
}
TMessagesProj/src/main/java/org/telegram/messenger/BuffersStorage.java
View file @
fc14e8b4
...
@@ -126,24 +126,34 @@ public class BuffersStorage {
...
@@ -126,24 +126,34 @@ public class BuffersStorage {
}
}
if
(
buffer
.
buffer
.
capacity
()
==
128
)
{
if
(
buffer
.
buffer
.
capacity
()
==
128
)
{
synchronized
(
freeBuffers128
)
{
synchronized
(
freeBuffers128
)
{
if
(
freeBuffers128
.
size
()
<
10
)
{
freeBuffers128
.
add
(
buffer
);
freeBuffers128
.
add
(
buffer
);
}
}
}
}
else
if
(
buffer
.
buffer
.
capacity
()
==
1024
+
200
)
{
}
else
if
(
buffer
.
buffer
.
capacity
()
==
1024
+
200
)
{
synchronized
(
freeBuffers1024
)
{
synchronized
(
freeBuffers1024
)
{
if
(
freeBuffers1024
.
size
()
<
10
)
{
freeBuffers1024
.
add
(
buffer
);
freeBuffers1024
.
add
(
buffer
);
}
}
}
}
else
if
(
buffer
.
buffer
.
capacity
()
==
4096
+
200
)
{
}
else
if
(
buffer
.
buffer
.
capacity
()
==
4096
+
200
)
{
synchronized
(
freeBuffers4096
)
{
synchronized
(
freeBuffers4096
)
{
if
(
freeBuffers4096
.
size
()
<
10
)
{
freeBuffers4096
.
add
(
buffer
);
freeBuffers4096
.
add
(
buffer
);
}
}
}
}
else
if
(
buffer
.
buffer
.
capacity
()
==
16384
+
200
)
{
}
else
if
(
buffer
.
buffer
.
capacity
()
==
16384
+
200
)
{
synchronized
(
freeBuffers16384
)
{
synchronized
(
freeBuffers16384
)
{
if
(
freeBuffers16384
.
size
()
<
10
)
{
freeBuffers16384
.
add
(
buffer
);
freeBuffers16384
.
add
(
buffer
);
}
}
}
}
else
if
(
buffer
.
buffer
.
capacity
()
==
40000
)
{
}
else
if
(
buffer
.
buffer
.
capacity
()
==
40000
)
{
synchronized
(
freeBuffers32768
)
{
synchronized
(
freeBuffers32768
)
{
if
(
freeBuffers32768
.
size
()
<
10
)
{
freeBuffers32768
.
add
(
buffer
);
freeBuffers32768
.
add
(
buffer
);
}
}
}
}
}
}
}
}
}
TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java
View file @
fc14e8b4
...
@@ -875,20 +875,17 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
...
@@ -875,20 +875,17 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
try
{
try
{
ConnectivityManager
cm
=
(
ConnectivityManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
ConnectivityManager
cm
=
(
ConnectivityManager
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
);
NetworkInfo
netInfo
=
cm
.
getActiveNetworkInfo
();
NetworkInfo
netInfo
=
cm
.
getActiveNetworkInfo
();
if
(
netInfo
!=
null
&&
netInfo
.
isConnected
(
))
{
if
(
netInfo
!=
null
&&
(
netInfo
.
isConnectedOrConnecting
()
||
netInfo
.
isRoaming
()
||
netInfo
.
isAvailable
()
))
{
return
true
;
return
true
;
}
}
netInfo
=
cm
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_MOBILE
);
netInfo
=
cm
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_MOBILE
);
if
(
netInfo
.
isConnected
())
{
return
true
;
}
if
(
netInfo
!=
null
&&
netInfo
.
getState
()
==
NetworkInfo
.
State
.
CONNECTED
)
{
if
(
netInfo
!=
null
&&
(
netInfo
.
isConnectedOrConnecting
()
||
netInfo
.
isRoaming
()
||
netInfo
.
isAvailable
())
)
{
return
true
;
return
true
;
}
else
{
}
else
{
netInfo
=
cm
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_WIFI
);
netInfo
=
cm
.
getNetworkInfo
(
ConnectivityManager
.
TYPE_WIFI
);
if
(
netInfo
!=
null
&&
netInfo
.
getState
()
==
NetworkInfo
.
State
.
CONNECTED
)
{
if
(
netInfo
!=
null
&&
(
netInfo
.
isConnectedOrConnecting
()
||
netInfo
.
isRoaming
()
||
netInfo
.
isAvailable
())
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -2605,6 +2602,13 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
...
@@ -2605,6 +2602,13 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
});
});
}
}
}
}
if
(
length
==
4
)
{
int
error
=
data
.
readInt32
();
FileLog
.
e
(
"tmessages"
,
"mtproto error = "
+
error
);
connection
.
suspendConnection
(
true
);
connection
.
connect
();
return
;
}
Datacenter
datacenter
=
datacenterWithId
(
connection
.
getDatacenterId
());
Datacenter
datacenter
=
datacenterWithId
(
connection
.
getDatacenterId
());
long
keyId
=
data
.
readInt64
();
long
keyId
=
data
.
readInt64
();
...
...
TMessagesProj/src/main/java/org/telegram/messenger/DispatchQueue.java
View file @
fc14e8b4
...
@@ -11,7 +11,6 @@ package org.telegram.messenger;
...
@@ -11,7 +11,6 @@ package org.telegram.messenger;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.os.Message
;
import
android.os.Message
;
import
android.util.Log
;
public
class
DispatchQueue
extends
Thread
{
public
class
DispatchQueue
extends
Thread
{
public
volatile
Handler
handler
=
null
;
public
volatile
Handler
handler
=
null
;
...
@@ -68,6 +67,12 @@ public class DispatchQueue extends Thread {
...
@@ -68,6 +67,12 @@ public class DispatchQueue extends Thread {
}
}
}
}
public
void
cleanupQueue
()
{
if
(
handler
!=
null
)
{
handler
.
removeCallbacksAndMessages
(
null
);
}
}
public
void
run
()
{
public
void
run
()
{
Looper
.
prepare
();
Looper
.
prepare
();
synchronized
(
handlerSyncObject
)
{
synchronized
(
handlerSyncObject
)
{
...
...
TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
View file @
fc14e8b4
...
@@ -393,6 +393,7 @@ public class Emoji {
...
@@ -393,6 +393,7 @@ public class Emoji {
}
}
long
buf
=
0
;
long
buf
=
0
;
int
emojiCount
=
0
;
int
emojiCount
=
0
;
try
{
for
(
int
i
=
0
;
i
<
cs
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
cs
.
length
();
i
++)
{
char
c
=
cs
.
charAt
(
i
);
char
c
=
cs
.
charAt
(
i
);
if
(
c
==
0xD83C
||
c
==
0xD83D
||
(
buf
!=
0
&&
(
buf
&
0xFFFFFFFF00000000
L
)
==
0
&&
(
c
>=
0xDDE6
&&
c
<=
0xDDFA
)))
{
if
(
c
==
0xD83C
||
c
==
0xD83D
||
(
buf
!=
0
&&
(
buf
&
0xFFFFFFFF00000000
L
)
==
0
&&
(
c
>=
0xDDE6
&&
c
<=
0xDDFA
)))
{
...
@@ -440,6 +441,10 @@ public class Emoji {
...
@@ -440,6 +441,10 @@ public class Emoji {
break
;
break
;
}
}
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
return
cs
;
}
return
s
;
return
s
;
}
}
...
...
TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
View file @
fc14e8b4
...
@@ -36,6 +36,11 @@ public class MessagesStorage {
...
@@ -36,6 +36,11 @@ public class MessagesStorage {
public
static
byte
[]
secretPBytes
=
null
;
public
static
byte
[]
secretPBytes
=
null
;
public
static
int
secretG
=
0
;
public
static
int
secretG
=
0
;
private
int
lastSavedSeq
=
0
;
private
int
lastSavedPts
=
0
;
private
int
lastSavedDate
=
0
;
private
int
lastSavedQts
=
0
;
public
static
final
int
wallpapersDidLoaded
=
171
;
public
static
final
int
wallpapersDidLoaded
=
171
;
private
static
volatile
MessagesStorage
Instance
=
null
;
private
static
volatile
MessagesStorage
Instance
=
null
;
...
@@ -168,6 +173,7 @@ public class MessagesStorage {
...
@@ -168,6 +173,7 @@ public class MessagesStorage {
}
}
public
void
cleanUp
()
{
public
void
cleanUp
()
{
storageQueue
.
cleanupQueue
();
storageQueue
.
postRunnable
(
new
Runnable
()
{
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -176,6 +182,12 @@ public class MessagesStorage {
...
@@ -176,6 +182,12 @@ public class MessagesStorage {
lastPtsValue
=
0
;
lastPtsValue
=
0
;
lastQtsValue
=
0
;
lastQtsValue
=
0
;
lastSecretVersion
=
0
;
lastSecretVersion
=
0
;
lastSavedSeq
=
0
;
lastSavedPts
=
0
;
lastSavedDate
=
0
;
lastSavedQts
=
0
;
secretPBytes
=
null
;
secretPBytes
=
null
;
secretG
=
0
;
secretG
=
0
;
if
(
database
!=
null
)
{
if
(
database
!=
null
)
{
...
@@ -186,6 +198,7 @@ public class MessagesStorage {
...
@@ -186,6 +198,7 @@ public class MessagesStorage {
cacheFile
.
delete
();
cacheFile
.
delete
();
cacheFile
=
null
;
cacheFile
=
null
;
}
}
storageQueue
.
cleanupQueue
();
openDatabase
();
openDatabase
();
}
}
});
});
...
@@ -218,6 +231,9 @@ public class MessagesStorage {
...
@@ -218,6 +231,9 @@ public class MessagesStorage {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
{
try
{
if
(
lastSavedSeq
==
seq
&&
lastSavedPts
==
pts
&&
lastSavedDate
==
date
&&
lastQtsValue
==
qts
)
{
return
;
}
SQLitePreparedStatement
state
=
database
.
executeFast
(
"UPDATE params SET seq = ?, pts = ?, date = ?, qts = ? WHERE id = 1"
);
SQLitePreparedStatement
state
=
database
.
executeFast
(
"UPDATE params SET seq = ?, pts = ?, date = ?, qts = ? WHERE id = 1"
);
state
.
bindInteger
(
1
,
seq
);
state
.
bindInteger
(
1
,
seq
);
state
.
bindInteger
(
2
,
pts
);
state
.
bindInteger
(
2
,
pts
);
...
@@ -225,6 +241,10 @@ public class MessagesStorage {
...
@@ -225,6 +241,10 @@ public class MessagesStorage {
state
.
bindInteger
(
4
,
qts
);
state
.
bindInteger
(
4
,
qts
);
state
.
step
();
state
.
step
();
state
.
dispose
();
state
.
dispose
();
lastSavedSeq
=
seq
;
lastSavedPts
=
pts
;
lastSavedDate
=
date
;
lastSavedQts
=
qts
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
}
...
@@ -1838,6 +1858,7 @@ public class MessagesStorage {
...
@@ -1838,6 +1858,7 @@ public class MessagesStorage {
state
.
bindInteger
(
2
,
count
);
state
.
bindInteger
(
2
,
count
);
state
.
step
();
state
.
step
();
}
}
cursor
.
dispose
();
}
}
state
.
dispose
();
state
.
dispose
();
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
fc14e8b4
...
@@ -2682,9 +2682,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -2682,9 +2682,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
scrollToTopUnReadOnResume
=
false
;
scrollToTopUnReadOnResume
=
false
;
scrollToTopOnResume
=
false
;
scrollToTopOnResume
=
false
;
}
}
if
(
emojiView
!=
null
)
{
emojiView
.
loadRecents
();
}
paused
=
false
;
paused
=
false
;
if
(
readWhenResume
&&
!
messages
.
isEmpty
())
{
if
(
readWhenResume
&&
!
messages
.
isEmpty
())
{
readWhenResume
=
false
;
readWhenResume
=
false
;
...
@@ -2866,10 +2863,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -2866,10 +2863,6 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
return
;
return
;
}
}
selectedObject
=
null
;
forwaringMessage
=
null
;
selectedMessagesCanCopyIds
.
clear
();
selectedMessagesIds
.
clear
();
View
parentView
=
getRowParentView
(
v
);
View
parentView
=
getRowParentView
(
v
);
if
(
parentView
==
null
)
{
if
(
parentView
==
null
)
{
return
;
return
;
...
@@ -2882,6 +2875,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -2882,6 +2875,12 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
message
=
holder
.
message
;
message
=
holder
.
message
;
}
}
final
int
type
=
getMessageType
(
message
);
final
int
type
=
getMessageType
(
message
);
selectedObject
=
null
;
forwaringMessage
=
null
;
selectedMessagesCanCopyIds
.
clear
();
selectedMessagesIds
.
clear
();
if
(
single
||
type
<
2
)
{
if
(
single
||
type
<
2
)
{
if
(
type
>=
0
)
{
if
(
type
>=
0
)
{
selectedObject
=
message
;
selectedObject
=
message
;
...
@@ -2924,6 +2923,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -2924,6 +2923,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
builder
.
setItems
(
items
,
new
DialogInterface
.
OnClickListener
()
{
builder
.
setItems
(
items
,
new
DialogInterface
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
if
(
selectedObject
==
null
)
{
return
;
}
if
(
type
==
0
)
{
if
(
type
==
0
)
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
processSelectedOption
(
0
);
processSelectedOption
(
0
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java
View file @
fc14e8b4
...
@@ -107,7 +107,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
...
@@ -107,7 +107,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
}
}
}
else
if
(
id
==
1
)
{
}
else
if
(
id
==
1
)
{
if
(
delegate
!=
null
)
{
if
(
delegate
!=
null
)
{
finishFragment
();
finishFragment
(
false
);
delegate
.
startPhotoSelectActivity
();
delegate
.
startPhotoSelectActivity
();
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java
View file @
fc14e8b4
...
@@ -59,7 +59,8 @@ public class ActionBarActivity extends Activity {
...
@@ -59,7 +59,8 @@ public class ActionBarActivity extends Activity {
private
long
transitionAnimationStartTime
;
private
long
transitionAnimationStartTime
;
private
boolean
inActionMode
=
false
;
private
boolean
inActionMode
=
false
;
private
int
startedTrackingPointerId
;
private
int
startedTrackingPointerId
;
private
Animation
.
AnimationListener
listener
;
private
Runnable
onCloseAnimationEndRunnable
=
null
;
private
Runnable
onOpenAnimationEndRunnable
=
null
;
private
class
FrameLayoutTouch
extends
FrameLayout
{
private
class
FrameLayoutTouch
extends
FrameLayout
{
public
FrameLayoutTouch
(
Context
context
)
{
public
FrameLayoutTouch
(
Context
context
)
{
...
@@ -157,10 +158,14 @@ public class ActionBarActivity extends Activity {
...
@@ -157,10 +158,14 @@ public class ActionBarActivity extends Activity {
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
fixLayout
();
fixLayout
();
if
(
transitionAnimationInProgress
&&
listener
!=
null
)
{
if
(
transitionAnimationInProgress
)
{
openAnimation
.
cancel
();
if
(
onCloseAnimationEndRunnable
!=
null
)
{
closeAnimation
.
cancel
();
closeAnimation
.
cancel
();
listener
.
onAnimationEnd
(
null
);
onCloseAnimationEnd
(
false
);
}
else
if
(
onOpenAnimationEndRunnable
!=
null
)
{
openAnimation
.
cancel
();
onOpenAnimationEnd
(
false
);
}
}
}
if
(!
fragmentsStack
.
isEmpty
())
{
if
(!
fragmentsStack
.
isEmpty
())
{
BaseFragment
lastFragment
=
fragmentsStack
.
get
(
fragmentsStack
.
size
()
-
1
);
BaseFragment
lastFragment
=
fragmentsStack
.
get
(
fragmentsStack
.
size
()
-
1
);
...
@@ -370,7 +375,7 @@ public class ActionBarActivity extends Activity {
...
@@ -370,7 +375,7 @@ public class ActionBarActivity extends Activity {
onFinish
();
onFinish
();
finish
();
finish
();
}
else
if
(!
fragmentsStack
.
isEmpty
())
{
}
else
if
(!
fragmentsStack
.
isEmpty
())
{
closeLastFragment
();
closeLastFragment
(
true
);
}
}
}
}
}
}
...
@@ -501,8 +506,15 @@ public class ActionBarActivity extends Activity {
...
@@ -501,8 +506,15 @@ public class ActionBarActivity extends Activity {
if
(
needAnimation
)
{
if
(
needAnimation
)
{
transitionAnimationStartTime
=
System
.
currentTimeMillis
();
transitionAnimationStartTime
=
System
.
currentTimeMillis
();
transitionAnimationInProgress
=
true
;
transitionAnimationInProgress
=
true
;
onOpenAnimationEndRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
presentFragmentInternalRemoveOld
(
removeLast
,
currentFragment
);
fragment
.
onOpenAnimationEnd
();
}
};
openAnimation
.
reset
();
openAnimation
.
reset
();
openAnimation
.
setAnimationListener
(
listener
=
new
Animation
.
AnimationListener
()
{
openAnimation
.
setAnimationListener
(
new
Animation
.
AnimationListener
()
{
@Override
@Override
public
void
onAnimationStart
(
Animation
animation
)
{
public
void
onAnimationStart
(
Animation
animation
)
{
...
@@ -510,18 +522,7 @@ public class ActionBarActivity extends Activity {
...
@@ -510,18 +522,7 @@ public class ActionBarActivity extends Activity {
@Override
@Override
public
void
onAnimationEnd
(
Animation
animation
)
{
public
void
onAnimationEnd
(
Animation
animation
)
{
if
(
transitionAnimationInProgress
)
{
onOpenAnimationEnd
(
true
);
transitionAnimationInProgress
=
false
;
transitionAnimationStartTime
=
0
;
fragment
.
onOpenAnimationEnd
();
new
Handler
().
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
presentFragmentInternalRemoveOld
(
removeLast
,
currentFragment
);
}
});
listener
=
null
;
}
}
}
@Override
@Override
...
@@ -552,14 +553,14 @@ public class ActionBarActivity extends Activity {
...
@@ -552,14 +553,14 @@ public class ActionBarActivity extends Activity {
fragmentsStack
.
remove
(
fragment
);
fragmentsStack
.
remove
(
fragment
);
}
}
public
void
closeLastFragment
()
{
public
void
closeLastFragment
(
boolean
animated
)
{
if
(
fragmentsStack
.
size
()
<=
1
||
checkTransitionAnimation
())
{
if
(
fragmentsStack
.
size
()
<=
1
||
checkTransitionAnimation
())
{
return
;
return
;
}
}
if
(
getCurrentFocus
()
!=
null
)
{
if
(
getCurrentFocus
()
!=
null
)
{
Utilities
.
hideKeyboard
(
getCurrentFocus
());
Utilities
.
hideKeyboard
(
getCurrentFocus
());
}
}
boolean
needAnimation
=
open
Animation
!=
null
&&
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
).
getBoolean
(
"view_animations"
,
true
);
boolean
needAnimation
=
animated
&&
close
Animation
!=
null
&&
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
).
getBoolean
(
"view_animations"
,
true
);
final
BaseFragment
currentFragment
=
fragmentsStack
.
get
(
fragmentsStack
.
size
()
-
1
);
final
BaseFragment
currentFragment
=
fragmentsStack
.
get
(
fragmentsStack
.
size
()
-
1
);
BaseFragment
previousFragment
=
fragmentsStack
.
get
(
fragmentsStack
.
size
()
-
2
);
BaseFragment
previousFragment
=
fragmentsStack
.
get
(
fragmentsStack
.
size
()
-
2
);
if
(!
needAnimation
)
{
if
(!
needAnimation
)
{
...
@@ -584,7 +585,13 @@ public class ActionBarActivity extends Activity {
...
@@ -584,7 +585,13 @@ public class ActionBarActivity extends Activity {
transitionAnimationInProgress
=
true
;
transitionAnimationInProgress
=
true
;
closeAnimation
.
reset
();
closeAnimation
.
reset
();
closeAnimation
.
setFillAfter
(
true
);
closeAnimation
.
setFillAfter
(
true
);
closeAnimation
.
setAnimationListener
(
listener
=
new
Animation
.
AnimationListener
()
{
onCloseAnimationEndRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
closeLastFragmentInternalRemoveOld
(
currentFragment
);
}
};
closeAnimation
.
setAnimationListener
(
new
Animation
.
AnimationListener
()
{
@Override
@Override
public
void
onAnimationStart
(
Animation
animation
)
{
public
void
onAnimationStart
(
Animation
animation
)
{
...
@@ -592,16 +599,7 @@ public class ActionBarActivity extends Activity {
...
@@ -592,16 +599,7 @@ public class ActionBarActivity extends Activity {
@Override
@Override
public
void
onAnimationEnd
(
Animation
animation
)
{
public
void
onAnimationEnd
(
Animation
animation
)
{
if
(
transitionAnimationInProgress
)
{
onCloseAnimationEnd
(
true
);
transitionAnimationInProgress
=
false
;
transitionAnimationStartTime
=
0
;
new
Handler
().
post
(
new
Runnable
()
{
public
void
run
()
{
closeLastFragmentInternalRemoveOld
(
currentFragment
);
}
});
listener
=
null
;
}
}
}
@Override
@Override
...
@@ -691,13 +689,56 @@ public class ActionBarActivity extends Activity {
...
@@ -691,13 +689,56 @@ public class ActionBarActivity extends Activity {
return
false
;
return
false
;
}
}
private
void
onCloseAnimationEnd
(
boolean
post
)
{
if
(
transitionAnimationInProgress
&&
onCloseAnimationEndRunnable
!=
null
)
{
transitionAnimationInProgress
=
false
;
transitionAnimationStartTime
=
0
;
if
(
post
)
{
new
Handler
().
post
(
new
Runnable
()
{
public
void
run
()
{
onCloseAnimationEndRunnable
.
run
();
onCloseAnimationEndRunnable
=
null
;
}
});
}
else
{
onCloseAnimationEndRunnable
.
run
();
onCloseAnimationEndRunnable
=
null
;
}
}
}
private
void
onOpenAnimationEnd
(
boolean
post
)
{
if
(
transitionAnimationInProgress
&&
onOpenAnimationEndRunnable
!=
null
)
{
transitionAnimationInProgress
=
false
;
transitionAnimationStartTime
=
0
;
if
(
post
)
{
new
Handler
().
post
(
new
Runnable
()
{
public
void
run
()
{
onOpenAnimationEndRunnable
.
run
();
onOpenAnimationEndRunnable
=
null
;
}
});
}
else
{
onOpenAnimationEndRunnable
.
run
();
onOpenAnimationEndRunnable
=
null
;
}
}
}
@Override
@Override
public
void
startActivityForResult
(
Intent
intent
,
int
requestCode
)
{
public
void
startActivityForResult
(
final
Intent
intent
,
final
int
requestCode
)
{
if
(
transitionAnimationInProgress
&&
listener
!=
null
)
{
if
(
transitionAnimationInProgress
)
{
openAnimation
.
cancel
();
if
(
onCloseAnimationEndRunnable
!=
null
)
{
closeAnimation
.
cancel
();
closeAnimation
.
cancel
();
listener
.
onAnimationEnd
(
null
);
onCloseAnimationEnd
(
false
);
}
else
if
(
onOpenAnimationEndRunnable
!=
null
)
{
openAnimation
.
cancel
();
onOpenAnimationEnd
(
false
);
}
}
containerView
.
invalidate
();
ActionBarActivity
.
super
.
startActivityForResult
(
intent
,
requestCode
);
}
else
{
super
.
startActivityForResult
(
intent
,
requestCode
);
super
.
startActivityForResult
(
intent
,
requestCode
);
}
}
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarMenuItem.java
View file @
fc14e8b4
...
@@ -121,7 +121,6 @@ public class ActionBarMenuItem extends ImageView {
...
@@ -121,7 +121,6 @@ public class ActionBarMenuItem extends ImageView {
}
}
if
(
popupWindow
==
null
)
{
if
(
popupWindow
==
null
)
{
popupWindow
=
new
ActionBarPopupWindow
(
popupLayout
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
);
popupWindow
=
new
ActionBarPopupWindow
(
popupLayout
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
);
popupWindow
.
setFocusable
(
true
);
popupWindow
.
setBackgroundDrawable
(
new
BitmapDrawable
());
popupWindow
.
setBackgroundDrawable
(
new
BitmapDrawable
());
popupWindow
.
setOutsideTouchable
(
true
);
popupWindow
.
setOutsideTouchable
(
true
);
popupWindow
.
setClippingEnabled
(
true
);
popupWindow
.
setClippingEnabled
(
true
);
...
@@ -132,8 +131,10 @@ public class ActionBarMenuItem extends ImageView {
...
@@ -132,8 +131,10 @@ public class ActionBarMenuItem extends ImageView {
if
(
popupLayout
.
getMeasuredWidth
()
==
0
)
{
if
(
popupLayout
.
getMeasuredWidth
()
==
0
)
{
popupWindow
.
showAsDropDown
(
this
,
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
0
);
popupWindow
.
showAsDropDown
(
this
,
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
0
);
popupWindow
.
update
(
this
,
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
0
,
-
1
,
-
1
);
popupWindow
.
update
(
this
,
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
0
,
-
1
,
-
1
);
popupWindow
.
setFocusable
(
true
);
}
else
{
}
else
{
popupWindow
.
showAsDropDown
(
this
,
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
0
);
popupWindow
.
showAsDropDown
(
this
,
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
0
);
popupWindow
.
setFocusable
(
true
);
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarPopupWindow.java
View file @
fc14e8b4
...
@@ -152,6 +152,7 @@ public class ActionBarPopupWindow extends PopupWindow {
...
@@ -152,6 +152,7 @@ public class ActionBarPopupWindow extends PopupWindow {
@Override
@Override
public
void
dismiss
()
{
public
void
dismiss
()
{
setFocusable
(
false
);
super
.
dismiss
();
super
.
dismiss
();
unregisterListener
();
unregisterListener
();
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/BaseFragment.java
View file @
fc14e8b4
...
@@ -69,10 +69,14 @@ public class BaseFragment {
...
@@ -69,10 +69,14 @@ public class BaseFragment {
}
}
public
void
finishFragment
()
{
public
void
finishFragment
()
{
finishFragment
(
true
);
}
public
void
finishFragment
(
boolean
animated
)
{
if
(
isFinished
||
parentActivity
==
null
)
{
if
(
isFinished
||
parentActivity
==
null
)
{
return
;
return
;
}
}
parentActivity
.
closeLastFragment
();
parentActivity
.
closeLastFragment
(
animated
);
}
}
public
void
removeSelfFromStack
()
{
public
void
removeSelfFromStack
()
{
...
@@ -192,14 +196,18 @@ public class BaseFragment {
...
@@ -192,14 +196,18 @@ public class BaseFragment {
}
}
protected
void
showAlertDialog
(
AlertDialog
.
Builder
builder
)
{
protected
boolean
showAlertDialog
(
AlertDialog
.
Builder
builder
)
{
if
(
parentActivity
==
null
||
parentActivity
.
checkTransitionAnimation
()
||
parentActivity
.
animationInProgress
||
parentActivity
.
startedTracking
)
{
if
(
parentActivity
==
null
||
parentActivity
.
checkTransitionAnimation
()
||
parentActivity
.
animationInProgress
||
parentActivity
.
startedTracking
)
{
return
;
return
false
;
}
}
if
(
visibleDialog
!=
null
&&
visibleDialog
.
isShowing
())
{
try
{
if
(
visibleDialog
!=
null
)
{
visibleDialog
.
dismiss
();
visibleDialog
.
dismiss
();
visibleDialog
=
null
;
visibleDialog
=
null
;
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
visibleDialog
=
builder
.
show
();
visibleDialog
=
builder
.
show
();
visibleDialog
.
setCanceledOnTouchOutside
(
true
);
visibleDialog
.
setCanceledOnTouchOutside
(
true
);
visibleDialog
.
setOnDismissListener
(
new
DialogInterface
.
OnDismissListener
()
{
visibleDialog
.
setOnDismissListener
(
new
DialogInterface
.
OnDismissListener
()
{
...
@@ -208,5 +216,6 @@ public class BaseFragment {
...
@@ -208,5 +216,6 @@ public class BaseFragment {
visibleDialog
=
null
;
visibleDialog
=
null
;
}
}
});
});
return
true
;
}
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/Views/EmojiView.java
View file @
fc14e8b4
...
@@ -100,14 +100,23 @@ public class EmojiView extends LinearLayout {
...
@@ -100,14 +100,23 @@ public class EmojiView extends LinearLayout {
}
}
private
void
init
()
{
private
void
init
()
{
setOrientation
(
1
);
setOrientation
(
LinearLayout
.
VERTICAL
);
for
(
int
i
=
0
;
;
i
++)
{
for
(
int
i
=
0
;
i
<
Emoji
.
data
.
length
;
i
++)
{
if
(
i
>=
Emoji
.
data
.
length
)
{
GridView
gridView
=
new
GridView
(
getContext
());
gridView
.
setColumnWidth
(
Utilities
.
dpf
(
45.0f
));
gridView
.
setNumColumns
(-
1
);
views
.
add
(
gridView
);
EmojiGridAdapter
localEmojiGridAdapter
=
new
EmojiGridAdapter
(
Emoji
.
data
[
i
]);
gridView
.
setAdapter
(
localEmojiGridAdapter
);
adapters
.
add
(
localEmojiGridAdapter
);
}
setBackgroundDrawable
(
new
GradientDrawable
(
GradientDrawable
.
Orientation
.
TOP_BOTTOM
,
new
int
[]
{
-
14145496
,
-
16777216
}));
setBackgroundDrawable
(
new
GradientDrawable
(
GradientDrawable
.
Orientation
.
TOP_BOTTOM
,
new
int
[]
{
-
14145496
,
-
16777216
}));
pager
=
new
ViewPager
(
getContext
());
pager
=
new
ViewPager
(
getContext
());
pager
.
setAdapter
(
new
EmojiPagesAdapter
());
pager
.
setAdapter
(
new
EmojiPagesAdapter
());
PagerSlidingTabStrip
tabs
=
new
PagerSlidingTabStrip
(
getContext
());
PagerSlidingTabStrip
tabs
=
new
PagerSlidingTabStrip
(
getContext
());
tabs
.
setViewPager
(
this
.
pager
);
tabs
.
setViewPager
(
pager
);
tabs
.
setShouldExpand
(
true
);
tabs
.
setShouldExpand
(
true
);
tabs
.
setIndicatorColor
(
0xff33b5e5
);
tabs
.
setIndicatorColor
(
0xff33b5e5
);
tabs
.
setIndicatorHeight
(
Utilities
.
dpf
(
2.0f
));
tabs
.
setIndicatorHeight
(
Utilities
.
dpf
(
2.0f
));
...
@@ -115,47 +124,34 @@ public class EmojiView extends LinearLayout {
...
@@ -115,47 +124,34 @@ public class EmojiView extends LinearLayout {
tabs
.
setUnderlineColor
(
1711276032
);
tabs
.
setUnderlineColor
(
1711276032
);
tabs
.
setTabBackground
(
0
);
tabs
.
setTabBackground
(
0
);
LinearLayout
localLinearLayout
=
new
LinearLayout
(
getContext
());
LinearLayout
localLinearLayout
=
new
LinearLayout
(
getContext
());
localLinearLayout
.
setOrientation
(
0
);
localLinearLayout
.
setOrientation
(
LinearLayout
.
HORIZONTAL
);
localLinearLayout
.
addView
(
tabs
,
new
LinearLayout
.
LayoutParams
(-
1
,
-
1
,
1.0
F
));
localLinearLayout
.
addView
(
tabs
,
new
LinearLayout
.
LayoutParams
(
LayoutParams
.
MATCH_PARENT
,
LayoutParams
.
MATCH_PARENT
,
1.0f
));
ImageView
localImageView
=
new
ImageView
(
getContext
());
ImageView
localImageView
=
new
ImageView
(
getContext
());
localImageView
.
setImageResource
(
R
.
drawable
.
ic_emoji_backspace
);
localImageView
.
setImageResource
(
R
.
drawable
.
ic_emoji_backspace
);
localImageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER
);
localImageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER
);
localImageView
.
setBackgroundResource
(
R
.
drawable
.
bg_emoji_bs
);
localImageView
.
setBackgroundResource
(
R
.
drawable
.
bg_emoji_bs
);
localImageView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
localImageView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
paramAnonymousV
iew
)
{
public
void
onClick
(
View
v
iew
)
{
if
(
EmojiView
.
this
.
listener
!=
null
)
{
if
(
EmojiView
.
this
.
listener
!=
null
)
{
EmojiView
.
this
.
listener
.
onBackspace
();
EmojiView
.
this
.
listener
.
onBackspace
();
}
}
}
}
});
});
localImageView
.
setOnLongClickListener
(
new
View
.
OnLongClickListener
()
{
localLinearLayout
.
addView
(
localImageView
,
new
LinearLayout
.
LayoutParams
(
Utilities
.
dpf
(
61.0f
),
LayoutParams
.
MATCH_PARENT
));
public
boolean
onLongClick
(
View
paramAnonymousView
)
{
recentsWrap
=
new
FrameLayout
(
getContext
());
EmojiView
.
this
.
getContext
().
getSharedPreferences
(
"emoji"
,
0
).
edit
().
clear
().
commit
();
recentsWrap
.
addView
(
views
.
get
(
0
));
return
true
;
}
});
localLinearLayout
.
addView
(
localImageView
,
new
LinearLayout
.
LayoutParams
(
Utilities
.
dpf
(
61.0f
),
-
1
));
this
.
recentsWrap
=
new
FrameLayout
(
getContext
());
this
.
recentsWrap
.
addView
(
this
.
views
.
get
(
0
));
TextView
localTextView
=
new
TextView
(
getContext
());
TextView
localTextView
=
new
TextView
(
getContext
());
localTextView
.
setText
(
LocaleController
.
getString
(
"NoRecent"
,
R
.
string
.
NoRecent
));
localTextView
.
setText
(
LocaleController
.
getString
(
"NoRecent"
,
R
.
string
.
NoRecent
));
localTextView
.
setTextSize
(
18.0f
);
localTextView
.
setTextSize
(
18.0f
);
localTextView
.
setTextColor
(-
7829368
);
localTextView
.
setTextColor
(-
7829368
);
localTextView
.
setGravity
(
17
);
localTextView
.
setGravity
(
17
);
this
.
recentsWrap
.
addView
(
localTextView
);
recentsWrap
.
addView
(
localTextView
);
this
.
views
.
get
(
0
).
setEmptyView
(
localTextView
);
views
.
get
(
0
).
setEmptyView
(
localTextView
);
addView
(
localLinearLayout
,
new
LinearLayout
.
LayoutParams
(-
1
,
Utilities
.
dpf
(
48.0f
)));
addView
(
localLinearLayout
,
new
LinearLayout
.
LayoutParams
(-
1
,
Utilities
.
dpf
(
48.0f
)));
addView
(
this
.
pager
);
addView
(
pager
);
loadRecents
();
loadRecents
();
return
;
if
(
Emoji
.
data
[
0
]
==
null
||
Emoji
.
data
[
0
].
length
==
0
)
{
}
pager
.
setCurrentItem
(
1
);
GridView
localGridView
=
new
GridView
(
getContext
());
localGridView
.
setColumnWidth
(
Utilities
.
dpf
(
45.0f
));
localGridView
.
setNumColumns
(-
1
);
EmojiGridAdapter
localEmojiGridAdapter
=
new
EmojiGridAdapter
(
Emoji
.
data
[
i
]);
localGridView
.
setAdapter
(
localEmojiGridAdapter
);
this
.
adapters
.
add
(
localEmojiGridAdapter
);
this
.
views
.
add
(
localGridView
);
}
}
}
}
...
...
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