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
dbef14df
Commit
dbef14df
authored
Aug 02, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
f7e0225f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
52 deletions
+87
-52
build.gradle
TMessagesProj/build.gradle
+1
-1
MessagesController.java
...rc/main/java/org/telegram/android/MessagesController.java
+25
-18
MessagesStorage.java
...j/src/main/java/org/telegram/android/MessagesStorage.java
+3
-4
FileLoadOperation.java
...c/main/java/org/telegram/messenger/FileLoadOperation.java
+7
-1
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+51
-28
No files found.
TMessagesProj/build.gradle
View file @
dbef14df
...
@@ -83,7 +83,7 @@ android {
...
@@ -83,7 +83,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
29
7
versionCode
29
9
versionName
"1.7.0"
versionName
"1.7.0"
}
}
}
}
TMessagesProj/src/main/java/org/telegram/android/MessagesController.java
View file @
dbef14df
...
@@ -708,6 +708,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -708,6 +708,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public
void
run
(
TLObject
response
,
TLRPC
.
TL_error
error
)
{
public
void
run
(
TLObject
response
,
TLRPC
.
TL_error
error
)
{
if
(
error
==
null
)
{
if
(
error
==
null
)
{
final
TLRPC
.
messages_Messages
res
=
(
TLRPC
.
messages_Messages
)
response
;
final
TLRPC
.
messages_Messages
res
=
(
TLRPC
.
messages_Messages
)
response
;
MessagesStorage
.
getInstance
().
putUsersAndChats
(
res
.
users
,
res
.
chats
,
true
,
true
);
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
for
(
TLRPC
.
User
user
:
res
.
users
)
{
users
.
put
(
user
.
id
,
user
);
if
(
user
.
id
==
UserConfig
.
getClientUserId
())
{
UserConfig
.
setCurrentUser
(
user
);
}
}
for
(
TLRPC
.
Chat
chat
:
res
.
chats
)
{
chats
.
put
(
chat
.
id
,
chat
);
}
}
});
if
(
res
instanceof
TLRPC
.
TL_messages_messagesSlice
)
{
if
(
res
instanceof
TLRPC
.
TL_messages_messagesSlice
)
{
processLoadedMediaCount
(
res
.
count
,
uid
,
classGuid
,
false
);
processLoadedMediaCount
(
res
.
count
,
uid
,
classGuid
,
false
);
}
else
{
}
else
{
...
@@ -1110,10 +1127,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1110,10 +1127,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
public
void
loadMessages
(
final
long
dialog_id
,
final
int
offset
,
final
int
count
,
final
int
max_id
,
boolean
fromCache
,
int
midDate
,
final
int
classGuid
,
boolean
from_unread
,
boolean
forward
)
{
public
void
loadMessages
(
final
long
dialog_id
,
final
int
count
,
final
int
max_id
,
boolean
fromCache
,
int
midDate
,
final
int
classGuid
,
boolean
from_unread
,
boolean
forward
)
{
int
lower_part
=
(
int
)
dialog_id
;
int
lower_part
=
(
int
)
dialog_id
;
if
(
fromCache
||
lower_part
==
0
)
{
if
(
fromCache
||
lower_part
==
0
)
{
MessagesStorage
.
getInstance
().
getMessages
(
dialog_id
,
offset
,
count
,
max_id
,
midDate
,
classGuid
,
from_unread
,
forward
);
MessagesStorage
.
getInstance
().
getMessages
(
dialog_id
,
count
,
max_id
,
midDate
,
classGuid
,
from_unread
,
forward
);
}
else
{
}
else
{
TLRPC
.
TL_messages_getHistory
req
=
new
TLRPC
.
TL_messages_getHistory
();
TLRPC
.
TL_messages_getHistory
req
=
new
TLRPC
.
TL_messages_getHistory
();
if
(
lower_part
<
0
)
{
if
(
lower_part
<
0
)
{
...
@@ -1130,7 +1147,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1130,7 +1147,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
req
.
peer
.
user_id
=
user
.
id
;
req
.
peer
.
user_id
=
user
.
id
;
}
}
}
}
req
.
offset
=
offset
;
req
.
offset
=
0
;
req
.
limit
=
count
;
req
.
limit
=
count
;
req
.
max_id
=
max_id
;
req
.
max_id
=
max_id
;
long
reqId
=
ConnectionsManager
.
getInstance
().
performRpc
(
req
,
new
RPCRequest
.
RPCRequestDelegate
()
{
long
reqId
=
ConnectionsManager
.
getInstance
().
performRpc
(
req
,
new
RPCRequest
.
RPCRequestDelegate
()
{
...
@@ -1138,7 +1155,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1138,7 +1155,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public
void
run
(
TLObject
response
,
TLRPC
.
TL_error
error
)
{
public
void
run
(
TLObject
response
,
TLRPC
.
TL_error
error
)
{
if
(
error
==
null
)
{
if
(
error
==
null
)
{
final
TLRPC
.
messages_Messages
res
=
(
TLRPC
.
messages_Messages
)
response
;
final
TLRPC
.
messages_Messages
res
=
(
TLRPC
.
messages_Messages
)
response
;
processLoadedMessages
(
res
,
dialog_id
,
offset
,
count
,
max_id
,
false
,
classGuid
,
0
,
0
,
0
,
0
,
false
);
processLoadedMessages
(
res
,
dialog_id
,
count
,
max_id
,
false
,
classGuid
,
0
,
0
,
0
,
0
,
false
);
}
}
}
}
});
});
...
@@ -1146,7 +1163,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1146,7 +1163,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
public
void
processLoadedMessages
(
final
TLRPC
.
messages_Messages
messagesRes
,
final
long
dialog_id
,
final
int
offset
,
final
int
count
,
final
int
max_id
,
final
boolean
isCache
,
final
int
classGuid
,
final
int
first_unread
,
final
int
last_unread
,
final
int
unread_count
,
final
int
last_date
,
final
boolean
isForward
)
{
public
void
processLoadedMessages
(
final
TLRPC
.
messages_Messages
messagesRes
,
final
long
dialog_id
,
final
int
count
,
final
int
max_id
,
final
boolean
isCache
,
final
int
classGuid
,
final
int
first_unread
,
final
int
last_unread
,
final
int
unread_count
,
final
int
last_date
,
final
boolean
isForward
)
{
Utilities
.
stageQueue
.
postRunnable
(
new
Runnable
()
{
Utilities
.
stageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -1158,7 +1175,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1158,7 +1175,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
loadMessages
(
dialog_id
,
offset
,
count
,
max_id
,
false
,
0
,
classGuid
,
false
,
false
);
loadMessages
(
dialog_id
,
count
,
max_id
,
false
,
0
,
classGuid
,
false
,
false
);
}
}
});
});
return
;
return
;
...
@@ -1196,7 +1213,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1196,7 +1213,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
chats
.
put
(
c
.
id
,
c
);
chats
.
put
(
c
.
id
,
c
);
}
}
}
}
NotificationCenter
.
getInstance
().
postNotificationName
(
messagesDidLoaded
,
dialog_id
,
offset
,
count
,
objects
,
isCache
,
first_unread
,
last_unread
,
unread_count
,
last_date
,
isForward
);
NotificationCenter
.
getInstance
().
postNotificationName
(
messagesDidLoaded
,
dialog_id
,
count
,
objects
,
isCache
,
first_unread
,
last_unread
,
unread_count
,
last_date
,
isForward
);
}
}
});
});
}
}
...
@@ -4618,17 +4635,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4618,17 +4635,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
boolean
isEncryptedChat
=
((
int
)
uid
)
==
0
;
boolean
isEncryptedChat
=
((
int
)
uid
)
==
0
;
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
NotificationCenter
.
getInstance
().
postNotificationName
(
didReceivedNewMessages
,
uid
,
messages
);
NotificationCenter
.
getInstance
().
postNotificationName
(
didReceivedNewMessages
,
uid
,
messages
);
}
});
}
});
for
(
MessageObject
message
:
messages
)
{
for
(
MessageObject
message
:
messages
)
{
if
(
lastMessage
==
null
||
(!
isEncryptedChat
&&
message
.
messageOwner
.
id
>
lastMessage
.
messageOwner
.
id
||
isEncryptedChat
&&
message
.
messageOwner
.
id
<
lastMessage
.
messageOwner
.
id
)
||
message
.
messageOwner
.
date
>
lastMessage
.
messageOwner
.
date
)
{
if
(
lastMessage
==
null
||
(!
isEncryptedChat
&&
message
.
messageOwner
.
id
>
lastMessage
.
messageOwner
.
id
||
isEncryptedChat
&&
message
.
messageOwner
.
id
<
lastMessage
.
messageOwner
.
id
)
||
message
.
messageOwner
.
date
>
lastMessage
.
messageOwner
.
date
)
{
...
...
TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java
View file @
dbef14df
...
@@ -217,7 +217,6 @@ public class MessagesStorage {
...
@@ -217,7 +217,6 @@ public class MessagesStorage {
cacheFile
.
delete
();
cacheFile
.
delete
();
cacheFile
=
null
;
cacheFile
=
null
;
}
}
storageQueue
.
cleanupQueue
();
openDatabase
();
openDatabase
();
if
(
isLogin
)
{
if
(
isLogin
)
{
Utilities
.
stageQueue
.
postRunnable
(
new
Runnable
()
{
Utilities
.
stageQueue
.
postRunnable
(
new
Runnable
()
{
...
@@ -1320,14 +1319,14 @@ public class MessagesStorage {
...
@@ -1320,14 +1319,14 @@ public class MessagesStorage {
});
});
}
}
public
void
getMessages
(
final
long
dialog_id
,
final
int
offset
,
final
int
count
,
final
int
max_id
,
final
int
minDate
,
final
int
classGuid
,
final
boolean
from_unread
,
final
boolean
forward
)
{
public
void
getMessages
(
final
long
dialog_id
,
final
int
count
,
final
int
max_id
,
final
int
minDate
,
final
int
classGuid
,
final
boolean
from_unread
,
final
boolean
forward
)
{
storageQueue
.
postRunnable
(
new
Runnable
()
{
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
TLRPC
.
TL_messages_messages
res
=
new
TLRPC
.
TL_messages_messages
();
TLRPC
.
TL_messages_messages
res
=
new
TLRPC
.
TL_messages_messages
();
int
count_unread
=
0
;
int
count_unread
=
0
;
int
count_query
=
count
;
int
count_query
=
count
;
int
offset_query
=
offset
;
int
offset_query
=
0
;
int
min_unread_id
=
0
;
int
min_unread_id
=
0
;
int
max_unread_id
=
0
;
int
max_unread_id
=
0
;
int
max_unread_date
=
0
;
int
max_unread_date
=
0
;
...
@@ -1486,7 +1485,7 @@ public class MessagesStorage {
...
@@ -1486,7 +1485,7 @@ public class MessagesStorage {
res
.
users
.
clear
();
res
.
users
.
clear
();
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
}
finally
{
MessagesController
.
getInstance
().
processLoadedMessages
(
res
,
dialog_id
,
offset
,
count_query
,
max_id
,
true
,
classGuid
,
min_unread_id
,
max_unread_id
,
count_unread
,
max_unread_date
,
forward
);
MessagesController
.
getInstance
().
processLoadedMessages
(
res
,
dialog_id
,
count_query
,
max_id
,
true
,
classGuid
,
min_unread_id
,
max_unread_id
,
count_unread
,
max_unread_date
,
forward
);
}
}
}
}
});
});
...
...
TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
View file @
dbef14df
...
@@ -17,10 +17,10 @@ import org.telegram.android.AndroidUtilities;
...
@@ -17,10 +17,10 @@ import org.telegram.android.AndroidUtilities;
import
org.telegram.ui.ApplicationLoader
;
import
org.telegram.ui.ApplicationLoader
;
import
java.io.RandomAccessFile
;
import
java.io.RandomAccessFile
;
import
java.net.URL
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLConnection
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileChannel
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -82,6 +82,12 @@ public class FileLoadOperation {
...
@@ -82,6 +82,12 @@ public class FileLoadOperation {
httpConnection
.
setReadTimeout
(
5000
);
httpConnection
.
setReadTimeout
(
5000
);
httpConnection
.
connect
();
httpConnection
.
connect
();
httpConnectionStream
=
httpConnection
.
getInputStream
();
httpConnectionStream
=
httpConnection
.
getInputStream
();
/*String ALLOWED_URI_CHARS = "@#&=*+-_.,:!?()/~'%";
String str = Uri.encode(url, ALLOWED_URI_CHARS);
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(str);
httpConnectionStream = httpclient.execute(request).getEntity().getContent();*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
cleanup
();
cleanup
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
dbef14df
...
@@ -143,14 +143,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -143,14 +143,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private
boolean
endReached
=
false
;
private
boolean
endReached
=
false
;
private
boolean
loading
=
false
;
private
boolean
loading
=
false
;
private
boolean
cacheEndReaced
=
false
;
private
boolean
cacheEndReaced
=
false
;
private
boolean
firstLoading
=
true
;
private
int
minDate
=
0
;
private
int
minDate
=
0
;
private
int
progressTag
=
0
;
private
int
progressTag
=
0
;
boolean
first
=
true
;
private
boolean
first
=
true
;
private
int
unread_to_load
=
0
;
private
int
unread_to_load
=
0
;
private
int
first_unread_id
=
0
;
private
int
first_unread_id
=
0
;
private
int
last_unread_id
=
0
;
private
int
last_unread_id
=
0
;
private
boolean
unread_end_reached
=
fals
e
;
private
boolean
unread_end_reached
=
tru
e
;
private
boolean
loadingForward
=
false
;
private
boolean
loadingForward
=
false
;
private
MessageObject
unreadMessageObject
=
null
;
private
MessageObject
unreadMessageObject
=
null
;
...
@@ -338,7 +339,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -338,7 +339,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
super
.
onFragmentCreate
();
super
.
onFragmentCreate
();
loading
=
true
;
loading
=
true
;
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
0
,
30
,
0
,
true
,
0
,
classGuid
,
true
,
false
);
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
30
,
0
,
true
,
0
,
classGuid
,
true
,
false
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
if
(
currentChat
!=
null
)
{
if
(
currentChat
!=
null
)
{
...
@@ -733,16 +734,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -733,16 +734,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
firstVisibleItem
<=
4
)
{
if
(
firstVisibleItem
<=
4
)
{
if
(!
endReached
&&
!
loading
)
{
if
(!
endReached
&&
!
loading
)
{
if
(
messagesByDays
.
size
()
!=
0
)
{
if
(
messagesByDays
.
size
()
!=
0
)
{
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
0
,
20
,
maxMessageId
,
!
cacheEndReaced
,
minDate
,
classGuid
,
false
,
false
);
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
20
,
maxMessageId
,
!
cacheEndReaced
,
minDate
,
classGuid
,
false
,
false
);
}
else
{
}
else
{
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
0
,
20
,
0
,
!
cacheEndReaced
,
minDate
,
classGuid
,
false
,
false
);
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
20
,
0
,
!
cacheEndReaced
,
minDate
,
classGuid
,
false
,
false
);
}
}
loading
=
true
;
loading
=
true
;
}
}
}
}
if
(
firstVisibleItem
+
visibleItemCount
>=
totalItemCount
-
6
)
{
if
(
firstVisibleItem
+
visibleItemCount
>=
totalItemCount
-
6
)
{
if
(!
unread_end_reached
&&
!
loadingForward
)
{
if
(!
unread_end_reached
&&
!
loadingForward
)
{
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
0
,
20
,
minMessageId
,
true
,
maxDate
,
classGuid
,
false
,
true
);
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
20
,
minMessageId
,
true
,
maxDate
,
classGuid
,
false
,
true
);
loadingForward
=
true
;
loadingForward
=
true
;
}
}
}
}
...
@@ -865,9 +866,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -865,9 +866,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
maxDate
=
Integer
.
MIN_VALUE
;
maxDate
=
Integer
.
MIN_VALUE
;
minDate
=
0
;
minDate
=
0
;
unread_end_reached
=
true
;
unread_end_reached
=
true
;
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
0
,
30
,
0
,
true
,
0
,
classGuid
,
true
,
false
);
loading
=
true
;
loading
=
true
;
chatAdapter
.
notifyDataSetChanged
();
chatAdapter
.
notifyDataSetChanged
();
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
30
,
0
,
true
,
0
,
classGuid
,
true
,
false
);
}
}
}
}
...
@@ -1479,6 +1480,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1479,6 +1480,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
tempPath
!=
null
)
{
if
(
tempPath
!=
null
)
{
File
temp
=
new
File
(
tempPath
);
File
temp
=
new
File
(
tempPath
);
originalPath
+=
temp
.
length
()
+
"_"
+
temp
.
lastModified
();
originalPath
+=
temp
.
length
()
+
"_"
+
temp
.
lastModified
();
}
else
{
originalPath
=
null
;
}
}
TLRPC
.
TL_photo
photo
=
(
TLRPC
.
TL_photo
)
MessagesStorage
.
getInstance
().
getSentFile
(
originalPath
,
currentEncryptedChat
==
null
?
0
:
3
);
TLRPC
.
TL_photo
photo
=
(
TLRPC
.
TL_photo
)
MessagesStorage
.
getInstance
().
getSentFile
(
originalPath
,
currentEncryptedChat
==
null
?
0
:
3
);
if
(
photo
==
null
&&
uri
!=
null
)
{
if
(
photo
==
null
&&
uri
!=
null
)
{
...
@@ -1696,24 +1699,42 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1696,24 +1699,42 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
id
==
MessagesController
.
messagesDidLoaded
)
{
if
(
id
==
MessagesController
.
messagesDidLoaded
)
{
long
did
=
(
Long
)
args
[
0
];
long
did
=
(
Long
)
args
[
0
];
if
(
did
==
dialog_id
)
{
if
(
did
==
dialog_id
)
{
int
offset
=
(
Integer
)
args
[
1
];
int
count
=
(
Integer
)
args
[
1
];
int
count
=
(
Integer
)
args
[
2
];
boolean
isCache
=
(
Boolean
)
args
[
3
];
boolean
isCache
=
(
Boolean
)
args
[
4
];
int
fnid
=
(
Integer
)
args
[
4
];
int
fnid
=
(
Integer
)
args
[
5
];
int
last_unread_date
=
(
Integer
)
args
[
7
];
int
last_unread_date
=
(
Integer
)
args
[
8
];
boolean
forwardLoad
=
(
Boolean
)
args
[
8
];
boolean
forwardLoad
=
(
Boolean
)
args
[
9
];
boolean
wasUnread
=
false
;
boolean
wasUnread
=
false
;
boolean
positionToUnread
=
false
;
boolean
positionToUnread
=
false
;
if
(
fnid
!=
0
)
{
if
(
fnid
!=
0
)
{
first_unread_id
=
(
Integer
)
args
[
5
]
;
first_unread_id
=
fnid
;
last_unread_id
=
(
Integer
)
args
[
6
];
last_unread_id
=
(
Integer
)
args
[
5
];
unread_to_load
=
(
Integer
)
args
[
7
];
unread_to_load
=
(
Integer
)
args
[
6
];
positionToUnread
=
true
;
positionToUnread
=
true
;
}
}
ArrayList
<
MessageObject
>
messArr
=
(
ArrayList
<
MessageObject
>)
args
[
3
];
ArrayList
<
MessageObject
>
messArr
=
(
ArrayList
<
MessageObject
>)
args
[
2
];
int
newRowsCount
=
0
;
int
newRowsCount
=
0
;
unread_end_reached
=
last_unread_id
==
0
;
unread_end_reached
=
last_unread_id
==
0
;
if
(
firstLoading
)
{
if
(!
unread_end_reached
)
{
messages
.
clear
();
messagesByDays
.
clear
();
messagesDict
.
clear
();
if
(
currentEncryptedChat
==
null
)
{
maxMessageId
=
Integer
.
MAX_VALUE
;
minMessageId
=
Integer
.
MIN_VALUE
;
}
else
{
maxMessageId
=
Integer
.
MIN_VALUE
;
minMessageId
=
Integer
.
MAX_VALUE
;
}
maxDate
=
Integer
.
MIN_VALUE
;
minDate
=
0
;
}
firstLoading
=
false
;
}
for
(
int
a
=
0
;
a
<
messArr
.
size
();
a
++)
{
for
(
int
a
=
0
;
a
<
messArr
.
size
();
a
++)
{
MessageObject
obj
=
messArr
.
get
(
a
);
MessageObject
obj
=
messArr
.
get
(
a
);
if
(
messagesDict
.
containsKey
(
obj
.
messageOwner
.
id
))
{
if
(
messagesDict
.
containsKey
(
obj
.
messageOwner
.
id
))
{
...
@@ -2042,6 +2063,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2042,6 +2063,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
lastVisible
++;
lastVisible
++;
}
}
if
(
lastVisible
==
oldCount
)
{
if
(
lastVisible
==
oldCount
)
{
if
(!
firstLoading
)
{
if
(
paused
)
{
if
(
paused
)
{
scrollToTopOnResume
=
true
;
scrollToTopOnResume
=
true
;
}
else
{
}
else
{
...
@@ -2052,6 +2074,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2052,6 +2074,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
});
});
}
}
}
}
else
{
}
else
{
showPagedownButton
(
true
,
true
);
showPagedownButton
(
true
,
true
);
}
}
...
@@ -2122,7 +2145,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2122,7 +2145,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
maxDate
=
Integer
.
MIN_VALUE
;
maxDate
=
Integer
.
MIN_VALUE
;
minDate
=
0
;
minDate
=
0
;
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
0
,
30
,
0
,
!
cacheEndReaced
,
minDate
,
classGuid
,
false
,
false
);
MessagesController
.
getInstance
().
loadMessages
(
dialog_id
,
30
,
0
,
!
cacheEndReaced
,
minDate
,
classGuid
,
false
,
false
);
loading
=
true
;
loading
=
true
;
}
}
}
}
...
@@ -2970,8 +2993,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -2970,8 +2993,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
else
if
(
lower_part
<
0
)
{
}
else
if
(
lower_part
<
0
)
{
args
.
putInt
(
"chat_id"
,
-
lower_part
);
args
.
putInt
(
"chat_id"
,
-
lower_part
);
}
}
forwardSelectedMessages
(
did
,
param
);
presentFragment
(
new
ChatActivity
(
args
),
true
);
presentFragment
(
new
ChatActivity
(
args
),
true
);
forwardSelectedMessages
(
did
,
param
);
removeSelfFromStack
();
removeSelfFromStack
();
}
else
{
}
else
{
activity
.
finishFragment
();
activity
.
finishFragment
();
...
...
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