Example usage for android.view.animation AlphaAnimation setFillAfter

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

Introduction

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

Prototype

public void setFillAfter(boolean fillAfter) 

Source Link

Document

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Usage

From source file:org.digitalcampus.oppia.fragments.CourseScorecardFragment.java

public void onParseComplete(CompleteCourse parsed) {

    ArrayList<Activity> baseline = parsed.getBaselineActivities();

    DbHelper db = DbHelper.getInstance(super.getActivity());
    long userId = db.getUserId(SessionManager.getUsername(getActivity()));
    ArrayList<Activity> quizActs = db.getCourseQuizzes(course.getCourseId());
    ArrayList<QuizStats> quizzes = new ArrayList<>();
    for (Activity a : quizActs) {
        // get the max score for the quiz for the user
        QuizStats qs = db.getQuizAttempt(a.getDigest(), userId);
        quizzes.add(qs);//from  w  w  w . j  av a2  s  .  com
    }

    int quizzesAttempted = 0, quizzesPassed = 0;

    for (QuizStats qs : quizzes) {
        if (qs.isAttempted()) {
            quizzesAttempted++;
        }
        if (qs.isPassed()) {
            quizzesPassed++;
        }
    }

    int pretestScore = -1;
    for (Activity baselineAct : baseline) {
        if (!baselineAct.getActType().equals("quiz"))
            continue;
        QuizStats pretest = db.getQuizAttempt(baselineAct.getDigest(), userId);
        pretestScore = pretest.getPercent();
    }

    quizStats.clear();
    quizStats.addAll(quizzes);
    if (quizStats.size() == 0) {
        quizzesContainer.setVisibility(View.GONE);
        return;
    }

    highlightPretest.setText(pretestScore >= 0 ? (pretestScore + "%") : "-");
    highlightAttempted.setText("" + quizzesAttempted);
    highlightPassed.setText("" + quizzesPassed);
    quizzesAdapter.notifyDataSetChanged();

    AlphaAnimation fadeInAnimation = new AlphaAnimation(0f, 1f);
    fadeInAnimation.setDuration(700);
    fadeInAnimation.setFillAfter(true);

    quizzesProgressBar.setProgress(0);
    quizzesProgressBar.setSecondaryProgress(0);

    quizzesView.setVisibility(View.VISIBLE);
    quizzesView.startAnimation(fadeInAnimation);

    quizzesProgressBar.setMax(quizStats.size());
    ProgressBarAnimator animator = new ProgressBarAnimator(quizzesProgressBar);
    animator.setStartDelay(500);
    animator.animateBoth(quizzesPassed, quizzesAttempted);
}

From source file:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateToHidden() {
    Log.v(TAG, "animateToHidden()");

    AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
    animation.setStartOffset(ANIMATION_END_PAUSE_DURATION);
    animation.setDuration(ANIMATION_END_FADE_DURATION);
    animation.setFillAfter(true);

    progressBar.clearAnimation();/*ww w.  j a va  2  s.c  o m*/
    progressBar.startAnimation(animation);
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateToHidden() {
    Timber.v("animateToHidden()");
    checkNotNull(progressBar);//  w  w w .j  a va  2s . com

    AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
    animation.setStartOffset(ANIMATION_END_PAUSE_DURATION);
    animation.setDuration(ANIMATION_END_FADE_DURATION);
    animation.setFillAfter(true);

    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:com.bhb27.isu.Main.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MainContext = this;

    LinearLayout layout = (LinearLayout) findViewById(R.id.MainLayout);
    AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setFillAfter(true);
    animation.setDuration(750);//from  www.  ja  v  a  2 s  .  co  m
    layout.startAnimation(animation);

    suVersion = Tools.SuVersion(MainContext);
    isCMSU = SuVersionBool(suVersion);

    Runnable runSepolicy = new Runnable() {
        public void run() {
            Sepolicy();
            // Only run boot service if app was used and is CM SU
            if (isCMSU && !Tools.getBoolean("run_boot", false, MainContext))
                Tools.saveBoolean("run_boot", true, MainContext);
        }
    };
    new Thread(runSepolicy).start();

    suSwitch = (Switch) findViewById(R.id.suSwitch);
    SuSwitchSummary = (TextView) findViewById(R.id.SuSwitchSummary);
    SuStatus = (TextView) findViewById(R.id.SuStatus);
    su_version = (TextView) findViewById(R.id.su_version);
    su_version_summary = (TextView) findViewById(R.id.su_version_summary);
    su_version_summary.setText(suVersion);

    SelinuxSwitch = (Switch) findViewById(R.id.SelinuxSwitch);
    SelinuxStatus = (TextView) findViewById(R.id.SelinuxStatus);
    Selinux_State = (TextView) findViewById(R.id.Selinux_State);
    Selinux_State.setText(Tools.getSELinuxStatus());

    iSuNotification = (Switch) findViewById(R.id.iSuNotification);
    SuSelinuxSwitch = (Switch) findViewById(R.id.SuSelinuxSwitch);
    SuSelinuxSwitchSummary = (TextView) findViewById(R.id.SuSelinuxSwitchSummary);

    per_app = (Button) findViewById(R.id.buttonPer_app);
    per_app_summary = (TextView) findViewById(R.id.per_app);

    download_folder_link = (TextView) findViewById(R.id.download_folder_link);
    kernel_check = (TextView) findViewById(R.id.kernel_check);
    // about button
    about = (Button) findViewById(R.id.buttonAbout);
    about.setOnClickListener(new View.OnClickListener() {
        Intent myIntent = new Intent(getApplicationContext(), AboutActivity.class);

        @Override
        public void onClick(View v) {
            startActivity(myIntent);
        }
    });

    ic_launcher = (ImageView) findViewById(R.id.ic_launcher);
    ic_launcher.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Tools.DoAToast(getString(R.string.isu_by), MainContext);
        }
    });

    //reboot support check
    if (RebootSupport()) {
        kernel_check.setText(getString(R.string.isu_reboot));
        download_folder_link.setVisibility(View.GONE);
    } else if (Tools.KernelSupport()) {
        kernel_check.setText(getString(R.string.isu_kernel_good));
        download_folder_link.setVisibility(View.GONE);
    } else {
        kernel_check.setTextColor(getColorWrapper(MainContext, R.color.colorAccent));
        kernel_check.setText(getString(R.string.isu_kernel_bad));
        download_folder_link.setText(getString(R.string.download_folder_link));
        download_folder_link.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("https://www.androidfilehost.com/?w=files&flid=120360")));
                } catch (ActivityNotFoundException ex) {
                    Tools.DoAToast(getString(R.string.no_browser), MainContext);
                }
            }
        });
    }
    UpdateMain(isCMSU);
}

