Search in sources :

Example 1 with ViewRevealManager

use of io.codetail.animation.ViewRevealManager in project CircularReveal by ozodrukh.

the class MainActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    final ViewRevealManager revealManager = new ViewRevealManager();
    final SpringViewAnimatorManager springManager = new SpringViewAnimatorManager();
    springManager.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY);
    springManager.setStiffness(SpringForce.STIFFNESS_LOW);
    parent.setViewRevealManager(revealManager);
    settingsView.addSwitch("Enable Spring", false, new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            parent.setViewRevealManager(isChecked ? springManager : revealManager);
        }
    });
    settingsView.setAnimatorManager(springManager);
    final BottomSheetBehavior behavior = BottomSheetBehavior.from(settingsView);
    behavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.bottom_peek_height));
    behavior.setSkipCollapsed(false);
    behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
Also used : BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) ViewRevealManager(io.codetail.animation.ViewRevealManager) SpringViewAnimatorManager(io.codetail.animation.SpringViewAnimatorManager) CompoundButton(android.widget.CompoundButton)

Example 2 with ViewRevealManager

use of io.codetail.animation.ViewRevealManager in project CircularReveal by ozodrukh.

the class RadialTransformationActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_2);
    ButterKnife.bind(this);
    Picasso.with(this).load("http://camp-campbell.com/wp-content/uploads/2014/09/847187872-san-francisco.jpg").resizeDimen(R.dimen.radial_card_width, R.dimen.radial_card_height).centerCrop().into(sanFranciscoView);
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    videoView.setVideoURI(Uri.parse(VIDEO_URL));
    videoView.start();
    final GestureDetector detector = new GestureDetector(this, tapDetector);
    for (int i = 0; i < stack.getChildCount(); i++) {
        View view = stack.getChildAt(i);
        view.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return detector.onTouchEvent(event);
            }
        });
    }
    final ViewRevealManager revealManager = new ViewRevealManager();
    final SpringViewAnimatorManager springManager = new SpringViewAnimatorManager();
    springManager.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY);
    springManager.setStiffness(SpringForce.STIFFNESS_LOW);
    stack.setViewRevealManager(revealManager);
    settingsView.addSwitch("Enable Spring", false, new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            stack.setViewRevealManager(isChecked ? springManager : revealManager);
        }
    });
    settingsView.setAnimatorManager(springManager);
    final BottomSheetBehavior behavior = BottomSheetBehavior.from(settingsView);
    behavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.bottom_peek_height));
    behavior.setSkipCollapsed(false);
    behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
Also used : GestureDetector(android.view.GestureDetector) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) VideoView(android.widget.VideoView) Point(android.graphics.Point) MotionEvent(android.view.MotionEvent) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) ViewRevealManager(io.codetail.animation.ViewRevealManager) SpringViewAnimatorManager(io.codetail.animation.SpringViewAnimatorManager) CompoundButton(android.widget.CompoundButton) MediaPlayer(android.media.MediaPlayer)

Aggregations

BottomSheetBehavior (android.support.design.widget.BottomSheetBehavior)2 CompoundButton (android.widget.CompoundButton)2 SpringViewAnimatorManager (io.codetail.animation.SpringViewAnimatorManager)2 ViewRevealManager (io.codetail.animation.ViewRevealManager)2 Point (android.graphics.Point)1 MediaPlayer (android.media.MediaPlayer)1 GestureDetector (android.view.GestureDetector)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 VideoView (android.widget.VideoView)1 BindView (butterknife.BindView)1