Example usage for android.view.animation Animation setStartOffset

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

Introduction

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

Prototype

public void setStartOffset(long startOffset) 

Source Link

Document

When this animation should start relative to the start time.

Usage

From source file:com.pepperonas.andbasx.animation.FadeAnimationColored.java

/**
 * Fade out.//ww w  .jav  a2s  .c  o m
 */
public void fadeOut() {
    this.view.setAlpha(1f);
    Animation anim = new AlphaAnimation(minBrightness, maxBrightness);
    anim.setDuration(duration);
    anim.setStartOffset(startOffset);
    anim.setFillEnabled(true);
    anim.setFillAfter(true);
    view.startAnimation(anim);
}

From source file:com.ae.apps.messagecounter.fragments.MessageChartFragment.java

private void updateMessagesChart() {
    try {/* w w w . j  a v a  2 s  .c  om*/
        // Reports of IllegalStateExceptions are received
        mTitleText.setText(getResources().getString(R.string.str_chart_title));

        // Get the preference value for including message counts from non contacts
        boolean includeNonContactMessages = getIncludeNonContactMessagesPref();

        // Do we need to show the other senders text?
        if (includeNonContactMessages) {
            mOtherSendersText.setVisibility(View.INVISIBLE);
        } else {
            mOtherSendersText.setVisibility(View.VISIBLE);
        }

        GraphData graphData = MessageCounterUtils.getMessageCountDegrees(mContactMessageList,
                mInboxMessageCount, AppConstants.MAX_ROWS_IN_CHART, includeNonContactMessages);
        View graphView = new SimpleGraphView(mContext, graphData.getValueInDegrees(), graphData.getLabels(),
                AppConstants.CHART_COLORFUL);

        // If we are updating, remove the previous graphView
        if (mGraphContainer.getChildCount() > 0) {
            mGraphContainer.removeAllViews();
        }

        // Create a new SimpleGraphView and add it to the graphContainer
        Animation fadeInAnimation = AnimationUtils.loadAnimation(mContext, R.animator.fade_in);
        fadeInAnimation.setStartOffset(150);
        graphView.startAnimation(fadeInAnimation);
        mGraphContainer.addView(graphView);
    } catch (Exception e) {
        Log.e(TAG, e.getMessage());
    }
}

From source file:com.ae.apps.messagecounter.fragments.SentCountFragment.java

/**
 * This method sets up the data that needs to be displyed if we have to show the content
 *///w  w w . j  av a 2  s. c  o m
private void showSentCountDetails() {
    // Lets find the cycle start date
    Date cycleStartDate = MessageCounterUtils.getCycleStartDate(mPreferences);

    mCycleDurationText.setText(MessageCounterUtils.getDurationDateString(cycleStartDate));

    // Get the sent count details from the database
    SentCountDataManager dataManager = new SentCountDataManager();
    SentCountDetailsVo detailsVo = dataManager.getSentCountData(mContext);

    // set no of messages sent today and in this cycle
    mSentTodayText.setText(String.valueOf(detailsVo.getSentToday()));
    mHeroSentTodayText.setText(String.valueOf(detailsVo.getSentToday()));
    mHeroSentInCycleText.setText(String.valueOf(detailsVo.getSentCycle()));

    // set the progressbar
    setProgressInfo(detailsVo.getSentCycle(), detailsVo.getCycleLimit(), mProgressBar, mProgressText, 0);

    // Show the previous cycle details
    int lastCycle = detailsVo.getSentLastCycle();
    Date prevCycleStartDate = MessageCounterUtils.getPrevCycleStartDate(cycleStartDate);
    mPrevCycleSentText.setText(String.valueOf(lastCycle));
    mPrevCycleDurationText.setText(MessageCounterUtils.getDurationDateString(prevCycleStartDate));

    // set the progressbar for the last cycle
    setProgressInfo(lastCycle, detailsVo.getCycleLimit(), mPrevCountProgressBar, mPrevCycleSentText, 0);

    // Some basic animations
    Animation fadeInAnimation = AnimationUtils.loadAnimation(mContext, R.animator.fade_in);
    fadeInAnimation.setStartOffset(150);
    mSentCounterLayout.startAnimation(fadeInAnimation);
}

From source file:de.uni_weimar.m18.anatomiederstadt.element.SliderFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_slider, container, false);
    SeekBar sb = (SeekBar) view.findViewById(R.id.seekBar);
    // scale mMin and mMax
    mMin = (int) (mMin / mGranularity);
    mMax = (int) (mMax / mGranularity);
    sb.setMax(mMax - mMin);/*from   w w w  .  j  ava  2 s  .c o m*/
    sb.setProgress((mMax - mMin) / 2);
    final RelativeLayout balloon = (RelativeLayout) view.findViewById(R.id.indicatorBalloon);
    final Space space = (Space) view.findViewById(R.id.balloonSpace);

    final Context context = getActivity();
    final TextView balloonText = (TextView) view.findViewById(R.id.indicatorTextView);
    final float[] value = { 0.0f };
    sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {

            RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            p.addRule(RelativeLayout.ABOVE, seekBar.getId());
            Rect thumbRect = seekBar.getThumb().getBounds();
            value[0] = mMin + progress * mGranularity;
            String valueString = new DecimalFormat("#.##").format(value[0]);
            balloonText.setText(String.valueOf(valueString) + " " + mSuffix);
            int balloonWidth = balloonText.getWidth();
            p.setMargins(thumbRect.centerX() - balloonWidth / 2, 0, 0, 0);
            balloon.setLayoutParams(p);
            balloon.setVisibility(View.VISIBLE);

            final Animation animFadeOut = AnimationUtils.loadAnimation(context, R.anim.fade_out);
            balloon.startAnimation(animFadeOut);
            animFadeOut.setStartOffset(1000);
            animFadeOut.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {

                }

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

                @Override
                public void onAnimationRepeat(Animation animation) {

                }
            });
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            LevelStateManager stateManager = ((AnatomieDerStadtApplication) getActivity()
                    .getApplicationContext()).getStateManager(getActivity());
            stateManager.saveFloat(mVar, value[0]);
        }
    });
    return view;
}

