Re: [android-developers] Click events doesn't work on a button after Animation

2013-01-23 Thread Mark Murphy
On Tue, Jan 22, 2013 at 11:46 PM, Ansh yourans...@gmail.com wrote:
 - Do not use TranslateAnimation, but instead switch to the newer
 ViewPropertyAnimator framework (and NineOldAndroids for a backport),

 I can't use ViewPropertyAnimator framework because i need to support
 for below 3.0 API level.

If you take the time to read what I wrote, you will notice that I
pointed you to the NineOldAndroids backport of the
ViewPropertyAnimator framework. NineOldAndroids works going back to
API Level 1.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.5 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Click events doesn't work on a button after Animation

2013-01-23 Thread G. Blake Meike

If you choose Mark's second solution, be sure to move the view *before* the 
animation.  If you don't you'll get a flash at the end of the animation, 
when you move the view.

-blake

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Click events doesn't work on a button after Animation

2013-01-23 Thread Ansh
Hi Blake / Mark,

I chose Mark's second option and yes i got the flash effect at the end.But 
as you say that move the view before animation , but I am calculating the 
views position at the end of animation and moving the layout.If i move the 
view before animation how would i suppose to find the position ?
*Can you guys suggest better idea for that?*

here is the code snippet :

Animation animation = new TranslateAnimation(0, 0, 0, -200);
animation.setDuration(1000);
 relativeMain.startAnimation(animation);


animation.setAnimationListener(new AnimationListener() {

@Override
public void onAnimationStart(Animation animation) {
 }

@Override
public void onAnimationRepeat(Animation animation) {

}

@Override
public void onAnimationEnd(Animation animation) {
   left = relativeMain.getLeft();
  top = relativeMain.getTop();
  right = relativeMain.getRight();
  bottom = relativeMain.getBottom();
  
 relativeMain.layout(left, top - 200, right , bottom -200  );  // 
layout to be moved upward after translate animation 
  }
});

On Wednesday, 23 January 2013 20:43:13 UTC+5:30, G. Blake Meike wrote:


 If you choose Mark's second solution, be sure to move the view *before* 
 the animation.  If you don't you'll get a flash at the end of the 
 animation, when you move the view.

 -blake


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Click events doesn't work on a button after Animation

2013-01-23 Thread Ansh
*Ok Blake , i have done the same way you described.I have moved the layout 
before animation starts and it moved towards up but now when the animations 
starts on the layout it ll start animating from the new position which i 
set before starting the animation for the layout.*
*
*
*Any better solution so that i can make the animation smooth?
*
On Thursday, 24 January 2013 10:31:04 UTC+5:30, Ansh wrote:

 Hi Blake / Mark,

 I chose Mark's second option and yes i got the flash effect at the end.But 
 as you say that move the view before animation , but I am calculating the 
 views position at the end of animation and moving the layout.If i move the 
 view before animation how would i suppose to find the position ?
 *Can you guys suggest better idea for that?*

 here is the code snippet :

 Animation animation = new TranslateAnimation(0, 0, 0, -200);
 animation.setDuration(1000);
  relativeMain.startAnimation(animation);


 animation.setAnimationListener(new AnimationListener() {

 @Override
 public void onAnimationStart(Animation animation) {
  }

 @Override
 public void onAnimationRepeat(Animation animation) {

 }

 @Override
 public void onAnimationEnd(Animation animation) {
left = relativeMain.getLeft();
   top = relativeMain.getTop();
   right = relativeMain.getRight();
   bottom = relativeMain.getBottom();
   
  relativeMain.layout(left, top - 200, right , bottom -200  );  // 
 layout to be moved upward after translate animation 
   }
 });

 On Wednesday, 23 January 2013 20:43:13 UTC+5:30, G. Blake Meike wrote:


 If you choose Mark's second solution, be sure to move the view *before* 
 the animation.  If you don't you'll get a flash at the end of the 
 animation, when you move the view.

 -blake



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Click events doesn't work on a button after Animation

2013-01-22 Thread Ansh
 Hi guys , i am facing a weird problem.I have a layout and there is a 
button inside that layout.On clicking of the button i need to translate 
that layout towards up say for example 30%.I am able to achieve this but 
when animation ends i loose click event on the button which a very weird 
and known issue to all the forums and stack overflow.I searched every where 
but could not find  a solution.I have read that When layout is animated it 
looks that it has been animated but it is View resides at there original 
position .Then how can i perform onClick of a button which is now placed to 
the new postion?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Click events doesn't work on a button after Animation

2013-01-22 Thread Mark Murphy
This is expected behavior. Either:

- Do not use TranslateAnimation, but instead switch to the newer
ViewPropertyAnimator framework (and NineOldAndroids for a backport),
or

- Do not bother with setFillAfter(true), but instead attach an
AnimationListener that will adjust the layout so the widget is in its
new position when the animation ends

On Tue, Jan 22, 2013 at 7:27 AM, Ansh yourans...@gmail.com wrote:
  Hi guys , i am facing a weird problem.I have a layout and there is a button
 inside that layout.On clicking of the button i need to translate that layout
 towards up say for example 30%.I am able to achieve this but when animation
 ends i loose click event on the button which a very weird and known issue to
 all the forums and stack overflow.I searched every where but could not find
 a solution.I have read that When layout is animated it looks that it has
 been animated but it is View resides at there original position .Then how
 can i perform onClick of a button which is now placed to the new postion?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.5 Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Click events doesn't work on a button after Animation

2013-01-22 Thread Ansh
Thanks for your comment  Mark.

- Do not use TranslateAnimation, but instead switch to the newer 
ViewPropertyAnimator framework (and NineOldAndroids for a backport), 
  
  *  I can't use ViewPropertyAnimator framework because i need to 
support for below 3.0 API level.*


- Do not bother with setFillAfter(true), but instead attach an 
AnimationListener that will adjust the layout so the widget is in its 
new position when the animation ends 

*I Could not understand clearly.Can you please explain more about this 
idea?Dummy code would be great as i am new to animations.*

On Tuesday, 22 January 2013 18:08:54 UTC+5:30, Mark Murphy (a Commons Guy) 
wrote:

 This is expected behavior. Either: 

 - Do not use TranslateAnimation, but instead switch to the newer 
 ViewPropertyAnimator framework (and NineOldAndroids for a backport), 
 or 

 - Do not bother with setFillAfter(true), but instead attach an 
 AnimationListener that will adjust the layout so the widget is in its 
 new position when the animation ends 

 On Tue, Jan 22, 2013 at 7:27 AM, Ansh youra...@gmail.com javascript: 
 wrote: 
   Hi guys , i am facing a weird problem.I have a layout and there is a 
 button 
  inside that layout.On clicking of the button i need to translate that 
 layout 
  towards up say for example 30%.I am able to achieve this but when 
 animation 
  ends i loose click event on the button which a very weird and known 
 issue to 
  all the forums and stack overflow.I searched every where but could not 
 find 
  a solution.I have read that When layout is animated it looks that it has 
  been animated but it is View resides at there original position .Then 
 how 
  can i perform onClick of a button which is now placed to the new 
 postion? 
  
  Thanks 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Android Developers group. 
  To post to this group, send email to 
  android-d...@googlegroups.comjavascript: 
  To unsubscribe from this group, send email to 
  android-developers+unsubscr...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/android-developers?hl=en 



 -- 
 Mark Murphy (a Commons Guy) 
 http://commonsware.com | http://github.com/commonsguy 
 http://commonsware.com/blog | http://twitter.com/commonsguy 

 _The Busy Coder's Guide to Android Development_ Version 4.5 Available! 


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en