Java Code Examples for android.view.View.setZ()

The following are Jave code examples for showing how to use setZ() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: GitHub   File: GuidePageActivity2.java   Source Code and License Vote up 7 votes
private void addPlanetAnimation() {
    View planet0 = findViewById(R.id.planet_0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) planet0.setZ(50);
    wowo.addAnimation(planet0)
            .add(WoWoTranslationAnimation.builder().page(1)
                    .keepX(0)
                    .fromY(0).toY(planet0.getHeight() + 200)
                    .ease(Ease.OutBack).sameEaseBack(false).build())
            .add(WoWoTranslationAnimation.builder().page(2)
                    .fromX(0).toX(screenW)
                    .keepY(planet0.getHeight() + 200)
                    .ease(Ease.InBack).sameEaseBack(false).build());

    View planet1 = findViewById(R.id.planet_1);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) planet1.setZ(50);
    wowo.addAnimation(planet1)
            .add(WoWoTranslationAnimation.builder().page(1)
                    .fromX(0).toX(-planet1.getWidth())
                    .keepY(0)
                    .ease(Ease.OutBack).sameEaseBack(false).build())
            .add(WoWoTranslationAnimation.builder().page(2)
                    .fromX(-planet1.getWidth()).toX(-screenW - planet1.getWidth())
                    .keepY(0)
                    .ease(Ease.InBack).sameEaseBack(false).build());
}
 
Example 2
Project: GitHub   File: GuidePageActivity2.java   Source Code and License Vote up 6 votes
private void addTextAnimation() {
    View text = findViewById(R.id.text);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) text.setZ(50);
    String[] texts = new String[]{
            "HOME?",
            "OR SKY?",
            "OR UNIVERSE?",
            "Let's Discover More!",
    };
    wowo.addAnimation(text)
            .add(WoWoTextViewTextAnimation.builder().page(0).from(texts[0]).to(texts[1]).build())
            .add(WoWoTextViewTextAnimation.builder().page(1).from(texts[1]).to(texts[2]).build())
            .add(WoWoTextViewTextAnimation.builder().page(2).from(texts[2]).to(texts[3]).build())
            .add(WoWoTextViewColorAnimation.builder().page(1).from("#05502f").to(Color.WHITE).build());
}
 
Example 3
Project: GitHub   File: GuidePageActivity2.java   Source Code and License Vote up 6 votes
private void addMeteorAnimation() {
    View meteor = findViewById(R.id.meteor);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) meteor.setZ(50);
    float fullOffset = screenW + meteor.getWidth();
    float offset = fullOffset / 2;
    wowo.addAnimation(meteor)
            .add(WoWoTranslationAnimation.builder().page(1)
                    .fromX(0).fromY(0)
                    .toX(offset).toY(offset).ease(Ease.OutBack).sameEaseBack(false).build())
            .add(WoWoTranslationAnimation.builder().page(2)
                    .fromX(offset).fromY(offset)
                    .toX(fullOffset).toY(fullOffset).ease(Ease.InBack).sameEaseBack(false).build());
}
 
Example 4
Project: JewelryUI   File: CircleZoomLayoutManager.java   Source Code and License Vote up 6 votes
@Override
protected void setItemViewProperty(View itemView, float targetOffset) {
    itemView.setRotation(targetOffset);
    float scale = calculateScale(itemView,targetOffset);
    itemView.setScaleX(scale);
    itemView.setScaleY(scale);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        itemView.setZ(scale);
    }
}
 
Example 5
Project: GitHub   File: WoWoPosition3DAnimation.java   Source Code and License Vote up 5 votes
@Override
protected void toStartState(View view) {
    view.setX(fromX);
    view.setY(fromY);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) view.setZ(fromZ);
}
 
Example 6
Project: GitHub   File: WoWoPosition3DAnimation.java   Source Code and License Vote up 5 votes
@Override
protected void toMiddleState(View view, float offset) {
    view.setX(fromX + (toX - fromX) * offset);
    view.setY(fromY + (toY - fromY) * offset);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) view.setZ(fromZ + (toZ - fromZ) * offset);
}
 
Example 7
Project: GitHub   File: WoWoPosition3DAnimation.java   Source Code and License Vote up 5 votes
@Override
protected void toEndState(View view) {
    view.setX(toX);
    view.setY(toY);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) view.setZ(toZ);
}
 
Example 8
Project: GitHub   File: GuidePageActivity2.java   Source Code and License Vote up 5 votes
private void addButtonAnimation() {
    View button = findViewById(R.id.button);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) button.setZ(50);
    wowo.addAnimation(button)
            .add(WoWoAlphaAnimation.builder().page(2).from(0).to(1).build());
}
 
Example 9
Project: aos-Video   File: ShadowHelperApi21.java   Source Code and License Vote up 5 votes
public static void setZ(View view, float z) {
    view.setZ(z);
}
 
Example 10
Project: Tangram-Android   File: MVHelper.java   Source Code and License Vote up 5 votes
protected void renderLayout(BaseCell cell, View view) {
    if (cell.style != null) {
        ViewGroup.LayoutParams lp = view.getLayoutParams();

        if (lp == null || !(lp instanceof VirtualLayoutManager.LayoutParams)) {
            if (lp == null) {
                lp = new VirtualLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            } else {
                lp = new VirtualLayoutManager.LayoutParams(lp.width, lp.height);
            }
            view.setLayoutParams(lp);
        }
        if (lp instanceof VirtualLayoutManager.LayoutParams) {
            VirtualLayoutManager.LayoutParams params = (VirtualLayoutManager.LayoutParams) lp;

            if (cell.style.height >= 0) {
                params.storeOriginHeight();
                params.height = cell.style.height;
            } else {
                params.restoreOriginHeight();
            }

            if (cell.style.width >= 0) {
                params.storeOriginWidth();
                params.width = cell.style.width;
            } else {
                params.restoreOriginWidth();
            }

            params.mAspectRatio = cell.style.aspectRatio;

            params.zIndex = cell.style.zIndex;
            if (params.zIndex == 0) {
                if (cell.parent != null && cell.parent.style != null) {
                    params.zIndex = cell.parent.style.zIndex;
                }
            }
            if (VERSION.SDK_INT >= 21) {
                view.setZ(params.zIndex);
            }
        } else {
            if (cell.style.height >= 0) {
                lp.height = cell.style.height;
            }

            if (cell.style.width >= 0) {
                lp.width = cell.style.width;
            }
        }


        if (lp instanceof ViewGroup.MarginLayoutParams) {
            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) lp;
            layoutParams.topMargin = cell.style.margin[MARGIN_TOP_INDEX];
            layoutParams.leftMargin = cell.style.margin[MARGIN_LEFT_INDEX];
            layoutParams.bottomMargin = cell.style.margin[MARGIN_BOTTOM_INDEX];
            layoutParams.rightMargin = cell.style.margin[MARGIN_RIGHT_INDEX];
        }

        // reset translation animation before reused
        view.setTranslationX(0);
        view.setTranslationY(0);
    }
}