Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
BlissLauncher
Commits
f58da8ec
Commit
f58da8ec
authored
Sep 12, 2021
by
Amit Kumar
💻
Browse files
Use drag region to calculate dragview center
parent
f6bd7feb
Pipeline
#135078
passed with stage
in 10 minutes and 35 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/blisslauncher/features/test/TestActivity.kt
View file @
f58da8ec
...
...
@@ -1391,7 +1391,6 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
})
animator
=
workspaceAnim
}
else
{
val
finalProgressOpposite
=
finalProgress
-
1
val
workspaceAnim
=
ValueAnimator
.
ofFloat
(
currentProgress
,
finalProgress
)
workspaceAnim
.
addUpdateListener
{
workspace
.
onOverlayScrollChanged
(
it
.
animatedValue
as
Float
)
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/dragndrop/DropTarget.java
View file @
f58da8ec
...
...
@@ -94,18 +94,17 @@ public interface DropTarget {
public
final
float
[]
getVisualCenter
(
float
[]
recycle
)
{
final
float
res
[]
=
(
recycle
==
null
)
?
new
float
[
2
]
:
recycle
;
Rect
dragRegion
=
dragView
.
getDragRegion
();
// These represent the visual top and left of drag view if a dragRect was provided.
// If a dragRect was not provided, then they correspond to the actual view left and
// top, as the dragRect is in that case taken to be the entire dragView.
// R.dimen.dragViewOffsetY.
Log
.
d
(
"DropTarget"
,
"X: "
+
x
+
", Y: "
+
y
+
", xoffset: "
+
xOffset
+
", yoffset: "
+
yOffset
);
int
left
=
x
-
xOffset
;
int
top
=
y
-
yOffset
;
int
left
=
x
-
xOffset
-
dragRegion
.
left
;
int
top
=
y
-
yOffset
-
dragRegion
.
top
;
// In order to find the visual center, we shift by half the dragRect
res
[
0
]
=
left
+
drag
View
.
getW
idth
()
/
2
;
res
[
1
]
=
top
+
drag
View
.
getH
eight
()
/
2
;
res
[
0
]
=
left
+
drag
Region
.
w
idth
()
/
2
;
res
[
1
]
=
top
+
drag
Region
.
h
eight
()
/
2
;
return
res
;
}
...
...
app/src/main/java/foundation/e/blisslauncher/features/test/graphics/DragPreviewProvider.java
View file @
f58da8ec
...
...
@@ -154,13 +154,10 @@ public class DragPreviewProvider {
public
float
getScaleAndPosition
(
Bitmap
preview
,
int
[]
outPos
)
{
float
scale
=
TestActivity
.
Companion
.
getLauncher
(
mView
.
getContext
())
.
getDragLayer
().
getLocationInDragLayer
(
mView
,
outPos
);
Log
.
i
(
"DragPreview"
,
"getScaleAndPosition: "
+
outPos
[
0
]+
" "
+
outPos
[
1
]+
" "
+
preview
.
getWidth
()+
" "
+
mView
.
getWidth
());
outPos
[
0
]
=
Math
.
round
(
outPos
[
0
]
-
(
preview
.
getWidth
()
-
scale
*
mView
.
getWidth
()
*
mView
.
getScaleX
())
/
2
);
outPos
[
1
]
=
Math
.
round
(
outPos
[
1
]
-
(
1
-
scale
)
*
preview
.
getHeight
()
/
2
-
previewPadding
/
2
);
Log
.
i
(
"DragPreview"
,
"getScaleAndPosition: "
+
outPos
[
0
]+
" "
+
outPos
[
1
]
+
" "
+
scale
);
return
scale
;
}
...
...
Write
Preview
Supports
Markdown
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