View Animation vs Property Animation in Android

Sometimes we need to animate some view in our application. Here is a sample code for translate a view over x axis from its location.


Button bt;
bt = (Button) findViewById(R.id.bt);
bt.setOnClickListener(this);

TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 300, Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_SELF);
animation.setDuration(1000);
animation.setFillAfter(true);
bt.setAnimation(animation);

But the problem of this code is if you want to click this button after animate you can not, why lets read the documentation from android developer site

disadvantage of the view animation system is that it only modified where the View was drawn, and not the actual View itself. For instance, if you animated a button to move across the screen, the button draws correctly, but the actual location where you can click the button does not change, so you have to implement your own logic to handle this.

more

To solve this issue we will use ObjectAnimator class to animate our view.


ObjectAnimator animXNext = ObjectAnimator.ofFloat(bt, "translationX", Animation.RELATIVE_TO_SELF, 300);
animXNext.setDuration(1000);
animXNext.start();

Now you can click on the button. Enjoy 🙂

The Era of Artificial Intelligence

I recently saw a post from Mark, he announced that Facebook is opening an international research center for artificial intelligence in Paris.

Screen Shot 2015-06-03 at 7.39.09 PM

see more

After that soundHound a popular song identification app company announced about a personal assistant called hound i am excited to see how this goes.

Last year amazon announced echo an intelligent device for your house or home. It can play music, get weather updates and other cool stuffs.

Apple also doing great with their intelligent personal assistant called Siri

What about Google ? we all know about their self driving car project. The software powering Google’s cars is called Google Chauffeur.

Last but not least i really loved the movie Ex machina. I think its not far when we can see this is happening in reality.  So is the “Turing Test” in the verge of failing … ?