androidx.interpolator.view.animation.FastOutSlowInInterpolator Java Examples
The following examples show how to use
androidx.interpolator.view.animation.FastOutSlowInInterpolator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuickAttachmentDrawer.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
private void slideTo(int slideOffset, boolean forceInstant) { if (animator != null) { animator.cancel(); animator = null; } if (!forceInstant) { animator = ObjectAnimator.ofInt(this, "slideOffset", this.slideOffset, slideOffset); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(400); animator.start(); ViewCompat.postInvalidateOnAnimation(this); } else { this.slideOffset = slideOffset; requestLayout(); invalidate(); } }
Example #2
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 6 votes |
public void showSideNavigationPrompt(View view) { final MaterialTapTargetPrompt.Builder tapTargetPromptBuilder = new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.menu_prompt_title) .setSecondaryText(R.string.menu_prompt_description) .setContentDescription(R.string.menu_prompt_content_description) .setFocalPadding(R.dimen.dp40) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .setIcon(R.drawable.ic_menu); final Toolbar tb = this.findViewById(R.id.toolbar); tapTargetPromptBuilder.setTarget(tb.getChildAt(1)); tapTargetPromptBuilder.setPromptStateChangeListener((prompt, state) -> { if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED) { //Do something such as storing a value so that this prompt is never shown again } }); tapTargetPromptBuilder.show(); }
Example #3
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 6 votes |
public void showOverflowPrompt(View view) { final MaterialTapTargetPrompt.Builder tapTargetPromptBuilder = new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.overflow_prompt_title) .setSecondaryText(R.string.overflow_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .setIcon(R.drawable.ic_more_vert); final Toolbar tb = this.findViewById(R.id.toolbar); final View child = tb.getChildAt(2); if (child instanceof ActionMenuView) { final ActionMenuView actionMenuView = ((ActionMenuView) child); tapTargetPromptBuilder.setTarget(actionMenuView.getChildAt(actionMenuView.getChildCount() - 1)); } else { Toast.makeText(this, R.string.overflow_unavailable, Toast.LENGTH_SHORT).show(); } tapTargetPromptBuilder.show(); }
Example #4
Source File: MaterialAboutActivity.java From material-about-library with Apache License 2.0 | 6 votes |
private void onTaskFinished(@Nullable MaterialAboutList materialAboutList) { if (materialAboutList != null) { list = materialAboutList; adapter.setData(list.getCards()); if (shouldAnimate()) { recyclerView.animate() .alpha(1f) .translationY(0f) .setDuration(600) .setInterpolator(new FastOutSlowInInterpolator()).start(); } else { recyclerView.setAlpha(1f); recyclerView.setTranslationY(0f); } } else { finish();//?? why we remain here anyway? } }
Example #5
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 6 votes |
public void showFabPromptFor(View view) { new MaterialTapTargetPrompt.Builder(MainActivity.this) .setTarget(findViewById(R.id.fab)) .setFocalPadding(R.dimen.dp40) .setPrimaryText("showFor(7000)") .setSecondaryText("This prompt will show for 7 seconds") .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setPromptStateChangeListener((prompt, state) -> { if (state == MaterialTapTargetPrompt.STATE_SHOW_FOR_TIMEOUT) { Toast.makeText(MainActivity.this, "Prompt timedout after 7 seconds", Toast.LENGTH_SHORT) .show(); } }) .showFor(7000); }
Example #6
Source File: BottomSheetDialogFragmentExample.java From MaterialTapTargetPrompt with Apache License 2.0 | 6 votes |
@NotNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Dialog dialog = super.onCreateDialog(savedInstanceState); View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sheet, null); dialog.setContentView(contentView); dialog.setOnShowListener(dialog1 -> new MaterialTapTargetPrompt.Builder(new DialogResourceFinder(getDialog()), 0) .setPrimaryText(R.string.search_prompt_title) .setSecondaryText(R.string.search_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .setIcon(R.drawable.ic_search) .setTarget(R.id.bs_search) .show()); return dialog; }
Example #7
Source File: DialogStyleActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 6 votes |
public void showSideNavigationPrompt(View view) { final MaterialTapTargetPrompt.Builder tapTargetPromptBuilder = new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.menu_prompt_title) .setSecondaryText(R.string.menu_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .setIcon(R.drawable.ic_back) .setClipToView(findViewById(R.id.dialog_view)); final Toolbar tb = this.findViewById(R.id.toolbar); tapTargetPromptBuilder.setTarget(tb.getChildAt(1)); tapTargetPromptBuilder.setPromptStateChangeListener((prompt, state) -> { if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED) { //Do something such as storing a value so that this prompt is never shown again } }); tapTargetPromptBuilder.show(); }
Example #8
Source File: DialogStyleActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 6 votes |
public void showOverflowPrompt(View view) { final MaterialTapTargetPrompt.Builder tapTargetPromptBuilder = new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.overflow_prompt_title) .setSecondaryText(R.string.overflow_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.max_prompt_width) .setIcon(R.drawable.ic_more_vert) .setClipToView(findViewById(R.id.dialog_view)); final Toolbar tb = this.findViewById(R.id.toolbar); final View child = tb.getChildAt(2); if (child instanceof ActionMenuView) { final ActionMenuView actionMenuView = ((ActionMenuView) child); tapTargetPromptBuilder.setTarget(actionMenuView.getChildAt(actionMenuView.getChildCount() - 1)); } else { Toast.makeText(this, R.string.overflow_unavailable, Toast.LENGTH_SHORT).show(); } tapTargetPromptBuilder.show(); }
Example #9
Source File: AnimationUtils.java From adamant-android with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static void startCircularRevealExitAnimation(Context context, final View view, RevealAnimationSetting revealSettings, int startColor, int endColor, final AnimationFinishedListener listener) { if (isAnimationEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int cx = revealSettings.getCenterX(); int cy = revealSettings.getCenterY(); int width = revealSettings.getWidth(); int height = revealSettings.getHeight(); float initRadius = (float) Math.sqrt(width * width + height * height); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initRadius, 0); anim.setDuration(getMediumDuration(context)); anim.setInterpolator(new FastOutSlowInInterpolator()); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { //Important: This will prevent the view's flashing (visible between the finished animation and the Fragment remove) view.setVisibility(View.GONE); listener.onAnimationFinished(); } }); anim.start(); startBackgroundColorAnimation(view, startColor, endColor, getMediumDuration(context)); } else { listener.onAnimationFinished(); } }
Example #10
Source File: StaticObjectDotView.java From mlkit-material-android with Apache License 2.0 | 6 votes |
public void playAnimationWithSelectedState(boolean selected) { ValueAnimator radiusOffsetAnimator; if (selected) { radiusOffsetAnimator = ValueAnimator.ofFloat(0f, radiusOffsetRange) .setDuration(DOT_SELECTION_ANIMATOR_DURATION_MS); radiusOffsetAnimator.setStartDelay(DOT_DESELECTION_ANIMATOR_DURATION_MS); } else { radiusOffsetAnimator = ValueAnimator.ofFloat(radiusOffsetRange, 0f) .setDuration(DOT_DESELECTION_ANIMATOR_DURATION_MS); } radiusOffsetAnimator.setInterpolator(new FastOutSlowInInterpolator()); radiusOffsetAnimator.addUpdateListener( animation -> { currentRadiusOffset = (float) animation.getAnimatedValue(); invalidate(); }); radiusOffsetAnimator.start(); }
Example #11
Source File: SearchToolbarActivity.java From Carbon with Apache License 2.0 | 6 votes |
private void closeSearch() { int[] setLocation = new int[2]; searchBar.getLocationOnScreen(setLocation); int[] sbLocation = new int[2]; searchButton.getLocationOnScreen(sbLocation); Animator animator = searchBar.createCircularReveal(sbLocation[0] - setLocation[0] + closeButton.getWidth() / 2, searchBar.getHeight() / 2, searchBar.getWidth(), 0); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { searchBar.setVisibility(View.INVISIBLE); } }); animator.start(); searchEditText.clearFocus(); }
Example #12
Source File: ElasticDragDismissDelegate.java From ElasticDragDismissLayout with Apache License 2.0 | 6 votes |
public void onStopNestedScroll(View child) { // if the drag is too fast it probably was not an intentional drag but a fling, don't dismiss final long dragTime = System.currentTimeMillis() - scrollStartTimestamp; if (Math.abs(totalDrag) >= dragDismissDistance && dragTime > DRAG_DURATION_BUFFER) { dispatchDismissCallback(); } else { // settle back to natural position ViewPropertyAnimator animator = mViewGroup.animate() .translationY(0f) .scaleY(1f) .setDuration(200L) .setInterpolator(new FastOutSlowInInterpolator()) .setListener(null); if (enableScaleX) { animator.scaleX(1f); } animator.start(); totalDrag = 0; draggingDown = draggingUp = false; dispatchDragCallback(0f, 0f, 0f, 0f); } }
Example #13
Source File: MotionSpecTest.java From material-components-android with Apache License 2.0 | 6 votes |
@Test public void validateSetOfObjectAnimatorTranslationMotionTiming() { MotionSpec spec = MotionSpec.createFromResource( activityTestRule.getActivity(), R.animator.valid_set_of_object_animator_motion_spec); MotionTiming translation = spec.getTiming("translation"); assertEquals(11, translation.getDelay()); assertEquals(13, translation.getDuration()); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { assertThat(translation.getInterpolator(), instanceOf(PathInterpolator.class)); } else { assertThat(translation.getInterpolator(), instanceOf(FastOutSlowInInterpolator.class)); } assertEquals(17, translation.getRepeatCount()); assertEquals(ValueAnimator.REVERSE, translation.getRepeatMode()); }
Example #14
Source File: SupportDialogFragmentExample.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
private void showFragmentFabPrompt() { new MaterialTapTargetPrompt.Builder((Fragment) this) .setTarget(R.id.fab) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setPrimaryText("Clipped to dialog bounds") .setSecondaryText("The prompt does not draw outside the dialog") .show(); }
Example #15
Source File: SupportDialogFragmentExample.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
private void showViewPagerTab() { new MaterialTapTargetPrompt.Builder((Fragment) this) .setTarget(this.viewPager.getChildAt(0)) .setPromptFocal(new RectanglePromptFocal()) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setPrimaryText("View Pager Tab") .setSecondaryText("Change tab") .setFocalRadius(R.dimen.dp60) .show(); }
Example #16
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showFabPrompt(View view) { if (mFabPrompt != null) { return; } SpannableStringBuilder secondaryText = new SpannableStringBuilder("Tap the envelope to start composing your first email"); secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(this, R.color.colorAccent)), 8, 15, Spanned.SPAN_INCLUSIVE_INCLUSIVE); SpannableStringBuilder primaryText = new SpannableStringBuilder("Send your first email"); primaryText.setSpan(new BackgroundColorSpan(ContextCompat.getColor(this, R.color.colorAccent)), 0, 4, Spanned.SPAN_INCLUSIVE_INCLUSIVE); mFabPrompt = new MaterialTapTargetPrompt.Builder(MainActivity.this) .setTarget(findViewById(R.id.fab)) .setFocalPadding(R.dimen.dp40) .setPrimaryText(primaryText) .setSecondaryText(secondaryText) .setBackButtonDismissEnabled(true) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setPromptStateChangeListener((prompt, state) -> { if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED || state == MaterialTapTargetPrompt.STATE_NON_FOCAL_PRESSED) { mFabPrompt = null; //Do something such as storing a value so that this prompt is never shown again } }) .create(); if (mFabPrompt != null) { mFabPrompt.show(); } }
Example #17
Source File: MainActivity.java From WanAndroid with Apache License 2.0 | 5 votes |
/** * 底部导航栏显示 */ private void show(View child) { if(mShowNavAnimator == null){ mShowNavAnimator = ObjectAnimator.ofFloat(child, "translationY", child.getHeight(), 0) .setDuration(200); mShowNavAnimator.setInterpolator(new FastOutSlowInInterpolator()); } if(!mShowNavAnimator.isRunning() && child.getTranslationY() >= child.getHeight()){ mShowNavAnimator.start(); } }
Example #18
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showNavPrompt(View view) { new MaterialTapTargetPrompt.Builder(this) .setTarget(R.id.navfab) .setPrimaryText(R.string.example_fab_title) .setSecondaryText(R.string.example_fab_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .show(); }
Example #19
Source File: AnimatingToggle.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
public AnimatingToggle(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.outAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.animation_toggle_out); this.inAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.animation_toggle_in); this.outAnimation.setInterpolator(new FastOutSlowInInterpolator()); this.inAnimation.setInterpolator(new FastOutSlowInInterpolator()); }
Example #20
Source File: DynamicPageIndicator2.java From dynamic-support with Apache License 2.0 | 5 votes |
public DynamicPageIndicator2(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final int density = (int) context.getResources().getDisplayMetrics().density; // Load attributes final TypedArray a = getContext().obtainStyledAttributes( attrs, R.styleable.DynamicPageIndicator2, defStyle, 0); dotDiameter = a.getDimensionPixelSize(R.styleable.DynamicPageIndicator2_ads_dotDiameter, DEFAULT_DOT_SIZE * density); dotRadius = dotDiameter / 2; halfDotRadius = dotRadius / 2; gap = a.getDimensionPixelSize(R.styleable.DynamicPageIndicator2_ads_dotGap, DEFAULT_GAP * density); animDuration = (long) a.getInteger(R.styleable.DynamicPageIndicator2_ads_animationDuration, DEFAULT_ANIM_DURATION); animHalfDuration = animDuration / 2; unselectedColour = a.getColor( R.styleable.DynamicPageIndicator2_ads_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR); selectedColour = a.getColor( R.styleable.DynamicPageIndicator2_ads_currentPageIndicatorColor, DEFAULT_SELECTED_COLOUR); a.recycle(); unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG); unselectedPaint.setColor(unselectedColour); selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG); selectedPaint.setColor(selectedColour); interpolator = new FastOutSlowInInterpolator(); // create paths & rect now – reuse & rewind later combinedUnselectedPath = new Path(); unselectedDotPath = new Path(); unselectedDotLeftPath = new Path(); unselectedDotRightPath = new Path(); rectF = new RectF(); addOnAttachStateChangeListener(this); }
Example #21
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showSearchPrompt(View view) { new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.search_prompt_title) .setSecondaryText(R.string.search_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .setIcon(R.drawable.ic_search) .setTarget(R.id.action_search) .show(); }
Example #22
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showActionModePrompt(View view) { mActionMode = this.startSupportActionMode(mActionModeCallback); new MaterialTapTargetPrompt.Builder(MainActivity.this) .setPrimaryText(R.string.action_mode_prompt_title) .setSecondaryText(R.string.action_mode_prompt_description) .setFocalPadding(R.dimen.dp40) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width) .setTarget(findViewById(R.id.action_mode_close_button)) .setIcon(R.drawable.ic_back) .show(); }
Example #23
Source File: MainActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showNoAutoDismiss(View view) { if (mFabPrompt != null) { return; } mFabPrompt = new MaterialTapTargetPrompt.Builder(MainActivity.this) .setTarget(findViewById(R.id.fab)) .setPrimaryText("No Auto Dismiss") .setSecondaryText("This prompt will only be removed after tapping the envelop") .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setAutoDismiss(false) .setAutoFinish(false) .setCaptureTouchEventOutsidePrompt(true) .setPromptStateChangeListener((prompt, state) -> { if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED) { prompt.finish(); mFabPrompt = null; } else if (state == MaterialTapTargetPrompt.STATE_NON_FOCAL_PRESSED) { mFabPrompt = null; } }) .show(); }
Example #24
Source File: DialogStyleActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showFabPrompt(View view) { new MaterialTapTargetPrompt.Builder(this) .setTarget(R.id.fab) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setPrimaryText("Clipped to activity bounds") .setSecondaryText("The prompt does not draw outside the activity") .setClipToView(findViewById(R.id.dialog_view)) .show(); }
Example #25
Source File: DialogStyleActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showSearchPrompt(View view) { new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.search_prompt_title) .setSecondaryText(R.string.search_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.max_prompt_width) .setIcon(R.drawable.ic_search) .setTarget(R.id.action_search) .setClipToView(findViewById(R.id.dialog_view)) .show(); }
Example #26
Source File: ViewPagerSupportFragment.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
private void showPrompt() { new MaterialTapTargetPrompt.Builder(dialogFragment) .setTarget(R.id.button) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setPrimaryText("Clipped to dialog bounds") .setSecondaryText("The prompt does not draw outside the dialog") .setClipToView(null) .show(); }
Example #27
Source File: CentrePositionActivity.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
public void showPrompt(final View view) { new MaterialTapTargetPrompt.Builder(this) .setPrimaryText(R.string.fab_centre_title) .setSecondaryText(R.string.fab_centre_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.max_prompt_width) .setTarget(view) .show(); }
Example #28
Source File: ContainerTransformConfigurationHelper.java From material-components-android with Apache License 2.0 | 5 votes |
/** Set up interpolation */ private void setUpBottomSheetInterpolation(View view) { RadioGroup interpolationGroup = view.findViewById(R.id.interpolation_radio_group); ViewGroup customContainer = view.findViewById(R.id.custom_curve_container); if (interpolationGroup != null && customContainer != null) { setTextInputClearOnTextChanged(view.findViewById(R.id.x1_text_input_layout)); setTextInputClearOnTextChanged(view.findViewById(R.id.x2_text_input_layout)); setTextInputClearOnTextChanged(view.findViewById(R.id.y1_text_input_layout)); setTextInputClearOnTextChanged(view.findViewById(R.id.y2_text_input_layout)); // Check the correct current radio button and fill in custom bezier fields if applicable. if (interpolator instanceof FastOutSlowInInterpolator) { interpolationGroup.check(R.id.radio_fast_out_slow_in); } else { interpolationGroup.check(R.id.radio_custom); CustomCubicBezier currentInterp = (CustomCubicBezier) interpolator; setTextFloat(view.findViewById(R.id.x1_edit_text), currentInterp.controlX1); setTextFloat(view.findViewById(R.id.y1_edit_text), currentInterp.controlY1); setTextFloat(view.findViewById(R.id.x2_edit_text), currentInterp.controlX2); setTextFloat(view.findViewById(R.id.y2_edit_text), currentInterp.controlY2); } // Enable/disable custom bezier fields depending on initial checked radio button. setViewGroupDescendantsEnabled( customContainer, interpolationGroup.getCheckedRadioButtonId() == R.id.radio_custom); // Watch for any changes to the selected radio button and update custom bezier enabled state. // The custom bezier values will be captured when the configuration is applied. interpolationGroup.setOnCheckedChangeListener( (group, checkedId) -> setViewGroupDescendantsEnabled(customContainer, checkedId == R.id.radio_custom)); } }
Example #29
Source File: ContainerTransformConfigurationHelper.java From material-components-android with Apache License 2.0 | 5 votes |
/** Set up buttons to apply and validate configuration values and dismiss the bottom sheet */ private void setUpBottomSheetConfirmationButtons(View view, BottomSheetDialog dialog) { view.findViewById(R.id.apply_button) .setOnClickListener( v -> { // Capture and update interpolation RadioGroup interpolationGroup = view.findViewById(R.id.interpolation_radio_group); if (interpolationGroup != null && interpolationGroup.getCheckedRadioButtonId() == R.id.radio_custom) { Float x1 = getTextFloat(view.findViewById(R.id.x1_edit_text)); Float y1 = getTextFloat(view.findViewById(R.id.y1_edit_text)); Float x2 = getTextFloat(view.findViewById(R.id.x2_edit_text)); Float y2 = getTextFloat(view.findViewById(R.id.y2_edit_text)); if (areValidCubicBezierControls(view, x1, y1, x2, y2)) { interpolator = new CustomCubicBezier(x1, y1, x2, y2); dialog.dismiss(); } } else { interpolator = new FastOutSlowInInterpolator(); dialog.dismiss(); } }); view.findViewById(R.id.clear_button) .setOnClickListener( v -> { setUpDefaultValues(); dialog.dismiss(); }); }
Example #30
Source File: BottomNavigationMenuView.java From material-components-android with Apache License 2.0 | 5 votes |
public BottomNavigationMenuView(Context context, AttributeSet attrs) { super(context, attrs); final Resources res = getResources(); inactiveItemMaxWidth = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_max_width); inactiveItemMinWidth = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_item_min_width); activeItemMaxWidth = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_max_width); activeItemMinWidth = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_active_item_min_width); itemHeight = res.getDimensionPixelSize(R.dimen.design_bottom_navigation_height); itemTextColorDefault = createDefaultColorStateList(android.R.attr.textColorSecondary); set = new AutoTransition(); set.setOrdering(TransitionSet.ORDERING_TOGETHER); set.setDuration(ACTIVE_ANIMATION_DURATION_MS); set.setInterpolator(new FastOutSlowInInterpolator()); set.addTransition(new TextScale()); onClickListener = new OnClickListener() { @Override public void onClick(View v) { final BottomNavigationItemView itemView = (BottomNavigationItemView) v; MenuItem item = itemView.getItemData(); if (!menu.performItemAction(item, presenter, 0)) { item.setChecked(true); } } }; tempChildWidths = new int[BottomNavigationMenu.MAX_ITEM_COUNT]; ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); }