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
db64b2f6
Commit
db64b2f6
authored
Jun 11, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Photo viewer bug fixes
parent
512aeaf2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
7 deletions
+64
-7
ChatMediaCell.java
...oj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java
+12
-0
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+5
-0
ChatProfileActivity.java
...oj/src/main/java/org/telegram/ui/ChatProfileActivity.java
+5
-0
MediaActivity.java
...agesProj/src/main/java/org/telegram/ui/MediaActivity.java
+4
-2
PhotoViewer.java
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
+28
-5
SettingsActivity.java
...sProj/src/main/java/org/telegram/ui/SettingsActivity.java
+5
-0
UserProfileActivity.java
...oj/src/main/java/org/telegram/ui/UserProfileActivity.java
+5
-0
photoview_placeholder.png
...sagesProj/src/main/res/drawable/photoview_placeholder.png
+0
-0
No files found.
TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java
View file @
db64b2f6
...
@@ -61,6 +61,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -61,6 +61,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
private
ProgressView
progressView
;
private
ProgressView
progressView
;
public
int
downloadPhotos
=
0
;
public
int
downloadPhotos
=
0
;
private
boolean
progressVisible
=
false
;
private
boolean
progressVisible
=
false
;
private
boolean
photoNotSet
=
false
;
private
int
TAG
;
private
int
TAG
;
...
@@ -290,6 +291,12 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -290,6 +291,12 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
}
}
}
else
if
(
currentPhotoObject
==
null
)
{
}
else
if
(
currentPhotoObject
==
null
)
{
return
true
;
return
true
;
}
else
if
(
currentPhotoObject
!=
null
&&
photoNotSet
)
{
String
fileName
=
MessageObject
.
getAttachFileName
(
currentPhotoObject
.
photoOwner
);
File
cacheFile
=
new
File
(
Utilities
.
getCacheDir
(),
fileName
);
if
(
cacheFile
.
exists
())
{
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
@@ -304,6 +311,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -304,6 +311,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
gifDrawable
=
null
;
gifDrawable
=
null
;
currentPhotoObject
=
null
;
currentPhotoObject
=
null
;
currentUrl
=
null
;
currentUrl
=
null
;
photoNotSet
=
false
;
if
(
messageObject
.
type
==
8
)
{
if
(
messageObject
.
type
==
8
)
{
gifDrawable
=
MediaController
.
getInstance
().
getGifDrawable
(
this
,
false
);
gifDrawable
=
MediaController
.
getInstance
().
getGifDrawable
(
this
,
false
);
...
@@ -405,6 +413,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -405,6 +413,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
photoImage
.
setImage
(
currentPhotoObject
.
photoOwner
.
location
,
currentPhotoFilter
,
messageObject
.
isOut
()
?
placeholderOutDrawable
:
placeholderInDrawable
,
currentPhotoObject
.
photoOwner
.
size
);
photoImage
.
setImage
(
currentPhotoObject
.
photoOwner
.
location
,
currentPhotoFilter
,
messageObject
.
isOut
()
?
placeholderOutDrawable
:
placeholderInDrawable
,
currentPhotoObject
.
photoOwner
.
size
);
}
}
}
else
{
}
else
{
photoNotSet
=
true
;
if
(
messageObject
.
imagePreview
!=
null
)
{
if
(
messageObject
.
imagePreview
!=
null
)
{
photoImage
.
setImageBitmap
(
messageObject
.
imagePreview
);
photoImage
.
setImageBitmap
(
messageObject
.
imagePreview
);
}
else
{
}
else
{
...
@@ -597,6 +606,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
...
@@ -597,6 +606,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD
if
(
currentMessageObject
.
type
==
8
&&
lastDownloadedGifMessage
!=
null
&&
lastDownloadedGifMessage
.
messageOwner
.
id
==
currentMessageObject
.
messageOwner
.
id
&&
buttonState
==
2
)
{
if
(
currentMessageObject
.
type
==
8
&&
lastDownloadedGifMessage
!=
null
&&
lastDownloadedGifMessage
.
messageOwner
.
id
==
currentMessageObject
.
messageOwner
.
id
&&
buttonState
==
2
)
{
didPressedButton
();
didPressedButton
();
}
}
if
(
photoNotSet
)
{
setMessageObject
(
currentMessageObject
);
}
}
}
@Override
@Override
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
db64b2f6
...
@@ -3371,6 +3371,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
...
@@ -3371,6 +3371,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
return
null
;
return
null
;
}
}
@Override
public
void
willHidePhotoViewer
()
{
updateVisibleRows
();
}
private
class
ChatAdapter
extends
BaseAdapter
{
private
class
ChatAdapter
extends
BaseAdapter
{
private
Context
mContext
;
private
Context
mContext
;
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java
View file @
db64b2f6
...
@@ -367,6 +367,11 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
...
@@ -367,6 +367,11 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
return
null
;
return
null
;
}
}
@Override
public
void
willHidePhotoViewer
()
{
}
public
void
didReceivedNotification
(
int
id
,
Object
...
args
)
{
public
void
didReceivedNotification
(
int
id
,
Object
...
args
)
{
if
(
id
==
MessagesController
.
updateInterfaces
)
{
if
(
id
==
MessagesController
.
updateInterfaces
)
{
int
mask
=
(
Integer
)
args
[
0
];
int
mask
=
(
Integer
)
args
[
0
];
...
...
TMessagesProj/src/main/java/org/telegram/ui/MediaActivity.java
View file @
db64b2f6
...
@@ -293,8 +293,10 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No
...
@@ -293,8 +293,10 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No
}
}
}
}
return
null
;
return
null
;
// NotificationCenter.getInstance().addToMemCache(54, messages); TODO
}
// NotificationCenter.getInstance().addToMemCache(55, i);
@Override
public
void
willHidePhotoViewer
()
{
}
}
...
...
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
View file @
db64b2f6
...
@@ -199,7 +199,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -199,7 +199,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
public
static
interface
PhotoViewerProvider
{
public
static
interface
PhotoViewerProvider
{
public
abstract
PlaceProviderObject
getPlaceForPhoto
(
MessageObject
messageObject
,
TLRPC
.
FileLocation
fileLocation
);
public
PlaceProviderObject
getPlaceForPhoto
(
MessageObject
messageObject
,
TLRPC
.
FileLocation
fileLocation
);
public
void
willHidePhotoViewer
();
}
}
private
static
class
FrameLayoutTouchListener
extends
FrameLayout
{
private
static
class
FrameLayoutTouchListener
extends
FrameLayout
{
...
@@ -737,17 +738,30 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -737,17 +738,30 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
TLRPC
.
PhotoSize
sizeFull
=
PhotoObject
.
getClosestPhotoSizeWithSize
(
message
.
messageOwner
.
action
.
photo
.
sizes
,
800
,
800
);
TLRPC
.
PhotoSize
sizeFull
=
PhotoObject
.
getClosestPhotoSizeWithSize
(
message
.
messageOwner
.
action
.
photo
.
sizes
,
800
,
800
);
if
(
sizeFull
!=
null
)
{
if
(
sizeFull
!=
null
)
{
size
[
0
]
=
sizeFull
.
size
;
size
[
0
]
=
sizeFull
.
size
;
if
(
size
[
0
]
==
0
)
{
size
[
0
]
=
-
1
;
}
return
sizeFull
.
location
;
return
sizeFull
.
location
;
}
else
{
size
[
0
]
=
-
1
;
}
}
}
}
}
else
if
(
message
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaPhoto
&&
message
.
messageOwner
.
media
.
photo
!=
null
)
{
}
else
if
(
message
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaPhoto
&&
message
.
messageOwner
.
media
.
photo
!=
null
)
{
TLRPC
.
PhotoSize
sizeFull
=
PhotoObject
.
getClosestPhotoSizeWithSize
(
message
.
messageOwner
.
media
.
photo
.
sizes
,
800
,
800
);
TLRPC
.
PhotoSize
sizeFull
=
PhotoObject
.
getClosestPhotoSizeWithSize
(
message
.
messageOwner
.
media
.
photo
.
sizes
,
800
,
800
);
if
(
sizeFull
!=
null
)
{
if
(
sizeFull
!=
null
)
{
size
[
0
]
=
sizeFull
.
size
;
size
[
0
]
=
sizeFull
.
size
;
if
(
size
[
0
]
==
0
)
{
size
[
0
]
=
-
1
;
}
return
sizeFull
.
location
;
return
sizeFull
.
location
;
}
else
{
size
[
0
]
=
-
1
;
}
}
}
else
if
(
message
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaVideo
&&
message
.
messageOwner
.
media
.
video
!=
null
&&
message
.
messageOwner
.
media
.
video
.
thumb
!=
null
)
{
}
else
if
(
message
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaVideo
&&
message
.
messageOwner
.
media
.
video
!=
null
&&
message
.
messageOwner
.
media
.
video
.
thumb
!=
null
)
{
size
[
0
]
=
message
.
messageOwner
.
media
.
video
.
thumb
.
size
;
size
[
0
]
=
message
.
messageOwner
.
media
.
video
.
thumb
.
size
;
if
(
size
[
0
]
==
0
)
{
size
[
0
]
=
-
1
;
}
return
message
.
messageOwner
.
media
.
video
.
thumb
.
location
;
return
message
.
messageOwner
.
media
.
video
.
thumb
.
location
;
}
}
}
}
...
@@ -1088,7 +1102,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1088,7 +1102,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
imageReceiver
.
setImage
(
fileLocation
,
null
,
placeHolder
!=
null
?
new
BitmapDrawable
(
null
,
placeHolder
)
:
null
,
size
[
0
]);
imageReceiver
.
setImage
(
fileLocation
,
null
,
placeHolder
!=
null
?
new
BitmapDrawable
(
null
,
placeHolder
)
:
null
,
size
[
0
]);
}
else
{
}
else
{
imageReceiver
.
setImageBitmap
(
(
Bitmap
)
null
);
imageReceiver
.
setImageBitmap
(
parentActivity
.
getResources
().
getDrawable
(
R
.
drawable
.
photoview_placeholder
)
);
}
}
}
else
{
}
else
{
Bitmap
placeHolder
=
null
;
Bitmap
placeHolder
=
null
;
...
@@ -1101,7 +1115,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1101,7 +1115,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
imageReceiver
.
setImage
(
fileLocation
,
null
,
placeHolder
!=
null
?
new
BitmapDrawable
(
null
,
placeHolder
)
:
null
,
size
[
0
]);
imageReceiver
.
setImage
(
fileLocation
,
null
,
placeHolder
!=
null
?
new
BitmapDrawable
(
null
,
placeHolder
)
:
null
,
size
[
0
]);
}
}
}
else
{
}
else
{
imageReceiver
.
setImageBitmap
((
Bitmap
)
null
);
if
(
size
[
0
]
==
0
)
{
imageReceiver
.
setImageBitmap
((
Bitmap
)
null
);
}
else
{
imageReceiver
.
setImageBitmap
(
parentActivity
.
getResources
().
getDrawable
(
R
.
drawable
.
photoview_placeholder
));
}
}
}
}
}
...
@@ -1357,11 +1375,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1357,11 +1375,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
private
void
onPhotoClosed
(
PlaceProviderObject
object
)
{
private
void
onPhotoClosed
(
PlaceProviderObject
object
)
{
placeProvider
=
null
;
disableShowCheck
=
true
;
currentMessageObject
=
null
;
currentMessageObject
=
null
;
currentFileLocation
=
null
;
currentFileLocation
=
null
;
currentThumb
=
null
;
currentThumb
=
null
;
animatingImageView
.
setImageBitmap
(
null
);
centerImage
.
setImageBitmap
((
Bitmap
)
null
);
centerImage
.
setImageBitmap
((
Bitmap
)
null
);
leftImage
.
setImageBitmap
((
Bitmap
)
null
);
leftImage
.
setImageBitmap
((
Bitmap
)
null
);
rightImage
.
setImageBitmap
((
Bitmap
)
null
);
rightImage
.
setImageBitmap
((
Bitmap
)
null
);
...
@@ -1371,10 +1388,16 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
...
@@ -1371,10 +1388,16 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
containerView
.
post
(
new
Runnable
()
{
containerView
.
post
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
animatingImageView
.
setImageBitmap
(
null
);
WindowManager
wm
=
(
WindowManager
)
parentActivity
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
wm
=
(
WindowManager
)
parentActivity
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
wm
.
removeView
(
containerView
);
wm
.
removeView
(
containerView
);
}
}
});
});
if
(
placeProvider
!=
null
)
{
placeProvider
.
willHidePhotoViewer
();
}
placeProvider
=
null
;
disableShowCheck
=
false
;
}
}
public
boolean
isVisible
()
{
public
boolean
isVisible
()
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java
View file @
db64b2f6
...
@@ -444,6 +444,11 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
...
@@ -444,6 +444,11 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
return
null
;
return
null
;
}
}
@Override
public
void
willHidePhotoViewer
()
{
}
public
void
performAskAQuestion
()
{
public
void
performAskAQuestion
()
{
final
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
final
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"mainconfig"
,
Activity
.
MODE_PRIVATE
);
int
uid
=
preferences
.
getInt
(
"support_id"
,
0
);
int
uid
=
preferences
.
getInt
(
"support_id"
,
0
);
...
...
TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java
View file @
db64b2f6
...
@@ -485,6 +485,11 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
...
@@ -485,6 +485,11 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
return
null
;
return
null
;
}
}
@Override
public
void
willHidePhotoViewer
()
{
}
private
void
createActionBarMenu
()
{
private
void
createActionBarMenu
()
{
ActionBarMenu
menu
=
actionBarLayer
.
createMenu
();
ActionBarMenu
menu
=
actionBarLayer
.
createMenu
();
menu
.
clearItems
();
menu
.
clearItems
();
...
...
TMessagesProj/src/main/res/drawable/photoview_placeholder.png
0 → 100644
View file @
db64b2f6
933 Bytes
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