Back to project page screenplay.
The source code is released under:
MIT License
If you think the Android project screenplay listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.davidstemmer.screenplay.scene.rigger; /*from w w w. ja va2 s.c o m*/ import android.view.View; import android.view.ViewGroup; import com.davidstemmer.screenplay.scene.Scene; import javax.inject.Inject; import flow.Flow; /** * Created by weefbellington on 10/14/14. */ public class StackRigger implements Scene.Rigger { private boolean showsBackgroundOverlay = true; private View overlay; @Inject public StackRigger() {} @Override public void layoutIncoming(ViewGroup parent, View nextView, Flow.Direction direction) { if (direction == Flow.Direction.FORWARD || direction == Flow.Direction.REPLACE) { if (showsBackgroundOverlay) { parent.addView(createBackgroundOverlay(parent)); } parent.addView(nextView); } } @Override public boolean layoutOutgoing(ViewGroup parent, View previousView, Flow.Direction direction) { if (direction == Flow.Direction.BACKWARD) { if (showsBackgroundOverlay) { parent.removeView(overlay); overlay = null; } parent.removeView(previousView); return true; } return false; } public void showsBackgroundOverlay(boolean show) { this.showsBackgroundOverlay = show; } protected View createBackgroundOverlay(ViewGroup parent) { overlay = new View(parent.getContext()); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); overlay.setLayoutParams(params); overlay.setBackgroundColor(0xA0000000); overlay.setClickable(true); return overlay; } }