コード例 #1
0
    public MaterialRippleLayout create() {
      MaterialRippleLayout layout = new MaterialRippleLayout(context);
      layout.setRippleColor(rippleColor);
      layout.setDefaultRippleAlpha((int) rippleAlpha);
      layout.setRippleDelayClick(rippleDelayClick);
      layout.setRippleDiameter((int) dpToPx(context.getResources(), rippleDiameter));
      layout.setRippleDuration(rippleDuration);
      layout.setRippleFadeDuration(rippleFadeDuration);
      layout.setRippleHover(rippleHover);
      layout.setRipplePersistent(ripplePersistent);
      layout.setRippleOverlay(rippleOverlay);
      layout.setRippleBackground(rippleBackground);
      layout.setRippleInAdapter(rippleSearchAdapter);
      layout.setRippleRoundedCorners((int) dpToPx(context.getResources(), rippleRoundedCorner));

      ViewGroup.LayoutParams params = child.getLayoutParams();
      ViewGroup parent = (ViewGroup) child.getParent();
      int index = 0;

      if (parent != null && parent instanceof MaterialRippleLayout) {
        throw new IllegalStateException(
            "MaterialRippleLayout could not be created: parent of the view already is  MaterialRippleLayout");
      }

      if (parent != null) {
        index = parent.indexOfChild(child);
        parent.removeView(child);
      }

      layout.addView(child, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

      if (parent != null) {
        parent.addView(layout, index, params);
      }

      return layout;
    }
コード例 #2
0
 @Override
 public void set(MaterialRippleLayout object, Integer value) {
   object.setRippleAlpha(value);
 }
コード例 #3
0
 @Override
 public void set(MaterialRippleLayout object, Float value) {
   object.setRadius(value);
 }
コード例 #4
0
 @Override
 public Integer get(MaterialRippleLayout object) {
   return object.getRippleAlpha();
 }
コード例 #5
0
 @Override
 public Float get(MaterialRippleLayout object) {
   return object.getRadius();
 }