List of usage examples for android.animation ObjectAnimator start
@Override public void start()
From source file:com.google.samples.apps.topeka.widget.quiz.AbsQuizView.java
private void animateForegroundColor(@ColorInt final int targetColor) { ObjectAnimator animator = ObjectAnimator.ofInt(this, ViewUtils.FOREGROUND_COLOR, Color.TRANSPARENT, targetColor);/* w ww .jav a2 s. co m*/ animator.setEvaluator(new ArgbEvaluator()); animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY); animator.start(); }
From source file:com.ffmpegtest.VideoActivity.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void swapScaleType() { FFmpegSurfaceView view = (FFmpegSurfaceView) mVideoView; FFmpegSurfaceView.ScaleType scaleType = view.getScaleType(); ScaleType newScaleType;//from ww w . j a v a 2s . c o m if (ScaleType.CENTER_INSIDE.equals(scaleType)) { newScaleType = ScaleType.CENTER_CROP; } else if (ScaleType.CENTER_CROP.equals(scaleType)) { newScaleType = ScaleType.FIT_XY; } else { newScaleType = ScaleType.CENTER_INSIDE; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { view.setScaleType(newScaleType, true); RectF dst = new RectF(); view.calculateRect(dst, newScaleType); ObjectAnimator anim = ObjectAnimator.ofObject(view, "destinationRect", new RectEvaluator(), dst); anim.setInterpolator(new AccelerateDecelerateInterpolator()); anim.start(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { view.setScaleType(newScaleType, true); RectF dst = new RectF(); view.calculateRect(dst, newScaleType); ObjectAnimator anim = ObjectAnimator.ofObject(view, new PropertyDestinationRect(), new RectEvaluator(), dst); anim.setInterpolator(new AccelerateDecelerateInterpolator()); anim.start(); } else { view.setScaleType(newScaleType, false); } }
From source file:com.github.dfa.diaspora_android.activity.DiasporaStreamFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { AppLog.d(this, "StreamFragment.onOptionsItemSelected()"); ShareUtil shu = new ShareUtil(getContext()).setFileProviderAuthority(BuildConfig.APPLICATION_ID); PermissionChecker permc = new PermissionChecker(getActivity()); switch (item.getItemId()) { case R.id.action_reload: { if (WebHelper.isOnline(getContext())) { reloadUrl();//w w w . j a v a 2 s. c o m return true; } else { return false; } } case R.id.action_go_to_top: { ObjectAnimator anim = ObjectAnimator.ofInt(webView, "scrollY", webView.getScrollY(), 0); anim.setDuration(400); anim.start(); return true; } case R.id.action_share_link: { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle()); sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_dotdotdot))); return true; } case R.id.action_share_pdf: { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { shu.createPdf(webView, "dandelion-" + ShareUtil.SDF_SHORT.format(new Date())); } return true; } case R.id.action_share_link_to_clipboard: { shu.setClipboard(webView.getUrl()); Toast.makeText(getContext(), R.string.link_adress_copied, Toast.LENGTH_SHORT).show(); return true; } case R.id.action_create_launcher_shortcut: { if (webView.getUrl() != null) { Intent intent = new Intent(getContext(), MainActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(webView.getUrl())); shu.createLauncherDesktopShortcut(intent, R.drawable.ic_launcher, webView.getTitle()); } return true; } case R.id.action_take_screenshot: { if (permc.doIfExtStoragePermissionGranted(getString(R.string.screenshot_permission__appspecific))) { File fileSaveDirectory = appSettings.getAppSaveDirectory(); if (permc.mkdirIfStoragePermissionGranted(fileSaveDirectory)) { Bitmap bmp = ShareUtil.getBitmapFromWebView(webView); String filename = "dandelion-" + ShareUtil.SDF_SHORT.format(new Date()) + ".jpg"; _cu.writeImageToFileJpeg(new File(fileSaveDirectory, filename), bmp); Snackbar.make(webView, getString(R.string.saving_screenshot_as) + " " + filename, Snackbar.LENGTH_LONG).show(); } } return true; } case R.id.action_share_screenshot: { if (permc.doIfExtStoragePermissionGranted(getString(R.string.screenshot_permission__appspecific))) { shu.shareImage(ShareUtil.getBitmapFromWebView(webView), Bitmap.CompressFormat.JPEG); } return true; } } return super.onOptionsItemSelected(item); }
From source file:com.jaredrummler.materialspinner.MaterialSpinner.java
private void animateArrow(boolean shouldRotateUp) { int start = shouldRotateUp ? 0 : 10000; int end = shouldRotateUp ? 10000 : 0; ObjectAnimator animator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end); animator.setInterpolator(new LinearOutSlowInInterpolator()); animator.start(); }
From source file:com.awt.supark.LayoutHandler.java
public void appBackgroundColorChange(View view, int time, int r, int g, int b) { ColorDrawable wBack = (ColorDrawable) view.getBackground(); int color = wBack.getColor(); int r1 = Color.red(color); int g1 = Color.green(color); int b1 = Color.blue(color); ObjectAnimator colorFade = ObjectAnimator.ofObject(view, "backgroundColor", new ArgbEvaluator(), Color.argb(255, r1, g1, b1), Color.argb(255, r, g, b)); colorFade.setDuration(time);//w ww .j a va2 s. c o m colorFade.start(); }
From source file:com.cyanogenmod.eleven.ui.activities.HomeActivity.java
private void updateStatusBarColor(int color) { final Window window = getWindow(); ObjectAnimator animator = ObjectAnimator.ofInt(window, "statusBarColor", window.getStatusBarColor(), color); animator.setEvaluator(new ArgbEvaluator()); animator.setDuration(300);//from w w w . j a va 2s . c o m animator.start(); }
From source file:com.github.jokar.rxupload.widget.ProgressDownloadView.java
public void setPercentage(float newProgress) { if (newProgress < 0 || newProgress > 100) { throw new IllegalArgumentException("setPercentage not between 0 and 100"); }/*from w w w .j a va 2 s .c om*/ mState = State.STATE_WORKING; mTarget = newProgress; ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2)); anim.start(); }
From source file:com.microntek.music.MusicActivity.java
private void updateStatusBarColor(int color) { if (color == Color.TRANSPARENT) { color = getResources().getColor(R.color.primary_dark); }// www .ja v a2 s . com final Window window = getWindow(); ObjectAnimator animator = ObjectAnimator.ofInt(window, "statusBarColor", window.getStatusBarColor(), color); animator.setEvaluator(new ArgbEvaluator()); animator.setDuration(300); animator.start(); }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void moveFABToOriginalLocation() { ObjectAnimator fabAnimator = getFABAnimator(); setupAnimationParams(fabAnimator);/*from w w w. jav a 2s . c om*/ fabAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); swapViews(); } }); fabAnimator.start(); }
From source file:com.bar.foldinglayout.sample.FoldingLayoutActivity.java
/** * Animates the folding view inwards (to a completely folded state) from its * current state and then back out to its original state. *//*ww w. j a v a2 s .c om*/ public void animateFold() { float foldFactor = mFoldLayout.getFoldFactor(); ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldLayout, "foldFactor", foldFactor, 1); animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(1); animator.setDuration(FOLD_ANIMATION_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); }