List of usage examples for android.view.animation LinearInterpolator LinearInterpolator
public LinearInterpolator()
From source file:com.gigigo.imagerecognition.vuforia.VuforiaActivity.java
private void startBoringAnimation() { scanLine.setVisibility(View.VISIBLE); // Create animators for y axe if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { int yMax = 0; yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight(); yMax = (int) (yMax * 0.9);// 174; ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax); oay.setRepeatCount(Animation.INFINITE); oay.setDuration(ANIM_DURATION);//w w w . j a v a 2s. co m oay.setRepeatMode(ValueAnimator.REVERSE); oay.setInterpolator(new LinearInterpolator()); oay.start(); //for draw points near ir_scanline markFakeFeaturePoint.setObjectAnimator(oay); } //scanAnimation. }
From source file:org.mozilla.focus.widget.AnimatedProgressBar.java
private void init(@NonNull Context context, @Nullable AttributeSet attrs) { tempRect = new Rect(); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedProgressBar); final int duration = a.getInteger(R.styleable.AnimatedProgressBar_shiftDuration, 1000); final int resID = a.getResourceId(R.styleable.AnimatedProgressBar_shiftInterpolator, 0); final boolean wrap = a.getBoolean(R.styleable.AnimatedProgressBar_wrapShiftDrawable, false); mPrimaryAnimator = ValueAnimator.ofInt(getProgress(), getMax()); mPrimaryAnimator.setInterpolator(new LinearInterpolator()); mPrimaryAnimator.setDuration(PROGRESS_DURATION); mPrimaryAnimator.addUpdateListener(mListener); mClosingAnimator.setDuration(CLOSING_DURATION); mClosingAnimator.setInterpolator(new LinearInterpolator()); mClosingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//from ww w.ja va 2s . co m public void onAnimationUpdate(ValueAnimator valueAnimator) { final float region = (float) valueAnimator.getAnimatedValue(); if (mClipRegion != region) { mClipRegion = region; invalidate(); } } }); mClosingAnimator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { mClipRegion = 0f; } @Override public void onAnimationEnd(Animator animator) { setVisibilityImmediately(GONE); } @Override public void onAnimationCancel(Animator animator) { mClipRegion = 0f; } @Override public void onAnimationRepeat(Animator animator) { } }); setProgressDrawable(buildWrapDrawable(getProgressDrawable(), wrap, duration, resID)); a.recycle(); }
From source file:pl.mg6.android.maps.extensions.demo.AnimateMarkersActivity.java
private Interpolator randomInterpolator() { int val = random.nextInt(14); switch (val) { case 0:// w w w. j ava 2 s.co m return new LinearInterpolator(); case 1: return new AccelerateDecelerateInterpolator(); case 2: return new AccelerateInterpolator(); case 3: return new AccelerateInterpolator(6.0f); case 4: return new DecelerateInterpolator(); case 5: return new DecelerateInterpolator(6.0f); case 6: return new BounceInterpolator(); case 7: return new AnticipateOvershootInterpolator(); case 8: return new AnticipateOvershootInterpolator(6.0f); case 9: return new AnticipateInterpolator(); case 10: return new AnticipateInterpolator(6.0f); case 11: return new OvershootInterpolator(); case 12: return new OvershootInterpolator(6.0f); case 13: return new CycleInterpolator(1.25f); } throw new RuntimeException(); }
From source file:com.angelatech.yeyelive.view.PeriscopeLayout.java
private AnimatorSet getEnterAnimtor(final View target) { ObjectAnimator alpha = ObjectAnimator.ofFloat(target, View.ALPHA, 0.2f, 1f); ObjectAnimator scaleX = ObjectAnimator.ofFloat(target, View.SCALE_X, 0.2f, 1f); ObjectAnimator scaleY = ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.2f, 1f); AnimatorSet enter = new AnimatorSet(); enter.setDuration(500);/* w w w . ja va 2s .c o m*/ enter.setInterpolator(new LinearInterpolator()); enter.playTogether(alpha, scaleX, scaleY); enter.setTarget(target); return enter; }
From source file:com.uf.togathor.Togathor.java
@Override public void onCreate() { super.onCreate(); sInstance = this; mPreferences = new Preferences(this); mPreferences.clearFlagsForTutorialEachBoot(getApplicationContext().getPackageName()); gOpenFromBackground = true;//w ww .j a v a 2s . com mFileDir = new FileDir(this); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); googleAPIService = new GoogleAPIService(this); messagesDataSource = new MessagesDataSource(this); eventMessagesDataSource = new EventMessagesDataSource(this); contactsDataSource = new ContactsDataSource(this); startEventService(); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("s3lab", "S3LAB!!".toCharArray()); } }); // Create typefaces mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf"); mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf"); setTransportBasedOnScreenDensity(42); // Example interpolator; could use linear or accelerate interpolator // instead final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator(); final LinearInterpolator linearInterpolator = new LinearInterpolator(); final int slidingDuration = getResources().getInteger(R.integer.sliding_duration); // Set up animations mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0); mSlideInLeft.setDuration(slidingDuration); // mSlideInLeft.setFillAfter(true); // hmm not sure mSlideInLeft.setFillEnabled(false); mSlideInLeft.setInterpolator(linearInterpolator); mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0); mSlideOutRight.setDuration(slidingDuration); mSlideOutRight.setFillAfter(true); mSlideOutRight.setFillEnabled(true); mSlideOutRight.setInterpolator(linearInterpolator); mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0); mSlideOutLeft.setDuration(slidingDuration); mSlideOutLeft.setInterpolator(linearInterpolator); mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0); mSlideInRight.setDuration(slidingDuration); mSlideInRight.setFillAfter(true); mSlideInRight.setFillEnabled(true); mSlideInRight.setInterpolator(linearInterpolator); mSlideFromTop.setFillAfter(true); mSlideFromTop.setFillEnabled(true); mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideFromTop.setInterpolator(linearInterpolator); mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideOutTop.setInterpolator(linearInterpolator); String strUUID = UUID.randomUUID().toString(); Logger.debug("uuid", strUUID); mBaseUrl = mPreferences.getUserServerURL(); }
From source file:com.example.gangzhang.myapplication.VideoPlayerActivity.java
/** * * Called when the activity is first created. *//*from w w w . j av a 2 s .c om*/ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Log.d(TAG, "onCreate"); requestWindowFeature(Window.FEATURE_NO_TITLE);//?? Vitamio.isInitialized(this.getApplicationContext()); setContentView(R.layout.videoview); mPreview = (SurfaceView) findViewById(R.id.surface); mPreview.setClickable(false); holder = mPreview.getHolder(); holder.addCallback(this); holder.setFormat(PixelFormat.RGBA_8888); mProgressBar = (ImageView) findViewById(R.id.loading); mPlayImageView = (ImageView) findViewById(R.id.play); mPlayImageView.setOnClickListener(this); mImageCapture = (Button) findViewById(R.id.capture); mImageCapture.setOnClickListener(this); mImageCapture.setEnabled(false); mImageRecord = (Button) findViewById(R.id.record); mImageRecord.setOnClickListener(this); extras = getIntent().getExtras(); operatingAnim = AnimationUtils.loadAnimation(this, R.anim.loading_anim); LinearInterpolator lin = new LinearInterpolator(); operatingAnim.setInterpolator(lin); sp = getSharedPreferences(SettingFragment.KEY_SETTING, PreferenceActivity.MODE_PRIVATE); hardEnabled = sp.getBoolean(SettingFragment.KEY_HARD_DECODER, false); // byte[] bt= new byte[]{}; // load(); // initH264(bt); }
From source file:com.zhihu.android.app.mirror.app.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.app_name), BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher), ContextCompat.getColor(this, R.color.black))); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mRootLayout = (FrameLayout) findViewById(R.id.root); mLinearInterpolator = new LinearInterpolator(); mAccelerateInterpolator = new AccelerateInterpolator(); mCurrentFlag = FLAG_MIRROR_LIST;// w ww .j av a 2s. c o m setupFresco(); setupMirrorListView(); setupArtboardListView(); setupArtboardPagerView(); setupConnectStatusLayout(); setupRxBus(); Intent intent = new Intent(this, MirrorService.class); startService(intent); }
From source file:com.example.waitou.rxjava.LoadingView.java
private void buildAnimator() { final ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(ANIMATOR_DURATION); valueAnimator.setRepeatCount(-1);/*ww w .j a v a2 s. co m*/ valueAnimator.setInterpolator(new LinearInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mRotation = (float) valueAnimator.getAnimatedValue(); invalidate(); } }); animator = valueAnimator; animatorSet = buildFlexibleAnimation(); animatorSet.addListener(animatorListener); }
From source file:de.grobox.liberario.ui.LocationGpsView.java
public void activateGPS() { if (searching) return;/*from w ww . ja v a 2s . c o m*/ // check permissions if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION)) { Toast.makeText(getContext(), R.string.permission_denied_gps, Toast.LENGTH_LONG).show(); } else { // No explanation needed, we can request the permission ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, caller); } return; } searching = true; List<String> providers = locationManager.getProviders(true); for (String provider : providers) { // Register the listener with the Location Manager to receive location updates locationManager.requestSingleUpdate(provider, this, null); Log.d(getClass().getSimpleName(), "Register provider for location updates: " + provider); } // check if there is a non-passive provider available if (providers.size() == 0 || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) { locationManager.removeUpdates(this); Toast.makeText(getContext(), getContext().getString(R.string.error_no_location_provider), Toast.LENGTH_LONG).show(); return; } // clear input setLocation(null, TransportrUtils.getTintedDrawable(getContext(), R.drawable.ic_gps)); ui.clear.setVisibility(View.VISIBLE); // clear current GPS location, because we are looking to find a new one gps_location = null; // show GPS button blinking final Animation animation = new AlphaAnimation(1, 0); animation.setDuration(500); animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); ui.status.startAnimation(animation); ui.location.setHint(R.string.stations_searching_position); ui.location.clearFocus(); if (gpsListener != null) gpsListener.activateGPS(); }
From source file:ezy.ui.view.NoticeView.java
private Animation anim(float from, float to) { final TranslateAnimation anim = new TranslateAnimation(0, 0f, 0, 0f, Animation.RELATIVE_TO_PARENT, from, Animation.RELATIVE_TO_PARENT, to); anim.setDuration(mDuration);//from w ww . j a va 2s. c o m anim.setFillAfter(false); anim.setInterpolator(new LinearInterpolator()); return anim; }