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
512aeaf2
Commit
512aeaf2
authored
Jun 11, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed image stuck after zoom end between max and min
parent
0c49c206
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
18 deletions
+31
-18
build.gradle
TMessagesProj/build.gradle
+1
-1
PhotoViewer.java
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
+30
-17
No files found.
TMessagesProj/build.gradle
View file @
512aeaf2
...
...
@@ -81,7 +81,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
19
versionCode
24
3
versionCode
24
4
versionName
"1.4.15"
}
}
TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java
View file @
512aeaf2
...
...
@@ -142,6 +142,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private
boolean
doubleTap
=
false
;
private
boolean
invalidCoords
=
false
;
private
boolean
canDragDown
=
true
;
private
boolean
zoomAnimation
=
false
;
private
int
switchImageAfterAnimation
=
0
;
private
VelocityTracker
velocityTracker
=
null
;
...
...
@@ -1409,20 +1410,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
doubleTap
=
false
;
moving
=
false
;
zooming
=
false
;
float
moveToX
=
translationX
;
float
moveToY
=
translationY
;
updateMinMax
(
scale
);
if
(
translationX
<
minX
)
{
moveToX
=
minX
;
}
else
if
(
translationX
>
maxX
)
{
moveToX
=
maxX
;
}
if
(
translationY
<
minY
)
{
moveToY
=
minY
;
}
else
if
(
translationY
>
maxY
)
{
moveToY
=
maxY
;
}
animateTo
(
scale
,
moveToX
,
moveToY
);
checkMinMax
(
false
);
return
true
;
}
...
...
@@ -1515,7 +1503,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
invalidCoords
=
true
;
if
(
scale
<
1.0f
)
{
updateMinMax
(
1.0f
);
animateTo
(
1.0f
,
0
,
0
);
animateTo
(
1.0f
,
0
,
0
,
true
);
}
else
if
(
scale
>
3.0f
)
{
float
atx
=
(
pinchCenterX
-
containerView
.
getWidth
()
/
2
)
-
((
pinchCenterX
-
containerView
.
getWidth
()
/
2
)
-
pinchStartX
)
*
(
3.0f
/
pinchStartScale
);
float
aty
=
(
pinchCenterY
-
containerView
.
getHeight
()
/
2
)
-
((
pinchCenterY
-
containerView
.
getHeight
()
/
2
)
-
pinchStartY
)
*
(
3.0f
/
pinchStartScale
);
...
...
@@ -1530,7 +1518,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
else
if
(
aty
>
maxY
)
{
aty
=
maxY
;
}
animateTo
(
3.0f
,
atx
,
aty
);
animateTo
(
3.0f
,
atx
,
aty
,
true
);
}
else
{
checkMinMax
(
true
);
}
zooming
=
false
;
}
else
if
(
draggingDown
)
{
...
...
@@ -1579,6 +1569,23 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return
false
;
}
private
void
checkMinMax
(
boolean
zoom
)
{
float
moveToX
=
translationX
;
float
moveToY
=
translationY
;
updateMinMax
(
scale
);
if
(
translationX
<
minX
)
{
moveToX
=
minX
;
}
else
if
(
translationX
>
maxX
)
{
moveToX
=
maxX
;
}
if
(
translationY
<
minY
)
{
moveToY
=
minY
;
}
else
if
(
translationY
>
maxY
)
{
moveToY
=
maxY
;
}
animateTo
(
scale
,
moveToX
,
moveToY
,
zoom
);
}
private
void
goToNext
()
{
float
extra
=
0
;
if
(
scale
!=
1
)
{
...
...
@@ -1598,6 +1605,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
private
void
animateTo
(
float
newScale
,
float
newTx
,
float
newTy
)
{
animateTo
(
newScale
,
newTx
,
newTy
,
false
);
}
private
void
animateTo
(
float
newScale
,
float
newTx
,
float
newTy
,
boolean
isZoom
)
{
if
(
switchImageAfterAnimation
==
0
)
{
toggleOverlayView
(
true
);
}
...
...
@@ -1605,6 +1616,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
Utilities
.
unlockOrientation
(
parentActivity
);
return
;
}
zoomAnimation
=
isZoom
;
animateToScale
=
newScale
;
animateToX
=
newTx
;
animateToY
=
newTy
;
...
...
@@ -1655,6 +1667,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animationStartTime
=
0
;
updateMinMax
(
scale
);
Utilities
.
unlockOrientation
(
parentActivity
);
zoomAnimation
=
false
;
}
if
(
switchImageAfterAnimation
!=
0
)
{
if
(
switchImageAfterAnimation
==
1
)
{
...
...
@@ -1710,7 +1723,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
sideImage
=
rightImage
;
}
if
(
sideImage
!=
null
)
{
if
(
!
zoomAnimation
&&
!
zooming
&&
sideImage
!=
null
)
{
changingPage
=
true
;
canvas
.
translate
(
k
*
containerView
.
getWidth
()
/
2
,
-
currentTranslationY
);
canvas
.
scale
(
1.0f
/
scale
,
1.0f
/
scale
);
...
...
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