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

How to use
RxBannerUtil
in
cn.levey.bannerlib.base

Best Java code snippets using cn.levey.bannerlib.base.RxBannerUtil (Showing top 20 results out of 315)

origin: leveychen/RxBanner

public void setTitlePaddingDp(int titlePaddingDp) {
  this.titlePadding = RxBannerUtil.dp2px(titlePaddingDp);
}
origin: leveychen/RxBanner

public void setTitleSizeSp(int titleSizeSp) {
  this.titleSize = RxBannerUtil.sp2px(titleSizeSp);
}
origin: leveychen/RxBanner

protected void initInnerView(Context context, AttributeSet attrs) {
  TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RxBanner);
  config.setAspectRatio(typedArray.getFloat(R.styleable.RxBanner_rb_aspectRatio, config.getAspectRatio()));
  config.setCanSwipe(typedArray.getBoolean(R.styleable.RxBanner_rb_canSwipe, config.isCanSwipe()));
  config.setCanSwipeWhenSingle(typedArray.getBoolean(R.styleable.RxBanner_rb_canSwipeWhenSingle, config.isCanSwipeWhenSingle()));
  config.setOrientation(typedArray.getInt(R.styleable.RxBanner_rb_orientation, config.getOrientation()));
  config.setViewPaperMode(typedArray.getBoolean(R.styleable.RxBanner_rb_viewPaperMode, config.isViewPaperMode()));
  config.setInfinite(typedArray.getBoolean(R.styleable.RxBanner_rb_infinite, config.isInfinite()));
  config.setAutoPlay(typedArray.getBoolean(R.styleable.RxBanner_rb_autoPlay, config.isAutoPlay()));
  config.setItemPercent(typedArray.getInt(R.styleable.RxBanner_rb_itemPercent, config.getItemPercent()));
  config.setItemSpacePx(typedArray.getDimensionPixelSize(R.styleable.RxBanner_rb_itemSpace, config.getItemSpace()));
  config.setItemScale(typedArray.getFloat(R.styleable.RxBanner_rb_itemScale, config.getItemScale()));
  config.setItemMoveSpeed(typedArray.getFloat(R.styleable.RxBanner_rb_itemMoveSpeed, config.getItemMoveSpeed()));
  config.setFlingDamping(typedArray.getFloat(R.styleable.RxBanner_rb_flingDamping, config.getFlingDamping()));
  config.setEmptyViewText(typedArray.getString(R.styleable.RxBanner_rb_emptyViewText));
  config.setEmptyViewResource(typedArray.getResourceId(R.styleable.RxBanner_rb_emptyViewResource, config.getEmptyViewResource()));
  config.setTimeInterval(typedArray.getInt(R.styleable.RxBanner_rb_timeInterval, RxBannerGlobalConfig.getInstance().getTimeInterval()));
  config.setCenterAlpha(typedArray.getFloat(R.styleable.RxBanner_rb_centerAlpha, config.getCenterAlpha()));
  config.setSideAlpha(typedArray.getFloat(R.styleable.RxBanner_rb_sideAlpha, config.getSideAlpha()));
  config.setOrderType(RxBannerUtil.getOrder(typedArray.getInt(R.styleable.RxBanner_rb_orderType, RxBannerUtil.getOrderType(config.getOrderType()))));
  //init title config
  initTitleConfig(typedArray);
  //init indicator config
  initIndicatorConfig(typedArray, attrs);
  typedArray.recycle();
  initInnerView();
}
origin: leveychen/RxBanner

config.setSideAlpha(getValue(sideAlpha));
config.setTimeInterval((int) getValue(timeInterval));
config.setOrderType(RxBannerUtil.getOrder(optionalType.get(orderType.getId()) + 1));
config.setOrientation(optionalType.get(orientation.getId()));
config.setTitleColor(selectedColor);
origin: leveychen/RxBanner

private int getPercentSize() {
  int percentSize = RelativeLayout.LayoutParams.MATCH_PARENT;
  if (config.getOrientation() == LinearLayout.VERTICAL) {
    if (parentHeight == RelativeLayout.LayoutParams.MATCH_PARENT)
      return RelativeLayout.LayoutParams.MATCH_PARENT;
    percentSize = RxBannerUtil.getPercentSize(parentHeight, config.getItemPercent());
  } else if (config.getOrientation() == LinearLayout.HORIZONTAL) {
    if (parentWidth == RelativeLayout.LayoutParams.MATCH_PARENT)
      return RelativeLayout.LayoutParams.MATCH_PARENT;
    percentSize = RxBannerUtil.getPercentSize(parentWidth, config.getItemPercent());
  }
  return percentSize;
}
origin: leveychen/RxBanner

public void setTitleMarginBottomDp(int titleMarginBottomDp) {
  this.titleMarginBottom = RxBannerUtil.dp2px(titleMarginBottomDp);
}
origin: leveychen/RxBanner

  private void initColorAttribute(@NonNull TypedArray typedArray) {

    int unselectedColor = typedArray.getColor(R.styleable.RxBanner_rb_indicator_unselected_color, Color.parseColor(ColorAnimation.DEFAULT_UNSELECTED_COLOR));
    int selectedColor = typedArray.getColor(R.styleable.RxBanner_rb_indicator_selected_color, Color.parseColor(ColorAnimation.DEFAULT_SELECTED_COLOR));
    indicatorConfig.setUnselectedColor(unselectedColor);
    indicatorConfig.setSelectedColor(selectedColor);

    indicatorConfig.setTextSize(typedArray.getDimensionPixelSize(R.styleable.RxBanner_rb_indicator_textSize, RxBannerUtil.sp2px(14)));
    indicatorConfig.setTextColor(typedArray.getColor(R.styleable.RxBanner_rb_indicator_textColor, Color.WHITE));
//        indicatorConfig.setBackgroundColor(typedArray.getColor(R.styleable.RxBanner_rb_indicator_backgroundColor, RxBannerUtil.DEFAULT_BG_COLOR));
    indicatorConfig.setBackgroundColor(typedArray.getColor(R.styleable.RxBanner_rb_indicator_backgroundColor, RxBannerUtil.DEFAULT_BG_COLOR));
    indicatorConfig.setBackgroundResource(typedArray.getResourceId(R.styleable.RxBanner_rb_indicator_backgroundResource, Integer.MAX_VALUE));

  }

