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
ba4cf583
Commit
ba4cf583
authored
Nov 19, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
ea8760f9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
40 deletions
+120
-40
build.gradle
TMessagesProj/build.gradle
+2
-2
ContactsController.java
...rc/main/java/org/telegram/android/ContactsController.java
+30
-0
ActionBarLayout.java
.../main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
+8
-0
DrawerLayoutContainer.java
...java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
+3
-0
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+39
-32
MessagesActivity.java
...sProj/src/main/java/org/telegram/ui/MessagesActivity.java
+25
-4
ChatActivityEnterView.java
...ain/java/org/telegram/ui/Views/ChatActivityEnterView.java
+3
-0
SectionsListView.java
...src/main/java/org/telegram/ui/Views/SectionsListView.java
+10
-2
No files found.
TMessagesProj/build.gradle
View file @
ba4cf583
...
...
@@ -80,7 +80,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
21
versionCode
38
6
versionName
"2.0.
0
"
versionCode
38
8
versionName
"2.0.
1
"
}
}
TMessagesProj/src/main/java/org/telegram/android/ContactsController.java
View file @
ba4cf583
...
...
@@ -850,6 +850,8 @@ public class ContactsController {
final
HashMap
<
Integer
,
TLRPC
.
User
>
usersDict
=
new
HashMap
<
Integer
,
TLRPC
.
User
>();
final
boolean
isEmpty
=
contactsArr
.
isEmpty
();
if
(!
contacts
.
isEmpty
())
{
for
(
int
a
=
0
;
a
<
contactsArr
.
size
();
a
++)
{
TLRPC
.
TL_contact
contact
=
contactsArr
.
get
(
a
);
...
...
@@ -1003,6 +1005,12 @@ public class ContactsController {
updateUnregisteredContacts
(
contactsArr
);
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
contactsDidLoaded
);
if
(
from
!=
1
&&
!
isEmpty
)
{
saveContactsLoadTime
();
}
else
{
reloadContactsStatusesMaybe
();
}
}
});
...
...
@@ -1037,6 +1045,27 @@ public class ContactsController {
});
}
private
void
reloadContactsStatusesMaybe
()
{
try
{
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
long
lastReloadStatusTime
=
preferences
.
getLong
(
"lastReloadStatusTime"
,
0
);
if
(
lastReloadStatusTime
<
System
.
currentTimeMillis
()
-
1000
*
60
*
60
*
24
)
{
reloadContactsStatuses
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
private
void
saveContactsLoadTime
()
{
try
{
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
preferences
.
edit
().
putLong
(
"lastReloadStatusTime"
,
System
.
currentTimeMillis
()).
commit
();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
private
void
updateUnregisteredContacts
(
final
ArrayList
<
TLRPC
.
TL_contact
>
contactsArr
)
{
final
HashMap
<
String
,
TLRPC
.
TL_contact
>
contactsPhonesShort
=
new
HashMap
<
String
,
TLRPC
.
TL_contact
>();
...
...
@@ -1586,6 +1615,7 @@ public class ContactsController {
}
public
void
reloadContactsStatuses
()
{
saveContactsLoadTime
();
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
final
SharedPreferences
.
Editor
editor
=
preferences
.
edit
();
editor
.
putBoolean
(
"needGetStatuses"
,
true
).
commit
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
View file @
ba4cf583
...
...
@@ -560,6 +560,10 @@ public class ActionBarLayout extends FrameLayout {
if
(
removeActionBarExtraHeight
)
{
fragment
.
actionBar
.
setOccupyStatusBar
(
false
);
}
ViewGroup
parent
=
(
ViewGroup
)
fragment
.
actionBar
.
getParent
();
if
(
parent
!=
null
)
{
parent
.
removeView
(
fragment
.
actionBar
);
}
containerViewBack
.
addView
(
fragment
.
actionBar
);
fragment
.
actionBar
.
setTitleOverlayText
(
titleOverlayText
);
}
...
...
@@ -698,6 +702,10 @@ public class ActionBarLayout extends FrameLayout {
if
(
removeActionBarExtraHeight
)
{
previousFragment
.
actionBar
.
setOccupyStatusBar
(
false
);
}
ViewGroup
parent
=
(
ViewGroup
)
previousFragment
.
actionBar
.
getParent
();
if
(
parent
!=
null
)
{
parent
.
removeView
(
previousFragment
.
actionBar
);
}
containerView
.
addView
(
previousFragment
.
actionBar
);
previousFragment
.
actionBar
.
setTitleOverlayText
(
titleOverlayText
);
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
View file @
ba4cf583
...
...
@@ -165,6 +165,9 @@ public class DrawerLayoutContainer extends FrameLayout {
}
public
void
openDrawer
(
boolean
fast
)
{
if
(
AndroidUtilities
.
isTablet
()
&&
parentActionBarLayout
!=
null
&&
parentActionBarLayout
.
parentActivity
!=
null
)
{
AndroidUtilities
.
hideKeyboard
(
parentActionBarLayout
.
parentActivity
.
getCurrentFocus
());
}
cancelCurrentAnimation
();
AnimatorSetProxy
animatorSet
=
new
AnimatorSetProxy
();
animatorSet
.
playTogether
(
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
ba4cf583
...
...
@@ -506,6 +506,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
currentEncryptedChat
!=
null
)
{
MediaController
.
getInstance
().
stopMediaObserver
();
}
if
(
currentUser
!=
null
)
{
MessagesController
.
getInstance
().
cancelLoadFullUser
(
currentUser
.
id
);
}
if
(!
AndroidUtilities
.
isTablet
())
{
getParentActivity
().
getWindow
().
setSoftInputMode
(
WindowManager
.
LayoutParams
.
SOFT_INPUT_ADJUST_PAN
);
}
...
...
@@ -996,38 +999,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
if
(
currentEncryptedChat
!=
null
)
{
emptyView
.
setVisibility
(
View
.
INVISIBLE
);
View
secretChatPlaceholder
=
contentView
.
findViewById
(
R
.
id
.
secret_placeholder
);
secretChatPlaceholder
.
setVisibility
(
View
.
VISIBLE
);
if
(
isCustomTheme
)
{
secretChatPlaceholder
.
setBackgroundResource
(
R
.
drawable
.
system_black
);
}
else
{
secretChatPlaceholder
.
setBackgroundResource
(
R
.
drawable
.
system_blue
);
}
secretViewStatusTextView
=
(
TextView
)
contentView
.
findViewById
(
R
.
id
.
invite_text
);
secretChatPlaceholder
.
setPadding
(
AndroidUtilities
.
dp
(
16
),
AndroidUtilities
.
dp
(
12
),
AndroidUtilities
.
dp
(
16
),
AndroidUtilities
.
dp
(
12
));
View
v
=
contentView
.
findViewById
(
R
.
id
.
secret_placeholder
);
v
.
setVisibility
(
View
.
VISIBLE
);
if
(
currentEncryptedChat
.
admin_id
==
UserConfig
.
getClientUserId
())
{
if
(
currentUser
.
first_name
.
length
()
>
0
)
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleOutgoing"
,
R
.
string
.
EncryptedPlaceholderTitleOutgoing
,
currentUser
.
first_name
));
}
else
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleOutgoing"
,
R
.
string
.
EncryptedPlaceholderTitleOutgoing
,
currentUser
.
last_name
));
}
}
else
{
if
(
currentUser
.
first_name
.
length
()
>
0
)
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleIncoming"
,
R
.
string
.
EncryptedPlaceholderTitleIncoming
,
currentUser
.
first_name
));
}
else
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleIncoming"
,
R
.
string
.
EncryptedPlaceholderTitleIncoming
,
currentUser
.
last_name
));
}
}
updateSecretStatus
();
}
if
(
isCustomTheme
)
{
progressViewInner
.
setBackgroundResource
(
R
.
drawable
.
system_loader2
);
emptyView
.
setBackgroundResource
(
R
.
drawable
.
system_black
);
...
...
@@ -1261,6 +1232,38 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatActivityEnterView
.
setContainerView
(
getParentActivity
(),
fragmentView
);
chatActivityEnterView
.
addToAttachLayout
(
menuItem
);
if
(
currentEncryptedChat
!=
null
)
{
emptyView
.
setVisibility
(
View
.
INVISIBLE
);
View
secretChatPlaceholder
=
contentView
.
findViewById
(
R
.
id
.
secret_placeholder
);
secretChatPlaceholder
.
setVisibility
(
View
.
VISIBLE
);
if
(
isCustomTheme
)
{
secretChatPlaceholder
.
setBackgroundResource
(
R
.
drawable
.
system_black
);
}
else
{
secretChatPlaceholder
.
setBackgroundResource
(
R
.
drawable
.
system_blue
);
}
secretViewStatusTextView
=
(
TextView
)
contentView
.
findViewById
(
R
.
id
.
invite_text
);
secretChatPlaceholder
.
setPadding
(
AndroidUtilities
.
dp
(
16
),
AndroidUtilities
.
dp
(
12
),
AndroidUtilities
.
dp
(
16
),
AndroidUtilities
.
dp
(
12
));
View
v
=
contentView
.
findViewById
(
R
.
id
.
secret_placeholder
);
v
.
setVisibility
(
View
.
VISIBLE
);
if
(
currentEncryptedChat
.
admin_id
==
UserConfig
.
getClientUserId
())
{
if
(
currentUser
.
first_name
.
length
()
>
0
)
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleOutgoing"
,
R
.
string
.
EncryptedPlaceholderTitleOutgoing
,
currentUser
.
first_name
));
}
else
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleOutgoing"
,
R
.
string
.
EncryptedPlaceholderTitleOutgoing
,
currentUser
.
last_name
));
}
}
else
{
if
(
currentUser
.
first_name
.
length
()
>
0
)
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleIncoming"
,
R
.
string
.
EncryptedPlaceholderTitleIncoming
,
currentUser
.
first_name
));
}
else
{
secretViewStatusTextView
.
setText
(
LocaleController
.
formatString
(
"EncryptedPlaceholderTitleIncoming"
,
R
.
string
.
EncryptedPlaceholderTitleIncoming
,
currentUser
.
last_name
));
}
}
updateSecretStatus
();
}
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
...
...
@@ -2544,6 +2547,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
cell
.
setAllowedToSetPhoto
(
true
);
}
}
if
(
currentUser
!=
null
)
{
MessagesController
.
getInstance
().
loadFullUser
(
MessagesController
.
getInstance
().
getUser
(
currentUser
.
id
),
classGuid
);
}
}
private
void
updateBottomOverlay
()
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java
View file @
ba4cf583
...
...
@@ -223,6 +223,9 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
messages_list
,
container
,
false
);
dialogsAdapter
=
new
DialogsAdapter
(
getParentActivity
(),
serverOnly
);
if
(
AndroidUtilities
.
isTablet
()
&&
openedDialogId
!=
0
)
{
dialogsAdapter
.
setOpenedDialogId
(
openedDialogId
);
}
dialogsSearchAdapter
=
new
DialogsSearchAdapter
(
getParentActivity
(),
!
onlySelect
);
dialogsSearchAdapter
.
setDelegate
(
new
DialogsSearchAdapter
.
MessagesActivitySearchAdapterDelegate
()
{
@Override
...
...
@@ -527,9 +530,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@SuppressWarnings
(
"unchecked"
)
public
void
didReceivedNotification
(
int
id
,
Object
...
args
)
{
if
(
id
==
NotificationCenter
.
dialogsNeedReload
)
{
if
(
dialogsAdapter
!=
null
)
{
dialogsAdapter
.
notifyDataSetChanged
();
}
if
(
messagesListView
!=
null
)
{
if
(
MessagesController
.
getInstance
().
loadingDialogs
&&
MessagesController
.
getInstance
().
dialogs
.
isEmpty
())
{
searchEmptyView
.
setVisibility
(
View
.
GONE
);
...
...
@@ -537,14 +537,33 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
messagesListView
.
setEmptyView
(
progressView
);
}
else
{
if
(
searching
&&
searchWas
)
{
if
(
dialogsAdapter
!=
null
)
{
dialogsAdapter
.
notifyDataSetChanged
();
}
if
(
dialogsSearchAdapter
!=
null
)
{
dialogsSearchAdapter
.
notifyDataSetChanged
();
}
messagesListView
.
setEmptyView
(
searchEmptyView
);
emptyView
.
setVisibility
(
View
.
GONE
);
}
else
{
if
(
dialogsAdapter
!=
null
)
{
dialogsAdapter
.
notifyDataSetChanged
();
}
if
(
dialogsSearchAdapter
!=
null
)
{
dialogsSearchAdapter
.
notifyDataSetChanged
();
}
messagesListView
.
setEmptyView
(
emptyView
);
searchEmptyView
.
setVisibility
(
View
.
GONE
);
}
progressView
.
setVisibility
(
View
.
GONE
);
}
}
else
{
if
(
dialogsAdapter
!=
null
)
{
dialogsAdapter
.
notifyDataSetChanged
();
}
if
(
dialogsSearchAdapter
!=
null
)
{
dialogsSearchAdapter
.
notifyDataSetChanged
();
}
}
}
else
if
(
id
==
NotificationCenter
.
emojiDidLoaded
)
{
if
(
messagesListView
!=
null
)
{
...
...
@@ -569,7 +588,9 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
}
else
{
openedDialogId
=
dialog_id
;
}
dialogsAdapter
.
setOpenedDialogId
(
openedDialogId
);
if
(
dialogsAdapter
!=
null
)
{
dialogsAdapter
.
setOpenedDialogId
(
openedDialogId
);
}
updateVisibleRows
(
MessagesController
.
UPDATE_MASK_SELECT_DIALOG
);
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java
View file @
ba4cf583
...
...
@@ -695,6 +695,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
}
public
void
setFieldText
(
String
text
)
{
if
(
messsageEditText
==
null
)
{
return
;
}
ignoreTextChange
=
true
;
messsageEditText
.
setText
(
text
);
messsageEditText
.
setSelection
(
messsageEditText
.
getText
().
length
());
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/SectionsListView.java
View file @
ba4cf583
...
...
@@ -17,6 +17,7 @@ import android.widget.AbsListView;
import
android.widget.ListAdapter
;
import
android.widget.ListView
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.LocaleController
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.ui.Adapters.BaseSectionsAdapter
;
...
...
@@ -112,7 +113,12 @@ public class SectionsListView extends ListView implements AbsListView.OnScrollLi
header
.
setTag
(-
header
.
getHeight
());
}
else
if
(
pos
==
count
-
2
)
{
View
child
=
getChildAt
(
itemNum
-
firstVisibleItem
);
int
headerTop
=
child
.
getTop
();
int
headerTop
=
0
;
if
(
child
!=
null
)
{
headerTop
=
child
.
getTop
();
}
else
{
headerTop
=
-
AndroidUtilities
.
dp
(
100
);
}
if
(
headerTop
<
0
)
{
header
.
setTag
(
headerTop
);
}
else
{
...
...
@@ -124,7 +130,9 @@ public class SectionsListView extends ListView implements AbsListView.OnScrollLi
itemNum
+=
count
-
mAdapter
.
getPositionInSectionForPosition
(
firstVisibleItem
);
}
else
{
View
child
=
getChildAt
(
itemNum
-
firstVisibleItem
);
header
.
setTag
(
child
.
getTop
());
if
(
child
!=
null
)
{
header
.
setTag
(
child
.
getTop
());
}
itemNum
+=
count
;
}
}
...
...
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