From source file:com.ae.apps.messagecounter.fragments.MessageListFragment.java

/**
 * The callback method that will be invoked when the data is ready
 *///from  w  w w  . j av  a 2  s .  co m
@SuppressWarnings("unchecked")
@Override
public void onDataReady(Object objData) {
    List<ContactMessageVo> temp = (List<ContactMessageVo>) objData;
    if (temp != null && adapter != null) {
        adapter.updateList(temp);

        if (loadAnimationDone == false) {
            loadAnimationDone = true;

            // hide the progressbar
            mProgressBar.setVisibility(View.INVISIBLE);

            // Make some hidden views visible with some animation
            if (null != getActivity() && null != getActivity().getBaseContext()) {
                Animation slideInAnimation = AnimationUtils.loadAnimation(getActivity().getBaseContext(),
                        R.animator.slide_in_top);
                // add a small delay before starting the animation
                slideInAnimation.setStartOffset(500);
                messageInfoLyout.startAnimation(slideInAnimation);
            }
            messageInfoLyout.setVisibility(View.VISIBLE);
            pageTitleText.setVisibility(View.VISIBLE);
        }
    }
}

From source file:dev.vision.shopping.center.Fragments.GourmetFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = new FrameLayout(getActivity());
    View fm = inflater.inflate(R.layout.tabbed_list_fragment, null);
    ((FrameLayout) v).addView(fm);//w w w . j  a v  a2s  .co  m
    tabs = (TabHost) v.findViewById(android.R.id.tabhost); //Id of tab host
    iv = new ImageView(getActivity());
    ((FrameLayout) v).addView(iv);
    iv.setImageResource(R.drawable.gourmetb);
    iv.setBackgroundColor(Color.WHITE);
    iv.setScaleType(ScaleType.CENTER_INSIDE);
    Animation mLoadAnimation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
    mLoadAnimation.setStartOffset(1000);
    mLoadAnimation.setDuration(1500);
    mLoadAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {

            iv.setVisibility(View.GONE);

        }
    });

    iv.setAnimation(mLoadAnimation);

    return v;
}

From source file:baasi.hackathon.sja.TalkActivity.java

/**
 * ?? ?? ?//from w  ww .  j  a  v a  2  s.c om
 * @param v View
 * @param Con Context
 * @param animationid animation id
 * @param StartOffset offset
 * @return animation
 */
public Animation PlayAnim(View v, Context Con, int animationid, int StartOffset) {
    if (v != null) {
        Animation animation = AnimationUtils.loadAnimation(Con, animationid);
        animation.setStartOffset(StartOffset);
        v.startAnimation(animation);

        return animation;
    }
    return null;
}

From source file:org.secuso.privacyfriendlydicegame.MainActivity.java

public void flashResult() {

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(500);//www.  j  a va 2 s  . co  m
    animation.setStartOffset(20);
    animation.setRepeatMode(Animation.REVERSE);

    TextView finalResult = (TextView) findViewById(R.id.resultTextView);

    for (int i = 0; i < dice.length; i++) {
        if (!isLocked[i])
            dice[i].startAnimation(animation);
    }

    if (roundCounter == 3) {
        finalResult.startAnimation(animation);
    }

}

From source file:org.secuso.privacyfriendlypasswordgenerator.activities.MainActivity.java

public void hints(int position) {

    Animation anim = new AlphaAnimation(0.0f, 1.0f);

    if (metadatalist.size() == 0 || position == 0) {

        initialAlert.setVisibility(View.VISIBLE);
        anim.setDuration(1500);//from   w w w. ja  v a  2 s .co m
        anim.setStartOffset(20);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setRepeatCount(Animation.INFINITE);
        initialAlert.startAnimation(anim);

    } else {
        initialAlert.setVisibility(View.GONE);
        initialAlert.clearAnimation();
    }

}

From source file:com.khoahuy.phototag.HomeActivity.java

private void showReady2ScanBlinkText() {

    TextView myText = (TextView) findViewById(R.id.text_ready2scan);

    Animation anim = new AlphaAnimation(0.4f, 1.0f);
    anim.setDuration(200); //You can manage the time of the blink with this parameter
    anim.setStartOffset(800);
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);
    myText.startAnimation(anim);// w ww. j av a  2 s  . c  o  m

}