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
ea0b86d0
Commit
ea0b86d0
authored
Nov 13, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Android L design
parent
4104a21f
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
1208 additions
and
2021 deletions
+1208
-2021
ImageReceiver.java
...roj/src/main/java/org/telegram/android/ImageReceiver.java
+13
-9
ContactsActivityAdapter.java
...ava/org/telegram/ui/Adapters/ContactsActivityAdapter.java
+7
-5
DialogCell.java
...sProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
+2
-2
EmptyCell.java
...esProj/src/main/java/org/telegram/ui/Cells/EmptyCell.java
+8
-0
TextCell.java
...gesProj/src/main/java/org/telegram/ui/Cells/TextCell.java
+2
-0
TextDetailSettingsCell.java
...in/java/org/telegram/ui/Cells/TextDetailSettingsCell.java
+3
-1
UserCell.java
...gesProj/src/main/java/org/telegram/ui/Cells/UserCell.java
+131
-219
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+17
-13
ChatProfileActivity.java
...oj/src/main/java/org/telegram/ui/ChatProfileActivity.java
+0
-776
ContactsActivity.java
...sProj/src/main/java/org/telegram/ui/ContactsActivity.java
+1
-5
GroupCreateActivity.java
...oj/src/main/java/org/telegram/ui/GroupCreateActivity.java
+141
-293
GroupCreateFinalActivity.java
...c/main/java/org/telegram/ui/GroupCreateFinalActivity.java
+2
-6
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+2
-2
ProfileActivity.java
...esProj/src/main/java/org/telegram/ui/ProfileActivity.java
+668
-137
SettingsActivity.java
...sProj/src/main/java/org/telegram/ui/SettingsActivity.java
+97
-11
SettingsBlockedUsersActivity.java
...in/java/org/telegram/ui/SettingsBlockedUsersActivity.java
+67
-25
ActionBar.java
.../main/java/org/telegram/ui/Views/ActionBar/ActionBar.java
+8
-1
ActionBarMenuItem.java
...va/org/telegram/ui/Views/ActionBar/ActionBarMenuItem.java
+1
-3
AvatarDrawable.java
...j/src/main/java/org/telegram/ui/Views/AvatarDrawable.java
+19
-5
chat_profile_add_row.xml
...sagesProj/src/main/res/layout-ar/chat_profile_add_row.xml
+0
-34
chat_profile_avatar_layout.xml
...roj/src/main/res/layout-ar/chat_profile_avatar_layout.xml
+0
-78
group_create_layout.xml
TMessagesProj/src/main/res/layout-ar/group_create_layout.xml
+0
-68
settings_row_button_layout.xml
...roj/src/main/res/layout-ar/settings_row_button_layout.xml
+8
-0
user_profile_leftright_row_layout.xml
.../main/res/layout-ar/user_profile_leftright_row_layout.xml
+0
-35
chat_profile_add_row.xml
TMessagesProj/src/main/res/layout/chat_profile_add_row.xml
+0
-33
chat_profile_avatar_layout.xml
...esProj/src/main/res/layout/chat_profile_avatar_layout.xml
+0
-74
group_create_layout.xml
TMessagesProj/src/main/res/layout/group_create_layout.xml
+0
-65
settings_blocked_users_layout.xml
...roj/src/main/res/layout/settings_blocked_users_layout.xml
+0
-44
settings_logout_button.xml
TMessagesProj/src/main/res/layout/settings_logout_button.xml
+0
-24
settings_row_button_layout.xml
...esProj/src/main/res/layout/settings_row_button_layout.xml
+8
-0
settings_unblock_info_row_layout.xml
.../src/main/res/layout/settings_unblock_info_row_layout.xml
+0
-14
user_profile_leftright_row_layout.xml
...src/main/res/layout/user_profile_leftright_row_layout.xml
+0
-36
strings.xml
TMessagesProj/src/main/res/values/strings.xml
+3
-3
No files found.
TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java
View file @
ea0b86d0
...
@@ -225,11 +225,13 @@ public class ImageReceiver {
...
@@ -225,11 +225,13 @@ public class ImageReceiver {
if
(
bitmapDrawable
!=
null
)
{
if
(
bitmapDrawable
!=
null
)
{
if
(
bitmapShader
!=
null
)
{
if
(
bitmapShader
!=
null
)
{
drawRegion
.
set
(
imageX
,
imageY
,
imageX
+
imageW
,
imageY
+
imageH
);
drawRegion
.
set
(
imageX
,
imageY
,
imageX
+
imageW
,
imageY
+
imageH
);
roundRect
.
set
(
drawRegion
);
if
(
isVisible
)
{
shaderMatrix
.
reset
();
roundRect
.
set
(
drawRegion
);
shaderMatrix
.
setRectToRect
(
bitmapRect
,
roundRect
,
Matrix
.
ScaleToFit
.
FILL
);
shaderMatrix
.
reset
();
bitmapShader
.
setLocalMatrix
(
shaderMatrix
);
shaderMatrix
.
setRectToRect
(
bitmapRect
,
roundRect
,
Matrix
.
ScaleToFit
.
FILL
);
canvas
.
drawRoundRect
(
roundRect
,
roundRadius
,
roundRadius
,
roundPaint
);
bitmapShader
.
setLocalMatrix
(
shaderMatrix
);
canvas
.
drawRoundRect
(
roundRect
,
roundRadius
,
roundRadius
,
roundPaint
);
}
}
else
{
}
else
{
int
bitmapW
=
bitmapDrawable
.
getIntrinsicWidth
();
int
bitmapW
=
bitmapDrawable
.
getIntrinsicWidth
();
int
bitmapH
=
bitmapDrawable
.
getIntrinsicHeight
();
int
bitmapH
=
bitmapDrawable
.
getIntrinsicHeight
();
...
@@ -412,10 +414,12 @@ public class ImageReceiver {
...
@@ -412,10 +414,12 @@ public class ImageReceiver {
public
void
setRoundRadius
(
int
value
)
{
public
void
setRoundRadius
(
int
value
)
{
roundRadius
=
value
;
roundRadius
=
value
;
if
(
roundRadius
!=
0
)
{
if
(
roundRadius
!=
0
)
{
roundPaint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
if
(
roundPaint
==
null
)
{
roundRect
=
new
RectF
();
roundPaint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
shaderMatrix
=
new
Matrix
();
roundRect
=
new
RectF
();
bitmapRect
=
new
RectF
();
shaderMatrix
=
new
Matrix
();
bitmapRect
=
new
RectF
();
}
}
else
{
}
else
{
roundPaint
=
null
;
roundPaint
=
null
;
roundRect
=
null
;
roundRect
=
null
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java
View file @
ea0b86d0
...
@@ -18,6 +18,7 @@ import org.telegram.messenger.TLRPC;
...
@@ -18,6 +18,7 @@ import org.telegram.messenger.TLRPC;
import
org.telegram.android.ContactsController
;
import
org.telegram.android.ContactsController
;
import
org.telegram.android.MessagesController
;
import
org.telegram.android.MessagesController
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
org.telegram.ui.AnimationCompat.ViewProxy
;
import
org.telegram.ui.Cells.DividerCell
;
import
org.telegram.ui.Cells.DividerCell
;
import
org.telegram.ui.Cells.GreySectionCell
;
import
org.telegram.ui.Cells.GreySectionCell
;
import
org.telegram.ui.Cells.LetterSectionCell
;
import
org.telegram.ui.Cells.LetterSectionCell
;
...
@@ -28,6 +29,7 @@ import java.util.ArrayList;
...
@@ -28,6 +29,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashMap
;
public
class
ContactsActivityAdapter
extends
BaseSectionsAdapter
{
public
class
ContactsActivityAdapter
extends
BaseSectionsAdapter
{
private
Context
mContext
;
private
Context
mContext
;
private
boolean
onlyUsers
;
private
boolean
onlyUsers
;
private
boolean
needPhonebook
;
private
boolean
needPhonebook
;
...
@@ -203,18 +205,18 @@ public class ContactsActivityAdapter extends BaseSectionsAdapter {
...
@@ -203,18 +205,18 @@ public class ContactsActivityAdapter extends BaseSectionsAdapter {
}
}
}
else
if
(
type
==
0
)
{
}
else
if
(
type
==
0
)
{
if
(
convertView
==
null
)
{
if
(
convertView
==
null
)
{
convertView
=
new
UserCell
(
mContext
);
convertView
=
new
UserCell
(
mContext
,
58
);
convertView
.
setPadding
(
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
16
:
54
),
0
,
0
,
0
);
((
UserCell
)
convertView
).
setStatusColors
(
0xffa8a8a8
,
0xff3b84c
0
);
}
}
ArrayList
<
TLRPC
.
TL_contact
>
arr
=
ContactsController
.
getInstance
().
usersSectionsDict
.
get
(
ContactsController
.
getInstance
().
sortedUsersSectionsArray
.
get
(
section
-
(
onlyUsers
?
0
:
1
)));
ArrayList
<
TLRPC
.
TL_contact
>
arr
=
ContactsController
.
getInstance
().
usersSectionsDict
.
get
(
ContactsController
.
getInstance
().
sortedUsersSectionsArray
.
get
(
section
-
(
onlyUsers
?
0
:
1
)));
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
arr
.
get
(
position
).
user_id
);
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
arr
.
get
(
position
).
user_id
);
((
UserCell
)
convertView
).
setData
(
user
,
null
,
null
);
((
UserCell
)
convertView
).
setData
(
user
,
null
,
null
,
0
);
if
(
ignoreUsers
!=
null
)
{
if
(
ignoreUsers
!=
null
)
{
if
(
ignoreUsers
.
containsKey
(
user
.
id
))
{
if
(
ignoreUsers
.
containsKey
(
user
.
id
))
{
((
UserCell
)
convertView
).
drawAlpha
=
0.5f
;
ViewProxy
.
setAlpha
(
convertView
,
0.5f
)
;
}
else
{
}
else
{
((
UserCell
)
convertView
).
drawAlpha
=
1.0f
;
ViewProxy
.
setAlpha
(
convertView
,
1.0f
)
;
}
}
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
View file @
ea0b86d0
...
@@ -702,8 +702,6 @@ public class DialogCell extends BaseCell {
...
@@ -702,8 +702,6 @@ public class DialogCell extends BaseCell {
canvas
.
restore
();
canvas
.
restore
();
}
}
avatarImage
.
draw
(
canvas
);
if
(
useSeparator
)
{
if
(
useSeparator
)
{
if
(
LocaleController
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
canvas
.
drawLine
(
0
,
getMeasuredHeight
()
-
1
,
getMeasuredWidth
()
-
AndroidUtilities
.
dp
(
72
),
getMeasuredHeight
()
-
1
,
linePaint
);
canvas
.
drawLine
(
0
,
getMeasuredHeight
()
-
1
,
getMeasuredWidth
()
-
AndroidUtilities
.
dp
(
72
),
getMeasuredHeight
()
-
1
,
linePaint
);
...
@@ -711,5 +709,7 @@ public class DialogCell extends BaseCell {
...
@@ -711,5 +709,7 @@ public class DialogCell extends BaseCell {
canvas
.
drawLine
(
AndroidUtilities
.
dp
(
72
),
getMeasuredHeight
()
-
1
,
getMeasuredWidth
(),
getMeasuredHeight
()
-
1
,
linePaint
);
canvas
.
drawLine
(
AndroidUtilities
.
dp
(
72
),
getMeasuredHeight
()
-
1
,
getMeasuredWidth
(),
getMeasuredHeight
()
-
1
,
linePaint
);
}
}
}
}
avatarImage
.
draw
(
canvas
);
}
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/Cells/EmptyCell.java
View file @
ea0b86d0
...
@@ -17,11 +17,19 @@ public class EmptyCell extends FrameLayout {
...
@@ -17,11 +17,19 @@ public class EmptyCell extends FrameLayout {
int
cellHeight
;
int
cellHeight
;
public
EmptyCell
(
Context
context
)
{
this
(
context
,
8
);
}
public
EmptyCell
(
Context
context
,
int
height
)
{
public
EmptyCell
(
Context
context
,
int
height
)
{
super
(
context
);
super
(
context
);
cellHeight
=
height
;
cellHeight
=
height
;
}
}
public
void
setHeight
(
int
height
)
{
cellHeight
=
height
;
}
@Override
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
super
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
cellHeight
),
MeasureSpec
.
EXACTLY
));
super
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
cellHeight
),
MeasureSpec
.
EXACTLY
));
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/TextCell.java
View file @
ea0b86d0
...
@@ -10,6 +10,7 @@ package org.telegram.ui.Cells;
...
@@ -10,6 +10,7 @@ package org.telegram.ui.Cells;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
...
@@ -35,6 +36,7 @@ public class TextCell extends FrameLayout {
...
@@ -35,6 +36,7 @@ public class TextCell extends FrameLayout {
textView
.
setLines
(
1
);
textView
.
setLines
(
1
);
textView
.
setMaxLines
(
1
);
textView
.
setMaxLines
(
1
);
textView
.
setSingleLine
(
true
);
textView
.
setSingleLine
(
true
);
textView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
textView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
)
|
Gravity
.
CENTER_VERTICAL
);
textView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
)
|
Gravity
.
CENTER_VERTICAL
);
addView
(
textView
);
addView
(
textView
);
LayoutParams
layoutParams
=
(
LayoutParams
)
textView
.
getLayoutParams
();
LayoutParams
layoutParams
=
(
LayoutParams
)
textView
.
getLayoutParams
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailSettingsCell.java
View file @
ea0b86d0
...
@@ -25,6 +25,7 @@ public class TextDetailSettingsCell extends FrameLayout {
...
@@ -25,6 +25,7 @@ public class TextDetailSettingsCell extends FrameLayout {
private
TextView
valueTextView
;
private
TextView
valueTextView
;
private
static
Paint
paint
;
private
static
Paint
paint
;
private
boolean
needDivider
;
private
boolean
needDivider
;
private
boolean
multiline
;
public
TextDetailSettingsCell
(
Context
context
)
{
public
TextDetailSettingsCell
(
Context
context
)
{
super
(
context
);
super
(
context
);
...
@@ -73,7 +74,7 @@ public class TextDetailSettingsCell extends FrameLayout {
...
@@ -73,7 +74,7 @@ public class TextDetailSettingsCell extends FrameLayout {
@Override
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
if
(
valueTextView
.
getMaxLines
()
==
1
)
{
if
(
!
multiline
)
{
super
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
64
)
+
(
needDivider
?
1
:
0
),
MeasureSpec
.
EXACTLY
));
super
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
64
)
+
(
needDivider
?
1
:
0
),
MeasureSpec
.
EXACTLY
));
}
else
{
}
else
{
super
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
0
,
MeasureSpec
.
UNSPECIFIED
));
super
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
0
,
MeasureSpec
.
UNSPECIFIED
));
...
@@ -81,6 +82,7 @@ public class TextDetailSettingsCell extends FrameLayout {
...
@@ -81,6 +82,7 @@ public class TextDetailSettingsCell extends FrameLayout {
}
}
public
void
setMultilineDetail
(
boolean
value
)
{
public
void
setMultilineDetail
(
boolean
value
)
{
multiline
=
value
;
if
(
value
)
{
if
(
value
)
{
valueTextView
.
setLines
(
0
);
valueTextView
.
setLines
(
0
);
valueTextView
.
setMaxLines
(
0
);
valueTextView
.
setMaxLines
(
0
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java
View file @
ea0b86d0
/*
/*
* This is the source code of Telegram for Android v. 1.
3
.x.
* This is the source code of Telegram for Android v. 1.
7
.x.
* It is licensed under GNU GPL v. 2 or later.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
* You should have received a copy of the license in this archive (see LICENSE).
*
*
* Copyright Nikolai Kudashov, 2013.
* Copyright Nikolai Kudashov, 2013
-2014
.
*/
*/
package
org
.
telegram
.
ui
.
Cells
;
package
org
.
telegram
.
ui
.
Cells
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.text.Layout
;
import
android.text.StaticLayout
;
import
android.text.TextPaint
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.android.ContactsController
;
import
org.telegram.android.ContactsController
;
import
org.telegram.android.LocaleController
;
import
org.telegram.android.LocaleController
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.android.MessagesController
;
import
org.telegram.android.MessagesController
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.android.ImageReceiver
;
import
org.telegram.ui.Views.AvatarDrawable
;
import
org.telegram.ui.Views.AvatarDrawable
;
import
org.telegram.ui.Views.BackupImageView
;
public
class
UserCell
extends
BaseCell
{
public
class
UserCell
extends
FrameLayout
{
private
static
TextPaint
namePaint
;
private
static
TextPaint
onlinePaint
;
private
BackupImageView
avatarImageView
;
private
static
TextPaint
offlinePaint
;
private
TextView
nameTextView
;
private
static
Paint
linePaint
;
private
TextView
statusTextView
;
private
ImageView
imageView
;
private
CharSequence
currentName
;
private
ImageReceiver
avatarImage
;
private
AvatarDrawable
avatarDrawable
;
private
AvatarDrawable
avatarDrawable
;
private
CharSequence
subLabe
l
;
private
TLRPC
.
User
currentUser
=
nul
l
;
private
TLRPC
.
User
user
=
null
;
private
CharSequence
currentName
;
private
CharSequence
currrntStatus
;
private
int
currentDrawable
;
private
String
lastName
=
null
;
private
String
lastName
=
null
;
private
int
lastStatus
=
0
;
private
int
lastStatus
=
0
;
private
TLRPC
.
FileLocation
lastAvatar
=
null
;
private
TLRPC
.
FileLocation
lastAvatar
=
null
;
public
boolean
useSeparator
=
false
;
private
int
statusColor
=
0xffa8a8a8
;
public
float
drawAlpha
=
1
;
private
int
statusOnlineColor
=
0xff3b84c0
;
private
int
nameLeft
;
private
int
nameTop
;
private
StaticLayout
nameLayout
;
private
int
onlineLeft
;
public
UserCell
(
Context
context
,
int
padding
)
{
private
int
onlineTop
=
AndroidUtilities
.
dp
(
36
);
private
StaticLayout
onlineLayout
;
public
UserCell
(
Context
context
)
{
super
(
context
);
super
(
context
);
init
();
avatarImage
=
new
ImageReceiver
(
this
);
avatarImage
.
setRoundRadius
(
AndroidUtilities
.
dp
(
24
));
avatarDrawable
=
new
AvatarDrawable
();
}
private
void
init
()
{
if
(
namePaint
==
null
)
{
namePaint
=
new
TextPaint
(
TextPaint
.
ANTI_ALIAS_FLAG
);
namePaint
.
setTextSize
(
AndroidUtilities
.
dp
(
18
));
namePaint
.
setColor
(
0xff222222
);
onlinePaint
=
new
TextPaint
(
TextPaint
.
ANTI_ALIAS_FLAG
);
onlinePaint
.
setTextSize
(
AndroidUtilities
.
dp
(
15
));
onlinePaint
.
setColor
(
0xff316f9f
);
offlinePaint
=
new
TextPaint
(
TextPaint
.
ANTI_ALIAS_FLAG
);
avatarImageView
=
new
BackupImageView
(
context
);
offlinePaint
.
setTextSize
(
AndroidUtilities
.
dp
(
15
));
avatarImageView
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
24
));
offlinePaint
.
setColor
(
0xff999999
);
addView
(
avatarImageView
);
LayoutParams
layoutParams
=
(
LayoutParams
)
avatarImageView
.
getLayoutParams
();
layoutParams
.
width
=
AndroidUtilities
.
dp
(
48
);
layoutParams
.
height
=
AndroidUtilities
.
dp
(
48
);
layoutParams
.
gravity
=
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
;
layoutParams
.
leftMargin
=
LocaleController
.
isRTL
?
0
:
AndroidUtilities
.
dp
(
7
+
padding
);
layoutParams
.
rightMargin
=
LocaleController
.
isRTL
?
AndroidUtilities
.
dp
(
7
+
padding
)
:
0
;
layoutParams
.
topMargin
=
AndroidUtilities
.
dp
(
8
);
avatarImageView
.
setLayoutParams
(
layoutParams
);
avatarDrawable
=
new
AvatarDrawable
();
linePaint
=
new
Paint
();
nameTextView
=
new
TextView
(
context
);
linePaint
.
setColor
(
0xffdcdcdc
);
nameTextView
.
setTextColor
(
0xff000000
);
}
nameTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
17
);
nameTextView
.
setLines
(
1
);
nameTextView
.
setMaxLines
(
1
);
nameTextView
.
setSingleLine
(
true
);
nameTextView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
nameTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
)
|
Gravity
.
CENTER_VERTICAL
);
addView
(
nameTextView
);
layoutParams
=
(
LayoutParams
)
nameTextView
.
getLayoutParams
();
layoutParams
.
width
=
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
height
=
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
16
:
(
68
+
padding
));
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
(
68
+
padding
)
:
16
);
layoutParams
.
topMargin
=
AndroidUtilities
.
dp
(
10.5f
);
layoutParams
.
gravity
=
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
;
nameTextView
.
setLayoutParams
(
layoutParams
);
statusTextView
=
new
TextView
(
context
);
statusTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
14
);
statusTextView
.
setLines
(
1
);
statusTextView
.
setMaxLines
(
1
);
statusTextView
.
setSingleLine
(
true
);
statusTextView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
statusTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
)
|
Gravity
.
CENTER_VERTICAL
);
addView
(
statusTextView
);
layoutParams
=
(
LayoutParams
)
statusTextView
.
getLayoutParams
();
layoutParams
.
width
=
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
height
=
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
16
:
(
68
+
padding
));
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
(
68
+
padding
)
:
16
);
layoutParams
.
topMargin
=
AndroidUtilities
.
dp
(
33.5f
);
layoutParams
.
gravity
=
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
;
statusTextView
.
setLayoutParams
(
layoutParams
);
imageView
=
new
ImageView
(
context
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER
);
addView
(
imageView
);
layoutParams
=
(
LayoutParams
)
imageView
.
getLayoutParams
();
layoutParams
.
width
=
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
height
=
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
0
:
16
);
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
16
:
0
);
layoutParams
.
gravity
=
(
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
)
|
Gravity
.
CENTER_VERTICAL
;
imageView
.
setLayoutParams
(
layoutParams
);
}
}
public
void
setData
(
TLRPC
.
User
u
,
CharSequence
n
,
CharSequence
s
)
{
public
void
setData
(
TLRPC
.
User
user
,
CharSequence
name
,
CharSequence
status
,
int
resId
)
{
currentName
=
n
;
if
(
user
==
null
)
{
user
=
u
;
currrntStatus
=
null
;
subLabel
=
s
;
currentName
=
null
;
currentUser
=
null
;
nameTextView
.
setText
(
""
);
statusTextView
.
setText
(
""
);
avatarImageView
.
setImageDrawable
(
null
);
return
;
}
currrntStatus
=
status
;
currentName
=
name
;
currentUser
=
user
;
currentDrawable
=
resId
;
update
(
0
);
update
(
0
);
}
}
@Override
@Override
protected
void
onDetachedFromWindow
()
{
protected
void
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
();
super
.
onDetachedFromWindow
();
if
(
avatarImage
!=
null
)
{
lastAvatar
=
null
;
avatarImage
.
clearImage
();
lastAvatar
=
null
;
}
}
}
@Override
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
s
etMeasuredDimension
(
MeasureSpec
.
getSize
(
widthMeasureSpec
)
-
getPaddingRight
(),
AndroidUtilities
.
dp
(
64
));
s
uper
.
onMeasure
(
widthMeasureSpec
,
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
64
),
MeasureSpec
.
EXACTLY
));
}
}
@Override
public
void
setStatusColors
(
int
color
,
int
onlineColor
)
{
protected
void
onLayout
(
boolean
changed
,
int
left
,
int
top
,
int
right
,
int
bottom
)
{
statusColor
=
color
;
if
(
user
==
null
)
{
statusOnlineColor
=
onlineColor
;
super
.
onLayout
(
changed
,
left
,
top
,
right
,
bottom
);
return
;
}
if
(
changed
)
{
buildLayout
();
}
}
public
void
buildLayout
()
{
int
paddingLeft
=
getPaddingLeft
();
int
paddingRight
=
getPaddingRight
();
onlineLeft
=
nameLeft
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
11
:
72
)
+
paddingLeft
;
int
avatarLeft
=
paddingLeft
+
(
LocaleController
.
isRTL
?
(
getMeasuredWidth
()
-
AndroidUtilities
.
dp
(
61
))
:
AndroidUtilities
.
dp
(
11
));
int
nameWidth
=
getMeasuredWidth
()
-
nameLeft
-
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
72
:
14
);
int
avatarTop
=
AndroidUtilities
.
dp
(
8
);
CharSequence
nameString
=
""
;
if
(
currentName
!=
null
)
{
nameString
=
currentName
;
}
else
{
String
nameString2
=
""
;
if
(
user
!=
null
)
{
nameString2
=
ContactsController
.
formatName
(
user
.
first_name
,
user
.
last_name
);
}
nameString
=
nameString2
.
replace
(
"\n"
,
" "
);
}
if
(
nameString
.
length
()
==
0
)
{
if
(
user
!=
null
&&
user
.
phone
!=
null
&&
user
.
phone
.
length
()
!=
0
)
{
nameString
=
PhoneFormat
.
getInstance
().
format
(
"+"
+
user
.
phone
);
}
else
{
nameString
=
LocaleController
.
getString
(
"HiddenName"
,
R
.
string
.
HiddenName
);
}
}
CharSequence
nameStringFinal
=
TextUtils
.
ellipsize
(
nameString
,
namePaint
,
nameWidth
-
AndroidUtilities
.
dp
(
12
),
TextUtils
.
TruncateAt
.
END
);
nameLayout
=
new
StaticLayout
(
nameStringFinal
,
namePaint
,
nameWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
CharSequence
onlineString
=
""
;
TextPaint
currentOnlinePaint
=
offlinePaint
;
if
(
subLabel
!=
null
)
{
onlineString
=
subLabel
;
}
else
{
onlineString
=
LocaleController
.
formatUserStatus
(
user
);
if
(
user
!=
null
&&
(
user
.
id
==
UserConfig
.
getClientUserId
()
||
user
.
status
!=
null
&&
user
.
status
.
expires
>
ConnectionsManager
.
getInstance
().
getCurrentTime
()))
{
currentOnlinePaint
=
onlinePaint
;
onlineString
=
LocaleController
.
getString
(
"Online"
,
R
.
string
.
Online
);
}
}
CharSequence
onlineStringFinal
=
TextUtils
.
ellipsize
(
onlineString
,
currentOnlinePaint
,
nameWidth
-
AndroidUtilities
.
dp
(
12
),
TextUtils
.
TruncateAt
.
END
);
onlineLayout
=
new
StaticLayout
(
onlineStringFinal
,
currentOnlinePaint
,
nameWidth
,
Layout
.
Alignment
.
ALIGN_NORMAL
,
1.0f
,
0.0f
,
false
);
nameTop
=
AndroidUtilities
.
dp
(
12
);
avatarImage
.
setImageCoords
(
avatarLeft
,
avatarTop
,
AndroidUtilities
.
dp
(
48
),
AndroidUtilities
.
dp
(
48
));
double
widthpx
=
0
;
float
left
=
0
;
if
(
LocaleController
.
isRTL
)
{
if
(
nameLayout
.
getLineCount
()
>
0
)
{
left
=
nameLayout
.
getLineLeft
(
0
);
if
(
left
==
0
)
{
widthpx
=
Math
.
ceil
(
nameLayout
.
getLineWidth
(
0
));
if
(
widthpx
<
nameWidth
)
{
nameLeft
+=
(
nameWidth
-
widthpx
);
}
}
}
if
(
onlineLayout
!=
null
&&
onlineLayout
.
getLineCount
()
>
0
)
{
left
=
onlineLayout
.
getLineLeft
(
0
);
if
(
left
==
0
)
{
widthpx
=
Math
.
ceil
(
onlineLayout
.
getLineWidth
(
0
));
if
(
widthpx
<
nameWidth
)
{
onlineLeft
+=
(
nameWidth
-
widthpx
);
}
}
}
}
else
{
if
(
nameLayout
.
getLineCount
()
>
0
)
{
left
=
nameLayout
.
getLineRight
(
0
);
if
(
left
==
nameWidth
)
{
widthpx
=
Math
.
ceil
(
nameLayout
.
getLineWidth
(
0
));
if
(
widthpx
<
nameWidth
)
{
nameLeft
-=
(
nameWidth
-
widthpx
);
}
}
}
if
(
onlineLayout
!=
null
&&
onlineLayout
.
getLineCount
()
>
0
)
{
left
=
onlineLayout
.
getLineRight
(
0
);
if
(
left
==
nameWidth
)
{
widthpx
=
Math
.
ceil
(
onlineLayout
.
getLineWidth
(
0
));
if
(
widthpx
<
nameWidth
)
{
onlineLeft
-=
(
nameWidth
-
widthpx
);
}
}
}
}
}
}
public
void
update
(
int
mask
)
{
public
void
update
(
int
mask
)
{
if
(
currentUser
==
null
)
{
return
;
}
TLRPC
.
FileLocation
photo
=
null
;
TLRPC
.
FileLocation
photo
=
null
;
if
(
user
!=
null
)
{
if
(
currentUser
.
photo
!=
null
)
{
if
(
user
.
photo
!=
null
)
{
photo
=
currentUser
.
photo
.
photo_small
;
photo
=
user
.
photo
.
photo_small
;
}
avatarDrawable
.
setInfo
(
user
);
}
else
{
avatarDrawable
.
setInfo
(
0
,
null
,
null
,
false
);
}
}
if
(
mask
!=
0
)
{
if
(
mask
!=
0
)
{
boolean
continueUpdate
=
false
;
boolean
continueUpdate
=
false
;
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
&&
user
!=
null
)
{
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
)
{
if
(
lastAvatar
!=
null
&&
photo
==
null
||
lastAvatar
==
null
&&
photo
!=
null
&&
lastAvatar
!=
null
&&
photo
!=
null
&&
(
lastAvatar
.
volume_id
!=
photo
.
volume_id
||
lastAvatar
.
local_id
!=
photo
.
local_id
))
{
if
(
lastAvatar
!=
null
&&
photo
==
null
||
lastAvatar
==
null
&&
photo
!=
null
&&
lastAvatar
!=
null
&&
photo
!=
null
&&
(
lastAvatar
.
volume_id
!=
photo
.
volume_id
||
lastAvatar
.
local_id
!=
photo
.
local_id
))
{
continueUpdate
=
true
;
continueUpdate
=
true
;
}
}
}
}
if
(!
continueUpdate
&&
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
&&
user
!=
null
)
{
if
(!
continueUpdate
&&
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
int
newStatus
=
0
;
int
newStatus
=
0
;
if
(
u
ser
.
status
!=
null
)
{
if
(
currentU
ser
.
status
!=
null
)
{
newStatus
=
u
ser
.
status
.
expires
;
newStatus
=
currentU
ser
.
status
.
expires
;
}
}
if
(
newStatus
!=
lastStatus
)
{
if
(
newStatus
!=
lastStatus
)
{
continueUpdate
=
true
;
continueUpdate
=
true
;
}
}
}
}
if
(!
continueUpdate
&&
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
&&
user
!=
null
)
{
if
(!
continueUpdate
&&
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
)
{
String
newName
=
null
;
String
newName
=
currentUser
.
first_name
+
currentUser
.
last_name
;
if
(
user
!=
null
)
{
newName
=
user
.
first_name
+
user
.
last_name
;
}
if
(
newName
==
null
||
!
newName
.
equals
(
lastName
))
{
if
(
newName
==
null
||
!
newName
.
equals
(
lastName
))
{
continueUpdate
=
true
;
continueUpdate
=
true
;
}
}
}
}
if
(!
continueUpdate
)
{
if
(!
continueUpdate
)
{
return
;
return
;
}
}
}
}
if
(
user
!=
null
)
{
avatarDrawable
.
setInfo
(
currentUser
);
if
(
user
.
status
!=
null
)
{
if
(
currentUser
.
status
!=
null
)
{
lastStatus
=
user
.
status
.
expires
;
lastStatus
=
currentUser
.
status
.
expires
;
}
else
{
}
else
{
lastStatus
=
0
;
lastStatus
=
0
;
}
lastName
=
user
.
first_name
+
user
.
last_name
;
}
}
lastName
=
currentUser
.
first_name
+
currentUser
.
last_name
;
lastAvatar
=
photo
;
lastAvatar
=
photo
;
avatarImage
.
setImage
(
photo
,
"50_50"
,
avatarDrawable
,
false
);
if
(
getMeasuredWidth
()
!=
0
||
getMeasuredHeight
()
!=
0
)
{
if
(
currentName
!=
null
)
{
buildLayout
(
);
nameTextView
.
setText
(
currentName
);
}
else
{
}
else
{
requestLayout
(
);
nameTextView
.
setText
(
ContactsController
.
formatName
(
currentUser
.
first_name
,
currentUser
.
last_name
)
);
}
}
postInvalidate
();
if
(
currrntStatus
!=
null
)
{
}
statusTextView
.
setText
(
currrntStatus
);
statusTextView
.
setTextColor
(
statusColor
);
@Override
}
else
{
protected
void
onDraw
(
Canvas
canvas
)
{
if
(
currentUser
.
id
==
UserConfig
.
getClientUserId
()
||
currentUser
.
status
!=
null
&&
currentUser
.
status
.
expires
>
ConnectionsManager
.
getInstance
().
getCurrentTime
())
{
if
(
user
==
null
)
{
statusTextView
.
setText
(
LocaleController
.
getString
(
"Online"
,
R
.
string
.
Online
));
return
;
statusTextView
.
setTextColor
(
statusOnlineColor
);
}
if
(
useSeparator
)
{
if
(
LocaleController
.
isRTL
)
{
canvas
.
drawLine
(
0
,
getMeasuredHeight
()
-
1
,
getMeasuredWidth
()
-
AndroidUtilities
.
dp
(
72
),
getMeasuredHeight
()
-
1
,
linePaint
);
}
else
{
}
else
{
canvas
.
drawLine
(
AndroidUtilities
.
dp
(
72
),
getMeasuredHeight
()
-
1
,
getMeasuredWidth
(),
getMeasuredHeight
()
-
1
,
linePaint
);
statusTextView
.
setText
(
LocaleController
.
formatUserStatus
(
currentUser
));
statusTextView
.
setTextColor
(
statusColor
);
}
}
}
}
if
(
drawAlpha
!=
1
)
{
imageView
.
setVisibility
(
currentDrawable
==
0
?
GONE
:
VISIBLE
);
canvas
.
saveLayerAlpha
(
0
,
0
,
canvas
.
getWidth
(),
canvas
.
getHeight
(),
(
int
)(
255
*
drawAlpha
),
Canvas
.
HAS_ALPHA_LAYER_SAVE_FLAG
);
imageView
.
setImageResource
(
currentDrawable
);
}
avatarImageView
.
setImage
(
photo
,
"50_50"
,
avatarDrawable
);
canvas
.
save
();
canvas
.
translate
(
nameLeft
,
nameTop
);
nameLayout
.
draw
(
canvas
);
canvas
.
restore
();
if
(
onlineLayout
!=
null
)
{
canvas
.
save
();
canvas
.
translate
(
onlineLeft
,
onlineTop
);
onlineLayout
.
draw
(
canvas
);
canvas
.
restore
();
}
avatarImage
.
draw
(
canvas
);
}
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
ea0b86d0
...
@@ -570,7 +570,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -570,7 +570,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
Bundle
args
=
new
Bundle
();
Bundle
args
=
new
Bundle
();
args
.
putInt
(
"chat_id"
,
currentChat
.
id
);
args
.
putInt
(
"chat_id"
,
currentChat
.
id
);
ChatProfileActivity
fragment
=
new
Chat
ProfileActivity
(
args
);
ProfileActivity
fragment
=
new
ProfileActivity
(
args
);
fragment
.
setChatInfo
(
info
);
fragment
.
setChatInfo
(
info
);
presentFragment
(
fragment
);
presentFragment
(
fragment
);
}
}
...
@@ -1196,9 +1196,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1196,9 +1196,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
checkAndUpdateAvatar
();
checkAndUpdateAvatar
();
}
}
private
void
updateOnlineCount
()
{
private
int
updateOnlineCount
()
{
if
(
info
==
null
)
{
if
(
info
==
null
)
{
return
;
return
0
;
}
}
onlineCount
=
0
;
onlineCount
=
0
;
int
currentTime
=
ConnectionsManager
.
getInstance
().
getCurrentTime
();
int
currentTime
=
ConnectionsManager
.
getInstance
().
getCurrentTime
();
...
@@ -1208,6 +1208,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1208,6 +1208,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
onlineCount
++;
onlineCount
++;
}
}
}
}
return
onlineCount
;
}
}
private
int
getMessageType
(
MessageObject
messageObject
)
{
private
int
getMessageType
(
MessageObject
messageObject
)
{
...
@@ -1865,15 +1866,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1865,15 +1866,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
updateTitle
();
updateTitle
();
}
}
boolean
updateSubtitle
=
false
;
boolean
updateSubtitle
=
false
;
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_CHAT_MEMBERS
)
!=
0
)
{
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_CHAT_MEMBERS
)
!=
0
||
(
updateMask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
updateSubtitle
=
true
;
if
(
currentChat
!=
null
)
{
updateOnlineCount
()
;
int
lastCount
=
onlineCount
;
}
if
(
lastCount
!=
updateOnlineCount
())
{
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
updateSubtitle
=
true
;
updateSubtitle
=
true
;
}
}
}
else
{
if
(
updateSubtitle
)
{
updateSubtitle
=
true
;
updateSubtitle
();
}
}
}
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
updateMask
&
MessagesController
.
UPDATE_MASK_CHAT_AVATAR
)
!=
0
||
(
updateMask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
)
{
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
updateMask
&
MessagesController
.
UPDATE_MASK_CHAT_AVATAR
)
!=
0
||
(
updateMask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
)
{
checkAndUpdateAvatar
();
checkAndUpdateAvatar
();
...
@@ -1882,9 +1883,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -1882,9 +1883,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_USER_PRINT
)
!=
0
)
{
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_USER_PRINT
)
!=
0
)
{
CharSequence
printString
=
MessagesController
.
getInstance
().
printingStrings
.
get
(
dialog_id
);
CharSequence
printString
=
MessagesController
.
getInstance
().
printingStrings
.
get
(
dialog_id
);
if
(
lastPrintString
!=
null
&&
printString
==
null
||
lastPrintString
==
null
&&
printString
!=
null
||
lastPrintString
!=
null
&&
printString
!=
null
&&
!
lastPrintString
.
equals
(
printString
))
{
if
(
lastPrintString
!=
null
&&
printString
==
null
||
lastPrintString
==
null
&&
printString
!=
null
||
lastPrintString
!=
null
&&
printString
!=
null
&&
!
lastPrintString
.
equals
(
printString
))
{
updateSubtitle
()
;
updateSubtitle
=
true
;
}
}
}
}
if
(
updateSubtitle
)
{
updateSubtitle
();
}
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_USER_PHONE
)
!=
0
)
{
if
((
updateMask
&
MessagesController
.
UPDATE_MASK_USER_PHONE
)
!=
0
)
{
updateContactStatus
();
updateContactStatus
();
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java
deleted
100644 → 0
View file @
4104a21f
/*
* This is the source code of Telegram for Android v. 1.3.2.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013.
*/
package
org
.
telegram
.
ui
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.Typeface
;
import
android.os.Bundle
;
import
android.text.Html
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.AdapterView
;
import
android.widget.ImageButton
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.LocaleController
;
import
org.telegram.android.MessagesStorage
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.android.MessagesController
;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.android.MessageObject
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.Cells.UserCell
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
import
org.telegram.ui.Views.AvatarDrawable
;
import
org.telegram.ui.Views.AvatarUpdater
;
import
org.telegram.ui.Views.BackupImageView
;
import
org.telegram.ui.Views.ActionBar.BaseFragment
;
import
org.telegram.ui.Views.SettingsSectionLayout
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.concurrent.Semaphore
;
public
class
ChatProfileActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
,
ContactsActivity
.
ContactsActivityDelegate
,
PhotoViewer
.
PhotoViewerProvider
{
private
ListView
listView
;
private
ListAdapter
listViewAdapter
;
private
int
chat_id
;
private
String
selectedPhone
;
private
TLRPC
.
ChatParticipants
info
;
private
TLRPC
.
TL_chatParticipant
selectedUser
;
private
AvatarUpdater
avatarUpdater
=
new
AvatarUpdater
();
private
int
totalMediaCount
=
-
1
;
private
int
onlineCount
=
-
1
;
private
ArrayList
<
Integer
>
sortedUsers
=
new
ArrayList
<
Integer
>();
private
TLRPC
.
Chat
currentChat
;
private
int
avatarRow
;
private
int
settingsSectionRow
;
private
int
settingsNotificationsRow
;
private
int
sharedMediaSectionRow
;
private
int
sharedMediaRow
;
private
int
membersSectionRow
;
private
int
membersEndRow
;
private
int
addMemberRow
;
private
int
leaveGroupRow
;
private
int
rowCount
=
0
;
private
static
final
int
done_button
=
1
;
public
ChatProfileActivity
(
Bundle
args
)
{
super
(
args
);
}
@Override
public
boolean
onFragmentCreate
()
{
super
.
onFragmentCreate
();
chat_id
=
getArguments
().
getInt
(
"chat_id"
,
0
);
currentChat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
currentChat
==
null
)
{
final
Semaphore
semaphore
=
new
Semaphore
(
0
);
MessagesStorage
.
getInstance
().
getStorageQueue
().
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
currentChat
=
MessagesStorage
.
getInstance
().
getChat
(
chat_id
);
semaphore
.
release
();
}
});
try
{
semaphore
.
acquire
();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(
currentChat
!=
null
)
{
MessagesController
.
getInstance
().
putChat
(
currentChat
,
true
);
}
else
{
return
false
;
}
}
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
chatInfoDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
mediaCountDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
closeChats
);
updateOnlineCount
();
if
(
chat_id
>
0
)
{
MessagesController
.
getInstance
().
getMediaCount
(-
chat_id
,
classGuid
,
true
);
}
avatarUpdater
.
delegate
=
new
AvatarUpdater
.
AvatarUpdaterDelegate
()
{
@Override
public
void
didUploadedPhoto
(
TLRPC
.
InputFile
file
,
TLRPC
.
PhotoSize
small
,
TLRPC
.
PhotoSize
big
)
{
if
(
chat_id
!=
0
)
{
MessagesController
.
getInstance
().
changeChatAvatar
(
chat_id
,
file
);
}
}
};
avatarUpdater
.
parentFragment
=
this
;
updateRowsIds
();
return
true
;
}
private
void
updateRowsIds
()
{
rowCount
=
0
;
avatarRow
=
rowCount
++;
if
(
chat_id
>
0
)
{
settingsSectionRow
=
rowCount
++;
settingsNotificationsRow
=
rowCount
++;
sharedMediaSectionRow
=
rowCount
++;
sharedMediaRow
=
rowCount
++;
}
if
(
info
!=
null
&&
!(
info
instanceof
TLRPC
.
TL_chatParticipantsForbidden
))
{
membersSectionRow
=
rowCount
++;
rowCount
+=
info
.
participants
.
size
();
membersEndRow
=
rowCount
;
int
maxCount
=
chat_id
>
0
?
MessagesController
.
getInstance
().
maxGroupCount
:
MessagesController
.
getInstance
().
maxBroadcastCount
;
if
(
info
.
participants
.
size
()
<
maxCount
)
{
addMemberRow
=
rowCount
++;
}
else
{
addMemberRow
=
-
1
;
}
}
else
{
membersEndRow
=
-
1
;
addMemberRow
=
-
1
;
membersSectionRow
=
-
1
;
}
if
(
chat_id
>
0
)
{
leaveGroupRow
=
rowCount
++;
}
}
@Override
public
void
onFragmentDestroy
()
{
super
.
onFragmentDestroy
();
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
chatInfoDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
mediaCountDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
closeChats
);
avatarUpdater
.
clear
();
}
public
View
createView
(
LayoutInflater
inflater
,
ViewGroup
container
)
{
if
(
fragmentView
==
null
)
{
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
if
(
chat_id
>
0
)
{
actionBar
.
setTitle
(
LocaleController
.
getString
(
"GroupInfo"
,
R
.
string
.
GroupInfo
));
}
else
{
actionBar
.
setTitle
(
LocaleController
.
getString
(
"BroadcastList"
,
R
.
string
.
BroadcastList
));
}
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
@Override
public
void
onItemClick
(
int
id
)
{
if
(
id
==
-
1
)
{
finishFragment
();
}
else
if
(
id
==
done_button
)
{
openAddMenu
();
}
}
});
ActionBarMenu
menu
=
actionBar
.
createMenu
();
View
item
=
menu
.
addItemResource
(
done_button
,
R
.
layout
.
group_profile_add_member_layout
);
TextView
textView
=
(
TextView
)
item
.
findViewById
(
R
.
id
.
done_button
);
if
(
textView
!=
null
)
{
if
(
chat_id
>
0
)
{
textView
.
setText
(
LocaleController
.
getString
(
"AddMember"
,
R
.
string
.
AddMember
));
}
else
{
textView
.
setText
(
LocaleController
.
getString
(
"AddRecipient"
,
R
.
string
.
AddRecipient
));
}
}
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
chat_profile_layout
,
container
,
false
);
listView
=
(
ListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
listView
.
setAdapter
(
listViewAdapter
=
new
ListAdapter
(
getParentActivity
()));
listView
.
setOnItemLongClickListener
(
new
AdapterView
.
OnItemLongClickListener
()
{
@Override
public
boolean
onItemLongClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
if
(
i
>
membersSectionRow
&&
i
<
membersEndRow
)
{
if
(
getParentActivity
()
==
null
)
{
return
false
;
}
TLRPC
.
TL_chatParticipant
user
=
info
.
participants
.
get
(
sortedUsers
.
get
(
i
-
membersSectionRow
-
1
));
if
(
user
.
user_id
==
UserConfig
.
getClientUserId
())
{
return
false
;
}
if
(
info
.
admin_id
!=
UserConfig
.
getClientUserId
()
&&
user
.
inviter_id
!=
UserConfig
.
getClientUserId
())
{
return
false
;
}
selectedUser
=
user
;
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
CharSequence
[]
items
=
new
CharSequence
[]
{
chat_id
>
0
?
LocaleController
.
getString
(
"KickFromGroup"
,
R
.
string
.
KickFromGroup
)
:
LocaleController
.
getString
(
"KickFromBroadcast"
,
R
.
string
.
KickFromBroadcast
)};
builder
.
setItems
(
items
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
if
(
i
==
0
)
{
kickUser
(
selectedUser
);
}
}
});
showAlertDialog
(
builder
);
return
true
;
}
return
false
;
}
});
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
final
int
i
,
long
l
)
{
if
(
i
==
sharedMediaRow
)
{
Bundle
args
=
new
Bundle
();
args
.
putLong
(
"dialog_id"
,
-
chat_id
);
presentFragment
(
new
MediaActivity
(
args
));
}
else
if
(
i
==
addMemberRow
)
{
openAddMenu
();
}
else
if
(
i
>
membersSectionRow
&&
i
<
membersEndRow
)
{
int
user_id
=
info
.
participants
.
get
(
sortedUsers
.
get
(
i
-
membersSectionRow
-
1
)).
user_id
;
if
(
user_id
==
UserConfig
.
getClientUserId
())
{
return
;
}
Bundle
args
=
new
Bundle
();
args
.
putInt
(
"user_id"
,
user_id
);
presentFragment
(
new
ProfileActivity
(
args
));
}
else
if
(
i
==
settingsNotificationsRow
)
{
Bundle
args
=
new
Bundle
();
args
.
putLong
(
"dialog_id"
,
-
chat_id
);
presentFragment
(
new
ProfileNotificationsActivity
(
args
));
}
}
});
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
parent
.
removeView
(
fragmentView
);
}
}
return
fragmentView
;
}
@Override
public
void
didSelectContact
(
TLRPC
.
User
user
,
String
param
)
{
MessagesController
.
getInstance
().
addUserToChat
(
chat_id
,
user
,
info
,
param
!=
null
?
Utilities
.
parseInt
(
param
)
:
0
);
}
@Override
public
void
onActivityResultFragment
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
avatarUpdater
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
@Override
public
void
saveSelfArgs
(
Bundle
args
)
{
if
(
avatarUpdater
!=
null
&&
avatarUpdater
.
currentPicturePath
!=
null
)
{
args
.
putString
(
"path"
,
avatarUpdater
.
currentPicturePath
);
}
}
@Override
public
void
restoreSelfArgs
(
Bundle
args
)
{
MessagesController
.
getInstance
().
loadChatInfo
(
chat_id
,
null
);
if
(
avatarUpdater
!=
null
)
{
avatarUpdater
.
currentPicturePath
=
args
.
getString
(
"path"
);
}
}
@Override
public
PhotoViewer
.
PlaceProviderObject
getPlaceForPhoto
(
MessageObject
messageObject
,
TLRPC
.
FileLocation
fileLocation
,
int
index
)
{
if
(
fileLocation
==
null
)
{
return
null
;
}
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
!=
null
&&
chat
.
photo
!=
null
&&
chat
.
photo
.
photo_big
!=
null
)
{
TLRPC
.
FileLocation
photoBig
=
chat
.
photo
.
photo_big
;
if
(
photoBig
.
local_id
==
fileLocation
.
local_id
&&
photoBig
.
volume_id
==
fileLocation
.
volume_id
&&
photoBig
.
dc_id
==
fileLocation
.
dc_id
)
{
int
count
=
listView
.
getChildCount
();
for
(
int
a
=
0
;
a
<
count
;
a
++)
{
View
view
=
listView
.
getChildAt
(
a
);
BackupImageView
avatarImage
=
(
BackupImageView
)
view
.
findViewById
(
R
.
id
.
settings_avatar_image
);
if
(
avatarImage
!=
null
)
{
int
coords
[]
=
new
int
[
2
];
avatarImage
.
getLocationInWindow
(
coords
);
PhotoViewer
.
PlaceProviderObject
object
=
new
PhotoViewer
.
PlaceProviderObject
();
object
.
viewX
=
coords
[
0
];
object
.
viewY
=
coords
[
1
]
-
AndroidUtilities
.
statusBarHeight
;
object
.
parentView
=
listView
;
object
.
imageReceiver
=
avatarImage
.
imageReceiver
;
object
.
thumb
=
object
.
imageReceiver
.
getBitmap
();
object
.
size
=
-
1
;
return
object
;
}
}
}
}
return
null
;
}
@Override
public
void
willSwitchFromPhoto
(
MessageObject
messageObject
,
TLRPC
.
FileLocation
fileLocation
,
int
index
)
{
}
@Override
public
void
willHidePhotoViewer
()
{
}
@Override
public
boolean
isPhotoChecked
(
int
index
)
{
return
false
;
}
@Override
public
void
setPhotoChecked
(
int
index
)
{
}
@Override
public
void
cancelButtonPressed
()
{
}
@Override
public
void
sendButtonPressed
(
int
index
)
{
}
@Override
public
int
getSelectedCount
()
{
return
0
;
}
public
void
didReceivedNotification
(
int
id
,
Object
...
args
)
{
if
(
id
==
NotificationCenter
.
updateInterfaces
)
{
int
mask
=
(
Integer
)
args
[
0
];
if
((
mask
&
MessagesController
.
UPDATE_MASK_CHAT_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_CHAT_NAME
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_CHAT_MEMBERS
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
updateOnlineCount
();
}
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
updateVisibleRows
(
mask
);
}
}
else
if
(
id
==
NotificationCenter
.
chatInfoDidLoaded
)
{
int
chatId
=
(
Integer
)
args
[
0
];
if
(
chatId
==
chat_id
)
{
info
=
(
TLRPC
.
ChatParticipants
)
args
[
1
];
updateOnlineCount
();
updateRowsIds
();
if
(
listViewAdapter
!=
null
)
{
listViewAdapter
.
notifyDataSetChanged
();
}
}
}
else
if
(
id
==
NotificationCenter
.
mediaCountDidLoaded
)
{
long
uid
=
(
Long
)
args
[
0
];
int
lower_part
=
(
int
)
uid
;
if
(
lower_part
<
0
&&
chat_id
==
-
lower_part
)
{
totalMediaCount
=
(
Integer
)
args
[
1
];
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
}
else
if
(
id
==
NotificationCenter
.
closeChats
)
{
removeSelfFromStack
();
}
}
@Override
public
void
onResume
()
{
super
.
onResume
();
if
(
listViewAdapter
!=
null
)
{
listViewAdapter
.
notifyDataSetChanged
();
}
}
public
void
setChatInfo
(
TLRPC
.
ChatParticipants
chatParticipants
)
{
info
=
chatParticipants
;
}
private
void
updateVisibleRows
(
int
mask
)
{
if
(
listView
==
null
)
{
return
;
}
int
count
=
listView
.
getChildCount
();
for
(
int
a
=
0
;
a
<
count
;
a
++)
{
View
child
=
listView
.
getChildAt
(
a
);
if
(
child
instanceof
UserCell
)
{
((
UserCell
)
child
).
update
(
mask
);
}
}
}
private
void
updateOnlineCount
()
{
if
(
info
==
null
)
{
return
;
}
onlineCount
=
0
;
int
currentTime
=
ConnectionsManager
.
getInstance
().
getCurrentTime
();
sortedUsers
.
clear
();
int
i
=
0
;
for
(
TLRPC
.
TL_chatParticipant
participant
:
info
.
participants
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
participant
.
user_id
);
if
(
user
!=
null
&&
user
.
status
!=
null
&&
(
user
.
status
.
expires
>
currentTime
||
user
.
id
==
UserConfig
.
getClientUserId
())
&&
user
.
status
.
expires
>
10000
)
{
onlineCount
++;
}
sortedUsers
.
add
(
i
);
i
++;
}
Collections
.
sort
(
sortedUsers
,
new
Comparator
<
Integer
>()
{
@Override
public
int
compare
(
Integer
lhs
,
Integer
rhs
)
{
TLRPC
.
User
user1
=
MessagesController
.
getInstance
().
getUser
(
info
.
participants
.
get
(
rhs
).
user_id
);
TLRPC
.
User
user2
=
MessagesController
.
getInstance
().
getUser
(
info
.
participants
.
get
(
lhs
).
user_id
);
Integer
status1
=
0
;
Integer
status2
=
0
;
if
(
user1
!=
null
&&
user1
.
status
!=
null
)
{
if
(
user1
.
id
==
UserConfig
.
getClientUserId
())
{
status1
=
ConnectionsManager
.
getInstance
().
getCurrentTime
()
+
50000
;
}
else
{
status1
=
user1
.
status
.
expires
;
}
}
if
(
user2
!=
null
&&
user2
.
status
!=
null
)
{
if
(
user2
.
id
==
UserConfig
.
getClientUserId
())
{
status2
=
ConnectionsManager
.
getInstance
().
getCurrentTime
()
+
50000
;
}
else
{
status2
=
user2
.
status
.
expires
;
}
}
return
status1
.
compareTo
(
status2
);
}
});
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
private
void
processPhotoMenu
(
int
action
)
{
if
(
action
==
0
)
{
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
.
photo
!=
null
&&
chat
.
photo
.
photo_big
!=
null
)
{
PhotoViewer
.
getInstance
().
setParentActivity
(
getParentActivity
());
PhotoViewer
.
getInstance
().
openPhoto
(
chat
.
photo
.
photo_big
,
this
);
}
}
else
if
(
action
==
1
)
{
avatarUpdater
.
openCamera
();
}
else
if
(
action
==
2
)
{
avatarUpdater
.
openGallery
();
}
else
if
(
action
==
3
)
{
MessagesController
.
getInstance
().
changeChatAvatar
(
chat_id
,
null
);
}
}
private
void
openAddMenu
()
{
Bundle
args
=
new
Bundle
();
args
.
putBoolean
(
"onlyUsers"
,
true
);
args
.
putBoolean
(
"destroyAfterSelect"
,
true
);
args
.
putBoolean
(
"returnAsResult"
,
true
);
//args.putBoolean("allowUsernameSearch", false);
if
(
chat_id
>
0
)
{
args
.
putString
(
"selectAlertString"
,
LocaleController
.
getString
(
"AddToTheGroup"
,
R
.
string
.
AddToTheGroup
));
}
ContactsActivity
fragment
=
new
ContactsActivity
(
args
);
fragment
.
setDelegate
(
this
);
if
(
info
!=
null
)
{
HashMap
<
Integer
,
TLRPC
.
User
>
users
=
new
HashMap
<
Integer
,
TLRPC
.
User
>();
for
(
TLRPC
.
TL_chatParticipant
p
:
info
.
participants
)
{
users
.
put
(
p
.
user_id
,
null
);
}
fragment
.
setIgnoreUsers
(
users
);
}
presentFragment
(
fragment
);
}
private
void
kickUser
(
TLRPC
.
TL_chatParticipant
user
)
{
if
(
user
!=
null
)
{
MessagesController
.
getInstance
().
deleteUserFromChat
(
chat_id
,
MessagesController
.
getInstance
().
getUser
(
user
.
user_id
),
info
);
}
else
{
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
closeChats
);
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
closeChats
);
MessagesController
.
getInstance
().
deleteUserFromChat
(
chat_id
,
MessagesController
.
getInstance
().
getUser
(
UserConfig
.
getClientUserId
()),
info
);
MessagesController
.
getInstance
().
deleteDialog
(-
chat_id
,
0
,
false
);
finishFragment
();
}
}
private
class
ListAdapter
extends
BaseFragmentAdapter
{
private
Context
mContext
;
public
ListAdapter
(
Context
context
)
{
mContext
=
context
;
}
@Override
public
boolean
areAllItemsEnabled
()
{
return
false
;
}
@Override
public
boolean
isEnabled
(
int
i
)
{
return
i
==
settingsNotificationsRow
||
i
==
sharedMediaRow
||
i
==
addMemberRow
||
i
>
membersSectionRow
&&
i
<
membersEndRow
;
}
@Override
public
int
getCount
()
{
return
rowCount
;
}
@Override
public
Object
getItem
(
int
i
)
{
return
null
;
}
@Override
public
long
getItemId
(
int
i
)
{
return
i
;
}
@Override
public
boolean
hasStableIds
()
{
return
false
;
}
@Override
public
View
getView
(
int
i
,
View
view
,
ViewGroup
viewGroup
)
{
int
type
=
getItemViewType
(
i
);
if
(
type
==
0
)
{
BackupImageView
avatarImage
;
TextView
onlineText
;
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
chat_profile_avatar_layout
,
viewGroup
,
false
);
onlineText
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_online
);
ImageButton
button
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
settings_edit_name
);
button
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Bundle
args
=
new
Bundle
();
args
.
putInt
(
"chat_id"
,
chat_id
);
presentFragment
(
new
ChatProfileChangeNameActivity
(
args
));
}
});
final
ImageButton
button2
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
settings_change_avatar_button
);
if
(
chat_id
>
0
)
{
button2
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
getParentActivity
()
==
null
)
{
return
;
}
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
CharSequence
[]
items
;
int
type
;
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
.
photo
==
null
||
chat
.
photo
.
photo_big
==
null
||
chat
.
photo
instanceof
TLRPC
.
TL_chatPhotoEmpty
)
{
items
=
new
CharSequence
[]{
LocaleController
.
getString
(
"FromCamera"
,
R
.
string
.
FromCamera
),
LocaleController
.
getString
(
"FromGalley"
,
R
.
string
.
FromGalley
)};
type
=
0
;
}
else
{
items
=
new
CharSequence
[]{
LocaleController
.
getString
(
"OpenPhoto"
,
R
.
string
.
OpenPhoto
),
LocaleController
.
getString
(
"FromCamera"
,
R
.
string
.
FromCamera
),
LocaleController
.
getString
(
"FromGalley"
,
R
.
string
.
FromGalley
),
LocaleController
.
getString
(
"DeletePhoto"
,
R
.
string
.
DeletePhoto
)};
type
=
1
;
}
final
int
arg0
=
type
;
builder
.
setItems
(
items
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
int
action
=
0
;
if
(
arg0
==
1
)
{
if
(
i
==
0
)
{
action
=
0
;
}
else
if
(
i
==
1
)
{
action
=
1
;
}
else
if
(
i
==
2
)
{
action
=
2
;
}
else
if
(
i
==
3
)
{
action
=
3
;
}
}
else
if
(
arg0
==
0
)
{
if
(
i
==
0
)
{
action
=
1
;
}
else
if
(
i
==
1
)
{
action
=
2
;
}
}
processPhotoMenu
(
action
);
}
});
showAlertDialog
(
builder
);
}
});
}
else
{
button2
.
setVisibility
(
View
.
GONE
);
}
}
else
{
onlineText
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_online
);
}
avatarImage
=
(
BackupImageView
)
view
.
findViewById
(
R
.
id
.
settings_avatar_image
);
avatarImage
.
processDetach
=
false
;
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_name
);
Typeface
typeface
=
AndroidUtilities
.
getTypeface
(
"fonts/rmedium.ttf"
);
textView
.
setTypeface
(
typeface
);
textView
.
setText
(
chat
.
title
);
int
count
=
chat
.
participants_count
;
if
(
info
!=
null
)
{
count
=
info
.
participants
.
size
();
}
if
(
count
!=
0
&&
onlineCount
>
1
)
{
onlineText
.
setText
(
Html
.
fromHtml
(
String
.
format
(
"%s, <font color='#548ab6'>%s</font>"
,
LocaleController
.
formatPluralString
(
"Members"
,
count
),
LocaleController
.
formatPluralString
(
"Online"
,
onlineCount
))));
}
else
{
onlineText
.
setText
(
LocaleController
.
formatPluralString
(
"Members"
,
count
));
}
TLRPC
.
FileLocation
photo
=
null
;
TLRPC
.
FileLocation
photoBig
=
null
;
if
(
chat
.
photo
!=
null
)
{
photo
=
chat
.
photo
.
photo_small
;
photoBig
=
chat
.
photo
.
photo_big
;
}
avatarImage
.
setImage
(
photo
,
"50_50"
,
new
AvatarDrawable
(
chat
));
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
return
view
;
}
else
if
(
type
==
1
)
{
if
(
view
==
null
)
{
view
=
new
SettingsSectionLayout
(
mContext
);
}
if
(
i
==
settingsSectionRow
)
{
((
SettingsSectionLayout
)
view
).
setText
(
LocaleController
.
getString
(
"SETTINGS"
,
R
.
string
.
SETTINGS
));
}
else
if
(
i
==
sharedMediaSectionRow
)
{
}
else
if
(
i
==
membersSectionRow
)
{
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
int
count
=
chat
.
participants_count
;
if
(
info
!=
null
)
{
count
=
info
.
participants
.
size
();
}
((
SettingsSectionLayout
)
view
).
setText
(
LocaleController
.
formatPluralString
(
"Members"
,
count
).
toUpperCase
());
}
}
else
if
(
type
==
2
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
user_profile_leftright_row_layout
,
viewGroup
,
false
);
}
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
TextView
detailTextView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text_detail
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
if
(
i
==
sharedMediaRow
)
{
textView
.
setText
(
LocaleController
.
getString
(
"SharedMedia"
,
R
.
string
.
SharedMedia
));
if
(
totalMediaCount
==
-
1
)
{
detailTextView
.
setText
(
LocaleController
.
getString
(
"Loading"
,
R
.
string
.
Loading
));
}
else
{
detailTextView
.
setText
(
String
.
format
(
"%d"
,
totalMediaCount
));
}
divider
.
setVisibility
(
View
.
INVISIBLE
);
}
}
else
if
(
type
==
3
)
{
TLRPC
.
TL_chatParticipant
part
=
info
.
participants
.
get
(
sortedUsers
.
get
(
i
-
membersSectionRow
-
1
));
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
part
.
user_id
);
if
(
view
==
null
)
{
view
=
new
UserCell
(
mContext
);
((
UserCell
)
view
).
useSeparator
=
true
;
}
((
UserCell
)
view
).
setData
(
user
,
null
,
null
);
}
else
if
(
type
==
4
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
chat_profile_add_row
,
viewGroup
,
false
);
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
messages_list_row_name
);
if
(
chat_id
>
0
)
{
textView
.
setText
(
LocaleController
.
getString
(
"AddMember"
,
R
.
string
.
AddMember
));
}
else
{
textView
.
setText
(
LocaleController
.
getString
(
"AddRecipient"
,
R
.
string
.
AddRecipient
));
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
divider
.
setVisibility
(
View
.
INVISIBLE
);
}
}
}
else
if
(
type
==
5
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
settings_logout_button
,
viewGroup
,
false
);
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
textView
.
setText
(
LocaleController
.
getString
(
"DeleteAndExit"
,
R
.
string
.
DeleteAndExit
));
textView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
getParentActivity
()
==
null
)
{
return
;
}
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
builder
.
setMessage
(
LocaleController
.
getString
(
"AreYouSureDeleteAndExit"
,
R
.
string
.
AreYouSureDeleteAndExit
));
builder
.
setTitle
(
LocaleController
.
getString
(
"AppName"
,
R
.
string
.
AppName
));
builder
.
setPositiveButton
(
LocaleController
.
getString
(
"OK"
,
R
.
string
.
OK
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
kickUser
(
null
);
}
});
builder
.
setNegativeButton
(
LocaleController
.
getString
(
"Cancel"
,
R
.
string
.
Cancel
),
null
);
showAlertDialog
(
builder
);
}
});
}
}
else
if
(
type
==
6
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
li
.
inflate
(
R
.
layout
.
settings_row_button_layout
,
viewGroup
,
false
);
}
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
settings_row_text
);
View
divider
=
view
.
findViewById
(
R
.
id
.
settings_row_divider
);
if
(
i
==
settingsNotificationsRow
)
{
textView
.
setText
(
LocaleController
.
getString
(
"NotificationsAndSounds"
,
R
.
string
.
NotificationsAndSounds
));
divider
.
setVisibility
(
View
.
INVISIBLE
);
}
}
return
view
;
}
@Override
public
int
getItemViewType
(
int
i
)
{
if
(
i
==
avatarRow
)
{
return
0
;
}
else
if
(
i
==
settingsSectionRow
||
i
==
sharedMediaSectionRow
||
i
==
membersSectionRow
)
{
return
1
;
}
else
if
(
i
==
sharedMediaRow
)
{
return
2
;
}
else
if
(
i
==
addMemberRow
)
{
return
4
;
}
else
if
(
i
==
leaveGroupRow
)
{
return
5
;
}
else
if
(
i
>
membersSectionRow
&&
i
<
membersEndRow
)
{
return
3
;
}
else
if
(
i
==
settingsNotificationsRow
)
{
return
6
;
}
return
0
;
}
@Override
public
int
getViewTypeCount
()
{
return
7
;
}
@Override
public
boolean
isEmpty
()
{
return
false
;
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/ContactsActivity.java
View file @
ea0b86d0
...
@@ -119,11 +119,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
...
@@ -119,11 +119,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
if
(
destroyAfterSelect
)
{
actionBar
.
setTitle
(
destroyAfterSelect
?
LocaleController
.
getString
(
"SelectContact"
,
R
.
string
.
SelectContact
)
:
LocaleController
.
getString
(
"Contacts"
,
R
.
string
.
Contacts
));
actionBar
.
setTitle
(
LocaleController
.
getString
(
"SelectContact"
,
R
.
string
.
SelectContact
));
}
else
{
actionBar
.
setTitle
(
LocaleController
.
getString
(
"Contacts"
,
R
.
string
.
Contacts
));
}
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
@Override
@Override
...
...
TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java
View file @
ea0b86d0
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
package
org
.
telegram
.
ui
;
package
org
.
telegram
.
ui
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.Paint
;
...
@@ -23,6 +22,8 @@ import android.text.SpannableString;
...
@@ -23,6 +22,8 @@ import android.text.SpannableString;
import
android.text.SpannableStringBuilder
;
import
android.text.SpannableStringBuilder
;
import
android.text.TextWatcher
;
import
android.text.TextWatcher
;
import
android.text.style.ImageSpan
;
import
android.text.style.ImageSpan
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
...
@@ -30,38 +31,34 @@ import android.view.ViewGroup;
...
@@ -30,38 +31,34 @@ import android.view.ViewGroup;
import
android.widget.AbsListView
;
import
android.widget.AbsListView
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.android.LocaleController
;
import
org.telegram.android.LocaleController
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.android.ContactsController
;
import
org.telegram.android.ContactsController
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.android.MessagesController
;
import
org.telegram.android.MessagesController
;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.ui.Adapters.BaseSectionsAdapter
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.ui.Adapters.ContactsActivityAdapter
;
import
org.telegram.ui.Adapters.ContactsActivitySearchAdapter
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
import
org.telegram.ui.Views.AvatarDrawable
;
import
org.telegram.ui.Views.BackupImageView
;
import
org.telegram.ui.Views.ActionBar.BaseFragment
;
import
org.telegram.ui.Views.ActionBar.BaseFragment
;
import
org.telegram.ui.Views.PinnedHeaderListView
;
import
org.telegram.ui.Views.SectionsListView
;
import
org.telegram.ui.Views.SectionedBaseAdapter
;
import
org.telegram.ui.Views.SettingsSectionLayout
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
GroupCreateActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
{
public
class
GroupCreateActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
{
public
static
class
XImageSpan
extends
ImageSpan
{
public
class
XImageSpan
extends
ImageSpan
{
public
int
uid
;
public
int
uid
;
public
XImageSpan
(
Drawable
d
,
int
verticalAlignment
)
{
public
XImageSpan
(
Drawable
d
,
int
verticalAlignment
)
{
...
@@ -75,7 +72,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -75,7 +72,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
}
int
sz
=
super
.
getSize
(
paint
,
text
,
start
,
end
,
fm
);
int
sz
=
super
.
getSize
(
paint
,
text
,
start
,
end
,
fm
);
int
offset
=
AndroidUtilities
.
dp
(
6
);
int
offset
=
AndroidUtilities
.
dp
(
6
);
int
w
=
(
fm
.
bottom
-
fm
.
top
)
/
2
;
int
w
=
(
fm
.
bottom
-
fm
.
top
)
/
2
;
fm
.
top
=
-
w
-
offset
;
fm
.
top
=
-
w
-
offset
;
...
@@ -83,30 +79,25 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -83,30 +79,25 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
fm
.
ascent
=
-
w
-
offset
;
fm
.
ascent
=
-
w
-
offset
;
fm
.
leading
=
0
;
fm
.
leading
=
0
;
fm
.
descent
=
w
-
offset
;
fm
.
descent
=
w
-
offset
;
return
sz
;
return
sz
;
}
}
}
}
private
SectionedBaseAdapter
listViewAdapter
;
private
BaseSectionsAdapter
listViewAdapter
;
private
PinnedHeaderListView
listView
;
private
TextView
emptyTextView
;
private
TextView
emptyTextView
;
private
EditText
userSelectEditText
;
private
EditText
userSelectEditText
;
private
SectionsListView
listView
;
private
ContactsActivitySearchAdapter
searchListViewAdapter
;
private
int
beforeChangeIndex
;
private
int
maxCount
=
200
;
private
boolean
ignoreChange
=
false
;
private
boolean
ignoreChange
=
false
;
private
boolean
isBroadcast
=
false
;
private
boolean
isBroadcast
=
false
;
private
int
maxCount
=
200
;
private
HashMap
<
Integer
,
XImageSpan
>
selectedContacts
=
new
HashMap
<
Integer
,
XImageSpan
>();
private
ArrayList
<
XImageSpan
>
allSpans
=
new
ArrayList
<
XImageSpan
>();
private
boolean
searchWas
;
private
boolean
searchWas
;
private
boolean
searching
;
private
boolean
searching
;
private
Timer
searchTimer
;
public
ArrayList
<
TLRPC
.
User
>
searchResult
;
public
ArrayList
<
CharSequence
>
searchResultNames
;
private
CharSequence
changeString
;
private
CharSequence
changeString
;
private
int
beforeChangeIndex
;
private
HashMap
<
Integer
,
XImageSpan
>
selectedContacts
=
new
HashMap
<
Integer
,
XImageSpan
>();
private
ArrayList
<
XImageSpan
>
allSpans
=
new
ArrayList
<
XImageSpan
>();
private
final
static
int
done_button
=
1
;
private
final
static
int
done_button
=
1
;
...
@@ -139,13 +130,12 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -139,13 +130,12 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
@Override
@Override
public
View
createView
(
LayoutInflater
inflater
,
ViewGroup
container
)
{
public
View
createView
(
LayoutInflater
inflater
,
ViewGroup
container
)
{
if
(
fragmentView
==
null
)
{
if
(
fragmentView
==
null
)
{
searching
=
false
;
searchWas
=
false
;
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
if
(
isBroadcast
)
{
actionBar
.
setTitle
(
isBroadcast
?
LocaleController
.
getString
(
"NewBroadcastList"
,
R
.
string
.
NewBroadcastList
)
:
LocaleController
.
getString
(
"NewGroup"
,
R
.
string
.
NewGroup
));
actionBar
.
setTitle
(
LocaleController
.
getString
(
"NewBroadcastList"
,
R
.
string
.
NewBroadcastList
));
}
else
{
actionBar
.
setTitle
(
LocaleController
.
getString
(
"NewGroup"
,
R
.
string
.
NewGroup
));
}
actionBar
.
setSubtitle
(
LocaleController
.
formatString
(
"MembersCount"
,
R
.
string
.
MembersCount
,
selectedContacts
.
size
(),
maxCount
));
actionBar
.
setSubtitle
(
LocaleController
.
formatString
(
"MembersCount"
,
R
.
string
.
MembersCount
,
selectedContacts
.
size
(),
maxCount
));
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
...
@@ -165,26 +155,99 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -165,26 +155,99 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
}
}
}
});
});
ActionBarMenu
menu
=
actionBar
.
createMenu
();
ActionBarMenu
menu
=
actionBar
.
createMenu
();
View
doneItem
=
menu
.
addItemResource
(
done_button
,
R
.
layout
.
group_create_done_layout
);
View
doneItem
=
menu
.
addItemResource
(
done_button
,
R
.
layout
.
group_create_done_layout
);
TextView
doneTextView
=
(
TextView
)
doneItem
.
findViewById
(
R
.
id
.
done_button
);
TextView
doneTextView
=
(
TextView
)
doneItem
.
findViewById
(
R
.
id
.
done_button
);
doneTextView
.
setText
(
LocaleController
.
getString
(
"Next"
,
R
.
string
.
Next
));
doneTextView
.
setText
(
LocaleController
.
getString
(
"Next"
,
R
.
string
.
Next
));
searching
=
false
;
searchListViewAdapter
=
new
ContactsActivitySearchAdapter
(
getParentActivity
(),
null
,
false
);
searchWas
=
false
;
listViewAdapter
=
new
ContactsActivityAdapter
(
getParentActivity
(),
true
,
false
,
null
);
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
group_create_layout
,
container
,
false
);
/*
emptyTextView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/top_layout"
android:layout_gravity="top">
<EditText
android:textColorHint="#a6a6a6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:minHeight="52dp"
android:gravity="right|center_vertical"
android:maxLines="2"
android:paddingTop="3dp"
android:layout_marginTop="0dp"
android:inputType="textFilter|textNoSuggestions|textMultiLine"
android:imeOptions="flagNoExtractUi"
android:textCursorDrawable="@null"
android:textColor="#000000"/>
</FrameLayout>
------------RTL---------- END
<EditText
android:textColorHint="#a6a6a6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:minHeight="52dp"
android:gravity="left|center_vertical"
android:maxLines="2"
android:paddingTop="3dp"
android:layout_marginTop="0dp"
android:inputType="textFilter|textNoSuggestions|textMultiLine"
android:imeOptions="flagNoExtractUi"
android:textCursorDrawable="@null"
android:textColor="#000000"/>
*/
fragmentView
=
new
LinearLayout
(
getParentActivity
());
LinearLayout
linearLayout
=
(
LinearLayout
)
fragmentView
;
linearLayout
.
setOrientation
(
LinearLayout
.
VERTICAL
);
emptyTextView
=
new
TextView
(
getParentActivity
());
emptyTextView
.
setTextColor
(
0xff808080
);
emptyTextView
.
setTextSize
(
24
);
emptyTextView
.
setGravity
(
Gravity
.
CENTER
);
emptyTextView
.
setVisibility
(
View
.
INVISIBLE
);
emptyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
emptyTextView
.
setText
(
LocaleController
.
getString
(
"NoContacts"
,
R
.
string
.
NoContacts
));
linearLayout
.
addView
(
emptyTextView
);
LinearLayout
.
LayoutParams
layoutParams
=
(
LinearLayout
.
LayoutParams
)
emptyTextView
.
getLayoutParams
();
layoutParams
.
width
=
LinearLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
height
=
LinearLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
gravity
=
Gravity
.
TOP
;
emptyTextView
.
setLayoutParams
(
layoutParams
);
emptyTextView
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
emptyTextView
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
@Override
@Override
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
return
true
;
return
true
;
}
}
});
});
userSelectEditText
=
(
EditText
)
fragmentView
.
findViewById
(
R
.
id
.
bubble_input_text
);
FrameLayout
frameLayout
=
new
FrameLayout
(
getParentActivity
());
linearLayout
.
addView
(
frameLayout
);
layoutParams
=
(
LinearLayout
.
LayoutParams
)
frameLayout
.
getLayoutParams
();
layoutParams
.
width
=
LinearLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
height
=
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
gravity
=
Gravity
.
TOP
;
frameLayout
.
setLayoutParams
(
layoutParams
);
userSelectEditText
=
new
EditText
(
getParentActivity
());
userSelectEditText
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
16
);
frameLayout
.
addView
(
userSelectEditText
);
userSelectEditText
.
setHint
(
LocaleController
.
getString
(
"SendMessageTo"
,
R
.
string
.
SendMessageTo
));
userSelectEditText
.
setHint
(
LocaleController
.
getString
(
"SendMessageTo"
,
R
.
string
.
SendMessageTo
));
if
(
Build
.
VERSION
.
SDK_INT
>=
11
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
11
)
{
userSelectEditText
.
setTextIsSelectable
(
false
);
userSelectEditText
.
setTextIsSelectable
(
false
);
...
@@ -256,11 +319,23 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -256,11 +319,23 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
}
});
});
listView
=
(
PinnedHeaderListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
listView
=
new
SectionsListView
(
getParentActivity
()
);
listView
.
setEmptyView
(
emptyTextView
);
listView
.
setEmptyView
(
emptyTextView
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setDivider
(
null
);
listView
.
setAdapter
(
listViewAdapter
=
new
ListAdapter
(
getParentActivity
()));
listView
.
setDividerHeight
(
0
);
listView
.
setFastScrollEnabled
(
true
);
listView
.
setScrollBarStyle
(
View
.
SCROLLBARS_OUTSIDE_OVERLAY
);
listView
.
setAdapter
(
listViewAdapter
);
if
(
Build
.
VERSION
.
SDK_INT
>=
11
)
{
listView
.
setFastScrollAlwaysVisible
(
true
);
listView
.
setVerticalScrollbarPosition
(
LocaleController
.
isRTL
?
ListView
.
SCROLLBAR_POSITION_LEFT
:
ListView
.
SCROLLBAR_POSITION_RIGHT
);
}
((
FrameLayout
)
fragmentView
).
addView
(
listView
);
layoutParams
=
(
LinearLayout
.
LayoutParams
)
listView
.
getLayoutParams
();
layoutParams
.
width
=
LinearLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
height
=
LinearLayout
.
LayoutParams
.
MATCH_PARENT
;
listView
.
setLayoutParams
(
layoutParams
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
@Override
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
...
@@ -315,7 +390,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -315,7 +390,6 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
}
}
}
}
});
});
listView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
()
{
listView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
()
{
@Override
@Override
public
void
onScrollStateChanged
(
AbsListView
absListView
,
int
i
)
{
public
void
onScrollStateChanged
(
AbsListView
absListView
,
int
i
)
{
...
@@ -337,6 +411,29 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -337,6 +411,29 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
return
fragmentView
;
return
fragmentView
;
}
}
@Override
public
void
didReceivedNotification
(
int
id
,
Object
...
args
)
{
if
(
id
==
NotificationCenter
.
contactsDidLoaded
)
{
if
(
listViewAdapter
!=
null
)
{
listViewAdapter
.
notifyDataSetChanged
();
}
}
else
if
(
id
==
NotificationCenter
.
updateInterfaces
)
{
int
mask
=
(
Integer
)
args
[
0
];
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
}
else
if
(
id
==
NotificationCenter
.
chatDidCreated
)
{
AndroidUtilities
.
runOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
removeSelfFromStack
();
}
});
}
}
public
XImageSpan
createAndPutChipForUser
(
TLRPC
.
User
user
)
{
public
XImageSpan
createAndPutChipForUser
(
TLRPC
.
User
user
)
{
LayoutInflater
lf
=
(
LayoutInflater
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Activity
.
LAYOUT_INFLATER_SERVICE
);
LayoutInflater
lf
=
(
LayoutInflater
)
ApplicationLoader
.
applicationContext
.
getSystemService
(
Activity
.
LAYOUT_INFLATER_SERVICE
);
View
textView
=
lf
.
inflate
(
R
.
layout
.
group_create_bubble
,
null
);
View
textView
=
lf
.
inflate
(
R
.
layout
.
group_create_bubble
,
null
);
...
@@ -374,253 +471,4 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
...
@@ -374,253 +471,4 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
userSelectEditText
.
setSelection
(
ssb
.
length
());
userSelectEditText
.
setSelection
(
ssb
.
length
());
return
span
;
return
span
;
}
}
public
void
searchDialogs
(
final
String
query
)
{
if
(
query
==
null
)
{
searchResult
=
null
;
searchResultNames
=
null
;
}
else
{
try
{
if
(
searchTimer
!=
null
)
{
searchTimer
.
cancel
();
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
searchTimer
=
new
Timer
();
searchTimer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
try
{
searchTimer
.
cancel
();
searchTimer
=
null
;
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
processSearch
(
query
);
}
},
100
,
300
);
}
}
private
void
processSearch
(
final
String
query
)
{
AndroidUtilities
.
runOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
final
ArrayList
<
TLRPC
.
TL_contact
>
contactsCopy
=
new
ArrayList
<
TLRPC
.
TL_contact
>();
contactsCopy
.
addAll
(
ContactsController
.
getInstance
().
contacts
);
Utilities
.
searchQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
query
.
length
()
==
0
)
{
updateSearchResults
(
new
ArrayList
<
TLRPC
.
User
>(),
new
ArrayList
<
CharSequence
>());
return
;
}
long
time
=
System
.
currentTimeMillis
();
ArrayList
<
TLRPC
.
User
>
resultArray
=
new
ArrayList
<
TLRPC
.
User
>();
ArrayList
<
CharSequence
>
resultArrayNames
=
new
ArrayList
<
CharSequence
>();
String
q
=
query
.
toLowerCase
();
for
(
TLRPC
.
TL_contact
contact
:
contactsCopy
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
contact
.
user_id
);
if
(
user
.
first_name
.
toLowerCase
().
startsWith
(
q
)
||
user
.
last_name
.
toLowerCase
().
startsWith
(
q
))
{
if
(
user
.
id
==
UserConfig
.
getClientUserId
())
{
continue
;
}
resultArrayNames
.
add
(
Utilities
.
generateSearchName
(
user
.
first_name
,
user
.
last_name
,
q
));
resultArray
.
add
(
user
);
}
}
updateSearchResults
(
resultArray
,
resultArrayNames
);
}
});
}
});
}
private
void
updateSearchResults
(
final
ArrayList
<
TLRPC
.
User
>
users
,
final
ArrayList
<
CharSequence
>
names
)
{
AndroidUtilities
.
runOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
searchResult
=
users
;
searchResultNames
=
names
;
listViewAdapter
.
notifyDataSetChanged
();
}
});
}
@Override
public
void
didReceivedNotification
(
int
id
,
Object
...
args
)
{
if
(
id
==
NotificationCenter
.
contactsDidLoaded
)
{
if
(
listViewAdapter
!=
null
)
{
listViewAdapter
.
notifyDataSetChanged
();
}
}
else
if
(
id
==
NotificationCenter
.
updateInterfaces
)
{
int
mask
=
(
Integer
)
args
[
0
];
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
}
else
if
(
id
==
NotificationCenter
.
chatDidCreated
)
{
AndroidUtilities
.
runOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
removeSelfFromStack
();
}
});
}
}
private
class
ListAdapter
extends
SectionedBaseAdapter
{
private
Context
mContext
;
public
ListAdapter
(
Context
context
)
{
mContext
=
context
;
}
@Override
public
Object
getItem
(
int
section
,
int
position
)
{
return
null
;
}
@Override
public
long
getItemId
(
int
section
,
int
position
)
{
return
0
;
}
@Override
public
int
getSectionCount
()
{
if
(
searching
&&
searchWas
)
{
return
searchResult
==
null
||
searchResult
.
isEmpty
()
?
0
:
1
;
}
return
ContactsController
.
getInstance
().
sortedUsersSectionsArray
.
size
();
}
@Override
public
int
getCountForSection
(
int
section
)
{
if
(
searching
&&
searchWas
)
{
return
searchResult
==
null
?
0
:
searchResult
.
size
();
}
ArrayList
<
TLRPC
.
TL_contact
>
arr
=
ContactsController
.
getInstance
().
usersSectionsDict
.
get
(
ContactsController
.
getInstance
().
sortedUsersSectionsArray
.
get
(
section
));
return
arr
.
size
();
}
@Override
public
View
getItemView
(
int
section
,
int
position
,
View
convertView
,
ViewGroup
parent
)
{
TLRPC
.
User
user
;
int
size
;
if
(
searchWas
&&
searching
)
{
user
=
MessagesController
.
getInstance
().
getUser
(
searchResult
.
get
(
position
).
id
);
size
=
searchResult
.
size
();
}
else
{
ArrayList
<
TLRPC
.
TL_contact
>
arr
=
ContactsController
.
getInstance
().
usersSectionsDict
.
get
(
ContactsController
.
getInstance
().
sortedUsersSectionsArray
.
get
(
section
));
user
=
MessagesController
.
getInstance
().
getUser
(
arr
.
get
(
position
).
user_id
);
size
=
arr
.
size
();
}
if
(
convertView
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
convertView
=
li
.
inflate
(
R
.
layout
.
group_create_row_layout
,
parent
,
false
);
}
ContactListRowHolder
holder
=
(
ContactListRowHolder
)
convertView
.
getTag
();
if
(
holder
==
null
)
{
holder
=
new
ContactListRowHolder
(
convertView
);
convertView
.
setTag
(
holder
);
}
ImageView
checkButton
=
(
ImageView
)
convertView
.
findViewById
(
R
.
id
.
settings_row_check_button
);
if
(
selectedContacts
.
containsKey
(
user
.
id
))
{
checkButton
.
setImageResource
(
R
.
drawable
.
btn_check_on_holo_light
);
}
else
{
checkButton
.
setImageResource
(
R
.
drawable
.
btn_check_off_holo_light
);
}
View
divider
=
convertView
.
findViewById
(
R
.
id
.
settings_row_divider
);
if
(
position
==
size
-
1
)
{
divider
.
setVisibility
(
View
.
INVISIBLE
);
}
else
{
divider
.
setVisibility
(
View
.
VISIBLE
);
}
if
(
searchWas
&&
searching
)
{
holder
.
nameTextView
.
setText
(
searchResultNames
.
get
(
position
));
}
else
{
String
name
=
ContactsController
.
formatName
(
user
.
first_name
,
user
.
last_name
);
if
(
name
.
length
()
==
0
)
{
if
(
user
.
phone
!=
null
&&
user
.
phone
.
length
()
!=
0
)
{
name
=
PhoneFormat
.
getInstance
().
format
(
"+"
+
user
.
phone
);
}
else
{
name
=
LocaleController
.
getString
(
"HiddenName"
,
R
.
string
.
HiddenName
);
}
}
holder
.
nameTextView
.
setText
(
name
);
}
TLRPC
.
FileLocation
photo
=
null
;
if
(
user
.
photo
!=
null
)
{
photo
=
user
.
photo
.
photo_small
;
}
holder
.
avatarDrawable
.
setInfo
(
user
.
id
,
user
.
first_name
,
user
.
last_name
,
false
);
holder
.
avatarImage
.
setImage
(
photo
,
"50_50"
,
holder
.
avatarDrawable
);
holder
.
messageTextView
.
setText
(
LocaleController
.
formatUserStatus
(
user
));
if
(
user
.
status
!=
null
&&
user
.
status
.
expires
>
ConnectionsManager
.
getInstance
().
getCurrentTime
())
{
holder
.
messageTextView
.
setTextColor
(
0xff548ab6
);
}
else
{
holder
.
messageTextView
.
setTextColor
(
0xff808080
);
}
return
convertView
;
}
@Override
public
int
getItemViewType
(
int
section
,
int
position
)
{
return
0
;
}
@Override
public
int
getItemViewTypeCount
()
{
return
1
;
}
@Override
public
int
getSectionHeaderViewType
(
int
section
)
{
return
0
;
}
@Override
public
int
getSectionHeaderViewTypeCount
()
{
return
1
;
}
@Override
public
View
getSectionHeaderView
(
int
section
,
View
convertView
,
ViewGroup
parent
)
{
if
(
convertView
==
null
)
{
convertView
=
new
SettingsSectionLayout
(
mContext
);
convertView
.
setBackgroundColor
(
0xffffffff
);
}
if
(
searching
&&
searchWas
)
{
((
SettingsSectionLayout
)
convertView
).
setText
(
LocaleController
.
getString
(
"AllContacts"
,
R
.
string
.
AllContacts
));
}
else
{
((
SettingsSectionLayout
)
convertView
).
setText
(
ContactsController
.
getInstance
().
sortedUsersSectionsArray
.
get
(
section
));
}
return
convertView
;
}
}
public
static
class
ContactListRowHolder
{
public
BackupImageView
avatarImage
;
public
TextView
messageTextView
;
public
TextView
nameTextView
;
public
AvatarDrawable
avatarDrawable
=
new
AvatarDrawable
();
public
ContactListRowHolder
(
View
view
)
{
messageTextView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
messages_list_row_message
);
nameTextView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
messages_list_row_name
);
avatarImage
=
(
BackupImageView
)
view
.
findViewById
(
R
.
id
.
messages_list_row_avatar
);
}
}
}
}
TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java
View file @
ea0b86d0
...
@@ -389,14 +389,10 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
...
@@ -389,14 +389,10 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
@Override
@Override
public
View
getItemView
(
int
section
,
int
position
,
View
convertView
,
ViewGroup
parent
)
{
public
View
getItemView
(
int
section
,
int
position
,
View
convertView
,
ViewGroup
parent
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
selectedContacts
.
get
(
position
));
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
selectedContacts
.
get
(
position
));
if
(
convertView
==
null
)
{
if
(
convertView
==
null
)
{
convertView
=
new
UserCell
(
mContext
);
convertView
=
new
UserCell
(
mContext
,
1
);
}
}
((
UserCell
)
convertView
).
setData
(
user
,
null
,
null
,
0
);
((
UserCell
)
convertView
).
setData
(
user
,
null
,
null
);
((
UserCell
)
convertView
).
useSeparator
=
position
!=
selectedContacts
.
size
()
-
1
;
return
convertView
;
return
convertView
;
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
ea0b86d0
...
@@ -355,7 +355,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
...
@@ -355,7 +355,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
}
}
}
else
if
(
fragmentName
.
equals
(
"chat_profile"
))
{
}
else
if
(
fragmentName
.
equals
(
"chat_profile"
))
{
if
(
args
!=
null
)
{
if
(
args
!=
null
)
{
ChatProfileActivity
profile
=
new
Chat
ProfileActivity
(
args
);
ProfileActivity
profile
=
new
ProfileActivity
(
args
);
if
(
actionBarLayout
.
addFragmentToStack
(
profile
))
{
if
(
actionBarLayout
.
addFragmentToStack
(
profile
))
{
profile
.
restoreSelfArgs
(
savedInstanceState
);
profile
.
restoreSelfArgs
(
savedInstanceState
);
}
}
...
@@ -1009,7 +1009,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
...
@@ -1009,7 +1009,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
outState
.
putString
(
"fragment"
,
"group"
);
outState
.
putString
(
"fragment"
,
"group"
);
}
else
if
(
lastFragment
instanceof
SettingsWallpapersActivity
)
{
}
else
if
(
lastFragment
instanceof
SettingsWallpapersActivity
)
{
outState
.
putString
(
"fragment"
,
"wallpapers"
);
outState
.
putString
(
"fragment"
,
"wallpapers"
);
}
else
if
(
lastFragment
instanceof
ChatProfileActivity
&&
args
!=
null
)
{
}
else
if
(
lastFragment
instanceof
ProfileActivity
&&
((
ProfileActivity
)
lastFragment
).
isChat
()
&&
args
!=
null
)
{
outState
.
putBundle
(
"args"
,
args
);
outState
.
putBundle
(
"args"
,
args
);
outState
.
putString
(
"fragment"
,
"chat_profile"
);
outState
.
putString
(
"fragment"
,
"chat_profile"
);
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
View file @
ea0b86d0
...
@@ -16,12 +16,15 @@ import android.content.res.Configuration;
...
@@ -16,12 +16,15 @@ import android.content.res.Configuration;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.Html
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.ViewTreeObserver
;
import
android.view.ViewTreeObserver
;
import
android.widget.AbsListView
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
...
@@ -31,7 +34,9 @@ import android.widget.TextView;
...
@@ -31,7 +34,9 @@ import android.widget.TextView;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.android.LocaleController
;
import
org.telegram.android.LocaleController
;
import
org.telegram.android.MessagesStorage
;
import
org.telegram.android.SendMessagesHelper
;
import
org.telegram.android.SendMessagesHelper
;
import
org.telegram.messenger.ConnectionsManager
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.android.ContactsController
;
import
org.telegram.android.ContactsController
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.FileLog
;
...
@@ -39,22 +44,33 @@ import org.telegram.android.MessagesController;
...
@@ -39,22 +44,33 @@ import org.telegram.android.MessagesController;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
org.telegram.android.MessageObject
;
import
org.telegram.android.MessageObject
;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.messenger.Utilities
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.AnimationCompat.ViewProxy
;
import
org.telegram.ui.Cells.DividerCell
;
import
org.telegram.ui.Cells.DividerCell
;
import
org.telegram.ui.Cells.EmptyCell
;
import
org.telegram.ui.Cells.EmptyCell
;
import
org.telegram.ui.Cells.ShadowSectionCell
;
import
org.telegram.ui.Cells.TextCell
;
import
org.telegram.ui.Cells.TextCell
;
import
org.telegram.ui.Cells.TextDetailCell
;
import
org.telegram.ui.Cells.TextDetailCell
;
import
org.telegram.ui.Cells.UserCell
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenuItem
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenuItem
;
import
org.telegram.ui.Views.AvatarDrawable
;
import
org.telegram.ui.Views.AvatarDrawable
;
import
org.telegram.ui.Views.AvatarUpdater
;
import
org.telegram.ui.Views.BackupImageView
;
import
org.telegram.ui.Views.BackupImageView
;
import
org.telegram.ui.Views.ActionBar.BaseFragment
;
import
org.telegram.ui.Views.ActionBar.BaseFragment
;
import
org.telegram.ui.Views.IdenticonDrawable
;
import
org.telegram.ui.Views.IdenticonDrawable
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.concurrent.Semaphore
;
public
class
ProfileActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
,
MessagesActivity
.
MessagesActivityDelegate
,
PhotoViewer
.
PhotoViewerProvider
{
public
class
ProfileActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
,
MessagesActivity
.
MessagesActivityDelegate
,
PhotoViewer
.
PhotoViewerProvider
{
private
ListView
listView
;
private
ListView
listView
;
private
ListAdapter
listAdapter
;
private
ListAdapter
listAdapter
;
private
BackupImageView
avatarImage
;
private
BackupImageView
avatarImage
;
...
@@ -63,19 +79,35 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -63,19 +79,35 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private
ImageView
writeButton
;
private
ImageView
writeButton
;
private
int
user_id
;
private
int
user_id
;
private
int
totalMediaCount
=
-
1
;
private
int
chat_id
;
private
boolean
creatingChat
=
false
;
private
long
dialog_id
;
private
long
dialog_id
;
private
boolean
creatingChat
;
private
boolean
userBlocked
;
private
AvatarUpdater
avatarUpdater
;
private
TLRPC
.
ChatParticipants
info
;
private
TLRPC
.
TL_chatParticipant
selectedUser
;
private
int
onlineCount
=
-
1
;
private
ArrayList
<
Integer
>
sortedUsers
;
private
TLRPC
.
EncryptedChat
currentEncryptedChat
;
private
TLRPC
.
EncryptedChat
currentEncryptedChat
;
private
boolean
userBlocked
=
false
;
private
TLRPC
.
Chat
currentChat
;
private
int
totalMediaCount
=
-
1
;
private
final
static
int
add_contact
=
1
;
private
final
static
int
add_contact
=
1
;
private
final
static
int
block_contact
=
2
;
private
final
static
int
block_contact
=
2
;
private
final
static
int
share_contact
=
3
;
private
final
static
int
share_contact
=
3
;
private
final
static
int
edit_contact
=
4
;
private
final
static
int
edit_contact
=
4
;
private
final
static
int
delete_contact
=
5
;
private
final
static
int
delete_contact
=
5
;
private
final
static
int
add_member
=
6
;
private
final
static
int
leave_group
=
7
;
private
final
static
int
edit_name
=
8
;
private
int
overscrollRow
;
private
int
emptyRow
;
private
int
emptyRow
;
private
int
emptyRowChat
;
private
int
emptyRowChat2
;
private
int
phoneRow
;
private
int
phoneRow
;
private
int
usernameRow
;
private
int
usernameRow
;
private
int
settingsTimerRow
;
private
int
settingsTimerRow
;
...
@@ -84,6 +116,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -84,6 +116,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
private
int
sharedMediaRow
;
private
int
sharedMediaRow
;
private
int
startSecretChatRow
;
private
int
startSecretChatRow
;
private
int
sectionRow
;
private
int
sectionRow
;
private
int
membersSectionRow
;
private
int
membersEndRow
;
private
int
rowCount
=
0
;
private
int
rowCount
=
0
;
public
ProfileActivity
(
Bundle
args
)
{
public
ProfileActivity
(
Bundle
args
)
{
...
@@ -93,23 +127,73 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -93,23 +127,73 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
@Override
public
boolean
onFragmentCreate
()
{
public
boolean
onFragmentCreate
()
{
user_id
=
arguments
.
getInt
(
"user_id"
,
0
);
user_id
=
arguments
.
getInt
(
"user_id"
,
0
);
dialog_id
=
arguments
.
getLong
(
"dialog_id"
,
0
);
chat_id
=
getArguments
().
getInt
(
"chat_id"
,
0
);
if
(
dialog_id
!=
0
)
{
if
(
user_id
!=
0
)
{
currentEncryptedChat
=
MessagesController
.
getInstance
().
getEncryptedChat
((
int
)(
dialog_id
>>
32
));
dialog_id
=
arguments
.
getLong
(
"dialog_id"
,
0
);
}
if
(
dialog_id
!=
0
)
{
updateRowsIds
();
currentEncryptedChat
=
MessagesController
.
getInstance
().
getEncryptedChat
((
int
)
(
dialog_id
>>
32
));
if
(
MessagesController
.
getInstance
().
getUser
(
user_id
)
==
null
)
{
}
if
(
MessagesController
.
getInstance
().
getUser
(
user_id
)
==
null
)
{
return
false
;
}
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
contactsDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
encryptedChatCreated
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
encryptedChatUpdated
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
blockedUsersDidLoaded
);
userBlocked
=
MessagesController
.
getInstance
().
blockedUsers
.
contains
(
user_id
);
MessagesController
.
getInstance
().
loadFullUser
(
MessagesController
.
getInstance
().
getUser
(
user_id
),
classGuid
);
}
else
if
(
chat_id
!=
0
)
{
currentChat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
currentChat
==
null
)
{
final
Semaphore
semaphore
=
new
Semaphore
(
0
);
MessagesStorage
.
getInstance
().
getStorageQueue
().
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
currentChat
=
MessagesStorage
.
getInstance
().
getChat
(
chat_id
);
semaphore
.
release
();
}
});
try
{
semaphore
.
acquire
();
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(
currentChat
!=
null
)
{
MessagesController
.
getInstance
().
putChat
(
currentChat
,
true
);
}
else
{
return
false
;
}
}
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
chatInfoDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
closeChats
);
sortedUsers
=
new
ArrayList
<
Integer
>();
updateOnlineCount
();
if
(
chat_id
>
0
)
{
MessagesController
.
getInstance
().
getMediaCount
(-
chat_id
,
classGuid
,
true
);
}
avatarUpdater
=
new
AvatarUpdater
();
avatarUpdater
.
delegate
=
new
AvatarUpdater
.
AvatarUpdaterDelegate
()
{
@Override
public
void
didUploadedPhoto
(
TLRPC
.
InputFile
file
,
TLRPC
.
PhotoSize
small
,
TLRPC
.
PhotoSize
big
)
{
if
(
chat_id
!=
0
)
{
MessagesController
.
getInstance
().
changeChatAvatar
(
chat_id
,
file
);
}
}
};
avatarUpdater
.
parentFragment
=
this
;
}
else
{
return
false
;
return
false
;
}
}
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
contactsDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
mediaCountDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
encryptedChatCreated
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
encryptedChatUpdated
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
blockedUsersDidLoaded
);
userBlocked
=
MessagesController
.
getInstance
().
blockedUsers
.
contains
(
user_id
);
MessagesController
.
getInstance
().
loadFullUser
(
MessagesController
.
getInstance
().
getUser
(
user_id
),
classGuid
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
mediaCountDidLoaded
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
updateRowsIds
();
return
true
;
return
true
;
}
}
...
@@ -117,27 +201,35 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -117,27 +201,35 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
@Override
public
void
onFragmentDestroy
()
{
public
void
onFragmentDestroy
()
{
super
.
onFragmentDestroy
();
super
.
onFragmentDestroy
();
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
contactsDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
mediaCountDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
mediaCountDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
encryptedChatCreated
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
encryptedChatUpdated
);
if
(
user_id
!=
0
)
{
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
blockedUsersDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
contactsDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
encryptedChatCreated
);
MessagesController
.
getInstance
().
cancelLoadFullUser
(
user_id
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
encryptedChatUpdated
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
blockedUsersDidLoaded
);
MessagesController
.
getInstance
().
cancelLoadFullUser
(
user_id
);
}
else
if
(
chat_id
!=
0
)
{
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
chatInfoDidLoaded
);
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
closeChats
);
avatarUpdater
.
clear
();
}
}
}
@Override
@Override
public
View
createView
(
LayoutInflater
inflater
,
ViewGroup
container
)
{
public
View
createView
(
LayoutInflater
inflater
,
ViewGroup
container
)
{
if
(
fragmentView
==
null
)
{
if
(
fragmentView
==
null
)
{
actionBar
.
setBackgroundColor
(
AvatarDrawable
.
getProfileBackColorForId
(
user_id
));
actionBar
.
setBackgroundColor
(
AvatarDrawable
.
getProfileBackColorForId
(
user_id
!=
0
?
user_id
:
chat_id
));
actionBar
.
setItemsBackground
(
AvatarDrawable
.
getButtonColorForId
(
user_id
));
actionBar
.
setItemsBackground
(
AvatarDrawable
.
getButtonColorForId
(
user_id
!=
0
?
user_id
:
chat_id
));
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
actionBar
.
setExtraHeight
(
AndroidUtilities
.
dp
(
88
));
actionBar
.
setExtraHeight
(
AndroidUtilities
.
dp
(
88
)
,
false
);
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
@Override
@Override
public
void
onItemClick
(
final
int
id
)
{
public
void
onItemClick
(
final
int
id
)
{
if
(
getParentActivity
()
==
null
)
{
return
;
}
if
(
id
==
-
1
)
{
if
(
id
==
-
1
)
{
finishFragment
();
finishFragment
();
}
else
if
(
id
==
block_contact
)
{
}
else
if
(
id
==
block_contact
)
{
...
@@ -194,6 +286,46 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -194,6 +286,46 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
});
});
builder
.
setNegativeButton
(
LocaleController
.
getString
(
"Cancel"
,
R
.
string
.
Cancel
),
null
);
builder
.
setNegativeButton
(
LocaleController
.
getString
(
"Cancel"
,
R
.
string
.
Cancel
),
null
);
showAlertDialog
(
builder
);
showAlertDialog
(
builder
);
}
else
if
(
id
==
add_member
)
{
Bundle
args
=
new
Bundle
();
args
.
putBoolean
(
"onlyUsers"
,
true
);
args
.
putBoolean
(
"destroyAfterSelect"
,
true
);
args
.
putBoolean
(
"returnAsResult"
,
true
);
//args.putBoolean("allowUsernameSearch", false);
if
(
chat_id
>
0
)
{
args
.
putString
(
"selectAlertString"
,
LocaleController
.
getString
(
"AddToTheGroup"
,
R
.
string
.
AddToTheGroup
));
}
ContactsActivity
fragment
=
new
ContactsActivity
(
args
);
fragment
.
setDelegate
(
new
ContactsActivity
.
ContactsActivityDelegate
()
{
@Override
public
void
didSelectContact
(
TLRPC
.
User
user
,
String
param
)
{
MessagesController
.
getInstance
().
addUserToChat
(
chat_id
,
user
,
info
,
param
!=
null
?
Utilities
.
parseInt
(
param
)
:
0
);
}
});
if
(
info
!=
null
)
{
HashMap
<
Integer
,
TLRPC
.
User
>
users
=
new
HashMap
<
Integer
,
TLRPC
.
User
>();
for
(
TLRPC
.
TL_chatParticipant
p
:
info
.
participants
)
{
users
.
put
(
p
.
user_id
,
null
);
}
fragment
.
setIgnoreUsers
(
users
);
}
presentFragment
(
fragment
);
}
else
if
(
id
==
leave_group
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
builder
.
setMessage
(
LocaleController
.
getString
(
"AreYouSureDeleteAndExit"
,
R
.
string
.
AreYouSureDeleteAndExit
));
builder
.
setTitle
(
LocaleController
.
getString
(
"AppName"
,
R
.
string
.
AppName
));
builder
.
setPositiveButton
(
LocaleController
.
getString
(
"OK"
,
R
.
string
.
OK
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
kickUser
(
null
);
}
});
builder
.
setNegativeButton
(
LocaleController
.
getString
(
"Cancel"
,
R
.
string
.
Cancel
),
null
);
showAlertDialog
(
builder
);
}
else
if
(
id
==
edit_name
)
{
Bundle
args
=
new
Bundle
();
args
.
putInt
(
"chat_id"
,
chat_id
);
presentFragment
(
new
ChatProfileChangeNameActivity
(
args
));
}
}
}
}
});
});
...
@@ -204,7 +336,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -204,7 +336,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
fragmentView
=
new
FrameLayout
(
getParentActivity
());
fragmentView
=
new
FrameLayout
(
getParentActivity
());
FrameLayout
frameLayout
=
(
FrameLayout
)
fragmentView
;
FrameLayout
frameLayout
=
(
FrameLayout
)
fragmentView
;
frameLayout
.
addView
(
actionBar
);
avatarImage
=
new
BackupImageView
(
getParentActivity
());
avatarImage
=
new
BackupImageView
(
getParentActivity
());
avatarImage
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
30
));
avatarImage
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
30
));
...
@@ -221,10 +352,18 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -221,10 +352,18 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarImage
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
avatarImage
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
if
(
user_id
!=
0
)
{
if
(
user
.
photo
!=
null
&&
user
.
photo
.
photo_big
!=
null
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
PhotoViewer
.
getInstance
().
setParentActivity
(
getParentActivity
());
if
(
user
.
photo
!=
null
&&
user
.
photo
.
photo_big
!=
null
)
{
PhotoViewer
.
getInstance
().
openPhoto
(
user
.
photo
.
photo_big
,
ProfileActivity
.
this
);
PhotoViewer
.
getInstance
().
setParentActivity
(
getParentActivity
());
PhotoViewer
.
getInstance
().
openPhoto
(
user
.
photo
.
photo_big
,
ProfileActivity
.
this
);
}
}
else
if
(
chat_id
!=
0
)
{
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
.
photo
!=
null
&&
chat
.
photo
.
photo_big
!=
null
)
{
PhotoViewer
.
getInstance
().
setParentActivity
(
getParentActivity
());
PhotoViewer
.
getInstance
().
openPhoto
(
chat
.
photo
.
photo_big
,
ProfileActivity
.
this
);
}
}
}
}
}
});
});
...
@@ -235,6 +374,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -235,6 +374,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
nameTextView
.
setLines
(
1
);
nameTextView
.
setLines
(
1
);
nameTextView
.
setMaxLines
(
1
);
nameTextView
.
setMaxLines
(
1
);
nameTextView
.
setSingleLine
(
true
);
nameTextView
.
setSingleLine
(
true
);
nameTextView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
nameTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
nameTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
nameTextView
.
setTypeface
(
AndroidUtilities
.
getTypeface
(
"fonts/rmedium.ttf"
));
nameTextView
.
setTypeface
(
AndroidUtilities
.
getTypeface
(
"fonts/rmedium.ttf"
));
actionBar
.
addView
(
nameTextView
);
actionBar
.
addView
(
nameTextView
);
...
@@ -248,11 +388,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -248,11 +388,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
nameTextView
.
setLayoutParams
(
layoutParams
);
nameTextView
.
setLayoutParams
(
layoutParams
);
onlineTextView
=
new
TextView
(
getParentActivity
());
onlineTextView
=
new
TextView
(
getParentActivity
());
onlineTextView
.
setTextColor
(
AvatarDrawable
.
getProfileTextColorForId
(
user_id
));
onlineTextView
.
setTextColor
(
AvatarDrawable
.
getProfileTextColorForId
(
user_id
!=
0
?
user_id
:
chat_id
));
onlineTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
14
);
onlineTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
14
);
onlineTextView
.
setLines
(
1
);
onlineTextView
.
setLines
(
1
);
onlineTextView
.
setMaxLines
(
1
);
onlineTextView
.
setMaxLines
(
1
);
onlineTextView
.
setSingleLine
(
true
);
onlineTextView
.
setSingleLine
(
true
);
onlineTextView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
onlineTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
onlineTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
actionBar
.
addView
(
onlineTextView
);
actionBar
.
addView
(
onlineTextView
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
onlineTextView
.
getLayoutParams
();
layoutParams
=
(
FrameLayout
.
LayoutParams
)
onlineTextView
.
getLayoutParams
();
...
@@ -265,10 +406,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -265,10 +406,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
onlineTextView
.
setLayoutParams
(
layoutParams
);
onlineTextView
.
setLayoutParams
(
layoutParams
);
listView
=
new
ListView
(
getParentActivity
());
listView
=
new
ListView
(
getParentActivity
());
listView
.
setDrawingCacheEnabled
(
false
);
listView
.
setDrawingCacheBackgroundColor
(
0
);
listView
.
setDivider
(
null
);
listView
.
setDivider
(
null
);
listView
.
setDividerHeight
(
0
);
listView
.
setDividerHeight
(
0
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setVerticalScrollBarEnabled
(
false
);
AndroidUtilities
.
setListViewEdgeEffectColor
(
listView
,
AvatarDrawable
.
getProfileBackColorForId
(
user_id
));
AndroidUtilities
.
setListViewEdgeEffectColor
(
listView
,
AvatarDrawable
.
getProfileBackColorForId
(
user_id
!=
0
?
user_id
:
chat_id
));
frameLayout
.
addView
(
listView
);
frameLayout
.
addView
(
listView
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
listView
.
getLayoutParams
();
layoutParams
=
(
FrameLayout
.
LayoutParams
)
listView
.
getLayoutParams
();
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
...
@@ -285,10 +428,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -285,10 +428,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
if
(
i
==
sharedMediaRow
)
{
if
(
i
==
sharedMediaRow
)
{
Bundle
args
=
new
Bundle
();
Bundle
args
=
new
Bundle
();
if
(
dialog
_id
!=
0
)
{
if
(
user
_id
!=
0
)
{
args
.
putLong
(
"dialog_id"
,
dialog_id
);
args
.
putLong
(
"dialog_id"
,
dialog_id
!=
0
?
dialog_id
:
user_id
);
}
else
{
}
else
{
args
.
putLong
(
"dialog_id"
,
user
_id
);
args
.
putLong
(
"dialog_id"
,
-
chat
_id
);
}
}
presentFragment
(
new
MediaActivity
(
args
));
presentFragment
(
new
MediaActivity
(
args
));
}
else
if
(
i
==
settingsKeyRow
)
{
}
else
if
(
i
==
settingsKeyRow
)
{
...
@@ -302,7 +445,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -302,7 +445,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
showAlertDialog
(
AndroidUtilities
.
buildTTLAlert
(
getParentActivity
(),
currentEncryptedChat
));
showAlertDialog
(
AndroidUtilities
.
buildTTLAlert
(
getParentActivity
(),
currentEncryptedChat
));
}
else
if
(
i
==
settingsNotificationsRow
)
{
}
else
if
(
i
==
settingsNotificationsRow
)
{
Bundle
args
=
new
Bundle
();
Bundle
args
=
new
Bundle
();
args
.
putLong
(
"dialog_id"
,
dialog_id
==
0
?
user_id
:
dialog_id
);
if
(
user_id
!=
0
)
{
args
.
putLong
(
"dialog_id"
,
dialog_id
==
0
?
user_id
:
dialog_id
);
}
else
if
(
chat_id
!=
0
)
{
args
.
putLong
(
"dialog_id"
,
-
chat_id
);
}
presentFragment
(
new
ProfileNotificationsActivity
(
args
));
presentFragment
(
new
ProfileNotificationsActivity
(
args
));
}
else
if
(
i
==
startSecretChatRow
)
{
}
else
if
(
i
==
startSecretChatRow
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
...
@@ -348,40 +495,147 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -348,40 +495,147 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
});
});
showAlertDialog
(
builder
);
showAlertDialog
(
builder
);
}
else
if
(
i
>
emptyRowChat2
&&
i
<
membersEndRow
)
{
int
user_id
=
info
.
participants
.
get
(
sortedUsers
.
get
(
i
-
emptyRowChat2
-
1
)).
user_id
;
if
(
user_id
==
UserConfig
.
getClientUserId
())
{
return
;
}
Bundle
args
=
new
Bundle
();
args
.
putInt
(
"user_id"
,
user_id
);
presentFragment
(
new
ProfileActivity
(
args
));
}
}
}
}
});
});
if
(
chat_id
!=
0
)
{
listView
.
setOnItemLongClickListener
(
new
AdapterView
.
OnItemLongClickListener
()
{
@Override
public
boolean
onItemLongClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
if
(
i
>
emptyRowChat2
&&
i
<
membersEndRow
)
{
if
(
getParentActivity
()
==
null
)
{
return
false
;
}
TLRPC
.
TL_chatParticipant
user
=
info
.
participants
.
get
(
sortedUsers
.
get
(
i
-
emptyRowChat2
-
1
));
if
(
user
.
user_id
==
UserConfig
.
getClientUserId
())
{
return
false
;
}
if
(
info
.
admin_id
!=
UserConfig
.
getClientUserId
()
&&
user
.
inviter_id
!=
UserConfig
.
getClientUserId
())
{
return
false
;
}
selectedUser
=
user
;
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
CharSequence
[]
items
=
new
CharSequence
[]{
chat_id
>
0
?
LocaleController
.
getString
(
"KickFromGroup"
,
R
.
string
.
KickFromGroup
)
:
LocaleController
.
getString
(
"KickFromBroadcast"
,
R
.
string
.
KickFromBroadcast
)};
builder
.
setItems
(
items
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
if
(
i
==
0
)
{
kickUser
(
selectedUser
);
}
}
});
showAlertDialog
(
builder
);
return
true
;
}
return
false
;
}
});
}
if
(
dialog_id
!=
0
)
{
if
(
dialog_id
!=
0
)
{
MessagesController
.
getInstance
().
getMediaCount
(
dialog_id
,
classGuid
,
true
);
MessagesController
.
getInstance
().
getMediaCount
(
dialog_id
,
classGuid
,
true
);
}
else
{
}
else
{
MessagesController
.
getInstance
().
getMediaCount
(
user_id
,
classGuid
,
true
);
MessagesController
.
getInstance
().
getMediaCount
(
user_id
,
classGuid
,
true
);
}
}
writeButton
=
new
ImageView
(
getParentActivity
());
frameLayout
.
addView
(
actionBar
);
writeButton
.
setImageResource
(
R
.
drawable
.
floating_user_states
);
frameLayout
.
addView
(
writeButton
);
if
(
user_id
!=
0
||
chat_id
>=
0
)
{
layoutParams
=
(
FrameLayout
.
LayoutParams
)
writeButton
.
getLayoutParams
();
writeButton
=
new
ImageView
(
getParentActivity
());
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
;
if
(
user_id
!=
0
)
{
layoutParams
.
height
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
;
writeButton
.
setImageResource
(
R
.
drawable
.
floating_user_states
);
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
16
:
0
);
}
else
if
(
chat_id
!=
0
)
{
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
0
:
16
);
writeButton
.
setImageResource
(
R
.
drawable
.
floating_group_states
);
layoutParams
.
gravity
=
(
LocaleController
.
isRTL
?
Gravity
.
LEFT
:
Gravity
.
RIGHT
);
}
writeButton
.
setLayoutParams
(
layoutParams
);
frameLayout
.
addView
(
writeButton
);
writeButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
layoutParams
=
(
FrameLayout
.
LayoutParams
)
writeButton
.
getLayoutParams
();
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
height
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
16
:
0
);
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
0
:
16
);
layoutParams
.
gravity
=
(
LocaleController
.
isRTL
?
Gravity
.
LEFT
:
Gravity
.
RIGHT
);
writeButton
.
setLayoutParams
(
layoutParams
);
writeButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
getParentActivity
()
==
null
)
{
return
;
}
if
(
user_id
!=
0
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
if
(
user
==
null
||
user
instanceof
TLRPC
.
TL_userEmpty
)
{
return
;
}
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
closeChats
);
Bundle
args
=
new
Bundle
();
args
.
putInt
(
"user_id"
,
user_id
);
presentFragment
(
new
ChatActivity
(
args
),
true
);
}
else
if
(
chat_id
!=
0
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
getParentActivity
());
CharSequence
[]
items
;
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
.
photo
==
null
||
chat
.
photo
.
photo_big
==
null
||
chat
.
photo
instanceof
TLRPC
.
TL_chatPhotoEmpty
)
{
items
=
new
CharSequence
[]{
LocaleController
.
getString
(
"FromCamera"
,
R
.
string
.
FromCamera
),
LocaleController
.
getString
(
"FromGalley"
,
R
.
string
.
FromGalley
)};
}
else
{
items
=
new
CharSequence
[]{
LocaleController
.
getString
(
"FromCamera"
,
R
.
string
.
FromCamera
),
LocaleController
.
getString
(
"FromGalley"
,
R
.
string
.
FromGalley
),
LocaleController
.
getString
(
"DeletePhoto"
,
R
.
string
.
DeletePhoto
)};
}
builder
.
setItems
(
items
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
int
action
=
0
;
if
(
i
==
0
)
{
avatarUpdater
.
openCamera
();
}
else
if
(
i
==
1
)
{
avatarUpdater
.
openGallery
();
}
else
if
(
i
==
3
)
{
MessagesController
.
getInstance
().
changeChatAvatar
(
chat_id
,
null
);
}
}
});
showAlertDialog
(
builder
);
}
}
});
}
listView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onScrollStateChanged
(
AbsListView
view
,
int
scrollState
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
if
(
user
==
null
||
user
instanceof
TLRPC
.
TL_userEmpty
)
{
}
@Override
public
void
onScroll
(
AbsListView
view
,
int
firstVisibleItem
,
int
visibleItemCount
,
int
totalItemCount
)
{
if
(
totalItemCount
==
0
)
{
return
;
return
;
}
}
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
closeChats
);
int
height
=
0
;
Bundle
args
=
new
Bundle
();
View
child
=
view
.
getChildAt
(
0
);
args
.
putInt
(
"user_id"
,
user_id
);
if
(
child
!=
null
)
{
presentFragment
(
new
ChatActivity
(
args
),
true
);
if
(
firstVisibleItem
==
0
)
{
height
=
AndroidUtilities
.
dp
(
88
)
+
child
.
getTop
();
}
if
(
actionBar
.
getExtraHeight
()
!=
height
)
{
actionBar
.
setExtraHeight
(
height
,
true
);
needLayout
();
}
}
}
}
});
});
update
User
Data
();
update
Profile
Data
();
}
else
{
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
if
(
parent
!=
null
)
{
...
@@ -391,6 +645,85 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -391,6 +645,85 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return
fragmentView
;
return
fragmentView
;
}
}
@Override
public
void
saveSelfArgs
(
Bundle
args
)
{
if
(
chat_id
!=
0
)
{
if
(
avatarUpdater
!=
null
&&
avatarUpdater
.
currentPicturePath
!=
null
)
{
args
.
putString
(
"path"
,
avatarUpdater
.
currentPicturePath
);
}
}
}
@Override
public
void
restoreSelfArgs
(
Bundle
args
)
{
if
(
chat_id
!=
0
)
{
MessagesController
.
getInstance
().
loadChatInfo
(
chat_id
,
null
);
if
(
avatarUpdater
!=
null
)
{
avatarUpdater
.
currentPicturePath
=
args
.
getString
(
"path"
);
}
}
}
@Override
public
void
onActivityResultFragment
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
chat_id
!=
0
)
{
avatarUpdater
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
}
private
void
needLayout
()
{
FrameLayout
.
LayoutParams
layoutParams
;
if
(
listView
!=
null
)
{
layoutParams
=
(
FrameLayout
.
LayoutParams
)
listView
.
getLayoutParams
();
layoutParams
.
topMargin
=
(
Build
.
VERSION
.
SDK_INT
>=
21
?
AndroidUtilities
.
statusBarHeight
:
0
)
+
AndroidUtilities
.
getCurrentActionBarHeight
();
listView
.
setLayoutParams
(
layoutParams
);
}
if
(
avatarImage
!=
null
)
{
float
diff
=
actionBar
.
getExtraHeight
()
/
(
float
)
AndroidUtilities
.
dp
(
88
);
float
diffm
=
1.0f
-
diff
;
int
avatarSize
=
42
+
(
int
)(
18
*
diff
);
int
avatarX
=
17
+
(
int
)(
47
*
diffm
);
int
avatarY
=
AndroidUtilities
.
dp
(
22
)
-
(
int
)((
AndroidUtilities
.
dp
(
22
)
-
(
AndroidUtilities
.
getCurrentActionBarHeight
()
-
AndroidUtilities
.
dp
(
42
))
/
2
)
*
(
1.0f
-
diff
));
int
nameX
=
97
+
(
int
)(
21
*
diffm
);
int
nameEndX
=
16
+
(
int
)(
32
*
diffm
);
float
nameFontSize
=
20
-
2
*
diffm
;
int
nameY
=
avatarY
+
AndroidUtilities
.
dp
(
29
-
10
*
diffm
);
int
statusY
=
avatarY
+
AndroidUtilities
.
dp
(
8
-
7
*
diffm
);
if
(
writeButton
!=
null
)
{
layoutParams
=
(
FrameLayout
.
LayoutParams
)
writeButton
.
getLayoutParams
();
layoutParams
.
topMargin
=
(
Build
.
VERSION
.
SDK_INT
>=
21
?
AndroidUtilities
.
statusBarHeight
:
0
)
+
AndroidUtilities
.
getCurrentActionBarHeight
()
+
actionBar
.
getExtraHeight
()
-
AndroidUtilities
.
dp
(
29.5f
);
writeButton
.
setLayoutParams
(
layoutParams
);
ViewProxy
.
setAlpha
(
writeButton
,
diff
);
writeButton
.
setVisibility
(
diff
==
0
?
View
.
GONE
:
View
.
VISIBLE
);
}
avatarImage
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
avatarSize
/
2
));
layoutParams
=
(
FrameLayout
.
LayoutParams
)
avatarImage
.
getLayoutParams
();
layoutParams
.
width
=
AndroidUtilities
.
dp
(
avatarSize
);
layoutParams
.
height
=
AndroidUtilities
.
dp
(
avatarSize
);
layoutParams
.
leftMargin
=
LocaleController
.
isRTL
?
0
:
AndroidUtilities
.
dp
(
avatarX
);
layoutParams
.
rightMargin
=
LocaleController
.
isRTL
?
AndroidUtilities
.
dp
(
avatarX
)
:
0
;
layoutParams
.
bottomMargin
=
avatarY
;
avatarImage
.
setLayoutParams
(
layoutParams
);
nameTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
nameFontSize
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
nameTextView
.
getLayoutParams
();
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameEndX
:
nameX
);
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameX
:
nameEndX
);
layoutParams
.
bottomMargin
=
nameY
;
nameTextView
.
setLayoutParams
(
layoutParams
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
onlineTextView
.
getLayoutParams
();
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameEndX
:
nameX
);
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameX
:
nameEndX
);
layoutParams
.
bottomMargin
=
statusY
;
onlineTextView
.
setLayoutParams
(
layoutParams
);
}
}
private
void
fixLayout
()
{
private
void
fixLayout
()
{
if
(
fragmentView
==
null
)
{
if
(
fragmentView
==
null
)
{
return
;
return
;
...
@@ -399,12 +732,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -399,12 +732,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
@Override
public
boolean
onPreDraw
()
{
public
boolean
onPreDraw
()
{
if
(
fragmentView
!=
null
)
{
if
(
fragmentView
!=
null
)
{
ViewGroup
.
MarginLayoutParams
layoutParams
=
(
ViewGroup
.
MarginLayoutParams
)
listView
.
getLayoutParams
();
needLayout
();
layoutParams
.
topMargin
=
actionBar
.
getHeight
();
listView
.
setLayoutParams
(
layoutParams
);
layoutParams
=
(
ViewGroup
.
MarginLayoutParams
)
writeButton
.
getLayoutParams
();
layoutParams
.
topMargin
=
actionBar
.
getHeight
()
-
AndroidUtilities
.
dp
(
29.5f
);
writeButton
.
setLayoutParams
(
layoutParams
);
fragmentView
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
fragmentView
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
}
}
return
false
;
return
false
;
...
@@ -423,20 +751,47 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -423,20 +751,47 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return
false
;
return
false
;
}
}
@Override
public
void
didReceivedNotification
(
int
id
,
final
Object
...
args
)
{
public
void
didReceivedNotification
(
int
id
,
final
Object
...
args
)
{
if
(
id
==
NotificationCenter
.
updateInterfaces
)
{
if
(
id
==
NotificationCenter
.
updateInterfaces
)
{
int
mask
=
(
Integer
)
args
[
0
];
int
mask
=
(
Integer
)
args
[
0
];
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
)
{
if
(
user_id
!=
0
)
{
updateUserData
();
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
)
{
updateProfileData
();
}
}
else
if
(
chat_id
!=
0
)
{
if
((
mask
&
MessagesController
.
UPDATE_MASK_CHAT_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_CHAT_NAME
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_CHAT_MEMBERS
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
updateOnlineCount
();
updateProfileData
();
}
if
((
mask
&
MessagesController
.
UPDATE_MASK_AVATAR
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_NAME
)
!=
0
||
(
mask
&
MessagesController
.
UPDATE_MASK_STATUS
)
!=
0
)
{
int
count
=
listView
.
getChildCount
();
for
(
int
a
=
0
;
a
<
count
;
a
++)
{
View
child
=
listView
.
getChildAt
(
a
);
if
(
child
instanceof
UserCell
)
{
((
UserCell
)
child
).
update
(
mask
);
}
}
}
}
}
}
else
if
(
id
==
NotificationCenter
.
contactsDidLoaded
)
{
}
else
if
(
id
==
NotificationCenter
.
contactsDidLoaded
)
{
createActionBarMenu
();
createActionBarMenu
();
}
else
if
(
id
==
NotificationCenter
.
mediaCountDidLoaded
)
{
}
else
if
(
id
==
NotificationCenter
.
mediaCountDidLoaded
)
{
long
uid
=
(
Long
)
args
[
0
];
long
uid
=
(
Long
)
args
[
0
];
if
(
uid
>
0
&&
user_id
==
uid
&&
dialog_id
==
0
||
dialog_id
!=
0
&&
dialog_id
==
uid
)
{
if
(
user_id
!=
0
)
{
totalMediaCount
=
(
Integer
)
args
[
1
];
if
(
uid
>
0
&&
user_id
==
uid
&&
dialog_id
==
0
||
dialog_id
!=
0
&&
dialog_id
==
uid
)
{
if
(
listView
!=
null
)
{
totalMediaCount
=
(
Integer
)
args
[
1
];
listView
.
invalidateViews
();
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
}
else
if
(
chat_id
!=
0
)
{
int
lower_part
=
(
int
)
uid
;
if
(
lower_part
<
0
&&
chat_id
==
-
lower_part
)
{
totalMediaCount
=
(
Integer
)
args
[
1
];
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
}
}
}
}
else
if
(
id
==
NotificationCenter
.
encryptedChatCreated
)
{
}
else
if
(
id
==
NotificationCenter
.
encryptedChatCreated
)
{
...
@@ -467,6 +822,18 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -467,6 +822,18 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if
(
oldValue
!=
userBlocked
)
{
if
(
oldValue
!=
userBlocked
)
{
createActionBarMenu
();
createActionBarMenu
();
}
}
}
else
if
(
id
==
NotificationCenter
.
chatInfoDidLoaded
)
{
int
chatId
=
(
Integer
)
args
[
0
];
if
(
chatId
==
chat_id
)
{
info
=
(
TLRPC
.
ChatParticipants
)
args
[
1
];
updateOnlineCount
();
updateRowsIds
();
if
(
listAdapter
!=
null
)
{
listAdapter
.
notifyDataSetChanged
();
}
}
}
else
if
(
id
==
NotificationCenter
.
closeChats
)
{
removeSelfFromStack
();
}
}
}
}
...
@@ -484,22 +851,33 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -484,22 +851,33 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if
(
fileLocation
==
null
)
{
if
(
fileLocation
==
null
)
{
return
null
;
return
null
;
}
}
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
if
(
user
!=
null
&&
user
.
photo
!=
null
&&
user
.
photo
.
photo_big
!=
null
)
{
TLRPC
.
FileLocation
photoBig
=
null
;
TLRPC
.
FileLocation
photoBig
=
user
.
photo
.
photo_big
;
if
(
user_id
!=
0
)
{
if
(
photoBig
.
local_id
==
fileLocation
.
local_id
&&
photoBig
.
volume_id
==
fileLocation
.
volume_id
&&
photoBig
.
dc_id
==
fileLocation
.
dc_id
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
int
coords
[]
=
new
int
[
2
];
if
(
user
!=
null
&&
user
.
photo
!=
null
&&
user
.
photo
.
photo_big
!=
null
)
{
avatarImage
.
getLocationInWindow
(
coords
);
photoBig
=
user
.
photo
.
photo_big
;
PhotoViewer
.
PlaceProviderObject
object
=
new
PhotoViewer
.
PlaceProviderObject
();
object
.
viewX
=
coords
[
0
];
object
.
viewY
=
coords
[
1
]
-
AndroidUtilities
.
statusBarHeight
;
object
.
parentView
=
avatarImage
;
object
.
imageReceiver
=
avatarImage
.
imageReceiver
;
object
.
user_id
=
user_id
;
object
.
thumb
=
object
.
imageReceiver
.
getBitmap
();
object
.
size
=
-
1
;
return
object
;
}
}
}
else
if
(
chat_id
!=
0
)
{
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
!=
null
&&
chat
.
photo
!=
null
&&
chat
.
photo
.
photo_big
!=
null
)
{
photoBig
=
chat
.
photo
.
photo_big
;
}
}
if
(
photoBig
!=
null
&&
photoBig
.
local_id
==
fileLocation
.
local_id
&&
photoBig
.
volume_id
==
fileLocation
.
volume_id
&&
photoBig
.
dc_id
==
fileLocation
.
dc_id
)
{
int
coords
[]
=
new
int
[
2
];
avatarImage
.
getLocationInWindow
(
coords
);
PhotoViewer
.
PlaceProviderObject
object
=
new
PhotoViewer
.
PlaceProviderObject
();
object
.
viewX
=
coords
[
0
];
object
.
viewY
=
coords
[
1
]
-
AndroidUtilities
.
statusBarHeight
;
object
.
parentView
=
avatarImage
;
object
.
imageReceiver
=
avatarImage
.
imageReceiver
;
object
.
user_id
=
user_id
;
object
.
thumb
=
object
.
imageReceiver
.
getBitmap
();
object
.
size
=
-
1
;
return
object
;
}
}
return
null
;
return
null
;
}
}
...
@@ -525,73 +903,199 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -525,73 +903,199 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
@Override
public
int
getSelectedCount
()
{
return
0
;
}
public
int
getSelectedCount
()
{
return
0
;
}
private
void
updateRowsIds
()
{
private
void
updateOnlineCount
()
{
rowCount
=
0
;
if
(
info
==
null
)
{
emptyRow
=
rowCount
++;
return
;
phoneRow
=
rowCount
++;
}
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
onlineCount
=
0
;
if
(
user
!=
null
&&
user
.
username
!=
null
&&
user
.
username
.
length
()
>
0
)
{
int
currentTime
=
ConnectionsManager
.
getInstance
().
getCurrentTime
();
usernameRow
=
rowCount
++;
sortedUsers
.
clear
();
}
else
{
int
i
=
0
;
usernameRow
=
-
1
;
for
(
TLRPC
.
TL_chatParticipant
participant
:
info
.
participants
)
{
}
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
participant
.
user_id
);
sectionRow
=
rowCount
++;
if
(
user
!=
null
&&
user
.
status
!=
null
&&
(
user
.
status
.
expires
>
currentTime
||
user
.
id
==
UserConfig
.
getClientUserId
())
&&
user
.
status
.
expires
>
10000
)
{
settingsNotificationsRow
=
rowCount
++;
onlineCount
++;
sharedMediaRow
=
rowCount
++;
}
if
(
currentEncryptedChat
instanceof
TLRPC
.
TL_encryptedChat
)
{
sortedUsers
.
add
(
i
);
settingsTimerRow
=
rowCount
++;
i
++;
settingsKeyRow
=
rowCount
++;
}
else
{
settingsTimerRow
=
-
1
;
settingsKeyRow
=
-
1
;
}
}
if
(
currentEncryptedChat
==
null
)
{
startSecretChatRow
=
rowCount
++;
Collections
.
sort
(
sortedUsers
,
new
Comparator
<
Integer
>()
{
@Override
public
int
compare
(
Integer
lhs
,
Integer
rhs
)
{
TLRPC
.
User
user1
=
MessagesController
.
getInstance
().
getUser
(
info
.
participants
.
get
(
rhs
).
user_id
);
TLRPC
.
User
user2
=
MessagesController
.
getInstance
().
getUser
(
info
.
participants
.
get
(
lhs
).
user_id
);
Integer
status1
=
0
;
Integer
status2
=
0
;
if
(
user1
!=
null
&&
user1
.
status
!=
null
)
{
if
(
user1
.
id
==
UserConfig
.
getClientUserId
())
{
status1
=
ConnectionsManager
.
getInstance
().
getCurrentTime
()
+
50000
;
}
else
{
status1
=
user1
.
status
.
expires
;
}
}
if
(
user2
!=
null
&&
user2
.
status
!=
null
)
{
if
(
user2
.
id
==
UserConfig
.
getClientUserId
())
{
status2
=
ConnectionsManager
.
getInstance
().
getCurrentTime
()
+
50000
;
}
else
{
status2
=
user2
.
status
.
expires
;
}
}
return
status1
.
compareTo
(
status2
);
}
});
if
(
listView
!=
null
)
{
listView
.
invalidateViews
();
}
}
public
void
setChatInfo
(
TLRPC
.
ChatParticipants
chatParticipants
)
{
info
=
chatParticipants
;
}
private
void
kickUser
(
TLRPC
.
TL_chatParticipant
user
)
{
if
(
user
!=
null
)
{
MessagesController
.
getInstance
().
deleteUserFromChat
(
chat_id
,
MessagesController
.
getInstance
().
getUser
(
user
.
user_id
),
info
);
}
else
{
}
else
{
startSecretChatRow
=
-
1
;
NotificationCenter
.
getInstance
().
removeObserver
(
this
,
NotificationCenter
.
closeChats
);
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
closeChats
);
MessagesController
.
getInstance
().
deleteUserFromChat
(
chat_id
,
MessagesController
.
getInstance
().
getUser
(
UserConfig
.
getClientUserId
()),
info
);
MessagesController
.
getInstance
().
deleteDialog
(-
chat_id
,
0
,
false
);
finishFragment
();
}
}
}
}
private
void
updateUserData
()
{
public
boolean
isChat
()
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
return
chat_id
!=
0
;
TLRPC
.
FileLocation
photo
=
null
;
}
TLRPC
.
FileLocation
photoBig
=
null
;
if
(
user
.
photo
!=
null
)
{
private
void
updateRowsIds
()
{
photo
=
user
.
photo
.
photo_small
;
rowCount
=
0
;
photoBig
=
user
.
photo
.
photo_big
;
overscrollRow
=
rowCount
++;
if
(
user_id
!=
0
)
{
emptyRow
=
rowCount
++;
phoneRow
=
rowCount
++;
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
if
(
user
!=
null
&&
user
.
username
!=
null
&&
user
.
username
.
length
()
>
0
)
{
usernameRow
=
rowCount
++;
}
else
{
usernameRow
=
-
1
;
}
sectionRow
=
rowCount
++;
settingsNotificationsRow
=
rowCount
++;
sharedMediaRow
=
rowCount
++;
if
(
currentEncryptedChat
instanceof
TLRPC
.
TL_encryptedChat
)
{
settingsTimerRow
=
rowCount
++;
settingsKeyRow
=
rowCount
++;
}
else
{
settingsTimerRow
=
-
1
;
settingsKeyRow
=
-
1
;
}
if
(
currentEncryptedChat
==
null
)
{
startSecretChatRow
=
rowCount
++;
}
else
{
startSecretChatRow
=
-
1
;
}
}
else
if
(
chat_id
!=
0
)
{
if
(
chat_id
>
0
)
{
emptyRow
=
rowCount
++;
settingsNotificationsRow
=
rowCount
++;
sharedMediaRow
=
rowCount
++;
emptyRowChat
=
rowCount
++;
membersSectionRow
=
rowCount
++;
}
if
(
info
!=
null
&&
!(
info
instanceof
TLRPC
.
TL_chatParticipantsForbidden
))
{
emptyRowChat2
=
rowCount
++;
rowCount
+=
info
.
participants
.
size
();
membersEndRow
=
rowCount
;
int
maxCount
=
chat_id
>
0
?
MessagesController
.
getInstance
().
maxGroupCount
:
MessagesController
.
getInstance
().
maxBroadcastCount
;
}
else
{
membersEndRow
=
-
1
;
membersSectionRow
=
-
1
;
emptyRowChat2
=
-
1
;
}
}
}
avatarImage
.
setImage
(
photo
,
"50_50"
,
new
AvatarDrawable
(
user
,
true
));
}
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
nameTextView
.
setText
(
ContactsController
.
formatName
(
user
.
first_name
,
user
.
last_name
));
private
void
updateProfileData
()
{
onlineTextView
.
setText
(
LocaleController
.
formatUserStatus
(
user
));
if
(
user_id
!=
0
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
TLRPC
.
FileLocation
photo
=
null
;
TLRPC
.
FileLocation
photoBig
=
null
;
if
(
user
.
photo
!=
null
)
{
photo
=
user
.
photo
.
photo_small
;
photoBig
=
user
.
photo
.
photo_big
;
}
avatarImage
.
setImage
(
photo
,
"50_50"
,
new
AvatarDrawable
(
user
,
true
));
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
nameTextView
.
setText
(
ContactsController
.
formatName
(
user
.
first_name
,
user
.
last_name
));
onlineTextView
.
setText
(
LocaleController
.
formatUserStatus
(
user
));
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
}
else
if
(
chat_id
!=
0
)
{
TLRPC
.
Chat
chat
=
MessagesController
.
getInstance
().
getChat
(
chat_id
);
if
(
chat
!=
null
)
{
currentChat
=
chat
;
}
nameTextView
.
setText
(
chat
.
title
);
int
count
=
chat
.
participants_count
;
if
(
info
!=
null
)
{
count
=
info
.
participants
.
size
();
}
if
(
count
!=
0
&&
onlineCount
>
1
)
{
onlineTextView
.
setText
(
Html
.
fromHtml
(
String
.
format
(
"%s, %s"
,
LocaleController
.
formatPluralString
(
"Members"
,
count
),
LocaleController
.
formatPluralString
(
"Online"
,
onlineCount
))));
}
else
{
onlineTextView
.
setText
(
LocaleController
.
formatPluralString
(
"Members"
,
count
));
}
TLRPC
.
FileLocation
photo
=
null
;
TLRPC
.
FileLocation
photoBig
=
null
;
if
(
chat
.
photo
!=
null
)
{
photo
=
chat
.
photo
.
photo_small
;
photoBig
=
chat
.
photo
.
photo_big
;
}
avatarImage
.
setImage
(
photo
,
"50_50"
,
new
AvatarDrawable
(
chat
));
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
}
}
}
private
void
createActionBarMenu
()
{
private
void
createActionBarMenu
()
{
ActionBarMenu
menu
=
actionBar
.
createMenu
();
ActionBarMenu
menu
=
actionBar
.
createMenu
();
menu
.
clearItems
();
menu
.
clearItems
();
if
(
ContactsController
.
getInstance
().
contactsDict
.
get
(
user_id
)
==
null
)
{
if
(
user_id
!=
0
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
if
(
ContactsController
.
getInstance
().
contactsDict
.
get
(
user_id
)
==
null
)
{
if
(
user
==
null
)
{
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
user_id
);
return
;
if
(
user
==
null
)
{
}
return
;
ActionBarMenuItem
item
=
menu
.
addItem
(
0
,
R
.
drawable
.
ic_ab_other
);
}
if
(
user
.
phone
!=
null
&&
user
.
phone
.
length
()
!=
0
)
{
ActionBarMenuItem
item
=
menu
.
addItem
(
0
,
R
.
drawable
.
ic_ab_other
);
item
.
addSubItem
(
add_contact
,
LocaleController
.
getString
(
"AddContact"
,
R
.
string
.
AddContact
),
0
);
if
(
user
.
phone
!=
null
&&
user
.
phone
.
length
()
!=
0
)
{
item
.
addSubItem
(
share_contact
,
LocaleController
.
getString
(
"ShareContact"
,
R
.
string
.
ShareContact
),
0
);
item
.
addSubItem
(
add_contact
,
LocaleController
.
getString
(
"AddContact"
,
R
.
string
.
AddContact
),
0
);
item
.
addSubItem
(
block_contact
,
!
userBlocked
?
LocaleController
.
getString
(
"BlockContact"
,
R
.
string
.
BlockContact
)
:
LocaleController
.
getString
(
"Unblock"
,
R
.
string
.
Unblock
),
0
);
item
.
addSubItem
(
share_contact
,
LocaleController
.
getString
(
"ShareContact"
,
R
.
string
.
ShareContact
),
0
);
item
.
addSubItem
(
block_contact
,
!
userBlocked
?
LocaleController
.
getString
(
"BlockContact"
,
R
.
string
.
BlockContact
)
:
LocaleController
.
getString
(
"Unblock"
,
R
.
string
.
Unblock
),
0
);
}
else
{
item
.
addSubItem
(
block_contact
,
!
userBlocked
?
LocaleController
.
getString
(
"BlockContact"
,
R
.
string
.
BlockContact
)
:
LocaleController
.
getString
(
"Unblock"
,
R
.
string
.
Unblock
),
0
);
}
}
else
{
}
else
{
ActionBarMenuItem
item
=
menu
.
addItem
(
0
,
R
.
drawable
.
ic_ab_other
);
item
.
addSubItem
(
share_contact
,
LocaleController
.
getString
(
"ShareContact"
,
R
.
string
.
ShareContact
),
0
);
item
.
addSubItem
(
block_contact
,
!
userBlocked
?
LocaleController
.
getString
(
"BlockContact"
,
R
.
string
.
BlockContact
)
:
LocaleController
.
getString
(
"Unblock"
,
R
.
string
.
Unblock
),
0
);
item
.
addSubItem
(
block_contact
,
!
userBlocked
?
LocaleController
.
getString
(
"BlockContact"
,
R
.
string
.
BlockContact
)
:
LocaleController
.
getString
(
"Unblock"
,
R
.
string
.
Unblock
),
0
);
item
.
addSubItem
(
edit_contact
,
LocaleController
.
getString
(
"EditContact"
,
R
.
string
.
EditContact
),
0
);
item
.
addSubItem
(
delete_contact
,
LocaleController
.
getString
(
"DeleteContact"
,
R
.
string
.
DeleteContact
),
0
);
}
}
}
else
{
}
else
if
(
chat_id
!=
0
)
{
ActionBarMenuItem
item
=
menu
.
addItem
(
0
,
R
.
drawable
.
ic_ab_other
);
ActionBarMenuItem
item
=
menu
.
addItem
(
0
,
R
.
drawable
.
ic_ab_other
);
item
.
addSubItem
(
share_contact
,
LocaleController
.
getString
(
"ShareContact"
,
R
.
string
.
ShareContact
),
0
);
item
.
addSubItem
(
edit_name
,
LocaleController
.
getString
(
"EditName"
,
R
.
string
.
EditName
),
0
);
item
.
addSubItem
(
block_contact
,
!
userBlocked
?
LocaleController
.
getString
(
"BlockContact"
,
R
.
string
.
BlockContact
)
:
LocaleController
.
getString
(
"Unblock"
,
R
.
string
.
Unblock
),
0
);
if
(
chat_id
>
0
)
{
item
.
addSubItem
(
edit_contact
,
LocaleController
.
getString
(
"EditContact"
,
R
.
string
.
EditContact
),
0
);
item
.
addSubItem
(
add_member
,
LocaleController
.
getString
(
"AddMember"
,
R
.
string
.
AddMember
),
0
);
item
.
addSubItem
(
delete_contact
,
LocaleController
.
getString
(
"DeleteContact"
,
R
.
string
.
DeleteContact
),
0
);
item
.
addSubItem
(
leave_group
,
LocaleController
.
getString
(
"DeleteAndExit"
,
R
.
string
.
DeleteAndExit
),
0
);
}
else
{
item
.
addSubItem
(
add_member
,
LocaleController
.
getString
(
"AddRecipient"
,
R
.
string
.
AddRecipient
),
0
);
}
}
}
}
}
...
@@ -639,7 +1143,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -639,7 +1143,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
@Override
public
boolean
isEnabled
(
int
i
)
{
public
boolean
isEnabled
(
int
i
)
{
return
i
==
phoneRow
||
i
==
settingsTimerRow
||
i
==
settingsKeyRow
||
i
==
settingsNotificationsRow
||
i
==
sharedMediaRow
||
i
==
startSecretChatRow
;
if
(
user_id
!=
0
)
{
return
i
==
phoneRow
||
i
==
settingsTimerRow
||
i
==
settingsKeyRow
||
i
==
settingsNotificationsRow
||
i
==
sharedMediaRow
||
i
==
startSecretChatRow
;
}
else
if
(
chat_id
!=
0
)
{
return
i
==
settingsNotificationsRow
||
i
==
sharedMediaRow
||
i
>
emptyRowChat2
&&
i
<
membersEndRow
;
}
return
false
;
}
}
@Override
@Override
...
@@ -667,7 +1176,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -667,7 +1176,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
int
type
=
getItemViewType
(
i
);
int
type
=
getItemViewType
(
i
);
if
(
type
==
0
)
{
if
(
type
==
0
)
{
if
(
view
==
null
)
{
if
(
view
==
null
)
{
view
=
new
EmptyCell
(
mContext
,
36
);
view
=
new
EmptyCell
(
mContext
);
}
if
(
i
==
overscrollRow
)
{
((
EmptyCell
)
view
).
setHeight
(
88
);
}
else
if
(
i
==
emptyRowChat
||
i
==
emptyRowChat2
)
{
((
EmptyCell
)
view
).
setHeight
(
8
);
}
else
{
((
EmptyCell
)
view
).
setHeight
(
36
);
}
}
}
else
if
(
type
==
1
)
{
}
else
if
(
type
==
1
)
{
if
(
view
==
null
)
{
if
(
view
==
null
)
{
...
@@ -733,13 +1249,24 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -733,13 +1249,24 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
identiconDrawable
.
setBytes
(
encryptedChat
.
auth_key
);
identiconDrawable
.
setBytes
(
encryptedChat
.
auth_key
);
textCell
.
setTextAndValueDrawable
(
LocaleController
.
getString
(
"EncryptionKey"
,
R
.
string
.
EncryptionKey
),
identiconDrawable
);
textCell
.
setTextAndValueDrawable
(
LocaleController
.
getString
(
"EncryptionKey"
,
R
.
string
.
EncryptionKey
),
identiconDrawable
);
}
}
}
else
if
(
type
==
4
)
{
if
(
view
==
null
)
{
view
=
new
UserCell
(
mContext
,
61
);
}
TLRPC
.
TL_chatParticipant
part
=
info
.
participants
.
get
(
sortedUsers
.
get
(
i
-
emptyRowChat2
-
1
));
((
UserCell
)
view
).
setData
(
MessagesController
.
getInstance
().
getUser
(
part
.
user_id
),
null
,
null
,
i
==
emptyRowChat2
+
1
?
R
.
drawable
.
menu_newgroup
:
0
);
}
else
if
(
type
==
5
)
{
if
(
view
==
null
)
{
view
=
new
ShadowSectionCell
(
mContext
);
}
}
}
return
view
;
return
view
;
}
}
@Override
@Override
public
int
getItemViewType
(
int
i
)
{
public
int
getItemViewType
(
int
i
)
{
if
(
i
==
emptyRow
)
{
if
(
i
==
emptyRow
||
i
==
overscrollRow
||
i
==
emptyRowChat
||
i
==
emptyRowChat2
)
{
return
0
;
return
0
;
}
else
if
(
i
==
sectionRow
)
{
}
else
if
(
i
==
sectionRow
)
{
return
1
;
return
1
;
...
@@ -747,13 +1274,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
...
@@ -747,13 +1274,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return
2
;
return
2
;
}
else
if
(
i
==
sharedMediaRow
||
i
==
settingsTimerRow
||
i
==
settingsNotificationsRow
||
i
==
startSecretChatRow
||
i
==
settingsKeyRow
)
{
}
else
if
(
i
==
sharedMediaRow
||
i
==
settingsTimerRow
||
i
==
settingsNotificationsRow
||
i
==
startSecretChatRow
||
i
==
settingsKeyRow
)
{
return
3
;
return
3
;
}
else
if
(
i
>
emptyRowChat2
&&
i
<
membersEndRow
)
{
return
4
;
}
else
if
(
i
==
membersSectionRow
)
{
return
5
;
}
}
return
0
;
return
0
;
}
}
@Override
@Override
public
int
getViewTypeCount
()
{
public
int
getViewTypeCount
()
{
return
4
;
return
6
;
}
}
@Override
@Override
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java
View file @
ea0b86d0
...
@@ -18,9 +18,11 @@ import android.content.SharedPreferences;
...
@@ -18,9 +18,11 @@ import android.content.SharedPreferences;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageInfo
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.Html
;
import
android.text.Html
;
import
android.text.Spannable
;
import
android.text.Spannable
;
import
android.text.TextUtils
;
import
android.text.method.LinkMovementMethod
;
import
android.text.method.LinkMovementMethod
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
...
@@ -30,6 +32,7 @@ import android.view.MotionEvent;
...
@@ -30,6 +32,7 @@ import android.view.MotionEvent;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.ViewTreeObserver
;
import
android.view.ViewTreeObserver
;
import
android.widget.AbsListView
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
...
@@ -58,6 +61,7 @@ import org.telegram.messenger.RPCRequest;
...
@@ -58,6 +61,7 @@ import org.telegram.messenger.RPCRequest;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.messenger.UserConfig
;
import
org.telegram.android.MessageObject
;
import
org.telegram.android.MessageObject
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.AnimationCompat.ViewProxy
;
import
org.telegram.ui.Cells.TextInfoCell
;
import
org.telegram.ui.Cells.TextInfoCell
;
import
org.telegram.ui.Cells.EmptyCell
;
import
org.telegram.ui.Cells.EmptyCell
;
import
org.telegram.ui.Cells.HeaderCell
;
import
org.telegram.ui.Cells.HeaderCell
;
...
@@ -88,6 +92,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -88,6 +92,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
private
ImageView
writeButton
;
private
ImageView
writeButton
;
private
AvatarUpdater
avatarUpdater
=
new
AvatarUpdater
();
private
AvatarUpdater
avatarUpdater
=
new
AvatarUpdater
();
private
int
overscrollRow
;
private
int
emptyRow
;
private
int
emptyRow
;
private
int
numberSectionRow
;
private
int
numberSectionRow
;
private
int
numberRow
;
private
int
numberRow
;
...
@@ -200,6 +205,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -200,6 +205,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
NotificationCenter
.
getInstance
().
addObserver
(
this
,
NotificationCenter
.
updateInterfaces
);
rowCount
=
0
;
rowCount
=
0
;
overscrollRow
=
rowCount
++;
emptyRow
=
rowCount
++;
emptyRow
=
rowCount
++;
numberSectionRow
=
rowCount
++;
numberSectionRow
=
rowCount
++;
numberRow
=
rowCount
++;
numberRow
=
rowCount
++;
...
@@ -261,7 +267,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -261,7 +267,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
actionBar
.
setItemsBackground
(
AvatarDrawable
.
getButtonColorForId
(
5
));
actionBar
.
setItemsBackground
(
AvatarDrawable
.
getButtonColorForId
(
5
));
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackButtonImage
(
R
.
drawable
.
ic_ab_back
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
actionBar
.
setBackOverlay
(
R
.
layout
.
updating_state_layout
);
actionBar
.
setExtraHeight
(
AndroidUtilities
.
dp
(
88
));
actionBar
.
setExtraHeight
(
AndroidUtilities
.
dp
(
88
)
,
false
);
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
actionBar
.
setActionBarMenuOnItemClick
(
new
ActionBar
.
ActionBarMenuOnItemClick
()
{
@Override
@Override
public
void
onItemClick
(
int
id
)
{
public
void
onItemClick
(
int
id
)
{
...
@@ -306,7 +312,6 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -306,7 +312,6 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
fragmentView
=
new
FrameLayout
(
getParentActivity
());
fragmentView
=
new
FrameLayout
(
getParentActivity
());
FrameLayout
frameLayout
=
(
FrameLayout
)
fragmentView
;
FrameLayout
frameLayout
=
(
FrameLayout
)
fragmentView
;
frameLayout
.
addView
(
actionBar
);
avatarImage
=
new
BackupImageView
(
getParentActivity
());
avatarImage
=
new
BackupImageView
(
getParentActivity
());
avatarImage
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
30
));
avatarImage
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
30
));
...
@@ -337,6 +342,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -337,6 +342,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
nameTextView
.
setLines
(
1
);
nameTextView
.
setLines
(
1
);
nameTextView
.
setMaxLines
(
1
);
nameTextView
.
setMaxLines
(
1
);
nameTextView
.
setSingleLine
(
true
);
nameTextView
.
setSingleLine
(
true
);
nameTextView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
nameTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
nameTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
nameTextView
.
setTypeface
(
AndroidUtilities
.
getTypeface
(
"fonts/rmedium.ttf"
));
nameTextView
.
setTypeface
(
AndroidUtilities
.
getTypeface
(
"fonts/rmedium.ttf"
));
actionBar
.
addView
(
nameTextView
);
actionBar
.
addView
(
nameTextView
);
...
@@ -355,6 +361,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -355,6 +361,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
onlineTextView
.
setLines
(
1
);
onlineTextView
.
setLines
(
1
);
onlineTextView
.
setMaxLines
(
1
);
onlineTextView
.
setMaxLines
(
1
);
onlineTextView
.
setSingleLine
(
true
);
onlineTextView
.
setSingleLine
(
true
);
onlineTextView
.
setEllipsize
(
TextUtils
.
TruncateAt
.
END
);
onlineTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
onlineTextView
.
setGravity
((
LocaleController
.
isRTL
?
Gravity
.
RIGHT
:
Gravity
.
LEFT
));
actionBar
.
addView
(
onlineTextView
);
actionBar
.
addView
(
onlineTextView
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
onlineTextView
.
getLayoutParams
();
layoutParams
=
(
FrameLayout
.
LayoutParams
)
onlineTextView
.
getLayoutParams
();
...
@@ -368,6 +375,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -368,6 +375,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
listView
=
new
ListView
(
getParentActivity
());
listView
=
new
ListView
(
getParentActivity
());
listView
.
setDivider
(
null
);
listView
.
setDivider
(
null
);
listView
.
setDrawingCacheEnabled
(
false
);
listView
.
setDividerHeight
(
0
);
listView
.
setDividerHeight
(
0
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setVerticalScrollBarEnabled
(
false
);
AndroidUtilities
.
setListViewEdgeEffectColor
(
listView
,
AvatarDrawable
.
getProfileBackColorForId
(
5
));
AndroidUtilities
.
setListViewEdgeEffectColor
(
listView
,
AvatarDrawable
.
getProfileBackColorForId
(
5
));
...
@@ -624,6 +632,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -624,6 +632,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
}
}
});
});
frameLayout
.
addView
(
actionBar
);
writeButton
=
new
ImageView
(
getParentActivity
());
writeButton
=
new
ImageView
(
getParentActivity
());
writeButton
.
setImageResource
(
R
.
drawable
.
floating_group_states
);
writeButton
.
setImageResource
(
R
.
drawable
.
floating_group_states
);
frameLayout
.
addView
(
writeButton
);
frameLayout
.
addView
(
writeButton
);
...
@@ -676,6 +686,31 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -676,6 +686,31 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
}
}
});
});
listView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
AbsListView
view
,
int
scrollState
)
{
}
@Override
public
void
onScroll
(
AbsListView
view
,
int
firstVisibleItem
,
int
visibleItemCount
,
int
totalItemCount
)
{
if
(
totalItemCount
==
0
)
{
return
;
}
int
height
=
0
;
View
child
=
view
.
getChildAt
(
0
);
if
(
child
!=
null
)
{
if
(
firstVisibleItem
==
0
)
{
height
=
AndroidUtilities
.
dp
(
88
)
+
child
.
getTop
();
}
if
(
actionBar
.
getExtraHeight
()
!=
height
)
{
actionBar
.
setExtraHeight
(
height
,
true
);
needLayout
();
}
}
}
});
updateUserData
();
updateUserData
();
}
else
{
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
...
@@ -864,6 +899,57 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -864,6 +899,57 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
fixLayout
();
fixLayout
();
}
}
private
void
needLayout
()
{
FrameLayout
.
LayoutParams
layoutParams
;
if
(
listView
!=
null
)
{
layoutParams
=
(
FrameLayout
.
LayoutParams
)
listView
.
getLayoutParams
();
layoutParams
.
topMargin
=
(
Build
.
VERSION
.
SDK_INT
>=
21
?
AndroidUtilities
.
statusBarHeight
:
0
)
+
AndroidUtilities
.
getCurrentActionBarHeight
();
listView
.
setLayoutParams
(
layoutParams
);
}
if
(
avatarImage
!=
null
)
{
float
diff
=
actionBar
.
getExtraHeight
()
/
(
float
)
AndroidUtilities
.
dp
(
88
);
float
diffm
=
1.0f
-
diff
;
int
avatarSize
=
42
+
(
int
)(
18
*
diff
);
int
avatarX
=
17
+
(
int
)(
47
*
diffm
);
int
avatarY
=
AndroidUtilities
.
dp
(
22
)
-
(
int
)((
AndroidUtilities
.
dp
(
22
)
-
(
AndroidUtilities
.
getCurrentActionBarHeight
()
-
AndroidUtilities
.
dp
(
42
))
/
2
)
*
(
1.0f
-
diff
));
int
nameX
=
97
+
(
int
)(
21
*
diffm
);
int
nameEndX
=
16
+
(
int
)(
32
*
diffm
);
float
nameFontSize
=
20
-
2
*
diffm
;
int
nameY
=
avatarY
+
AndroidUtilities
.
dp
(
29
-
10
*
diffm
);
int
statusY
=
avatarY
+
AndroidUtilities
.
dp
(
8
-
7
*
diffm
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
writeButton
.
getLayoutParams
();
layoutParams
.
topMargin
=
(
Build
.
VERSION
.
SDK_INT
>=
21
?
AndroidUtilities
.
statusBarHeight
:
0
)
+
AndroidUtilities
.
getCurrentActionBarHeight
()
+
actionBar
.
getExtraHeight
()
-
AndroidUtilities
.
dp
(
29.5f
);
writeButton
.
setLayoutParams
(
layoutParams
);
ViewProxy
.
setAlpha
(
writeButton
,
diff
);
writeButton
.
setVisibility
(
diff
==
0
?
View
.
GONE
:
View
.
VISIBLE
);
avatarImage
.
imageReceiver
.
setRoundRadius
(
AndroidUtilities
.
dp
(
avatarSize
/
2
));
layoutParams
=
(
FrameLayout
.
LayoutParams
)
avatarImage
.
getLayoutParams
();
layoutParams
.
width
=
AndroidUtilities
.
dp
(
avatarSize
);
layoutParams
.
height
=
AndroidUtilities
.
dp
(
avatarSize
);
layoutParams
.
leftMargin
=
LocaleController
.
isRTL
?
0
:
AndroidUtilities
.
dp
(
avatarX
);
layoutParams
.
rightMargin
=
LocaleController
.
isRTL
?
AndroidUtilities
.
dp
(
avatarX
)
:
0
;
layoutParams
.
bottomMargin
=
avatarY
;
avatarImage
.
setLayoutParams
(
layoutParams
);
nameTextView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_DIP
,
nameFontSize
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
nameTextView
.
getLayoutParams
();
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameEndX
:
nameX
);
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameX
:
nameEndX
);
layoutParams
.
bottomMargin
=
nameY
;
nameTextView
.
setLayoutParams
(
layoutParams
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
onlineTextView
.
getLayoutParams
();
layoutParams
.
leftMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameEndX
:
nameX
);
layoutParams
.
rightMargin
=
AndroidUtilities
.
dp
(
LocaleController
.
isRTL
?
nameX
:
nameEndX
);
layoutParams
.
bottomMargin
=
statusY
;
onlineTextView
.
setLayoutParams
(
layoutParams
);
}
}
private
void
fixLayout
()
{
private
void
fixLayout
()
{
if
(
fragmentView
==
null
)
{
if
(
fragmentView
==
null
)
{
return
;
return
;
...
@@ -872,12 +958,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -872,12 +958,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
@Override
@Override
public
boolean
onPreDraw
()
{
public
boolean
onPreDraw
()
{
if
(
fragmentView
!=
null
)
{
if
(
fragmentView
!=
null
)
{
ViewGroup
.
MarginLayoutParams
layoutParams
=
(
ViewGroup
.
MarginLayoutParams
)
listView
.
getLayoutParams
();
needLayout
();
layoutParams
.
topMargin
=
actionBar
.
getHeight
();
listView
.
setLayoutParams
(
layoutParams
);
layoutParams
=
(
ViewGroup
.
MarginLayoutParams
)
writeButton
.
getLayoutParams
();
layoutParams
.
topMargin
=
actionBar
.
getHeight
()
-
AndroidUtilities
.
dp
(
29.5f
);
writeButton
.
setLayoutParams
(
layoutParams
);
fragmentView
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
fragmentView
.
getViewTreeObserver
().
removeOnPreDrawListener
(
this
);
}
}
return
false
;
return
false
;
...
@@ -897,7 +978,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -897,7 +978,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
nameTextView
.
setText
(
ContactsController
.
formatName
(
user
.
first_name
,
user
.
last_name
));
nameTextView
.
setText
(
ContactsController
.
formatName
(
user
.
first_name
,
user
.
last_name
));
onlineTextView
.
setText
(
LocaleController
.
formatUserStatus
(
user
));
onlineTextView
.
setText
(
LocaleController
.
getString
(
"Online"
,
R
.
string
.
Online
));
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
avatarImage
.
imageReceiver
.
setVisible
(!
PhotoViewer
.
getInstance
().
isShowingImage
(
photoBig
),
false
);
}
}
...
@@ -971,7 +1052,12 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -971,7 +1052,12 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
int
type
=
getItemViewType
(
i
);
int
type
=
getItemViewType
(
i
);
if
(
type
==
0
)
{
if
(
type
==
0
)
{
if
(
view
==
null
)
{
if
(
view
==
null
)
{
view
=
new
EmptyCell
(
mContext
,
16
);
view
=
new
EmptyCell
(
mContext
);
}
if
(
i
==
overscrollRow
)
{
((
EmptyCell
)
view
).
setHeight
(
88
);
}
else
{
((
EmptyCell
)
view
).
setHeight
(
16
);
}
}
}
else
if
(
type
==
1
)
{
}
else
if
(
type
==
1
)
{
if
(
view
==
null
)
{
if
(
view
==
null
)
{
...
@@ -1131,7 +1217,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -1131,7 +1217,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
@Override
@Override
public
int
getItemViewType
(
int
i
)
{
public
int
getItemViewType
(
int
i
)
{
if
(
i
==
emptyRow
)
{
if
(
i
==
emptyRow
||
i
==
overscrollRow
)
{
return
0
;
return
0
;
}
if
(
i
==
settingsSectionRow
||
i
==
supportSectionRow
||
i
==
messagesSectionRow
||
i
==
mediaDownloadSection
||
i
==
contactsSectionRow
)
{
}
if
(
i
==
settingsSectionRow
||
i
==
supportSectionRow
||
i
==
messagesSectionRow
||
i
==
mediaDownloadSection
||
i
==
contactsSectionRow
)
{
return
1
;
return
1
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsersActivity.java
View file @
ea0b86d0
...
@@ -11,13 +11,17 @@ package org.telegram.ui;
...
@@ -11,13 +11,17 @@ package org.telegram.ui;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView
;
import
android.widget.FrameLayout
;
import
android.widget.ListView
;
import
android.widget.ListView
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
org.telegram.PhoneFormat.PhoneFormat
;
import
org.telegram.PhoneFormat.PhoneFormat
;
...
@@ -27,6 +31,7 @@ import org.telegram.android.MessagesController;
...
@@ -27,6 +31,7 @@ import org.telegram.android.MessagesController;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.android.NotificationCenter
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.Adapters.BaseFragmentAdapter
;
import
org.telegram.ui.Cells.TextInfoCell
;
import
org.telegram.ui.Cells.UserCell
;
import
org.telegram.ui.Cells.UserCell
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBar
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
import
org.telegram.ui.Views.ActionBar.ActionBarMenu
;
...
@@ -35,8 +40,8 @@ import org.telegram.ui.Views.ActionBar.BaseFragment;
...
@@ -35,8 +40,8 @@ import org.telegram.ui.Views.ActionBar.BaseFragment;
public
class
SettingsBlockedUsersActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
,
ContactsActivity
.
ContactsActivityDelegate
{
public
class
SettingsBlockedUsersActivity
extends
BaseFragment
implements
NotificationCenter
.
NotificationCenterDelegate
,
ContactsActivity
.
ContactsActivityDelegate
{
private
ListView
listView
;
private
ListView
listView
;
private
ListAdapter
listViewAdapter
;
private
ListAdapter
listViewAdapter
;
private
View
progressView
;
private
FrameLayout
progressView
;
private
TextView
emptyView
;
private
TextView
empty
Text
View
;
private
int
selectedUserId
;
private
int
selectedUserId
;
private
final
static
int
block_user
=
1
;
private
final
static
int
block_user
=
1
;
...
@@ -83,27 +88,58 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
...
@@ -83,27 +88,58 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
ActionBarMenu
menu
=
actionBar
.
createMenu
();
ActionBarMenu
menu
=
actionBar
.
createMenu
();
menu
.
addItem
(
block_user
,
R
.
drawable
.
plus
);
menu
.
addItem
(
block_user
,
R
.
drawable
.
plus
);
fragmentView
=
inflater
.
inflate
(
R
.
layout
.
settings_blocked_users_layout
,
container
,
false
);
fragmentView
=
new
FrameLayout
(
getParentActivity
());
listViewAdapter
=
new
ListAdapter
(
getParentActivity
());
FrameLayout
frameLayout
=
(
FrameLayout
)
fragmentView
;
listView
=
(
ListView
)
fragmentView
.
findViewById
(
R
.
id
.
listView
);
progressView
=
fragmentView
.
findViewById
(
R
.
id
.
progressLayout
);
emptyTextView
=
new
TextView
(
getParentActivity
());
emptyView
=
(
TextView
)
fragmentView
.
findViewById
(
R
.
id
.
searchEmptyView
);
emptyTextView
.
setTextColor
(
0xff808080
);
emptyView
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
emptyTextView
.
setTextSize
(
24
);
emptyTextView
.
setGravity
(
Gravity
.
CENTER
);
emptyTextView
.
setVisibility
(
View
.
INVISIBLE
);
emptyTextView
.
setText
(
LocaleController
.
getString
(
"NoBlocked"
,
R
.
string
.
NoBlocked
));
frameLayout
.
addView
(
emptyTextView
);
FrameLayout
.
LayoutParams
layoutParams
=
(
FrameLayout
.
LayoutParams
)
emptyTextView
.
getLayoutParams
();
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
height
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
gravity
=
Gravity
.
TOP
;
emptyTextView
.
setLayoutParams
(
layoutParams
);
emptyTextView
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
@Override
@Override
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
return
true
;
return
true
;
}
}
});
});
emptyView
.
setText
(
LocaleController
.
getString
(
"NoBlocked"
,
R
.
string
.
NoBlocked
));
if
(
MessagesController
.
getInstance
().
loadingBlockedUsers
)
{
progressView
=
new
FrameLayout
(
getParentActivity
());
progressView
.
setVisibility
(
View
.
VISIBLE
);
frameLayout
.
addView
(
progressView
);
emptyView
.
setVisibility
(
View
.
GONE
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
progressView
.
getLayoutParams
();
listView
.
setEmptyView
(
null
);
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
}
else
{
layoutParams
.
height
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
progressView
.
setVisibility
(
View
.
GONE
);
progressView
.
setLayoutParams
(
layoutParams
);
listView
.
setEmptyView
(
emptyView
);
ProgressBar
progressBar
=
new
ProgressBar
(
getParentActivity
());
progressView
.
addView
(
progressBar
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
progressView
.
getLayoutParams
();
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
height
=
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
;
layoutParams
.
gravity
=
Gravity
.
CENTER
;
progressView
.
setLayoutParams
(
layoutParams
);
listView
=
new
ListView
(
getParentActivity
());
listView
.
setEmptyView
(
emptyTextView
);
listView
.
setVerticalScrollBarEnabled
(
false
);
listView
.
setDivider
(
null
);
listView
.
setDividerHeight
(
0
);
listView
.
setAdapter
(
listViewAdapter
=
new
ListAdapter
(
getParentActivity
()));
if
(
Build
.
VERSION
.
SDK_INT
>=
11
)
{
listView
.
setVerticalScrollbarPosition
(
LocaleController
.
isRTL
?
ListView
.
SCROLLBAR_POSITION_LEFT
:
ListView
.
SCROLLBAR_POSITION_RIGHT
);
}
}
listView
.
setAdapter
(
listViewAdapter
);
frameLayout
.
addView
(
listView
);
layoutParams
=
(
FrameLayout
.
LayoutParams
)
listView
.
getLayoutParams
();
layoutParams
.
width
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
layoutParams
.
height
=
FrameLayout
.
LayoutParams
.
MATCH_PARENT
;
listView
.
setLayoutParams
(
layoutParams
);
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
listView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
@Override
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
public
void
onItemClick
(
AdapterView
<?>
adapterView
,
View
view
,
int
i
,
long
l
)
{
...
@@ -140,6 +176,15 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
...
@@ -140,6 +176,15 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
return
true
;
return
true
;
}
}
});
});
if
(
MessagesController
.
getInstance
().
loadingBlockedUsers
)
{
progressView
.
setVisibility
(
View
.
VISIBLE
);
emptyTextView
.
setVisibility
(
View
.
GONE
);
listView
.
setEmptyView
(
null
);
}
else
{
progressView
.
setVisibility
(
View
.
GONE
);
listView
.
setEmptyView
(
emptyTextView
);
}
}
else
{
}
else
{
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
ViewGroup
parent
=
(
ViewGroup
)
fragmentView
.
getParent
();
if
(
parent
!=
null
)
{
if
(
parent
!=
null
)
{
...
@@ -161,7 +206,7 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
...
@@ -161,7 +206,7 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
progressView
.
setVisibility
(
View
.
GONE
);
progressView
.
setVisibility
(
View
.
GONE
);
}
}
if
(
listView
!=
null
&&
listView
.
getEmptyView
()
==
null
)
{
if
(
listView
!=
null
&&
listView
.
getEmptyView
()
==
null
)
{
listView
.
setEmptyView
(
emptyView
);
listView
.
setEmptyView
(
empty
Text
View
);
}
}
if
(
listViewAdapter
!=
null
)
{
if
(
listViewAdapter
!=
null
)
{
listViewAdapter
.
notifyDataSetChanged
();
listViewAdapter
.
notifyDataSetChanged
();
...
@@ -243,17 +288,14 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
...
@@ -243,17 +288,14 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi
int
type
=
getItemViewType
(
i
);
int
type
=
getItemViewType
(
i
);
if
(
type
==
0
)
{
if
(
type
==
0
)
{
if
(
view
==
null
)
{
if
(
view
==
null
)
{
view
=
new
UserCell
(
mContext
);
view
=
new
UserCell
(
mContext
,
1
);
((
UserCell
)
view
).
useSeparator
=
true
;
}
}
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
MessagesController
.
getInstance
().
blockedUsers
.
get
(
i
));
TLRPC
.
User
user
=
MessagesController
.
getInstance
().
getUser
(
MessagesController
.
getInstance
().
blockedUsers
.
get
(
i
));
((
UserCell
)
view
).
setData
(
user
,
null
,
user
.
phone
!=
null
&&
user
.
phone
.
length
()
!=
0
?
PhoneFormat
.
getInstance
().
format
(
"+"
+
user
.
phone
)
:
LocaleController
.
getString
(
"NumberUnknown"
,
R
.
string
.
NumberUnknown
));
((
UserCell
)
view
).
setData
(
user
,
null
,
user
.
phone
!=
null
&&
user
.
phone
.
length
()
!=
0
?
PhoneFormat
.
getInstance
().
format
(
"+"
+
user
.
phone
)
:
LocaleController
.
getString
(
"NumberUnknown"
,
R
.
string
.
NumberUnknown
)
,
0
);
}
else
if
(
type
==
1
)
{
}
else
if
(
type
==
1
)
{
if
(
view
==
null
)
{
if
(
view
==
null
)
{
LayoutInflater
li
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
view
=
new
TextInfoCell
(
mContext
);
view
=
li
.
inflate
(
R
.
layout
.
settings_unblock_info_row_layout
,
viewGroup
,
false
);
((
TextInfoCell
)
view
).
setText
(
LocaleController
.
getString
(
"UnblockText"
,
R
.
string
.
UnblockText
));
TextView
textView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
info_text_view
);
textView
.
setText
(
LocaleController
.
getString
(
"UnblockText"
,
R
.
string
.
UnblockText
));
}
}
}
}
return
view
;
return
view
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBar.java
View file @
ea0b86d0
...
@@ -452,8 +452,15 @@ public class ActionBar extends FrameLayout {
...
@@ -452,8 +452,15 @@ public class ActionBar extends FrameLayout {
positionBackOverlay
(
getMeasuredWidth
(),
getMeasuredHeight
());
positionBackOverlay
(
getMeasuredWidth
(),
getMeasuredHeight
());
}
}
public
void
setExtraHeight
(
int
value
)
{
public
void
setExtraHeight
(
int
value
,
boolean
layout
)
{
extraHeight
=
value
;
extraHeight
=
value
;
if
(
layout
)
{
requestLayout
();
}
}
public
int
getExtraHeight
()
{
return
extraHeight
;
}
}
private
void
positionBackOverlay
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
private
void
positionBackOverlay
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarMenuItem.java
View file @
ea0b86d0
...
@@ -31,7 +31,6 @@ import android.widget.TextView;
...
@@ -31,7 +31,6 @@ import android.widget.TextView;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.AndroidUtilities
;
import
org.telegram.android.LocaleController
;
import
org.telegram.android.LocaleController
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
...
@@ -186,7 +185,7 @@ public class ActionBarMenuItem extends ImageView {
...
@@ -186,7 +185,7 @@ public class ActionBarMenuItem extends ImageView {
if
(
LocaleController
.
isRTL
)
{
if
(
LocaleController
.
isRTL
)
{
layoutParams
.
gravity
=
Gravity
.
RIGHT
;
layoutParams
.
gravity
=
Gravity
.
RIGHT
;
}
}
layoutParams
.
width
=
LinearLayout
.
LayoutParams
.
WRAP_CONT
ENT
;
layoutParams
.
width
=
LinearLayout
.
LayoutParams
.
MATCH_PAR
ENT
;
layoutParams
.
height
=
AndroidUtilities
.
dp
(
48
);
layoutParams
.
height
=
AndroidUtilities
.
dp
(
48
);
textView
.
setLayoutParams
(
layoutParams
);
textView
.
setLayoutParams
(
layoutParams
);
textView
.
setOnClickListener
(
new
OnClickListener
()
{
textView
.
setOnClickListener
(
new
OnClickListener
()
{
...
@@ -389,7 +388,6 @@ public class ActionBarMenuItem extends ImageView {
...
@@ -389,7 +388,6 @@ public class ActionBarMenuItem extends ImageView {
if
(
popupWindow
!=
null
&&
popupWindow
.
isShowing
())
{
if
(
popupWindow
!=
null
&&
popupWindow
.
isShowing
())
{
int
x
=
parentMenu
.
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
();
int
x
=
parentMenu
.
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
();
int
y
=
-
getMeasuredHeight
();
int
y
=
-
getMeasuredHeight
();
FileLog
.
e
(
"tmessages"
,
"x = "
+
x
+
" y = "
+
y
);
popupWindow
.
update
(
this
,
parentMenu
.
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
-
getMeasuredHeight
(),
-
1
,
-
1
);
popupWindow
.
update
(
this
,
parentMenu
.
parentActionBar
.
getMeasuredWidth
()
-
popupLayout
.
getMeasuredWidth
()
-
getLeft
()
-
parentMenu
.
getLeft
(),
-
getMeasuredHeight
(),
-
1
,
-
1
);
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Views/AvatarDrawable.java
View file @
ea0b86d0
...
@@ -21,6 +21,7 @@ import org.telegram.android.AndroidUtilities;
...
@@ -21,6 +21,7 @@ import org.telegram.android.AndroidUtilities;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.messenger.TLRPC
;
import
org.telegram.ui.ApplicationLoader
;
public
class
AvatarDrawable
extends
Drawable
{
public
class
AvatarDrawable
extends
Drawable
{
...
@@ -33,11 +34,14 @@ public class AvatarDrawable extends Drawable {
...
@@ -33,11 +34,14 @@ public class AvatarDrawable extends Drawable {
private
static
int
[]
arrColorsButtons
=
{
R
.
drawable
.
bar_selector_red
,
R
.
drawable
.
bar_selector_orange
,
R
.
drawable
.
bar_selector_yellow
,
private
static
int
[]
arrColorsButtons
=
{
R
.
drawable
.
bar_selector_red
,
R
.
drawable
.
bar_selector_orange
,
R
.
drawable
.
bar_selector_yellow
,
R
.
drawable
.
bar_selector_green
,
R
.
drawable
.
bar_selector_cyan
,
R
.
drawable
.
bar_selector_blue
,
R
.
drawable
.
bar_selector_violet
,
R
.
drawable
.
bar_selector_pink
};
R
.
drawable
.
bar_selector_green
,
R
.
drawable
.
bar_selector_cyan
,
R
.
drawable
.
bar_selector_blue
,
R
.
drawable
.
bar_selector_violet
,
R
.
drawable
.
bar_selector_pink
};
private
static
Drawable
broadcastDrawable
;
private
int
color
;
private
int
color
;
private
StaticLayout
textLayout
;
private
StaticLayout
textLayout
;
private
float
textWidth
;
private
float
textWidth
;
private
float
textHeight
;
private
float
textHeight
;
private
boolean
isProfile
;
private
boolean
isProfile
;
private
boolean
drawBrodcast
;
public
AvatarDrawable
()
{
public
AvatarDrawable
()
{
super
();
super
();
...
@@ -46,6 +50,8 @@ public class AvatarDrawable extends Drawable {
...
@@ -46,6 +50,8 @@ public class AvatarDrawable extends Drawable {
namePaint
=
new
TextPaint
(
Paint
.
ANTI_ALIAS_FLAG
);
namePaint
=
new
TextPaint
(
Paint
.
ANTI_ALIAS_FLAG
);
namePaint
.
setColor
(
0xffffffff
);
namePaint
.
setColor
(
0xffffffff
);
namePaint
.
setTextSize
(
AndroidUtilities
.
dp
(
20
));
namePaint
.
setTextSize
(
AndroidUtilities
.
dp
(
20
));
broadcastDrawable
=
ApplicationLoader
.
applicationContext
.
getResources
().
getDrawable
(
R
.
drawable
.
broadcast_w
);
}
}
}
}
...
@@ -116,6 +122,8 @@ public class AvatarDrawable extends Drawable {
...
@@ -116,6 +122,8 @@ public class AvatarDrawable extends Drawable {
color
=
arrColors
[
Math
.
abs
(
id
)
%
arrColors
.
length
];
color
=
arrColors
[
Math
.
abs
(
id
)
%
arrColors
.
length
];
}
}
drawBrodcast
=
isBroadcast
;
String
text
=
""
;
String
text
=
""
;
if
(
firstName
!=
null
&&
firstName
.
length
()
>
0
)
{
if
(
firstName
!=
null
&&
firstName
.
length
()
>
0
)
{
text
+=
firstName
.
substring
(
0
,
1
);
text
+=
firstName
.
substring
(
0
,
1
);
...
@@ -145,16 +153,22 @@ public class AvatarDrawable extends Drawable {
...
@@ -145,16 +153,22 @@ public class AvatarDrawable extends Drawable {
if
(
bounds
==
null
)
{
if
(
bounds
==
null
)
{
return
;
return
;
}
}
int
size
=
bounds
.
right
-
bounds
.
left
;
int
size
=
bounds
.
width
()
;
paint
.
setColor
(
color
);
paint
.
setColor
(
color
);
canvas
.
save
();
canvas
.
save
();
canvas
.
translate
(
bounds
.
left
,
bounds
.
top
);
canvas
.
translate
(
bounds
.
left
,
bounds
.
top
);
canvas
.
drawCircle
(
size
/
2
,
size
/
2
,
size
/
2
,
paint
);
canvas
.
drawCircle
(
size
/
2
,
size
/
2
,
size
/
2
,
paint
);
if
(
textLayout
!=
null
)
{
if
(
drawBrodcast
&&
broadcastDrawable
!=
null
)
{
canvas
.
translate
((
size
-
textWidth
)
/
2
,
(
size
-
textHeight
)
/
2
);
int
x
=
(
size
-
broadcastDrawable
.
getIntrinsicWidth
())
/
2
;
textLayout
.
draw
(
canvas
);
int
y
=
(
size
-
broadcastDrawable
.
getIntrinsicHeight
())
/
2
;
broadcastDrawable
.
setBounds
(
x
,
y
,
x
+
broadcastDrawable
.
getIntrinsicWidth
(),
y
+
broadcastDrawable
.
getIntrinsicHeight
());
broadcastDrawable
.
draw
(
canvas
);
}
else
{
if
(
textLayout
!=
null
)
{
canvas
.
translate
((
size
-
textWidth
)
/
2
,
(
size
-
textHeight
)
/
2
);
textLayout
.
draw
(
canvas
);
}
}
}
canvas
.
restore
();
canvas
.
restore
();
}
}
...
...
TMessagesProj/src/main/res/layout-ar/chat_profile_add_row.xml
deleted
100644 → 0
View file @
4104a21f
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"66dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/messages_list_row_avatar"
android:contentDescription=
""
android:layout_marginRight=
"24dp"
android:src=
"@drawable/addmember"
android:scaleType=
"center"
android:layout_gravity=
"center_vertical|right"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/messages_list_row_name"
android:textSize=
"18dp"
android:layout_marginRight=
"61dp"
android:ellipsize=
"end"
android:gravity=
"right"
android:textColor=
"#000000"
android:maxLines=
"1"
android:layout_gravity=
"center_vertical|right"
/>
<View
android:background=
"@color/divider"
android:layout_width=
"fill_parent"
android:layout_height=
"1px"
android:layout_gravity=
"bottom"
android:id=
"@+id/settings_row_divider"
/>
</FrameLayout>
\ No newline at end of file
TMessagesProj/src/main/res/layout-ar/chat_profile_avatar_layout.xml
deleted
100644 → 0
View file @
4104a21f
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:gravity=
"center_vertical|right"
android:orientation=
"horizontal"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:paddingTop=
"13dp"
android:paddingBottom=
"12dp"
>
<ImageButton
android:id=
"@+id/settings_edit_name"
android:background=
"@drawable/list_selector"
android:clickable=
"true"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:src=
"@drawable/ic_edit"
/>
<View
android:background=
"#e8e8e8"
android:layout_width=
"1dp"
android:layout_height=
"48dp"
/>
<LinearLayout
android:layout_gravity=
"center_vertical"
android:orientation=
"vertical"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"4dp"
android:layout_marginRight=
"13dp"
android:layout_marginBottom=
"1dp"
android:layout_weight=
"1"
>
<TextView
android:textSize=
"21dp"
android:textColor=
"#333333"
android:id=
"@+id/settings_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:lines=
"1"
android:ellipsize=
"end"
android:singleLine=
"true"
android:layout_gravity=
"right"
android:gravity=
"right"
/>
<TextView
android:textSize=
"14dp"
android:textColor=
"#999999"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:maxLines=
"1"
android:lines=
"1"
android:ellipsize=
"end"
android:id=
"@+id/settings_online"
android:layout_gravity=
"right"
android:gravity=
"right"
/>
</LinearLayout>
<FrameLayout
android:layout_width=
"64dp"
android:layout_height=
"64dp"
>
<org.telegram.ui.Views.BackupImageView
android:id=
"@+id/settings_avatar_image"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
/>
<ImageButton
android:id=
"@+id/settings_change_avatar_button"
android:background=
"@drawable/photo_spinner"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
/>
</FrameLayout>
</LinearLayout>
TMessagesProj/src/main/res/layout-ar/group_create_layout.xml
deleted
100644 → 0
View file @
4104a21f
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/top_layout"
android:layout_gravity=
"top"
>
<EditText
android:textSize=
"16dp"
android:textColorHint=
"#a6a6a6"
android:id=
"@+id/bubble_input_text"
android:paddingLeft=
"60dp"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:layout_marginRight=
"5dp"
android:minHeight=
"52dp"
android:gravity=
"right|center_vertical"
android:maxLines=
"2"
android:paddingTop=
"3dp"
android:layout_marginTop=
"0dp"
android:inputType=
"textFilter|textNoSuggestions|textMultiLine"
android:imeOptions=
"flagNoExtractUi"
android:textCursorDrawable=
"@null"
android:textColor=
"#000000"
/>
</FrameLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<org.telegram.ui.Views.PinnedHeaderListView
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:id=
"@+id/listView"
android:clipToPadding=
"false"
android:fadingEdge=
"none"
android:fadingEdgeLength=
"0dp"
android:paddingLeft=
"30dp"
android:paddingRight=
"16dp"
android:dividerHeight=
"0dp"
android:divider=
"@null"
android:paddingBottom=
"16dp"
android:fastScrollEnabled=
"true"
android:fastScrollAlwaysVisible=
"true"
android:scrollbarStyle=
"outsideOverlay"
android:verticalScrollbarPosition=
"left"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:textColor=
"#808080"
android:gravity=
"center"
android:textSize=
"24dp"
android:id=
"@+id/searchEmptyView"
android:visibility=
"invisible"
/>
</FrameLayout>
</LinearLayout>
TMessagesProj/src/main/res/layout-ar/settings_row_button_layout.xml
View file @
ea0b86d0
<!--
~ This is the source code of Telegram for Android v. 1.7.x.
~ It is licensed under GNU GPL v. 2 or later.
~ You should have received a copy of the license in this archive (see LICENSE).
~
~ Copyright Nikolai Kudashov, 2013-2014.
-->
<FrameLayout
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
...
...
TMessagesProj/src/main/res/layout-ar/user_profile_leftright_row_layout.xml
deleted
100644 → 0
View file @
4104a21f
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"50dp"
android:layout_gravity=
"top"
>
<TextView
android:textSize=
"18dp"
android:textColor=
"#333333"
android:id=
"@+id/settings_row_text"
android:layout_width=
"wrap_content"
android:layout_height=
"fill_parent"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"8dp"
android:gravity=
"center_vertical"
android:layout_gravity=
"top|right"
/>
<TextView
android:textSize=
"18dp"
android:textColor=
"#316f9f"
android:id=
"@+id/settings_row_text_detail"
android:layout_width=
"wrap_content"
android:layout_height=
"fill_parent"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"8dp"
android:gravity=
"center_vertical"
/>
<View
android:background=
"@color/divider"
android:layout_width=
"fill_parent"
android:layout_height=
"1px"
android:layout_gravity=
"bottom"
android:id=
"@+id/settings_row_divider"
/>
</FrameLayout>
\ No newline at end of file
TMessagesProj/src/main/res/layout/chat_profile_add_row.xml
deleted
100644 → 0
View file @
4104a21f
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"66dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/messages_list_row_avatar"
android:contentDescription=
""
android:src=
"@drawable/addmember"
android:scaleType=
"center"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/messages_list_row_name"
android:textSize=
"18dp"
android:layout_marginLeft=
"61dp"
android:ellipsize=
"end"
android:textColor=
"#000000"
android:maxLines=
"1"
android:layout_gravity=
"center_vertical"
/>
<View
android:background=
"@color/divider"
android:layout_width=
"fill_parent"
android:layout_height=
"1px"
android:layout_gravity=
"bottom"
android:id=
"@+id/settings_row_divider"
/>
</FrameLayout>
\ No newline at end of file
TMessagesProj/src/main/res/layout/chat_profile_avatar_layout.xml
deleted
100644 → 0
View file @
4104a21f
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:paddingTop=
"13dp"
android:paddingBottom=
"12dp"
>
<FrameLayout
android:layout_width=
"64dp"
android:layout_height=
"64dp"
>
<org.telegram.ui.Views.BackupImageView
android:id=
"@+id/settings_avatar_image"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
/>
<ImageButton
android:id=
"@+id/settings_change_avatar_button"
android:background=
"@drawable/photo_spinner"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
/>
</FrameLayout>
<LinearLayout
android:layout_gravity=
"center_vertical"
android:orientation=
"vertical"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"13dp"
android:layout_marginRight=
"4dp"
android:layout_marginBottom=
"1dp"
android:layout_weight=
"1"
>
<TextView
android:textSize=
"21dp"
android:textColor=
"#333333"
android:id=
"@+id/settings_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:lines=
"1"
android:ellipsize=
"end"
android:singleLine=
"true"
/>
<TextView
android:textSize=
"14dp"
android:textColor=
"#999999"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:maxLines=
"1"
android:lines=
"1"
android:ellipsize=
"end"
android:id=
"@+id/settings_online"
/>
</LinearLayout>
<View
android:background=
"#e8e8e8"
android:layout_width=
"1dp"
android:layout_height=
"48dp"
/>
<ImageButton
android:id=
"@+id/settings_edit_name"
android:background=
"@drawable/list_selector"
android:clickable=
"true"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:src=
"@drawable/ic_edit"
/>
</LinearLayout>
TMessagesProj/src/main/res/layout/group_create_layout.xml
deleted
100644 → 0
View file @
4104a21f
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/top_layout"
android:layout_gravity=
"top"
>
<EditText
android:textSize=
"16dp"
android:textColorHint=
"#a6a6a6"
android:id=
"@+id/bubble_input_text"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
android:layout_marginRight=
"5dp"
android:minHeight=
"52dp"
android:gravity=
"left|center_vertical"
android:maxLines=
"2"
android:paddingTop=
"3dp"
android:layout_marginTop=
"0dp"
android:inputType=
"textFilter|textNoSuggestions|textMultiLine"
android:imeOptions=
"flagNoExtractUi"
android:textCursorDrawable=
"@null"
android:textColor=
"#000000"
/>
</FrameLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<org.telegram.ui.Views.PinnedHeaderListView
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:id=
"@+id/listView"
android:clipToPadding=
"false"
android:fadingEdge=
"none"
android:fadingEdgeLength=
"0dp"
android:paddingLeft=
"16dp"
android:paddingRight=
"30dp"
android:dividerHeight=
"0dp"
android:divider=
"@null"
android:paddingBottom=
"16dp"
android:fastScrollEnabled=
"true"
android:fastScrollAlwaysVisible=
"true"
android:scrollbarStyle=
"outsideOverlay"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:textColor=
"#808080"
android:gravity=
"center"
android:textSize=
"24dp"
android:id=
"@+id/searchEmptyView"
android:visibility=
"invisible"
/>
</FrameLayout>
</LinearLayout>
TMessagesProj/src/main/res/layout/settings_blocked_users_layout.xml
deleted
100644 → 0
View file @
4104a21f
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ListView
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:id=
"@+id/listView"
android:layout_alignParentTop=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentBottom=
"true"
android:clipToPadding=
"false"
android:fadingEdge=
"none"
android:fadingEdgeLength=
"0dp"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:dividerHeight=
"0dp"
android:divider=
"@null"
android:scrollbars=
"none"
android:paddingBottom=
"16dp"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:textColor=
"#808080"
android:gravity=
"center"
android:textSize=
"24dp"
android:id=
"@+id/searchEmptyView"
/>
<LinearLayout
android:id=
"@+id/progressLayout"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ProgressBar
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</RelativeLayout>
TMessagesProj/src/main/res/layout/settings_logout_button.xml
deleted
100644 → 0
View file @
4104a21f
<!--
~ This is the source code of Telegram for Android v. 1.7.x.
~ It is licensed under GNU GPL v. 2 or later.
~ You should have received a copy of the license in this archive (see LICENSE).
~
~ Copyright Nikolai Kudashov, 2013-2014.
-->
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"56dp"
android:paddingTop=
"8dp"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/logout_button_states"
android:gravity=
"center"
android:textSize=
"17dp"
android:textColor=
"#000000"
android:id=
"@+id/settings_row_text"
/>
</FrameLayout>
\ No newline at end of file
TMessagesProj/src/main/res/layout/settings_row_button_layout.xml
View file @
ea0b86d0
<!--
~ This is the source code of Telegram for Android v. 1.7.x.
~ It is licensed under GNU GPL v. 2 or later.
~ You should have received a copy of the license in this archive (see LICENSE).
~
~ Copyright Nikolai Kudashov, 2013-2014.
-->
<FrameLayout
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
...
...
TMessagesProj/src/main/res/layout/settings_unblock_info_row_layout.xml
deleted
100644 → 0
View file @
4104a21f
<FrameLayout
android:layout_width=
"fill_parent"
android:layout_height=
"48dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:textColor=
"#9a9a9a"
android:textSize=
"15dp"
android:id=
"@+id/info_text_view"
/>
</FrameLayout>
\ No newline at end of file
TMessagesProj/src/main/res/layout/user_profile_leftright_row_layout.xml
deleted
100644 → 0
View file @
4104a21f
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"50dp"
android:layout_gravity=
"top"
>
<TextView
android:textSize=
"18dp"
android:textColor=
"#333333"
android:id=
"@+id/settings_row_text"
android:layout_width=
"wrap_content"
android:layout_height=
"fill_parent"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"8dp"
android:gravity=
"center_vertical"
android:layout_gravity=
"top"
/>
<TextView
android:textSize=
"18dp"
android:textColor=
"#316f9f"
android:id=
"@+id/settings_row_text_detail"
android:layout_width=
"wrap_content"
android:layout_height=
"fill_parent"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"8dp"
android:gravity=
"center_vertical"
android:layout_gravity=
"right"
/>
<View
android:background=
"@color/divider"
android:layout_width=
"fill_parent"
android:layout_height=
"1px"
android:layout_gravity=
"bottom"
android:id=
"@+id/settings_row_divider"
/>
</FrameLayout>
\ No newline at end of file
TMessagesProj/src/main/res/values/strings.xml
View file @
ea0b86d0
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
<string
name=
"NewBroadcastList"
>
New Broadcast List
</string>
<string
name=
"NewBroadcastList"
>
New Broadcast List
</string>
<string
name=
"EnterListName"
>
Enter list name
</string>
<string
name=
"EnterListName"
>
Enter list name
</string>
<string
name=
"YouCreatedBroadcastList"
>
You created a broadcast list
</string>
<string
name=
"YouCreatedBroadcastList"
>
You created a broadcast list
</string>
<string
name=
"AddRecipient"
>
Add
R
ecipient
</string>
<string
name=
"AddRecipient"
>
Add
r
ecipient
</string>
<string
name=
"KickFromBroadcast"
>
Remove from broadcast list
</string>
<string
name=
"KickFromBroadcast"
>
Remove from broadcast list
</string>
<!--documents view-->
<!--documents view-->
<string
name=
"SelectFile"
>
Select File
</string>
<string
name=
"SelectFile"
>
Select File
</string>
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
<string
name=
"NotificationsAndSounds"
>
Notifications and Sounds
</string>
<string
name=
"NotificationsAndSounds"
>
Notifications and Sounds
</string>
<string
name=
"BlockedUsers"
>
Blocked Users
</string>
<string
name=
"BlockedUsers"
>
Blocked Users
</string>
<string
name=
"SaveIncomingPhotos"
>
Save Incoming Photos
</string>
<string
name=
"SaveIncomingPhotos"
>
Save Incoming Photos
</string>
<string
name=
"LogOut"
>
Log
O
ut
</string>
<string
name=
"LogOut"
>
Log
o
ut
</string>
<string
name=
"YourFirstNameAndLastName"
>
YOUR FIRST AND LAST NAME
</string>
<string
name=
"YourFirstNameAndLastName"
>
YOUR FIRST AND LAST NAME
</string>
<string
name=
"NoSound"
>
No sound
</string>
<string
name=
"NoSound"
>
No sound
</string>
<string
name=
"Default"
>
Default
</string>
<string
name=
"Default"
>
Default
</string>
...
@@ -285,7 +285,7 @@
...
@@ -285,7 +285,7 @@
<string
name=
"WhenRoaming"
>
When roaming
</string>
<string
name=
"WhenRoaming"
>
When roaming
</string>
<string
name=
"NoMediaAutoDownload"
>
No media
</string>
<string
name=
"NoMediaAutoDownload"
>
No media
</string>
<string
name=
"SaveToGallerySettings"
>
Save to gallery
</string>
<string
name=
"SaveToGallerySettings"
>
Save to gallery
</string>
<string
name=
"EditName"
>
Edit
N
ame
</string>
<string
name=
"EditName"
>
Edit
n
ame
</string>
<!--media view-->
<!--media view-->
<string
name=
"NoMedia"
>
No shared media yet
</string>
<string
name=
"NoMedia"
>
No shared media yet
</string>
<string
name=
"CancelDownload"
>
Cancel Download
</string>
<string
name=
"CancelDownload"
>
Cancel Download
</string>
...
...
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