use of android.view.animation.OvershootInterpolator in project LeafPic by HoraApps.
the class AlertDialogsHelper method getProgressDialogWithErrors.
public static AlertDialog getProgressDialogWithErrors(ThemedActivity activity, @StringRes int title, ProgressAdapter adapter, int max) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity, activity.getDialogStyle());
View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_list_progress, null);
final int[] progress = { 0 };
TextView dialogTitle = dialogLayout.findViewById(R.id.text_dialog_title);
TextView progressMessage = dialogLayout.findViewById(R.id.name_folder);
((ProgressBar) dialogLayout.findViewById(org.horaapps.leafpic.R.id.progress_dialog_loading)).getIndeterminateDrawable().setColorFilter(activity.getPrimaryColor(), android.graphics.PorterDuff.Mode.SRC_ATOP);
adapter.setListener(item -> {
progress[0]++;
dialogTitle.setText(activity.getString(title, progress[0], max));
progressMessage.setText(item.getName());
});
RecyclerView rv = dialogLayout.findViewById(R.id.rv_progress);
rv.setLayoutManager(new LinearLayoutManager(activity));
rv.setHasFixedSize(true);
rv.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
rv.setAdapter(adapter);
((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.message_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
dialogTitle.setBackgroundColor(activity.getPrimaryColor());
dialogTitle.setText(activity.getString(title, progress[0], max));
builder.setView(dialogLayout);
return builder.create();
}
use of android.view.animation.OvershootInterpolator in project LeafPic by HoraApps.
the class BlackWhiteListActivity method initUi.
private void initUi() {
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter((adapter = new ItemsAdapter()));
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 1));
mRecyclerView.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(new OvershootInterpolator(1f))));
}
use of android.view.animation.OvershootInterpolator in project MaterialLibrary by DeveloperPaul123.
the class MaterialFloatingActionButtonMenu method init.
/**
* Initialize the view and fields.
* @param context the context of this view.
* @param attrs the attribute set of this view.
*/
private void init(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialFloatingActionButtonMenu);
circleColor = a.getColor(R.styleable.MaterialFloatingActionButtonMenu_mat_fab_menu_color, getColor(android.R.color.holo_blue_dark));
mShowAllChildren = a.getBoolean(R.styleable.MaterialFloatingActionButtonMenu_mat_fab_menu_showChildrenAlways, false);
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
buttonColor = getColor(android.R.color.holo_blue_dark);
circlePaint.setStyle(Paint.Style.FILL);
circlePaint.setColor(circleColor);
menuRadius = 1f;
circleShowAnimator = ObjectAnimator.ofFloat(this, "menuRadius", maxRadius);
circleCloseAnimator = ObjectAnimator.ofFloat(this, "menuRadius", 1.0f);
degreeOffsetAnimator = ObjectAnimator.ofFloat(this, "degreeOffset", 0.0f);
OvershootInterpolator interpolator = new OvershootInterpolator();
mExpandAnimation = new AnimatorSet().setDuration(150);
mExpandAnimation.setInterpolator(interpolator);
mExpandAnimation.addListener(expandMenuListener);
mCollapseAnimation = new AnimatorSet().setDuration(100);
mCollapseAnimation.addListener(collapseMenuListener);
showButtonsSet = new AnimatorSet().setDuration(100);
showButtonsSet.setInterpolator(interpolator);
showButtonsSet.addListener(showButtonsListener);
hideButtonsSet = new AnimatorSet().setDuration(50);
hideButtonsSet.addListener(hideButtonsListener);
setWillNotDraw(false);
setClickable(false);
setLongClickable(false);
createAddButton(context);
interceptDownEvents[0] = 0.0f;
interceptDownEvents[1] = 0.0f;
lastEventPoints[0] = 0.0f;
lastEventPoints[1] = 0.0f;
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mSlop = configuration.getScaledTouchSlop();
minFlingVel = configuration.getScaledMinimumFlingVelocity();
maxFlingVel = configuration.getScaledMaximumFlingVelocity();
startAngle = 225f;
collapseOnChildClick = true;
expands = new ArrayList<>();
collapses = new ArrayList<>();
DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
windowWidth = metrics.widthPixels;
windowHeight = metrics.heightPixels;
gestureDetector = new GestureDetector(getContext(), new GestureListener());
mScroller = new Scroller(context, new AccelerateDecelerateInterpolator(), true);
}
use of android.view.animation.OvershootInterpolator in project ViewAnimator by florent37.
the class ViewAnimatorMainActivity method animateParallel.
protected void animateParallel() {
final ViewAnimator viewAnimator = ViewAnimator.animate(mountain, image).dp().translationY(-1000, 0).alpha(0, 1).singleInterpolator(new OvershootInterpolator()).andAnimate(percent).scale(0, 1).andAnimate(text).textColor(Color.BLACK, Color.WHITE).backgroundColor(Color.WHITE, Color.BLACK).waitForHeight().singleInterpolator(new AccelerateDecelerateInterpolator()).duration(2000).thenAnimate(percent).custom(new AnimationListener.Update<TextView>() {
@Override
public void update(TextView view, float value) {
view.setText(String.format(Locale.US, "%.02f%%", value));
}
}, 0, 1).andAnimate(image).rotation(0, 360).duration(5000).start();
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
viewAnimator.cancel();
}
}, 3000);
}
use of android.view.animation.OvershootInterpolator in project android_packages_apps_crDroidSettings by crdroidandroid.
the class FloatingActionsMenu method createAddButton.
private void createAddButton(Context context) {
mAddButton = new AddFloatingActionButton(context) {
@Override
void updateBackground() {
mPlusColor = mAddButtonPlusColor;
mColorNormal = mAddButtonColorNormal;
mColorPressed = mAddButtonColorPressed;
mStrokeVisible = mAddButtonStrokeVisible;
super.updateBackground();
}
@Override
Drawable getIconDrawable() {
final RotatingDrawable rotatingDrawable = new RotatingDrawable(super.getIconDrawable());
mRotatingDrawable = rotatingDrawable;
final OvershootInterpolator interpolator = new OvershootInterpolator();
final ObjectAnimator collapseAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", EXPANDED_PLUS_ROTATION, COLLAPSED_PLUS_ROTATION);
final ObjectAnimator expandAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", COLLAPSED_PLUS_ROTATION, EXPANDED_PLUS_ROTATION);
collapseAnimator.setInterpolator(interpolator);
expandAnimator.setInterpolator(interpolator);
mExpandAnimation.play(expandAnimator);
mCollapseAnimation.play(collapseAnimator);
return rotatingDrawable;
}
};
mAddButton.setId(R.id.fab_expand_menu_button);
mAddButton.setSize(mAddButtonSize);
mAddButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
toggle();
}
});
addView(mAddButton, super.generateDefaultLayoutParams());
mButtonsCount++;
}
Aggregations