origin: leveychen/RxBanner

public void setTitleMarginStartDp(int titleMarginStartDp) {
  this.titleMarginStart = RxBannerUtil.dp2px(titleMarginStartDp);
}
origin: leveychen/RxBanner

public void setTitleWidthDp(int titleWidthDp) {
  this.titleWidth = titleWidthDp > 0 ? RxBannerUtil.dp2px(titleWidthDp) : titleWidthDp;
}
origin: leveychen/RxBanner

public void setTitleMarginTopDp(int titleMarginTopDp) {
  this.titleMarginTop = RxBannerUtil.dp2px(titleMarginTopDp);
}
origin: leveychen/RxBanner

public void setTitleMarginEndDp(int titleMarginEndDp) {
  this.titleMarginEnd = RxBannerUtil.dp2px(titleMarginEndDp);
}
origin: leveychen/RxBanner

public void setTitlePaddingBottomDp(int titlePaddingBottomDp) {
  this.titlePaddingBottom = RxBannerUtil.dp2px(titlePaddingBottomDp);
}
origin: leveychen/RxBanner

public void setTitlePaddingEndDp(int titlePaddingEndDp) {
  this.titlePaddingEnd = RxBannerUtil.dp2px(titlePaddingEndDp);
}
origin: leveychen/RxBanner

public void setItemSpaceDp(int itemSpaceDp) {
  this.itemSpace = RxBannerUtil.dp2px(itemSpaceDp);
}
origin: leveychen/RxBanner

public void setTitleMarginDp(int titleMarginDp) {
  this.titleMargin = RxBannerUtil.dp2px(titleMarginDp);
}
origin: leveychen/RxBanner

public void setTitlePaddingStartDp(int titlePaddingStartDp) {
  this.titlePaddingStart = RxBannerUtil.dp2px(titlePaddingStartDp);
}
origin: leveychen/RxBanner

public void setTitlePaddingTopDp(int titlePaddingTopDp) {
  this.titlePaddingTop = RxBannerUtil.dp2px(titlePaddingTopDp);
}
origin: leveychen/RxBanner

public void setTitleHeightDp(int titleHeightDp) {
  this.titleHeight = titleHeightDp > 0 ? RxBannerUtil.dp2px(titleHeightDp) : titleHeightDp;
}
origin: leveychen/RxBanner

/**
 * Set padding in dp between each circle indicator. Default value is {@link IndicatorConfig#DEFAULT_PADDING_DP}.
 *
 * @param paddingDp padding between circles in dp.
 */
public void setPadding(int paddingDp) {
  if (paddingDp < 0) {
    paddingDp = 0;
  }
  int paddingPx = RxBannerUtil.dp2px(paddingDp);
  manager.indicator().setPadding(paddingPx);
  invalidate();
}
origin: leveychen/RxBanner

private void initSizeAttribute(@NonNull TypedArray typedArray) {
  int orientationIndex = typedArray.getInt(R.styleable.RxBanner_rb_indicator_orientation, Orientation.HORIZONTAL.ordinal());
  Orientation orientation;
  if (orientationIndex == 0) {
    orientation = Orientation.HORIZONTAL;
  } else {
    orientation = Orientation.VERTICAL;
  }
  int radius = typedArray.getDimensionPixelSize(R.styleable.RxBanner_rb_indicator_radius, RxBannerUtil.dp2px(IndicatorConfig.DEFAULT_RADIUS_DP));
  if (radius < 0) {
    radius = 0;
  }
  float scaleFactor = typedArray.getFloat(R.styleable.RxBanner_rb_indicator_scale, ScaleAnimation.DEFAULT_SCALE_FACTOR);
  if (scaleFactor < ScaleAnimation.MIN_SCALE_FACTOR) {
    scaleFactor = ScaleAnimation.MIN_SCALE_FACTOR;
  } else if (scaleFactor > ScaleAnimation.MAX_SCALE_FACTOR) {
    scaleFactor = ScaleAnimation.MAX_SCALE_FACTOR;
  }
  int stroke = typedArray.getDimensionPixelSize(R.styleable.RxBanner_rb_indicator_stroke_width, RxBannerUtil.dp2px(FillAnimation.DEFAULT_STROKE_DP));
  if (stroke > radius) {
    stroke = radius;
  }
  if (indicatorConfig.getAnimationType() != AnimationType.FILL) {
    stroke = 0;
  }
  indicatorConfig.setRadius(radius);
  indicatorConfig.setOrientation(orientation);
  indicatorConfig.setScale(scaleFactor);
  indicatorConfig.setStroke(stroke);
}
cn.levey.bannerlib.baseRxBannerUtil

Javadoc

Created by Levey on 2018/4/9 10:57. e-mail: m@levey.cn

Most used methods

  • dp2px
  • getOrder
  • getOrderType
  • getPercentSize
  • sp2px

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Sublime Text 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