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
d03fa955
Commit
d03fa955
authored
Oct 23, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
e5def002
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
67 additions
and
42 deletions
+67
-42
build.gradle
TMessagesProj/build.gradle
+2
-2
BaseContactsSearchAdapter.java
...a/org/telegram/ui/Adapters/BaseContactsSearchAdapter.java
+2
-2
ContactsActivitySearchAdapter.java
...g/telegram/ui/Adapters/ContactsActivitySearchAdapter.java
+27
-16
ChatProfileActivity.java
...oj/src/main/java/org/telegram/ui/ChatProfileActivity.java
+1
-0
ContactsActivity.java
...sProj/src/main/java/org/telegram/ui/ContactsActivity.java
+7
-5
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+3
-0
MessagesActivity.java
...sProj/src/main/java/org/telegram/ui/MessagesActivity.java
+21
-16
PhotoPickerActivity.java
...oj/src/main/java/org/telegram/ui/PhotoPickerActivity.java
+3
-0
SettingsChangeUsernameActivity.java
.../java/org/telegram/ui/SettingsChangeUsernameActivity.java
+1
-1
No files found.
TMessagesProj/build.gradle
View file @
d03fa955
...
...
@@ -80,7 +80,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
19
versionCode
37
1
versionName
"1.9.
5
"
versionCode
37
2
versionName
"1.9.
6
"
}
}
TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseContactsSearchAdapter.java
View file @
d03fa955
...
...
@@ -18,7 +18,7 @@ import java.util.ArrayList;
public
class
BaseContactsSearchAdapter
extends
BaseFragmentAdapter
{
protected
ArrayList
<
TLRPC
.
User
>
globalSearch
;
protected
ArrayList
<
TLRPC
.
User
>
globalSearch
=
new
ArrayList
<
TLRPC
.
User
>()
;
private
long
reqId
=
0
;
private
int
lastReqId
;
protected
String
lastFoundUsername
=
null
;
...
...
@@ -29,7 +29,7 @@ public class BaseContactsSearchAdapter extends BaseFragmentAdapter {
ConnectionsManager
.
getInstance
().
cancelRpc
(
reqId
,
true
);
reqId
=
0
;
}
globalSearch
=
null
;
globalSearch
.
clear
()
;
lastReqId
=
0
;
notifyDataSetChanged
();
return
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java
View file @
d03fa955
...
...
@@ -36,17 +36,21 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
private
ArrayList
<
TLRPC
.
User
>
searchResult
;
private
ArrayList
<
CharSequence
>
searchResultNames
;
private
Timer
searchTimer
;
private
boolean
allowUsernameSearch
;
public
ContactsActivitySearchAdapter
(
Context
context
,
HashMap
<
Integer
,
TLRPC
.
User
>
arg1
)
{
public
ContactsActivitySearchAdapter
(
Context
context
,
HashMap
<
Integer
,
TLRPC
.
User
>
arg1
,
boolean
usernameSearch
)
{
mContext
=
context
;
ignoreUsers
=
arg1
;
allowUsernameSearch
=
usernameSearch
;
}
public
void
searchDialogs
(
final
String
query
)
{
if
(
query
==
null
)
{
searchResult
=
null
;
searchResultNames
=
null
;
searchResult
.
clear
();
searchResultNames
.
clear
();
if
(
allowUsernameSearch
)
{
queryServerSearch
(
null
);
}
notifyDataSetChanged
();
}
else
{
try
{
...
...
@@ -76,7 +80,9 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
AndroidUtilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
allowUsernameSearch
)
{
queryServerSearch
(
query
);
}
final
ArrayList
<
TLRPC
.
TL_contact
>
contactsCopy
=
new
ArrayList
<
TLRPC
.
TL_contact
>();
contactsCopy
.
addAll
(
ContactsController
.
getInstance
().
contacts
);
Utilities
.
searchQueue
.
postRunnable
(
new
Runnable
()
{
...
...
@@ -128,13 +134,13 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
@Override
public
boolean
isEnabled
(
int
i
)
{
return
i
!=
(
searchResult
==
null
?
0
:
searchResult
.
size
()
);
return
i
!=
searchResult
.
size
(
);
}
@Override
public
int
getCount
()
{
int
count
=
searchResult
==
null
?
0
:
searchResult
.
size
();
int
globalCount
=
globalSearch
==
null
?
0
:
globalSearch
.
size
();
int
count
=
searchResult
.
size
();
int
globalCount
=
globalSearch
.
size
();
if
(
globalCount
!=
0
)
{
count
+=
globalCount
+
1
;
}
...
...
@@ -142,8 +148,8 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
}
public
boolean
isGlobalSearch
(
int
i
)
{
int
localCount
=
searchResult
==
null
?
0
:
searchResult
.
size
();
int
globalCount
=
globalSearch
==
null
?
0
:
globalSearch
.
size
();
int
localCount
=
searchResult
.
size
();
int
globalCount
=
globalSearch
.
size
();
if
(
i
>=
0
&&
i
<
localCount
)
{
return
false
;
}
else
if
(
i
>
localCount
&&
i
<=
globalCount
+
localCount
)
{
...
...
@@ -154,8 +160,8 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
@Override
public
TLRPC
.
User
getItem
(
int
i
)
{
int
localCount
=
searchResult
==
null
?
0
:
searchResult
.
size
();
int
globalCount
=
globalSearch
==
null
?
0
:
globalSearch
.
size
();
int
localCount
=
searchResult
.
size
();
int
globalCount
=
globalSearch
.
size
();
if
(
i
>=
0
&&
i
<
localCount
)
{
return
searchResult
.
get
(
i
);
}
else
if
(
i
>
localCount
&&
i
<=
globalCount
+
localCount
)
{
...
...
@@ -176,7 +182,7 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
@Override
public
View
getView
(
int
i
,
View
view
,
ViewGroup
viewGroup
)
{
if
(
i
==
(
searchResult
==
null
?
0
:
searchResult
.
size
()
))
{
if
(
i
==
searchResult
.
size
(
))
{
if
(
view
==
null
)
{
view
=
new
SettingsSectionLayout
(
mContext
);
((
SettingsSectionLayout
)
view
).
setText
(
LocaleController
.
getString
(
"GlobalSearch"
,
R
.
string
.
GlobalSearch
));
...
...
@@ -192,7 +198,12 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
if
(
user
!=
null
)
{
CharSequence
username
=
null
;
if
(
i
>
searchResult
.
size
()
&&
user
.
username
!=
null
)
{
try
{
username
=
Html
.
fromHtml
(
String
.
format
(
"<font color=\"#357aa8\">@%s</font>%s"
,
user
.
username
.
substring
(
0
,
lastFoundUsername
.
length
()),
user
.
username
.
substring
(
lastFoundUsername
.
length
())));
}
catch
(
Exception
e
)
{
username
=
user
.
username
;
FileLog
.
e
(
"tmessages"
,
e
);
}
}
((
ChatOrUserCell
)
view
).
setData
(
user
,
null
,
null
,
i
<
searchResult
.
size
()
?
searchResultNames
.
get
(
i
)
:
null
,
username
);
...
...
@@ -211,7 +222,7 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
@Override
public
int
getItemViewType
(
int
i
)
{
if
(
i
==
(
searchResult
==
null
?
0
:
searchResult
.
size
()
))
{
if
(
i
==
searchResult
.
size
(
))
{
return
1
;
}
return
0
;
...
...
@@ -224,6 +235,6 @@ public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter {
@Override
public
boolean
isEmpty
()
{
return
(
searchResult
==
null
||
searchResult
.
size
()
==
0
)
&&
(
globalSearch
==
null
||
globalSearch
.
isEmpty
()
);
return
searchResult
.
isEmpty
()
&&
globalSearch
.
isEmpty
(
);
}
}
TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java
View file @
d03fa955
...
...
@@ -477,6 +477,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
args
.
putBoolean
(
"destroyAfterSelect"
,
true
);
args
.
putBoolean
(
"usersAsSections"
,
true
);
args
.
putBoolean
(
"returnAsResult"
,
true
);
args
.
putBoolean
(
"allowUsernameSearch"
,
false
);
if
(
chat_id
>
0
)
{
args
.
putString
(
"selectAlertString"
,
LocaleController
.
getString
(
"AddToTheGroup"
,
R
.
string
.
AddToTheGroup
));
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java
View file @
d03fa955
...
...
@@ -73,6 +73,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
private
String
inviteText
;
private
boolean
updatingInviteText
=
false
;
private
boolean
allowUsernameSearch
=
true
;
private
ContactsActivityDelegate
delegate
;
public
static
interface
ContactsActivityDelegate
{
...
...
@@ -92,11 +93,12 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
encryptedChatCreated
);
if
(
arguments
!=
null
)
{
onlyUsers
=
getArguments
().
getBoolean
(
"onlyUsers"
,
false
);
destroyAfterSelect
=
getArguments
()
.
getBoolean
(
"destroyAfterSelect"
,
false
);
usersAsSections
=
getArguments
()
.
getBoolean
(
"usersAsSections"
,
false
);
returnAsResult
=
getArguments
()
.
getBoolean
(
"returnAsResult"
,
false
);
createSecretChat
=
getArguments
()
.
getBoolean
(
"createSecretChat"
,
false
);
destroyAfterSelect
=
arguments
.
getBoolean
(
"destroyAfterSelect"
,
false
);
usersAsSections
=
arguments
.
getBoolean
(
"usersAsSections"
,
false
);
returnAsResult
=
arguments
.
getBoolean
(
"returnAsResult"
,
false
);
createSecretChat
=
arguments
.
getBoolean
(
"createSecretChat"
,
false
);
selectAlertString
=
arguments
.
getString
(
"selectAlertString"
);
allowUsernameSearch
=
arguments
.
getBoolean
(
"allowUsernameSearch"
,
true
);
}
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
...
...
@@ -200,7 +202,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
emptyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
emptyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
searchListViewAdapter
=
new
ContactsActivitySearchAdapter
(
getParentActivity
(),
ignoreUsers
);
searchListViewAdapter
=
new
ContactsActivitySearchAdapter
(
getParentActivity
(),
ignoreUsers
,
allowUsernameSearch
);
listView
=
(
PinnedHeaderListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
listView
.
setEmptyView
(
emptyTextView
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
d03fa955
...
...
@@ -787,6 +787,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
public
void
fixLayout
()
{
if
(
AndroidUtilities
.
isTablet
())
{
if
(
actionBarLayout
==
null
)
{
return
;
}
actionBarLayout
.
getViewTreeObserver
().
addOnGlobalLayoutListener
(
new
ViewTreeObserver
.
OnGlobalLayoutListener
()
{
@Override
public
void
onGlobalLayout
()
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java
View file @
d03fa955
...
...
@@ -619,8 +619,8 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
private
Context
mContext
;
private
Timer
searchTimer
;
private
ArrayList
<
TLObject
>
searchResult
;
private
ArrayList
<
CharSequence
>
searchResultNames
;
private
ArrayList
<
TLObject
>
searchResult
=
new
ArrayList
<
TLObject
>()
;
private
ArrayList
<
CharSequence
>
searchResultNames
=
new
ArrayList
<
CharSequence
>()
;
public
MessagesAdapter
(
Context
context
)
{
mContext
=
context
;
...
...
@@ -656,8 +656,8 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
public
boolean
isGlobalSearch
(
int
i
)
{
if
(
searching
&&
searchWas
)
{
int
localCount
=
searchResult
==
null
?
0
:
searchResult
.
size
();
int
globalCount
=
globalSearch
==
null
?
0
:
globalSearch
.
size
();
int
localCount
=
searchResult
.
size
();
int
globalCount
=
globalSearch
.
size
();
if
(
i
>=
0
&&
i
<
localCount
)
{
return
false
;
}
else
if
(
i
>
localCount
&&
i
<=
globalCount
+
localCount
)
{
...
...
@@ -669,8 +669,8 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
public
void
searchDialogs
(
final
String
query
)
{
if
(
query
==
null
)
{
searchResult
=
null
;
searchResultNames
=
null
;
searchResult
.
clear
()
;
searchResultNames
.
clear
()
;
queryServerSearch
(
null
);
notifyDataSetChanged
();
}
else
{
...
...
@@ -710,14 +710,14 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@Override
public
boolean
isEnabled
(
int
i
)
{
return
!(
searching
&&
searchWas
)
||
i
!=
(
searchResult
==
null
?
0
:
searchResult
.
size
()
);
return
!(
searching
&&
searchWas
)
||
i
!=
searchResult
.
size
(
);
}
@Override
public
int
getCount
()
{
if
(
searching
&&
searchWas
)
{
int
count
=
searchResult
==
null
?
0
:
searchResult
.
size
();
int
globalCount
=
globalSearch
==
null
?
0
:
globalSearch
.
size
();
int
count
=
searchResult
.
size
();
int
globalCount
=
globalSearch
.
size
();
if
(
globalCount
!=
0
)
{
count
+=
globalCount
+
1
;
}
...
...
@@ -741,8 +741,8 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@Override
public
TLObject
getItem
(
int
i
)
{
if
(
searching
&&
searchWas
)
{
int
localCount
=
searchResult
==
null
?
0
:
searchResult
.
size
();
int
globalCount
=
globalSearch
==
null
?
0
:
globalSearch
.
size
();
int
localCount
=
searchResult
.
size
();
int
globalCount
=
globalSearch
.
size
();
if
(
i
>=
0
&&
i
<
localCount
)
{
return
searchResult
.
get
(
i
);
}
else
if
(
i
>
localCount
&&
i
<=
globalCount
+
localCount
)
{
...
...
@@ -776,7 +776,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@Override
public
View
getView
(
int
i
,
View
view
,
ViewGroup
viewGroup
)
{
if
(
searching
&&
searchWas
)
{
if
(
i
==
(
searchResult
==
null
?
0
:
searchResult
.
size
()
))
{
if
(
i
==
searchResult
.
size
(
))
{
if
(
view
==
null
)
{
view
=
new
SettingsSectionLayout
(
mContext
);
((
SettingsSectionLayout
)
view
).
setText
(
LocaleController
.
getString
(
"GlobalSearch"
,
R
.
string
.
GlobalSearch
));
...
...
@@ -805,8 +805,13 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
}
CharSequence
username
=
null
;
if
(
i
>
searchResult
.
size
()
&&
user
.
username
!=
null
)
{
if
(
i
>
searchResult
.
size
()
&&
user
!=
null
&&
user
.
username
!=
null
)
{
try
{
username
=
Html
.
fromHtml
(
String
.
format
(
"<font color=\"#357aa8\">@%s</font>%s"
,
user
.
username
.
substring
(
0
,
lastFoundUsername
.
length
()),
user
.
username
.
substring
(
lastFoundUsername
.
length
())));
}
catch
(
Exception
e
)
{
username
=
user
.
username
;
FileLog
.
e
(
"tmessages"
,
e
);
}
}
((
ChatOrUserCell
)
view
).
setData
(
user
,
chat
,
encryptedChat
,
i
<
searchResult
.
size
()
?
searchResultNames
.
get
(
i
)
:
null
,
username
);
...
...
@@ -847,7 +852,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@Override
public
int
getItemViewType
(
int
i
)
{
if
(
searching
&&
searchWas
)
{
if
(
i
==
(
searchResult
==
null
?
0
:
searchResult
.
size
()
))
{
if
(
i
==
searchResult
.
size
(
))
{
return
3
;
}
return
2
;
...
...
@@ -866,7 +871,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@Override
public
boolean
isEmpty
()
{
if
(
searching
&&
searchWas
)
{
return
(
searchResult
==
null
||
searchResult
.
size
()
==
0
)
&&
(
globalSearch
==
null
||
globalSearch
.
isEmpty
()
);
return
searchResult
.
size
()
==
0
&&
globalSearch
.
isEmpty
(
);
}
if
(
MessagesController
.
getInstance
().
loadingDialogs
&&
MessagesController
.
getInstance
().
dialogs
.
isEmpty
())
{
return
false
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java
View file @
d03fa955
...
...
@@ -279,6 +279,9 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
int
count
=
listView
.
getChildCount
();
for
(
int
a
=
0
;
a
<
count
;
a
++)
{
View
view
=
listView
.
getChildAt
(
a
);
if
(
view
.
getTag
()
==
null
)
{
continue
;
}
int
num
=
(
Integer
)
view
.
getTag
();
if
(
num
<
0
||
num
>=
selectedAlbum
.
photos
.
size
())
{
continue
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeUsernameActivity.java
View file @
d03fa955
...
...
@@ -239,7 +239,7 @@ public class SettingsChangeUsernameActivity extends BaseFragment {
}
return
false
;
}
if
(!(
ch
>=
'0'
&&
ch
<=
'9'
||
ch
>=
'a'
&&
ch
<=
'z'
||
ch
>=
'A'
&&
ch
<=
'Z'
||
a
==
'_'
))
{
if
(!(
ch
>=
'0'
&&
ch
<=
'9'
||
ch
>=
'a'
&&
ch
<=
'z'
||
ch
>=
'A'
&&
ch
<=
'Z'
||
ch
==
'_'
))
{
if
(
alert
)
{
showErrorAlert
(
LocaleController
.
getString
(
"UsernameInvalid"
,
R
.
string
.
UsernameInvalid
));
}
else
{
...
...
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