From source file:org.kiwix.kiwixmobile.ZimFileSelectActivity.java

private void setAlpha(boolean transparent) {

    float viewTransparency = transparent ? 0.4F : 1F;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mZimFileList.setAlpha(viewTransparency);
    } else {// w  ww.  ja va  2 s  . c  o  m
        AlphaAnimation alpha = new AlphaAnimation(viewTransparency, viewTransparency);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        mZimFileList.startAnimation(alpha);
    }
}

From source file:com.freshdigitable.udonroad.UserInfoActivity.java

private void setUpAppbar() {
    binding.userInfoToolbar.setTitle("");

    final TextView toolbarTitle = binding.userInfoToolbarTitle;
    binding.userInfoAppbarLayout.addOnOffsetChangedListener(new OnOffsetChangedListener() {
        private boolean isTitleVisible = toolbarTitle.getVisibility() == View.VISIBLE;

        @Override//from  ww  w.  ja v  a 2  s  .  c o  m
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
            final int totalScrollRange = appBarLayout.getTotalScrollRange();
            final float percent = (float) Math.abs(verticalOffset) / (float) totalScrollRange;
            if (percent > 0.9) {
                if (!isTitleVisible) {
                    startAnimation(toolbarTitle, View.VISIBLE);
                    isTitleVisible = true;
                }
            } else {
                if (isTitleVisible) {
                    startAnimation(toolbarTitle, View.INVISIBLE);
                    isTitleVisible = false;
                }
            }
        }

        private void startAnimation(View v, int visibility) {
            AlphaAnimation animation = (visibility == View.VISIBLE) ? new AlphaAnimation(0f, 1f)
                    : new AlphaAnimation(1f, 0f);
            animation.setDuration(200);
            animation.setFillAfter(true);
            v.startAnimation(animation);
        }
    });
}

From source file:org.digitalcampus.oppia.activity.CourseIndexActivity.java

private void initializeCourseIndex(boolean animate) {

    final ListView listView = (ListView) findViewById(R.id.section_list);
    if (listView == null)
        return;/*from w  w w .j  ava2s .  c o m*/
    ViewCompat.setNestedScrollingEnabled(listView, true);
    sla = new SectionListAdapter(CourseIndexActivity.this, course, sections,
            new SectionListAdapter.CourseClickListener() {
                @Override
                public void onActivityClicked(String activityDigest) {
                    startCourseActivityByDigest(activityDigest);
                }
            });

    if (animate) {
        AlphaAnimation fadeOutAnimation = new AlphaAnimation(1f, 0f);
        fadeOutAnimation.setDuration(700);
        fadeOutAnimation.setFillAfter(true);

        listView.setAlpha(0f);
        ValueAnimator animator = ValueAnimator.ofFloat(1f, 0f);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                listView.setTranslationX((Float) valueAnimator.getAnimatedValue() * 80);
                listView.setAlpha(1f - (Float) valueAnimator.getAnimatedValue());
            }
        });
        animator.setDuration(700);
        animator.start();
        loadingCourseView.startAnimation(fadeOutAnimation);

    } else {
        loadingCourseView.setVisibility(View.GONE);
        listView.setVisibility(View.VISIBLE);
    }

    listView.setAdapter(sla);
}

From source file:com.sahildave.snackbar.SnackBar.java

private AnimationSet getEntryAnimation() {
    //In//w  ww. j  a va  2s . c  o  m
    mInAnimationSet = new AnimationSet(false);

    TranslateAnimation mSlideInAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
    mSlideInAnimation.setFillAfter(true);

    AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
    mFadeInAnimation.setFillAfter(true);

    mInAnimationSet.addAnimation(mSlideInAnimation);
    mInAnimationSet.addAnimation(mFadeInAnimation);

    mInAnimationSet.setDuration(IN_ANIMATION_DURATION);

    return mInAnimationSet;

}

From source file:com.sahildave.snackbar.SnackBar.java

private AnimationSet getExitAnimation() {
    //Out//  www. jav  a  2  s.  c om
    mOutAnimationSet = new AnimationSet(false);

    TranslateAnimation mSlideOutAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 1.0f);

    mSlideOutAnimation.setFillAfter(true);

    AlphaAnimation mFadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
    mFadeOutAnimation.setFillAfter(true);

    mOutAnimationSet.addAnimation(mSlideOutAnimation);
    mOutAnimationSet.addAnimation(mFadeOutAnimation);

    mOutAnimationSet.setDuration(OUT_ANIMATION_DURATION);

    return mOutAnimationSet;
}

From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java

private Animation createAlphaOutAnimation() {
    AlphaAnimation an = new AlphaAnimation(1, 0);
    an.setDuration(ALPHA_DURATION);/*w ww. java 2  s  .co  m*/
    an.setFillAfter(true);
    return an;
}