Commit 3d0d3812 authored by v.tarantik's avatar v.tarantik

#342 oprava razitka zasekavajiciho se pod perem

parent b396ad08
......@@ -109,7 +109,6 @@
android:id="@+id/newuser_pen_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="matrix"
android:src="@drawable/newuser_pencil_dropped" >
</ImageView>
......
......@@ -399,10 +399,7 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
animateViewInOriginalPosition(imageViewStamper, false);
}
} else {
//animateViewInOriginalPosition(imageViewStamper, false);
imageViewStamper.setTranslationX(start.x);
imageViewStamper.setTranslationY(start.y);
// TODO animace
animateViewInOriginalPosition(imageViewStamper, false);
}
return true;
} else {
......@@ -426,10 +423,6 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
if (timer != null) {
timer.cancel();
}
imageViewPen.clearAnimation();
// subscriptionDialogShown = false;
//imageViewPen.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.newuser_pencil_grabbed));
if (event.getAction() == MotionEvent.ACTION_MOVE) {
if (!subscriptionDialogShown) {
imageViewPen.getLocationOnScreen(penLoc);
......@@ -440,8 +433,6 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
signatureDialog.show(getActivity().getFragmentManager(), null);
MediaPlayerHelper.playSound("newuser/mfx/profil_podpis_prst.mp3", true, getActivity());
subscriptionDialogShown = true;
//imageViewPen.setEnabled(false);
//imageViewPen.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.newuser_pencil_dropped));
}
}
......@@ -457,10 +448,7 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
@Override
public boolean onDrop(View v, MotionEvent event, Point start) {
subscriptionDialogShown = false;
//animateViewInOriginalPosition(imageViewPen, false);
imageViewPen.setTranslationX(start.x);
imageViewPen.setTranslationY(start.y);
// TODO animace
animateViewInOriginalPosition(imageViewPen, false);
return true;
}
});
......@@ -690,17 +678,17 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
viewOriginalPosition = stamperOriginalPosition;
}
int[] viewLocation = new int[2];
final int[] viewLocation = new int[2];
view.getLocationOnScreen(viewLocation);
TranslateAnimation animation = new TranslateAnimation(0, viewOriginalPosition.x - viewLocation[0], 0, viewOriginalPosition.y - viewLocation[1]);
animation.setDuration(1000);
animation.setDuration(500);
animation.setFillAfter(true);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Log.d(TAG, "Animating view to original position ");
Log.d(TAG, "Animating view to original position");
}
@Override
......@@ -710,7 +698,6 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
@Override
public void onAnimationEnd(Animation animation) {
view.setEnabled(true);
if (proceedConditionMet) {
if (view.equals(imageViewPen)) {
penDropPositiveAction();
......@@ -718,6 +705,10 @@ public class NewUserFormFragment extends RoboFragment implements OnClickListener
stamperDropPositiveAction();
}
}
view.clearAnimation();
view.setTranslationX((view.getTranslationX() + viewOriginalPosition.x) - viewLocation[0]);
view.setTranslationY((view.getTranslationY() + viewOriginalPosition.y) - viewLocation[1]);
}
});
view.startAnimation(animation);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment