Example usage for android.view.animation LinearInterpolator LinearInterpolator

List of usage examples for android.view.animation LinearInterpolator LinearInterpolator

Introduction

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

Prototype

public LinearInterpolator() 

Source Link

Usage

From source file:com.example.fansonlib.widget.calendar.CalendarView.java

/**
 * ??/*w  w w .j  a va 2  s.c  o  m*/
 *
 * @param position ?
 */
public void closeSelectLayout(final int position) {
    mSelectLayout.setVisibility(GONE);
    mLinearWeek.setVisibility(VISIBLE);
    mViewPager.setVisibility(VISIBLE);
    if (position == mViewPager.getCurrentItem()) {
        if (mListener != null) {
            Calendar calendar = new Calendar();
            calendar.setYear(position / 12 + mMinYear);
            calendar.setMonth(position % 12 + 1);
            calendar.setDay(1);
            calendar.setLunar(LunarCalendar.numToChineseDay(
                    LunarCalendar.solarToLunar(calendar.getYear(), calendar.getMonth(), 1)[2]));
            mListener.onDateChange(calendar);
        }
    } else {
        mViewPager.setCurrentItem(position, true);
    }
    mLinearWeek.animate().translationY(0).setInterpolator(new LinearInterpolator()).setDuration(180)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mLinearWeek.setVisibility(VISIBLE);
                    if (mParentLayout != null && mParentLayout.mContentView != null) {
                        mParentLayout.mContentView.setVisibility(VISIBLE);
                    }
                }
            });
    mViewPager.animate().scaleX(1).scaleY(1).setDuration(180).setInterpolator(new LinearInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mViewPager.setVisibility(VISIBLE);

                }
            });
}

From source file:io.vit.vitio.Fragments.Today.TodayFragment.java

private void animateView() {
    PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && powerManager.isPowerSaveMode()) {
        return;/*  w w w.ja v  a 2  s. co  m*/
    }
    //float dimension = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, getResources().getDisplayMetrics());
    ObjectAnimator objectAnimatorX = ObjectAnimator.ofFloat(ocassionImage, "scaleX", 1f, 0.8f);
    ObjectAnimator objectAnimatorY = ObjectAnimator.ofFloat(ocassionImage, "scaleY", 1f, 0.8f);
    objectAnimatorX.setDuration(6000);
    objectAnimatorY.setDuration(6000);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(objectAnimatorX, objectAnimatorY);
    animatorSet.setInterpolator(new LinearInterpolator());
    objectAnimatorX.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorX.setRepeatMode(ObjectAnimator.REVERSE);
    objectAnimatorY.setRepeatCount(ObjectAnimator.INFINITE);
    objectAnimatorY.setRepeatMode(ObjectAnimator.REVERSE);
    animatorSet.start();
    objectAnimatorX.start();
}

From source file:cc.echonet.coolmicapp.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.home);//  ww  w.j  av a  2s . co  m
    timerValue = (TextView) findViewById(R.id.timerValue);
    BroadcastReceiver mPowerKeyReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String strAction = intent.getAction();
            if (strAction.equals(Intent.ACTION_SCREEN_OFF) || strAction.equals(Intent.ACTION_SCREEN_ON)
                    || strAction.equals(Intent.ACTION_USER_PRESENT)) {
                if (isThreadOn) {
                    RedFlashLight();
                }
            }
        }
    };
    final IntentFilter theFilter = new IntentFilter();
    /** System Defined Broadcast */
    theFilter.addAction(Intent.ACTION_SCREEN_ON);
    theFilter.addAction(Intent.ACTION_SCREEN_OFF);
    theFilter.addAction(Intent.ACTION_USER_PRESENT);

    getApplicationContext().registerReceiver(mPowerKeyReceiver, theFilter);

    imageView1 = (ImageView) findViewById(R.id.imageView1);

    Log.v("onCreate", (imageView1 == null ? "iv null" : "iv ok"));

    android.view.ViewGroup.LayoutParams layoutParams = imageView1.getLayoutParams();

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        layoutParams.height = 400;
    } else {
        layoutParams.height = 180;
    }

    imageView1.setLayoutParams(layoutParams);

    myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    animation.setDuration(500); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
    animation.setRepeatMode(Animation.REVERSE);
    start_button = (Button) findViewById(R.id.start_recording_button);
    stop_button = (Button) findViewById(R.id.stop_recording_button);
    buttonColor = start_button.getBackground();
    logArea = (TextView) findViewById(R.id.log_area);
    logArea.setMovementMethod(new ScrollingMovementMethod());

    coolmic = new CoolMic(this, "default");

    if (Wrapper.getState() == Wrapper.WrapperInitializationStatus.WRAPPER_UNINITIALIZED) {
        if (Wrapper.init() == Wrapper.WrapperInitializationStatus.WRAPPER_INITIALIZATION_ERROR) {
            Log.d("WrapperInit", Wrapper.getInitException().toString());
            Toast.makeText(getApplicationContext(),
                    "Could not initialize native components :( Blocking controls!", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(getApplicationContext(), "Native components initialized!", Toast.LENGTH_SHORT)
                    .show();
        }
    } else if (Wrapper.init() == Wrapper.WrapperInitializationStatus.WRAPPER_INITIALIZATION_ERROR) {
        Toast.makeText(getApplicationContext(),
                "Previous problem detected with native components :( Blocking controls!", Toast.LENGTH_SHORT)
                .show();
    } else if (Wrapper.init() != Wrapper.WrapperInitializationStatus.WRAPPER_INTITIALIZED) {
        Toast.makeText(getApplicationContext(), "Native components in unknown state!", Toast.LENGTH_SHORT)
                .show();
    }

    txtListeners = (TextView) findViewById(R.id.txtListeners);
    IntentFilter mStatusIntentFilter = new IntentFilter(Constants.BROADCAST_STREAM_STATS_SERVICE);
    LocalBroadcastManager.getInstance(this).registerReceiver(mStreamStatsReceiver, mStatusIntentFilter);
}

