Example usage for android.view.animation AlphaAnimation setStartOffset

List of usage examples for android.view.animation AlphaAnimation setStartOffset

Introduction

In this page you can find the example usage for android.view.animation AlphaAnimation setStartOffset.

Prototype

public void setStartOffset(long startOffset) 

Source Link

Document

When this animation should start relative to the start time.

Usage

From source file:io.github.data4all.activity.CameraActivity.java

private AlphaAnimation createAnimation(final View v) {
    AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(3000);//  w w w .jav a 2  s.com
    anim.setStartOffset(3000);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            v.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            v.setVisibility(View.INVISIBLE);
            v.setClickable(false);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    return anim;
}

From source file:com.mina.breathitout.AnalyzeActivity.java

public void fadeInText() {
    AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
    AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
    txtView.startAnimation(fadeIn);/*  w  w w. ja va2 s  . c o m*/
    txtView.startAnimation(fadeOut);
    fadeIn.setDuration(4000);
    fadeIn.setFillAfter(true);
    fadeOut.setDuration(4000);
    fadeOut.setFillAfter(true);
    fadeIn.setStartOffset(4200);
}

From source file:com.popdeem.sdk.uikit.activity.PDUIClaimActivity.java

private void processValidationReturn(JsonObject jsonObject) {
    parseResponse(jsonObject);/*from  ww  w  .  j a v a 2  s.  c  o  m*/
    PDLog.d(PDUIClaimActivity.class, "verify success: " + jsonObject.toString());
    claiming = false;
    boolean success = false;
    if (jsonObject != null && jsonObject.has("validated")) {
        success = true;
    }
    Realm realm = Realm.getDefaultInstance();
    PDRealmUserDetails userDetails = realm.where(PDRealmUserDetails.class).findFirst();

    if (success) {
        Gson gson = new Gson();
        PDPostScan postScan = gson.fromJson(jsonObject, PDPostScan.class);

        if (postScan != null && postScan.getValidated()) {

            mReward.setInstagramVerified(true);
            Log.d("VERIFYING", "verifyReward: success");

            String headingText = pdVerifyHeadingText.getText().toString();
            if (userDetails.getFirstName() != null && userDetails.getFirstName().length() > 0) {
                headingText = headingText.replace("Richard", userDetails.getFirstName());
            } else {
                headingText = headingText.replace("Hey Richard, w", "W");
            }

            if (postScan != null && postScan.getText() != null && postScan.getText().length() > 0) {
                headingText = headingText.replace("#hashtag", postScan.getText());
            } else {
                headingText = headingText.replace("with #hashtag", "");
            }
            pdVerifyHeadingText.setText(headingText);

            if (postScan != null && postScan.getText() != null && postScan.getText().length() > 0) {
                pdClaimUserHashtagTextView.setText(headingText);
            } else {
                pdClaimUserHashtagTextView.setText("");
            }

            if (postScan != null && postScan.getSocialName() != null && postScan.getSocialName().length() > 0) {
                pdClaimUserNameTextView.setText(postScan.getSocialName());
            } else {
                pdClaimUserNameTextView.setVisibility(View.GONE);
            }
            if (postScan != null && postScan.getSocialName() != null && postScan.getSocialName().length() > 0) {
                pdClaimUserHashtagTextView.setText(postScan.getText());
            } else {
                pdClaimUserHashtagTextView.setVisibility(View.GONE);
            }
            Glide.with(PDUIClaimActivity.this).load(postScan.getMediaUrl()).dontAnimate().into(pdVerifyImage);

            if (postScan != null && postScan.getProfilePictureUrl() != null) {

                String url = postScan.getProfilePictureUrl();
                if (!url.startsWith("http")) {
                    url = "http:" + url;
                }
                Glide.with(PDUIClaimActivity.this).load(url).placeholder(R.drawable.pd_ui_default_user)
                        .error(R.drawable.pd_ui_default_user).dontAnimate().into(pdClaimProfileImageView);
            }

            pdVerifyHeadingText.setVisibility(View.VISIBLE);
            pdVerifyImageCard.setVisibility(View.VISIBLE);
            pdProceedButton.setVisibility(View.VISIBLE);

            int animationTime = 1000;

            AlphaAnimation animation1 = new AlphaAnimation(0f, 1.0f);
            animation1.setDuration(animationTime);
            pdVerifyHeadingText.setAlpha(1f);
            pdVerifyHeadingText.startAnimation(animation1);

            AlphaAnimation animation2 = new AlphaAnimation(0f, 1.0f);
            animation2.setDuration(animationTime);
            animation2.setStartOffset(animationTime);
            pdVerifyImageCard.setAlpha(1f);
            pdVerifyImageCard.startAnimation(animation2);

            AlphaAnimation animation3 = new AlphaAnimation(0f, 1.0f);
            animation3.setDuration(animationTime);
            animation3.setStartOffset(animationTime * 2);
            pdProceedButton.setAlpha(1f);
            pdProceedButton.startAnimation(animation3);
            pdProceedButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (mTwitterSwitch.isChecked() || mFacebookSwitch.isChecked()
                            || mInstagramSwitch.isChecked()) {
                        claimReward();
                        return;
                    }

                    Intent data = new Intent();
                    data.putExtra("id", mReward.getId());
                    data.putExtra("verificationNeeded", false);
                    //                        data.putExtra("verificationNeeded", mInstagramSwitch.isChecked());
                    setResult(RESULT_OK, data);
                    finish();
                }
            });

        } else {
            showInstagramFailure(userDetails, mReward.getGlobalHashtag());
        }

    } else {
        showInstagramFailure(userDetails, mReward.getGlobalHashtag());
    }
    dotProgress.hide(150);
    mReward.setVerifying(false);
    realm.close();
}