congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
MathUtils.clamp
Code IndexAdd Tabnine to your IDE (free)

How to use
clamp
method
in
android.support.v4.math.MathUtils

Best Java code snippets using android.support.v4.math.MathUtils.clamp (Showing top 6 results out of 315)

origin: skimarxall/AnchorSheetBehavior

@Override
public int clampViewPositionVertical(View child, int top, int dy) {
  return MathUtils.clamp(top, mMinOffset, mHideable ? mParentHeight : mMaxOffset);
}
origin: laenger/ViewPagerBottomSheet

@Override
public int clampViewPositionVertical(View child, int top, int dy) {
  return MathUtils.clamp(top, mMinOffset, mHideable ? mParentHeight : mMaxOffset);
}
origin: opacapp/multiline-collapsingtoolbar

/**
 * Set the value indicating the current scroll value. This decides how much of the
 * background will be displayed, as well as the title metrics/positioning.
 *
 * A value of {@code 0.0} indicates that the layout is fully expanded.
 * A value of {@code 1.0} indicates that the layout is fully collapsed.
 */
void setExpansionFraction(float fraction) {
  fraction = MathUtils.clamp(fraction, 0f, 1f);
  if (fraction != mExpandedFraction) {
    mExpandedFraction = fraction;
    calculateCurrentOffsets();
  }
}
origin: SouthernBox/NestedCalendar

int calendarOffset = MathUtils.clamp(
    getTopAndBottomOffset() - dy, calendarMinOffset, 0);
setTopAndBottomOffset(calendarOffset);
if (behavior instanceof CalendarScrollBehavior) {
  final CalendarScrollBehavior listBehavior = (CalendarScrollBehavior) behavior;
  int listOffset = MathUtils.clamp(
      listBehavior.getTopAndBottomOffset() - dy, -listMaxOffset, 0);
  listBehavior.setTopAndBottomOffset(listOffset);
origin: DarkionAvey/SwipeSpinnerWidget

  @Override
  public void run() {
    float translation = (isVertical() ? mRecyclerView.getTranslationY() : mRecyclerView.getTranslationX());
    float fraction = MathUtils.clamp(Math.abs((translation / getDragThreshold())), 0f, 1f);
    int scroll = (int) (0f - translation * Math.pow(fraction, SCROLL_EXPONENT));
    if (Math.abs(scroll) > 0 && (isVertical() && mRecyclerView.canScrollVertically(scroll) || !isVertical() && mRecyclerView.canScrollHorizontally(scroll))) {
      if (mScrollCallbacks != null)
        mScrollCallbacks.onScrolled((translation > 0 ? 1f : -1) * fraction);
      mRecyclerView.scrollBy(isVertical() ? 0 : scroll, isVertical() ? scroll : 0);
    }
    mRecyclerView.post(mScrollByRunnable);
  }
};
origin: opacapp/multiline-collapsingtoolbar

offsetHelper.setTopAndBottomOffset(MathUtils.clamp(
    -verticalOffset, 0, getMaxOffsetForPinChild(child)));
break;
android.support.v4.mathMathUtilsclamp

Popular methods of MathUtils

    Popular in Java

    • Reactive rest calls using spring rest template
    • getSupportFragmentManager (FragmentActivity)
    • setScale (BigDecimal)
    • compareTo (BigDecimal)
    • URLEncoder (java.net)
      This class is used to encode a string using the format required by application/x-www-form-urlencoded
    • SecureRandom (java.security)
      This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
    • Format (java.text)
      The base class for all formats. This is an abstract base class which specifies the protocol for clas
    • JarFile (java.util.jar)
      JarFile is used to read jar entries and their associated data from jar files.
    • JButton (javax.swing)
    • JTextField (javax.swing)
    • Best IntelliJ plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now