congrats Icon
New! Announcing our next generation AI code completions
Read here
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

    • Making http requests using okhttp
    • scheduleAtFixedRate (ScheduledExecutorService)
    • notifyDataSetChanged (ArrayAdapter)
    • getSupportFragmentManager (FragmentActivity)
    • Window (java.awt)
      A Window object is a top-level window with no borders and no menubar. The default layout for a windo
    • KeyStore (java.security)
      KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
    • SQLException (java.sql)
      An exception that indicates a failed JDBC operation. It provides the following information about pro
    • Stream (java.util.stream)
      A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
    • Modifier (javassist)
      The Modifier class provides static methods and constants to decode class and member access modifiers
    • HttpServletRequest (javax.servlet.http)
      Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
    • 21 Best IntelliJ Plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

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