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
1c74ed45
Commit
1c74ed45
authored
Apr 25, 2016
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
fe9e23ec
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
232 additions
and
94 deletions
+232
-94
ImageLoader.java
...roj/src/main/java/org/telegram/messenger/ImageLoader.java
+1
-1
MessageObject.java
...j/src/main/java/org/telegram/messenger/MessageObject.java
+2
-0
SendMessagesHelper.java
.../main/java/org/telegram/messenger/SendMessagesHelper.java
+26
-20
ActionBarLayout.java
.../main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
+60
-3
ActionBarMenu.java
...rc/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java
+1
-4
BottomSheet.java
.../src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
+22
-12
Theme.java
...esProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
+10
-8
AudioSelectActivity.java
...oj/src/main/java/org/telegram/ui/AudioSelectActivity.java
+1
-1
ChatMessageCell.java
.../src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
+11
-1
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+6
-18
ChatAttachView.java
.../main/java/org/telegram/ui/Components/ChatAttachView.java
+7
-17
WebFrameLayout.java
.../main/java/org/telegram/ui/Components/WebFrameLayout.java
+81
-5
LaunchActivity.java
...gesProj/src/main/java/org/telegram/ui/LaunchActivity.java
+3
-3
LoginActivity.java
...agesProj/src/main/java/org/telegram/ui/LoginActivity.java
+1
-1
No files found.
TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java
View file @
1c74ed45
...
...
@@ -1191,8 +1191,8 @@ public class ImageLoader {
AndroidUtilities
.
addMediaToGallery
(
finalFile
.
toString
());
}
}
ImageLoader
.
this
.
fileDidLoaded
(
location
,
finalFile
,
type
);
NotificationCenter
.
getInstance
().
postNotificationName
(
NotificationCenter
.
FileDidLoaded
,
location
);
ImageLoader
.
this
.
fileDidLoaded
(
location
,
finalFile
,
type
);
}
});
}
...
...
TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
View file @
1c74ed45
...
...
@@ -1673,6 +1673,8 @@ public class MessageObject {
public
void
checkMediaExistance
()
{
File
cacheFile
=
null
;
attachPathExists
=
false
;
mediaExists
=
false
;
if
(
type
==
1
)
{
TLRPC
.
PhotoSize
currentPhotoObject
=
FileLoader
.
getClosestPhotoSizeWithSize
(
photoThumbs
,
AndroidUtilities
.
getPhotoSize
());
if
(
currentPhotoObject
!=
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
View file @
1c74ed45
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
View file @
1c74ed45
...
...
@@ -13,6 +13,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.Rect
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.os.Handler
;
...
...
@@ -28,6 +29,7 @@ import android.widget.FrameLayout;
import
android.widget.LinearLayout
;
import
org.telegram.messenger.AndroidUtilities
;
import
org.telegram.messenger.BuildVars
;
import
org.telegram.messenger.FileLog
;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.AnimationCompat.AnimatorListenerAdapterProxy
;
...
...
@@ -50,6 +52,9 @@ public class ActionBarLayout extends FrameLayout {
public
class
LinearLayoutContainer
extends
LinearLayout
{
private
Rect
rect
=
new
Rect
();
private
boolean
isKeyboardVisible
;
public
LinearLayoutContainer
(
Context
context
)
{
super
(
context
);
setOrientation
(
VERTICAL
);
...
...
@@ -87,12 +92,32 @@ public class ActionBarLayout extends FrameLayout {
public
boolean
hasOverlappingRendering
()
{
return
false
;
}
@Override
protected
void
onLayout
(
boolean
changed
,
int
l
,
int
t
,
int
r
,
int
b
)
{
super
.
onLayout
(
changed
,
l
,
t
,
r
,
b
);
View
rootView
=
getRootView
();
getWindowVisibleDisplayFrame
(
rect
);
int
usableViewHeight
=
rootView
.
getHeight
()
-
(
rect
.
top
!=
0
?
AndroidUtilities
.
statusBarHeight
:
0
)
-
AndroidUtilities
.
getViewInset
(
rootView
);
isKeyboardVisible
=
usableViewHeight
-
(
rect
.
bottom
-
rect
.
top
)
>
0
;
if
(
BuildVars
.
DEBUG_VERSION
)
{
FileLog
.
e
(
"tmessages"
,
"keyboard visible = "
+
isKeyboardVisible
+
" for "
+
this
);
}
if
(
waitingForKeyboardCloseRunnable
!=
null
&&
!
containerView
.
isKeyboardVisible
&&
!
containerViewBack
.
isKeyboardVisible
)
{
AndroidUtilities
.
cancelRunOnUIThread
(
waitingForKeyboardCloseRunnable
);
waitingForKeyboardCloseRunnable
.
run
();
waitingForKeyboardCloseRunnable
=
null
;
}
}
}
private
static
Drawable
headerShadowDrawable
;
private
static
Drawable
layerShadowDrawable
;
private
static
Paint
scrimPaint
;
private
Runnable
waitingForKeyboardCloseRunnable
;
private
LinearLayoutContainer
containerView
;
private
LinearLayoutContainer
containerViewBack
;
private
DrawerLayoutContainer
drawerLayoutContainer
;
...
...
@@ -494,6 +519,10 @@ public class ActionBarLayout extends FrameLayout {
private
void
onAnimationEndCheck
(
boolean
byCheck
)
{
onCloseAnimationEnd
(
false
);
onOpenAnimationEnd
(
false
);
if
(
waitingForKeyboardCloseRunnable
!=
null
)
{
AndroidUtilities
.
cancelRunOnUIThread
(
waitingForKeyboardCloseRunnable
);
waitingForKeyboardCloseRunnable
=
null
;
}
if
(
currentAnimation
!=
null
)
{
if
(
byCheck
)
{
currentAnimation
.
cancel
();
...
...
@@ -514,7 +543,7 @@ public class ActionBarLayout extends FrameLayout {
}
public
boolean
checkTransitionAnimation
()
{
if
(
transitionAnimationInProgress
&&
transitionAnimationStartTime
<
System
.
currentTimeMillis
()
-
1
0
00
)
{
if
(
transitionAnimationInProgress
&&
transitionAnimationStartTime
<
System
.
currentTimeMillis
()
-
1
5
00
)
{
onAnimationEndCheck
(
true
);
}
return
transitionAnimationInProgress
;
...
...
@@ -718,7 +747,21 @@ public class ActionBarLayout extends FrameLayout {
if
(
animation
==
null
)
{
ViewProxy
.
setAlpha
(
containerView
,
0.0f
);
ViewProxy
.
setTranslationX
(
containerView
,
48.0f
);
startLayoutAnimation
(
true
,
true
);
if
(
containerView
.
isKeyboardVisible
||
containerViewBack
.
isKeyboardVisible
)
{
waitingForKeyboardCloseRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
FileLog
.
e
(
"tmessages"
,
"start delayed by keyboard open animation"
);
if
(
waitingForKeyboardCloseRunnable
!=
this
)
{
return
;
}
startLayoutAnimation
(
true
,
true
);
}
};
AndroidUtilities
.
runOnUIThread
(
waitingForKeyboardCloseRunnable
,
200
);
}
else
{
startLayoutAnimation
(
true
,
true
);
}
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>
15
)
{
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
...
...
@@ -868,7 +911,21 @@ public class ActionBarLayout extends FrameLayout {
}
});
if
(
animation
==
null
)
{
startLayoutAnimation
(
false
,
true
);
if
(
containerView
.
isKeyboardVisible
||
containerViewBack
.
isKeyboardVisible
)
{
waitingForKeyboardCloseRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
waitingForKeyboardCloseRunnable
!=
this
)
{
return
;
}
FileLog
.
e
(
"tmessages"
,
"start delayed by keyboard close animation"
);
startLayoutAnimation
(
false
,
true
);
}
};
AndroidUtilities
.
runOnUIThread
(
waitingForKeyboardCloseRunnable
,
200
);
}
else
{
startLayoutAnimation
(
false
,
true
);
}
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>
15
)
{
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
...
...
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java
View file @
1c74ed45
...
...
@@ -112,10 +112,7 @@ public class ActionBarMenu extends LinearLayout {
}
public
void
clearItems
()
{
while
(
getChildCount
()
>
0
)
{
View
view
=
getChildAt
(
0
);
removeView
(
view
);
}
removeAllViews
();
}
public
void
onMenuButtonPressed
()
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
View file @
1c74ed45
...
...
@@ -233,6 +233,9 @@ public class BottomSheet extends Dialog {
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
int
width
=
MeasureSpec
.
getSize
(
widthMeasureSpec
);
int
height
=
MeasureSpec
.
getSize
(
heightMeasureSpec
);
if
(
lastInsets
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
21
)
{
width
-=
lastInsets
.
getSystemWindowInsetRight
()
+
lastInsets
.
getSystemWindowInsetLeft
();
}
setMeasuredDimension
(
width
,
height
);
boolean
isPortrait
=
width
<
height
;
...
...
@@ -262,9 +265,6 @@ public class BottomSheet extends Dialog {
if
(
child
.
getVisibility
()
==
GONE
||
child
==
containerView
)
{
continue
;
}
if
(
lastInsets
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
21
)
{
child
.
dispatchApplyWindowInsets
(
lastInsets
);
}
measureChildWithMargins
(
child
,
MeasureSpec
.
makeMeasureSpec
(
width
,
MeasureSpec
.
EXACTLY
),
0
,
MeasureSpec
.
makeMeasureSpec
(
height
,
MeasureSpec
.
EXACTLY
),
0
);
}
}
...
...
@@ -272,15 +272,15 @@ public class BottomSheet extends Dialog {
@Override
protected
void
onLayout
(
boolean
changed
,
int
left
,
int
top
,
int
right
,
int
bottom
)
{
if
(
containerView
!=
null
)
{
int
l
=
((
right
-
left
)
-
containerView
.
getMeasuredWidth
())
/
2
;
int
t
=
(
bottom
-
top
)
-
containerView
.
getMeasuredHeight
();
if
(
lastInsets
!=
null
&&
Build
.
VERSION
.
SDK_INT
>=
21
)
{
l
+=
lastInsets
.
getSystemWindowInsetLeft
()
/
2
;
l
-=
lastInsets
.
getSystemWindowInsetRight
()
/
2
;
l
eft
+=
lastInsets
.
getSystemWindowInsetLeft
()
;
right
+=
lastInsets
.
getSystemWindowInsetLeft
()
;
if
(
focusable
)
{
t
-=
lastInsets
.
getSystemWindowInsetBottom
();
}
}
int
l
=
((
right
-
left
)
-
containerView
.
getMeasuredWidth
())
/
2
;
containerView
.
layout
(
l
,
t
,
l
+
containerView
.
getMeasuredWidth
(),
t
+
getMeasuredHeight
());
}
...
...
@@ -382,6 +382,12 @@ public class BottomSheet extends Dialog {
protected
boolean
drawChild
(
Canvas
canvas
,
View
child
,
long
drawingTime
)
{
return
super
.
drawChild
(
canvas
,
child
,
drawingTime
);
}
@Override
protected
void
onLayout
(
boolean
changed
,
int
l
,
int
t
,
int
r
,
int
b
)
{
super
.
onLayout
(
changed
,
l
,
t
,
r
,
b
);
FileLog
.
e
(
"tmessages"
,
"container on layout"
);
}
};
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
containerView
.
setFitsSystemWindows
(
true
);
...
...
@@ -548,7 +554,7 @@ public class BottomSheet extends Dialog {
private
void
startRevealAnimation
(
final
boolean
open
)
{
ViewProxy
.
setTranslationY
(
containerView
,
0
);
AnimatorSet
animatorSet
=
new
AnimatorSet
();
final
AnimatorSet
animatorSet
=
new
AnimatorSet
();
View
view
=
delegate
.
getRevealView
();
if
(
view
.
getVisibility
()
==
View
.
VISIBLE
&&
((
ViewGroup
)
view
.
getParent
()).
getVisibility
()
==
View
.
VISIBLE
)
{
...
...
@@ -580,6 +586,7 @@ public class BottomSheet extends Dialog {
for
(
int
a
=
0
;
a
<
4
;
a
++)
{
finalRevealRadius
=
Math
.
max
(
finalRevealRadius
,
(
int
)
Math
.
ceil
(
Math
.
sqrt
((
revealX
-
corners
[
a
][
0
])
*
(
revealX
-
corners
[
a
][
0
])
+
(
revealY
-
corners
[
a
][
1
])
*
(
revealY
-
corners
[
a
][
1
]))));
}
int
finalRevealX
=
revealX
<=
containerView
.
getMeasuredWidth
()
?
revealX
:
containerView
.
getMeasuredWidth
();
ArrayList
<
Animator
>
animators
=
new
ArrayList
<>(
3
);
animators
.
add
(
ObjectAnimator
.
ofFloat
(
this
,
"revealRadius"
,
open
?
0
:
finalRevealRadius
,
open
?
finalRevealRadius
:
0
));
...
...
@@ -587,7 +594,7 @@ public class BottomSheet extends Dialog {
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
containerView
.
setElevation
(
AndroidUtilities
.
dp
(
10
));
try
{
animators
.
add
(
ViewAnimationUtils
.
createCircularReveal
(
containerView
,
revealX
<=
containerView
.
getMeasuredWidth
()
?
revealX
:
containerView
.
getMeasuredWidth
()
,
revealY
,
open
?
0
:
finalRevealRadius
,
open
?
finalRevealRadius
:
0
));
animators
.
add
(
ViewAnimationUtils
.
createCircularReveal
(
containerView
,
finalRevealX
,
revealY
,
open
?
0
:
finalRevealRadius
,
open
?
finalRevealRadius
:
0
));
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
...
...
@@ -626,7 +633,7 @@ public class BottomSheet extends Dialog {
}
containerView
.
invalidate
();
if
(
Build
.
VERSION
.
SDK_INT
>=
11
)
{
container
.
setLayerType
(
View
.
LAYER_TYPE_NONE
,
null
);
container
View
.
setLayerType
(
View
.
LAYER_TYPE_NONE
,
null
);
}
if
(!
open
)
{
containerView
.
setVisibility
(
View
.
INVISIBLE
);
...
...
@@ -642,17 +649,20 @@ public class BottomSheet extends Dialog {
}
private
void
startOpenAnimation
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
container
.
setLayerType
(
View
.
LAYER_TYPE_HARDWARE
,
null
);
}
if
(
containerView
.
getMeasuredHeight
()
==
0
)
{
containerView
.
measure
(
View
.
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
displaySize
.
x
,
View
.
MeasureSpec
.
AT_MOST
),
View
.
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
displaySize
.
y
,
View
.
MeasureSpec
.
AT_MOST
));
}
backgroundDrawable
.
setAlpha
(
0
);
containerView
.
setVisibility
(
View
.
VISIBLE
);
if
(
useRevealAnimation
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
containerView
.
setLayerType
(
View
.
LAYER_TYPE_HARDWARE
,
null
);
}
startRevealAnimation
(
true
);
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
20
)
{
container
.
setLayerType
(
View
.
LAYER_TYPE_HARDWARE
,
null
);
}
ViewProxy
.
setTranslationY
(
containerView
,
containerView
.
getMeasuredHeight
());
backgroundDrawable
.
setAlpha
(
0
);
AnimatorSetProxy
animatorSetProxy
=
new
AnimatorSetProxy
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
View file @
1c74ed45
...
...
@@ -233,6 +233,8 @@ public class Theme {
public
static
PorterDuffColorFilter
colorPressedFilter
;
private
static
int
currentColor
;
public
static
Drawable
attachButtonDrawables
[]
=
new
Drawable
[
8
];
private
static
Paint
maskPaint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
public
static
void
loadRecources
(
Context
context
)
{
...
...
@@ -329,14 +331,14 @@ public class Theme {
geoInDrawable
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
location_b
);
geoOutDrawable
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
location_g
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_camera_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_gallery_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_video_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_audio_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_file_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_contact_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_location_states
);
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_hide_states
);
attachButtonDrawables
[
0
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_camera_states
);
attachButtonDrawables
[
1
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_gallery_states
);
attachButtonDrawables
[
2
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_video_states
);
attachButtonDrawables
[
3
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_audio_states
);
attachButtonDrawables
[
4
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_file_states
);
attachButtonDrawables
[
5
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_contact_states
);
attachButtonDrawables
[
6
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_location_states
);
attachButtonDrawables
[
7
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
attach_hide_states
);
cornerOuter
[
0
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
corner_out_tl
);
cornerOuter
[
1
]
=
context
.
getResources
().
getDrawable
(
R
.
drawable
.
corner_out_tr
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/AudioSelectActivity.java
View file @
1c74ed45
...
...
@@ -203,7 +203,7 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
final
ArrayList
<
MediaController
.
AudioEntry
>
newAudioEntries
=
new
ArrayList
<>();
Cursor
cursor
=
null
;
try
{
cursor
=
ApplicationLoader
.
applicationContext
.
getContentResolver
().
query
(
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
,
projection
,
MediaStore
.
Audio
.
Media
.
IS_MUSIC
+
" != 0"
,
null
,
null
);
cursor
=
ApplicationLoader
.
applicationContext
.
getContentResolver
().
query
(
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
,
projection
,
MediaStore
.
Audio
.
Media
.
IS_MUSIC
+
" != 0"
,
null
,
MediaStore
.
Audio
.
Media
.
TITLE
);
int
id
=
-
2000000000
;
while
(
cursor
.
moveToNext
())
{
MediaController
.
AudioEntry
audioEntry
=
new
MediaController
.
AudioEntry
();
...
...
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
View file @
1c74ed45
...
...
@@ -62,7 +62,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.Locale
;
public
class
ChatMessageCell
extends
ChatBaseCell
implements
SeekBar
.
SeekBarDelegate
{
public
class
ChatMessageCell
extends
ChatBaseCell
implements
SeekBar
.
SeekBarDelegate
,
ImageReceiver
.
ImageReceiverDelegate
{
private
final
static
int
DOCUMENT_ATTACH_TYPE_NONE
=
0
;
private
final
static
int
DOCUMENT_ATTACH_TYPE_DOCUMENT
=
1
;
...
...
@@ -202,6 +202,7 @@ public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDele
super
(
context
);
avatarDrawable
=
new
AvatarDrawable
();
photoImage
=
new
ImageReceiver
(
this
);
photoImage
.
setDelegate
(
this
);
radialProgress
=
new
RadialProgress
(
this
);
seekBar
=
new
SeekBar
(
context
);
seekBar
.
setDelegate
(
this
);
...
...
@@ -1703,6 +1704,7 @@ public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDele
}
}
}
else
if
(
webPage
.
photo
!=
null
)
{
drawImageButton
=
webPage
.
type
!=
null
&&
webPage
.
type
.
equals
(
"photo"
);
currentPhotoObject
=
FileLoader
.
getClosestPhotoSizeWithSize
(
messageObject
.
photoThumbs
,
drawImageButton
?
AndroidUtilities
.
getPhotoSize
()
:
maxPhotoWidth
,
!
drawImageButton
);
currentPhotoObjectThumb
=
FileLoader
.
getClosestPhotoSizeWithSize
(
messageObject
.
photoThumbs
,
80
);
if
(
currentPhotoObjectThumb
==
currentPhotoObject
)
{
...
...
@@ -3300,6 +3302,14 @@ public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDele
}
}
@Override
public
void
didSetImage
(
ImageReceiver
imageReceiver
,
boolean
set
,
boolean
thumb
)
{
if
(
currentMessageObject
!=
null
&&
set
&&
!
thumb
&&
!
currentMessageObject
.
mediaExists
&&
!
currentMessageObject
.
attachPathExists
)
{
currentMessageObject
.
mediaExists
=
true
;
updateButtonState
(
true
);
}
}
@Override
public
void
onProgressDownload
(
String
fileName
,
float
progress
)
{
radialProgress
.
setProgress
(
progress
,
true
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
1c74ed45
...
...
@@ -250,7 +250,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private
Runnable
waitingForCharaterEnterRunnable
;
private
boolean
openAnimationEnded
;
private
boolean
attachAttachViewFirstShow
=
true
;
private
int
readWithDate
;
private
int
readWithMid
;
...
...
@@ -702,7 +701,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
cantDeleteMessagesCount
=
0
;
hasOwnBackground
=
true
;
chatAttachView
=
null
;
if
(
chatAttachView
!=
null
){
chatAttachView
.
onDestroy
();
chatAttachView
=
null
;
}
chatAttachViewSheet
=
null
;
Theme
.
loadRecources
(
context
);
...
...
@@ -876,17 +878,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
chatAttachView
.
init
(
ChatActivity
.
this
);
if
(
attachAttachViewFirstShow
)
{
AndroidUtilities
.
runOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
showDialog
(
chatAttachViewSheet
);
}
});
attachAttachViewFirstShow
=
false
;
}
else
{
showDialog
(
chatAttachViewSheet
);
}
showDialog
(
chatAttachViewSheet
);
}
else
if
(
id
==
bot_help
)
{
SendMessagesHelper
.
getInstance
().
sendMessage
(
"/help"
,
dialog_id
,
null
,
null
,
false
,
chatActivityEnterView
==
null
||
chatActivityEnterView
.
asAdmin
(),
null
,
null
,
null
);
}
else
if
(
id
==
bot_settings
)
{
...
...
@@ -2845,11 +2837,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int
totalItemCount
=
chatAdapter
.
getItemCount
();
int
checkLoadCount
;
if
(
scroll
)
{
if
(
lastLoadIndex
<
3
)
{
checkLoadCount
=
5
;
}
else
{
checkLoadCount
=
25
;
}
checkLoadCount
=
25
;
}
else
{
checkLoadCount
=
5
;
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachView.java
View file @
1c74ed45
...
...
@@ -17,6 +17,7 @@ import android.annotation.SuppressLint;
import
android.content.Context
;
import
android.content.pm.PackageManager
;
import
android.graphics.Bitmap
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
...
...
@@ -39,6 +40,7 @@ import org.telegram.messenger.support.widget.LinearLayoutManager;
import
org.telegram.messenger.R
;
import
org.telegram.messenger.support.widget.RecyclerView
;
import
org.telegram.tgnet.TLRPC
;
import
org.telegram.ui.ActionBar.Theme
;
import
org.telegram.ui.Cells.PhotoAttachPhotoCell
;
import
org.telegram.ui.ChatActivity
;
import
org.telegram.ui.PhotoViewer
;
...
...
@@ -97,9 +99,9 @@ public class ChatAttachView extends FrameLayout implements NotificationCenter.No
super
.
onMeasure
(
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
85
),
MeasureSpec
.
EXACTLY
),
MeasureSpec
.
makeMeasureSpec
(
AndroidUtilities
.
dp
(
90
),
MeasureSpec
.
EXACTLY
));
}
public
void
setTextAndIcon
(
CharSequence
text
,
int
icon
)
{
public
void
setTextAndIcon
(
CharSequence
text
,
Drawable
drawable
)
{
textView
.
setText
(
text
);
imageView
.
setBackground
Resource
(
icon
);
imageView
.
setBackground
Drawable
(
drawable
);
}
}
...
...
@@ -168,19 +170,9 @@ public class ChatAttachView extends FrameLayout implements NotificationCenter.No
LocaleController
.
getString
(
"ChatLocation"
,
R
.
string
.
ChatLocation
),
""
};
int
itemIcons
[]
=
new
int
[]
{
R
.
drawable
.
attach_camera_states
,
R
.
drawable
.
attach_gallery_states
,
R
.
drawable
.
attach_video_states
,
R
.
drawable
.
attach_audio_states
,
R
.
drawable
.
attach_file_states
,
R
.
drawable
.
attach_contact_states
,
R
.
drawable
.
attach_location_states
,
R
.
drawable
.
attach_hide_states
,
};
for
(
int
a
=
0
;
a
<
8
;
a
++)
{
AttachButton
attachButton
=
new
AttachButton
(
context
);
attachButton
.
setTextAndIcon
(
items
[
a
],
itemIcon
s
[
a
]);
attachButton
.
setTextAndIcon
(
items
[
a
],
Theme
.
attachButtonDrawable
s
[
a
]);
addView
(
attachButton
,
LayoutHelper
.
createFrame
(
85
,
90
,
Gravity
.
LEFT
|
Gravity
.
TOP
));
attachButton
.
setTag
(
a
);
views
[
a
]
=
attachButton
;
...
...
@@ -282,10 +274,8 @@ public class ChatAttachView extends FrameLayout implements NotificationCenter.No
}
public
void
loadGalleryPhotos
()
{
if
(
MediaController
.
allPhotosAlbumEntry
==
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
MediaController
.
loadGalleryPhotosAlbums
(
0
);
}
if
(
MediaController
.
allPhotosAlbumEntry
==
null
&&
Build
.
VERSION
.
SDK_INT
>=
21
)
{
MediaController
.
loadGalleryPhotosAlbums
(
0
);
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/Components/WebFrameLayout.java
View file @
1c74ed45
...
...
@@ -10,6 +10,7 @@ package org.telegram.ui.Components;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
...
...
@@ -38,6 +39,8 @@ import org.telegram.ui.ActionBar.BottomSheet;
import
org.telegram.ui.ActionBar.Theme
;
import
java.util.HashMap
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
WebFrameLayout
extends
FrameLayout
{
...
...
@@ -52,11 +55,67 @@ public class WebFrameLayout extends FrameLayout {
private
int
height
;
private
String
openUrl
;
private
boolean
hasDescription
;
private
String
embedUrl
;
final
static
Pattern
youtubeIdRegex
=
Pattern
.
compile
(
"(?:youtube(?:-nocookie)?\\.com\\/(?:[^\\/\\n\\s]+\\/\\S+\\/|(?:v|e(?:mbed)?)\\/|\\S*?[?&]v=)|youtu\\.be\\/)([a-zA-Z0-9_-]{11})"
);
private
final
String
youtubeFrame
=
"<!DOCTYPE html><html><head><style>"
+
"body { margin: 0; width:100%%; height:100%%; background-color:#000; }"
+
"html { width:100%%; height:100%%; background-color:#000; }"
+
".embed-container iframe,"
+
".embed-container object,"
+
" .embed-container embed {"
+
" position: absolute;"
+
" top: 0;"
+
" left: 0;"
+
" width: 100%% !important;"
+
" height: 100%% !important;"
+
" }"
+
" </style></head><body>"
+
" <div class=\"embed-container\">"
+
" <div id=\"player\"></div>"
+
" </div>"
+
" <script src=\"https://www.youtube.com/iframe_api\"></script>"
+
" <script>"
+
" var player;"
+
" YT.ready(function() {"
+
" player = new YT.Player(\"player\", {"
+
" \"width\" : \"100%%\","
+
" \"events\" : {"
+
" \"onReady\" : \"onReady\","
+
" },"
+
" \"videoId\" : \"%1$s\","
+
" \"height\" : \"100%%\","
+
" \"playerVars\" : {"
+
" \"start\" : 0,"
+
" \"rel\" : 0,"
+
" \"showinfo\" : 0,"
+
" \"modestbranding\" : 1,"
+
" \"iv_load_policy\" : 3,"
+
" \"autohide\" : 1,"
+
" \"cc_load_policy\" : 1,"
+
" \"playsinline\" : 1,"
+
" \"controls\" : 1"
+
" }"
+
" });"
+
" player.setSize(window.innerWidth, window.innerHeight);"
+
" });"
+
" function onReady(event) {"
+
" player.playVideo();"
+
" }"
+
" window.onresize = function() {"
+
" player.setSize(window.innerWidth, window.innerHeight);"
+
" }"
+
" </script>"
+
"</body>"
+
"</html>"
;
@SuppressLint
(
"SetJavaScriptEnabled"
)
public
WebFrameLayout
(
Context
context
,
final
BottomSheet
parentDialog
,
String
title
,
String
descripton
,
String
originalUrl
,
final
String
url
,
int
w
,
int
h
)
{
super
(
context
);
embedUrl
=
url
;
if
(
embedUrl
.
toLowerCase
().
contains
(
"youtube"
))
{
//embedUrl += "&enablejsapi=1";
}
hasDescription
=
descripton
!=
null
&&
descripton
.
length
()
>
0
;
openUrl
=
originalUrl
;
width
=
w
;
...
...
@@ -162,9 +221,6 @@ public class WebFrameLayout extends FrameLayout {
progressBar
=
new
ProgressBar
(
context
);
addView
(
progressBar
,
LayoutHelper
.
createFrame
(
LayoutHelper
.
WRAP_CONTENT
,
LayoutHelper
.
WRAP_CONTENT
,
Gravity
.
CENTER
,
0
,
0
,
0
,
(
48
+
36
+
(
hasDescription
?
22
:
0
))
/
2
));
//TODO 16m
//TODO 14
TextView
textView
;
if
(
hasDescription
)
{
...
...
@@ -282,11 +338,31 @@ public class WebFrameLayout extends FrameLayout {
public
void
onOpenAnimationEnd
()
{
HashMap
<
String
,
String
>
args
=
new
HashMap
<>();
args
.
put
(
"Referer"
,
"http://youtube.com"
);
boolean
ok
=
false
;
try
{
webView
.
loadUrl
(
url
,
args
);
Uri
uri
=
Uri
.
parse
(
openUrl
);
String
host
=
uri
.
getHost
().
toLowerCase
();
if
(
host
!=
null
&&
host
.
endsWith
(
"youtube.com"
)
||
host
.
endsWith
(
"youtu.be"
))
{
Matcher
matcher
=
youtubeIdRegex
.
matcher
(
openUrl
);
String
id
=
null
;
if
(
matcher
.
find
())
{
id
=
matcher
.
group
(
1
);
}
if
(
id
!=
null
)
{
ok
=
true
;
webView
.
loadDataWithBaseURL
(
"http://youtube.com"
,
String
.
format
(
youtubeFrame
,
id
),
"text/html"
,
"UTF-8"
,
"http://youtube.com"
);
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
if
(!
ok
)
{
try
{
webView
.
loadUrl
(
embedUrl
,
args
);
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
}
}
});
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java
View file @
1c74ed45
...
...
@@ -779,7 +779,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
group
=
path
.
replace
(
"joinchat/"
,
""
);
}
else
if
(
path
.
startsWith
(
"addstickers/"
))
{
sticker
=
path
.
replace
(
"addstickers/"
,
""
);
}
else
if
(
path
.
startsWith
(
"msg/"
))
{
}
else
if
(
path
.
startsWith
(
"msg/"
)
||
path
.
startsWith
(
"share/"
)
)
{
message
=
data
.
getQueryParameter
(
"url"
);
if
(
message
==
null
)
{
message
=
""
;
...
...
@@ -823,8 +823,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
url
=
url
.
replace
(
"tg:addstickers"
,
"tg://telegram.org"
).
replace
(
"tg://addstickers"
,
"tg://telegram.org"
);
data
=
Uri
.
parse
(
url
);
sticker
=
data
.
getQueryParameter
(
"set"
);
}
else
if
(
url
.
startsWith
(
"tg:msg"
)
||
url
.
startsWith
(
"tg://msg"
))
{
url
=
url
.
replace
(
"tg:msg"
,
"tg://telegram.org"
).
replace
(
"tg://msg"
,
"tg://telegram.org"
);
}
else
if
(
url
.
startsWith
(
"tg:msg"
)
||
url
.
startsWith
(
"tg://msg"
)
||
url
.
startsWith
(
"tg://share"
)
||
url
.
startsWith
(
"tg:share"
)
)
{
url
=
url
.
replace
(
"tg:msg"
,
"tg://telegram.org"
).
replace
(
"tg://msg"
,
"tg://telegram.org"
)
.
replace
(
"tg://share"
,
"tg://telegram.org"
).
replace
(
"tg:share"
,
"tg://telegram.org"
)
;
data
=
Uri
.
parse
(
url
);
message
=
data
.
getQueryParameter
(
"url"
);
if
(
message
==
null
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java
View file @
1c74ed45
...
...
@@ -890,7 +890,7 @@ public class LoginActivity extends BaseFragment {
if
(
countryState
==
1
)
{
needShowAlert
(
LocaleController
.
getString
(
"AppName"
,
R
.
string
.
AppName
),
LocaleController
.
getString
(
"ChooseCountry"
,
R
.
string
.
ChooseCountry
));
return
;
}
else
if
(
countryState
==
2
&&
!
BuildVars
.
DEBUG_VERSION
)
{
}
else
if
(
countryState
==
2
&&
!
BuildVars
.
DEBUG_VERSION
&&
!
codeField
.
getText
().
toString
().
equals
(
"999"
)
)
{
needShowAlert
(
LocaleController
.
getString
(
"AppName"
,
R
.
string
.
AppName
),
LocaleController
.
getString
(
"WrongCountry"
,
R
.
string
.
WrongCountry
));
return
;
}
...
...
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