Skip to content

Commit ad55642

Browse files
committed
revert deletions
1 parent 58f9cba commit ad55642

File tree

7 files changed

+144
-1
lines changed

7 files changed

+144
-1
lines changed

app/src/androidMain/kotlin/de/westnordost/streetcomplete/screens/main/bottom_sheet/SplitWayFragment.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class SplitWayFragment :
204204
} else {
205205
splits.add(Pair(splitWay, splitPosition))
206206
animateButtonVisibilities()
207-
//animateScissors() todo
207+
animateScissors()
208208
showsGeometryMarkersListener?.putMarkersForCurrentHighlighting(listOf(
209209
Marker(
210210
ElementPointGeometry(splitPosition),
@@ -217,6 +217,23 @@ class SplitWayFragment :
217217
return true
218218
}
219219

220+
private fun animateScissors() {
221+
val scissorsPos = clickPos ?: return
222+
223+
(binding.scissors.drawable as? Animatable)?.start()
224+
225+
binding.scissors.updateLayoutParams<RelativeLayout.LayoutParams> {
226+
leftMargin = (scissorsPos.x - binding.scissors.width / 2).toInt()
227+
topMargin = (scissorsPos.y - binding.scissors.height / 2).toInt()
228+
}
229+
binding.scissors.alpha = 1f
230+
val animator = AnimatorInflater.loadAnimator(context, R.animator.scissors_snip)
231+
animator.setTarget(binding.scissors)
232+
animator.start()
233+
234+
viewLifecycleScope.launch { soundFx.play(R.raw.snip) }
235+
}
236+
220237
private fun createSplits(clickPosition: LatLon, clickAreaSizeInMeters: Double): Set<SplitPolylineAtPosition> {
221238
val splitWaysAtNodes = createSplitsAtNodes(clickPosition, clickAreaSizeInMeters)
222239
// if a split on a node is possible, do that and don't even check if a split on a way is also possible
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:ordering="sequentially">
4+
<objectAnimator
5+
android:propertyName="rotation"
6+
android:valueFrom="0"
7+
android:valueTo="29"
8+
android:duration="60"
9+
android:interpolator="@android:anim/decelerate_interpolator"/>
10+
<objectAnimator
11+
android:propertyName="rotation"
12+
android:valueFrom="29"
13+
android:valueTo="0"
14+
android:duration="220"
15+
android:interpolator="@android:anim/accelerate_interpolator"/>
16+
</set>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:ordering="sequentially">
4+
<objectAnimator
5+
android:propertyName="rotation"
6+
android:valueFrom="0"
7+
android:valueTo="-29"
8+
android:duration="60"
9+
android:interpolator="@android:anim/decelerate_interpolator"/>
10+
<objectAnimator
11+
android:propertyName="rotation"
12+
android:valueFrom="-29"
13+
android:valueTo="0"
14+
android:duration="220"
15+
android:interpolator="@android:anim/accelerate_interpolator"/>
16+
</set>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
3+
<set android:ordering="together">
4+
<objectAnimator
5+
android:propertyName="translationX"
6+
android:valueType="floatType"
7+
android:valueFrom="16dp"
8+
android:valueTo="0"
9+
android:duration="60"
10+
android:interpolator="@android:anim/decelerate_interpolator"/>
11+
<objectAnimator
12+
android:propertyName="translationY"
13+
android:valueType="floatType"
14+
android:valueFrom="16dp"
15+
android:valueTo="0"
16+
android:duration="60"
17+
android:interpolator="@android:anim/decelerate_interpolator"/>
18+
</set>
19+
<set android:ordering="together">
20+
<objectAnimator
21+
android:propertyName="translationX"
22+
android:valueType="floatType"
23+
android:valueFrom="0"
24+
android:valueTo="32dp"
25+
android:duration="220"
26+
android:interpolator="@android:anim/decelerate_interpolator"/>
27+
<objectAnimator
28+
android:propertyName="translationY"
29+
android:valueType="floatType"
30+
android:valueFrom="0"
31+
android:valueTo="32dp"
32+
android:duration="220"
33+
android:interpolator="@android:anim/decelerate_interpolator"/>
34+
<objectAnimator
35+
android:propertyName="alpha"
36+
android:valueType="floatType"
37+
android:valueFrom="1"
38+
android:valueTo="0"
39+
android:startOffset="120"
40+
android:duration="100"
41+
android:interpolator="@android:anim/accelerate_interpolator"/>
42+
</set>
43+
</set>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="96dp"
3+
android:height="96dp"
4+
android:viewportWidth="44"
5+
android:viewportHeight="44">
6+
<group
7+
android:name="scissorGroupLeft"
8+
android:pivotX="22.0"
9+
android:pivotY="22.0"
10+
android:rotation="0.0">
11+
<path
12+
android:pathData="m29,34c-2.3906,-4 -1.9361,-3.2881 -3,-5 0.1925,-1.5267 1,-4 1,-4 0.9758,1.3862 8,-0 11,3 3,3 2,7 -0,9 -2,2 -6.6094,1 -9,-3zM36,30c-2,-2 -5.88,-1.1144 -6,-1 -0.6234,0.5944 0.3766,1.6953 2,4 1.6234,2.3047 3,3 4,2 1,-1 2,-3 -0,-5z"
13+
android:fillColor="#dd2e44"/>
14+
<path
15+
android:pathData="m12,4c-1.163,0.657 -1.658,2.836 -1,4l9,16c1,2 5,3 6,5 1.103,-0.496 0.394,-2.401 1,-4z"
16+
android:fillColor="#99aab5"/>
17+
</group>
18+
<group
19+
android:name="scissorGroupRight"
20+
android:pivotX="22.0"
21+
android:pivotY="22.0"
22+
android:rotation="-0.0" >
23+
<path
24+
android:pathData="m15,34c2.3906,-4 1.9361,-3.2881 3,-5 -0.1925,-1.5267 -1,-4 -1,-4 -0.9758,1.3862 -8,-0 -11,3 -3,3 -2,7 -0,9 2,2 6.6094,1 9,-3zM8,30c2,-2 5.88,-1.1144 6,-1 0.6234,0.5944 -0.3766,1.6953 -2,4 -1.6234,2.3047 -3,3 -4,2 -1,-1 -2,-3 -0,-5z"
25+
android:fillColor="#dd2e44"/>
26+
<path
27+
android:pathData="m32,4c1.163,0.657 1.658,2.836 1,4l-9,16c-1,2 -5,3 -6,5 -1.103,-0.496 -0.394,-2.401 -1,-4z"
28+
android:fillColor="#ccd6dd"/>
29+
</group>
30+
<path
31+
android:pathData="M22,22m-1.3722,0a1.3722,1.3722 0,1 1,2.7445 0a1.3722,1.3722 0,1 1,-2.7445 0"
32+
android:fillColor="#99aab5"/>
33+
</vector>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:drawable="@drawable/scissors" >
4+
<target
5+
android:name="scissorGroupLeft"
6+
android:animation="@animator/scissor_left" />
7+
<target
8+
android:name="scissorGroupRight"
9+
android:animation="@animator/scissor_right" />
10+
</animated-vector>

app/src/androidMain/res/layout/fragment_split_way.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
xmlns:tools="http://schemas.android.com/tools"
77
android:id="@+id/splitWayRoot">
88

9+
<ImageView
10+
android:id="@+id/scissors"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:rotation="-45"
14+
android:alpha="0"
15+
app:srcCompat="@drawable/scissors_animation"/>
16+
917
<de.westnordost.streetcomplete.view.SlidingRelativeLayout
1018
android:layout_width="@dimen/quest_form_width"
1119
android:layout_height="match_parent"

0 commit comments

Comments
 (0)