From source file:uk.ac.horizon.artcodes.ui.MarkerHistoryViewController.java

private void animateEnterOrMove(View view, int x, int y) {
    view.animate().alpha(1).translationX(x).translationY(y).setDuration(ANIMATION_DURATION_MS)
            .setInterpolator(new LinearInterpolator()).start();
}

From source file:uk.ac.horizon.artcodes.ui.MarkerHistoryViewController.java

private void animateEnterOrMove(View view, int x, int y, float scale) {
    view.animate().alpha(1).translationX(x).translationY(y).scaleX(scale).scaleY(scale)
            .setDuration(ANIMATION_DURATION_MS).setInterpolator(new LinearInterpolator()).start();
}

From source file:com.example.volunteerhandbook.MainActivity.java

void loop_what_I_thought() {
    thoughts = getResources().getStringArray(R.array.what_I_thought);
    int lines = thoughts.length / 4;
    container = (FrameLayout) findViewById(R.id.main_content_frame);
    LinearLayout[] textBox = new LinearLayout[3];
    endY = container.getHeight() - 100f;
    h = (float) container.getHeight();
    hBox = 0;/*  w  ww.  java  2  s  .com*/
    /*
    for (int k=0; k<3; k++){
       textBox[k]=new LinearLayout(this);
       textBox[k].setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    textBox[k].setOrientation(1);
    }
    */
    //LinearLayout tmp=(LinearLayout) getLayoutInflater().inflate(R.layout.one_line, null);
    //TextView  tmpTxt=(TextView)tmp.findViewById(R.id.oneLine);
    //tmp.removeView(tmpTxt);
    int[] color = new int[4];
    color[3] = Color.parseColor("#66FF66");
    color[1] = Color.parseColor("#FF9900");
    color[2] = Color.parseColor("#0099FF");
    color[0] = Color.parseColor("#00FF00");
    toMove = new TextView[thoughts.length];
    int textSize = 24;
    for (int i = 0; i < thoughts.length; i++) {
        toMove[i] = new TextView(this);
        toMove[i].setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        toMove[i].setText(thoughts[i]);
        toMove[i].setTextSize(textSize);
        toMove[i].getPaint().setFakeBoldText(true);
        toMove[i].setTextColor(color[1] - 0x20202 * i);
        //textBox.addView(toMove);
    }
    int boxHeight = (lines + 1) * (int) (textSize * 1.5);
    for (int k = 0; k < 3; k++) {
        textBox[k].removeAllViews();
        for (int i = 0; i < thoughts.length / 4; i++) {
            TextView v = toMove[iTh++ % thoughts.length];
            v.setTextColor(color[k]);
            textBox[k].addView(v);
        }
        //toMove.setTranslationY(600);
        //container.addView(textBox);
        container.addView(textBox[k]);
        textBox[k].setX(20);
        textBox[k].setY(2 * boxHeight + hBox);
        hBox += boxHeight; //textBox[k].getHeight();
        float startY = textBox[k].getY();
        endY = (-1) * boxHeight;
        int duration = (int) (((startY - endY) / (3 * boxHeight)) * 20000);
        ValueAnimator bounceAnim = ObjectAnimator.ofFloat(textBox[k], "y", startY, endY);
        bounceAnim.setDuration(duration);
        bounceAnim.setInterpolator(new LinearInterpolator());
        final LinearLayout iBox = textBox[k];
        bounceAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                loopNewBox(iBox);
            }
        });
        bounceAnim.start();
    }

}

From source file:com.gigamole.library.ntb.NavigationTabBar.java

public NavigationTabBar(final Context context, final AttributeSet attrs, final int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    //Init NTB/* w  ww  .j  ava  2 s. c o  m*/

    // Always draw
    setWillNotDraw(false);
    // More speed!
    setLayerType(LAYER_TYPE_HARDWARE, null);

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NavigationTabBar);
    try {
        setIsTitled(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_titled, false));
        setIsBadged(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_badged, false));
        setIsScaled(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_scaled, true));
        setIsTinted(typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_tinted, true));
        setIsBadgeUseTypeface(
                typedArray.getBoolean(R.styleable.NavigationTabBar_ntb_badge_use_typeface, false));

        setTitleMode(typedArray.getInt(R.styleable.NavigationTabBar_ntb_title_mode, TitleMode.ALL_INDEX));
        setBadgePosition(
                typedArray.getInt(R.styleable.NavigationTabBar_ntb_badge_position, BadgePosition.RIGHT_INDEX));
        setBadgeGravity(
                typedArray.getInt(R.styleable.NavigationTabBar_ntb_badge_gravity, BadgeGravity.TOP_INDEX));
        setBadgeBgColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_badge_bg_color, 0));
        setBadgeTitleColor(typedArray.getColor(R.styleable.NavigationTabBar_ntb_badge_title_color, 0));

        setTypeface(typedArray.getString(R.styleable.NavigationTabBar_ntb_typeface));
        setInactiveColor(
                typedArray.getColor(R.styleable.NavigationTabBar_ntb_inactive_color, DEFAULT_INACTIVE_COLOR));
        setActiveColor(
                typedArray.getColor(R.styleable.NavigationTabBar_ntb_active_color, DEFAULT_ACTIVE_COLOR));
        setAnimationDuration(typedArray.getInteger(R.styleable.NavigationTabBar_ntb_animation_duration,
                DEFAULT_ANIMATION_DURATION));
        setCornersRadius(typedArray.getDimension(R.styleable.NavigationTabBar_ntb_corners_radius, 0.0F));

        // Init animator
        mAnimator.setFloatValues(MIN_FRACTION, MAX_FRACTION);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(final ValueAnimator animation) {
                updateIndicatorPosition((Float) animation.getAnimatedValue());
            }
        });

        // Set preview models
        if (isInEditMode()) {
            // Get preview colors
            String[] previewColors = null;
            try {
                final int previewColorsId = typedArray
                        .getResourceId(R.styleable.NavigationTabBar_ntb_preview_colors, 0);
                previewColors = previewColorsId == 0 ? null
                        : typedArray.getResources().getStringArray(previewColorsId);
            } catch (Exception exception) {
                previewColors = null;
                exception.printStackTrace();
            } finally {
                if (previewColors == null)
                    previewColors = typedArray.getResources().getStringArray(R.array.default_preview);

                for (String previewColor : previewColors)
                    mModels.add(new Model.Builder(null, Color.parseColor(previewColor)).build());
                requestLayout();
            }
        }
    } finally {
        typedArray.recycle();
    }
}

From source file:uk.ac.horizon.artcodes.ui.MarkerHistoryViewController.java

private void animateRemoval(final View view) {
    view.animate().setListener(new Animator.AnimatorListener() {
        @Override// w  w w  .  j  ava2 s . co m
        public void onAnimationStart(Animator animator) {

        }

        @Override
        public void onAnimationEnd(Animator animator) {
            relativeLayout.removeView(view);
        }

        @Override
        public void onAnimationCancel(Animator animator) {

        }

        @Override
        public void onAnimationRepeat(Animator animator) {

        }
    }).alpha(0).setInterpolator(new LinearInterpolator()).setDuration(ANIMATION_DURATION_MS).start();
}

From source file:com.gitstudy.rili.liarbry.CalendarView.java

/**
 * ??/*ww  w . j a  v a  2  s .c o m*/
 *
 * @param position ?
 */
private void closeSelectLayout(final int position) {
    mSelectLayout.setVisibility(GONE);
    mWeekBar.setVisibility(VISIBLE);
    if (position == mMonthPager.getCurrentItem()) {
        if (mDelegate.mCalendarSelectListener != null
                && mDelegate.getSelectMode() != CalendarViewDelegate.SELECT_MODE_SINGLE) {
            mDelegate.mCalendarSelectListener.onCalendarSelect(mDelegate.mSelectedCalendar, false);
        }
    } else {
        mMonthPager.setCurrentItem(position, false);
    }
    mWeekBar.animate().translationY(0).setInterpolator(new LinearInterpolator()).setDuration(280)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mWeekBar.setVisibility(VISIBLE);
                }
            });
    mMonthPager.animate().scaleX(1).scaleY(1).setDuration(180).setInterpolator(new LinearInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mMonthPager.setVisibility(VISIBLE);
                    mMonthPager.clearAnimation();
                    if (mParentLayout != null) {
                        mParentLayout.showContentView();
                    }
                }
            });
}

From source file:com.folioreader.activity.FolioActivity.java

private void toolbarAnimateShow(final int verticalOffset) {
    mToolbar.animate().translationY(0).setInterpolator(new LinearInterpolator()).setDuration(180)
            .setListener(new AnimatorListenerAdapter() {

                @Override//from  w w w .j ava  2  s .c o m
                public void onAnimationStart(Animator animation) {
                    toolbarSetElevation(verticalOffset == 0 ? 0 : 1);
                }
            });

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (mIsActionBarVisible) {
                        toolbarAnimateHide();
                    }
                }
            });
        }
    }, 10000);

    mIsActionBarVisible = true;
}