This guide refers to customizing rich media appearance and animation styles
Overview
Customize the appearance of rich media pages to make them fit your app’s style perfectly. Change the background color of your in-app messages, add some animation, or adjust the loading view to the app layout. Improve user experience with in-apps looking like a native component of the app.
Implementation
First, get an instance of the RichMediaStyle class:
Implement RichMediaAnimation interface and set it for custom Rich Media close and open animation:
richMediaStyle.setRichMediaAnimation(newRichMediaAnimation() {//Allows to set rules and behavior for custom Rich Media open animation @OverridepublicvoidopenAnimation(View contentView,View parentView) {AnimationSet fadeInAnimation =newAnimationSet(true); fadeInAnimation.addAnimation(new TranslateAnimation(0.15f * parentView.getWidth(), 0, parentView.getHeight() / 2.5f, 0));
fadeInAnimation.addAnimation(newAlphaAnimation(0,1));fadeInAnimation.addAnimation(newScaleAnimation(0.7f,1.0f,0.7f,1.0f));fadeInAnimation.setDuration(2000);fadeInAnimation.setInterpolator(newDecelerateInterpolator(1f));contentView.startAnimation(fadeInAnimation); }//Allows to set rules and behavior for custom Rich Media close animation @OverridepublicvoidcloseAnimation(View contentView,View parentView,Animation.AnimationListener endAnimationListener) {// !IMPORTANT! // endAnimationListener has to be added to your custom animation to let Pushwoosh SDK handle animation end event
AlphaAnimation alphaAnimation =newAlphaAnimation(1,0);alphaAnimation.setDuration(2000);alphaAnimation.setAnimationListener(endAnimationListener);alphaAnimation.setFillEnabled(true);alphaAnimation.setFillAfter(true);contentView.animate().translationY(parentView.getHeight() /5).setDuration(250).start();parentView.startAnimation(alphaAnimation); }});
Custom loading view
Catch user attention from the first seconds with customized loading view of your In-App Messages.