Search in sources :

Example 51 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project robolectric by robolectric.

the class ShadowViewGroupTest method testLayoutAnimationListener.

@Test
public void testLayoutAnimationListener() {
    assertThat(root.getLayoutAnimationListener()).isNull();
    AnimationListener animationListener = new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation a) {
        }

        @Override
        public void onAnimationRepeat(Animation a) {
        }

        @Override
        public void onAnimationStart(Animation a) {
        }
    };
    root.setLayoutAnimationListener(animationListener);
    assertThat(root.getLayoutAnimationListener()).isSameAs(animationListener);
}
Also used : Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener) Test(org.junit.Test)

Example 52 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project JamsMusicPlayer by psaravan.

the class ListViewFragment method showSearch.

/**
     * Displays the search field.
     */
private void showSearch() {
    mSearchLayout.setVisibility(View.VISIBLE);
    final TranslateAnimation searchAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -2f, Animation.RELATIVE_TO_SELF, 0f);
    searchAnim.setDuration(500l);
    searchAnim.setInterpolator(new AccelerateDecelerateInterpolator());
    final TranslateAnimation gridListAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 2f);
    gridListAnim.setDuration(500l);
    gridListAnim.setInterpolator(new LinearInterpolator());
    gridListAnim.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mListView.setAdapter(null);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationStart(Animation animation) {
            mSearchLayout.startAnimation(searchAnim);
            mSearchLayout.setVisibility(View.VISIBLE);
        }
    });
    searchAnim.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation animation) {
            if (mSearchEditText.requestFocus()) {
                mFragment.getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationStart(Animation animation) {
        // TODO Auto-generated method stub
        }
    });
    mListView.startAnimation(gridListAnim);
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 53 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project ListViewCellDeleteAnimation by paraches.

the class MainActivity method deleteCell.

private void deleteCell(final View v, final int index) {
    AnimationListener al = new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation arg0) {
            mAnimList.remove(index);
            ViewHolder vh = (ViewHolder) v.getTag();
            vh.needInflate = true;
            mMyAnimListAdapter.notifyDataSetChanged();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    };
    collapse(v, al);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 54 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project KeepScore by nolanlawson.

the class MainActivity method startShowButtonRowAnimation.

private void startShowButtonRowAnimation() {
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_bottom_to_top);
    animation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            // propertly shrink the scroll view
            spacerView.setVisibility(View.VISIBLE);
        }
    });
    buttonRow.setAnimation(animation);
    buttonRow.setVisibility(View.VISIBLE);
    buttonRow.startAnimation(animation);
}
Also used : Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 55 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project FloatingStickies by MohammadAdib.

the class MainActivity method onTouch.

@Override
public boolean onTouch(View v, MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
        Animation anim = AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
        anim.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                SharedPreferences.Editor editor = prefs.edit();
                CheckBox cb = (CheckBox) findViewById(R.id.checkBox);
                editor.putBoolean("key", cb.isChecked());
                editor.commit();
                finish();
            }
        });
        findViewById(R.id.ll0).startAnimation(anim);
    }
    return true;
}
Also used : SharedPreferences(android.content.SharedPreferences) CheckBox(android.widget.CheckBox) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Aggregations

Animation (android.view.animation.Animation)80 AnimationListener (android.view.animation.Animation.AnimationListener)80 AlphaAnimation (android.view.animation.AlphaAnimation)25 TranslateAnimation (android.view.animation.TranslateAnimation)20 View (android.view.View)14 LinearInterpolator (android.view.animation.LinearInterpolator)12 RotateAnimation (android.view.animation.RotateAnimation)10 ScaleAnimation (android.view.animation.ScaleAnimation)10 ImageView (android.widget.ImageView)10 Rect (android.graphics.Rect)7 PopupWindow (android.widget.PopupWindow)6 Window (wei.mark.standout.ui.Window)6 ViewGroup (android.view.ViewGroup)5 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)5 SuppressLint (android.annotation.SuppressLint)4 Interpolator (android.view.animation.Interpolator)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 TextView (android.widget.TextView)4 Notification (android.app.Notification)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3