@Override public MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { final LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); return new MyViewHolder( MaterialRippleLayout.on(inflater.inflate(R.layout.demo_recycler_item, viewGroup, false)) .rippleOverlay(true) .rippleAlpha(0.2f) .rippleColor(0xFF585858) .rippleHover(true) .create()); }
/** @Description: 弹框选择图片来源 */ @SuppressLint("InflateParams") private void showAlbumDialog() { albumDialog = new AlertDialog.Builder(this).create(); albumDialog.setCanceledOnTouchOutside(true); View v = LayoutInflater.from(this).inflate(R.layout.dialog_select_picture, null); albumDialog.show(); albumDialog.setContentView(v); albumDialog.getWindow().setGravity(Gravity.CENTER); TextView albumPic = (TextView) v.findViewById(R.id.album_pic); TextView cameraPic = (TextView) v.findViewById(R.id.camera_pic); // 动态特效 MaterialRippleLayout.on(albumPic) .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_DARK)) .rippleAlpha(CommonConstant.RIPPLE_ALPHA) .rippleHover(true) .create(); MaterialRippleLayout.on(cameraPic) .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_DARK)) .rippleAlpha(CommonConstant.RIPPLE_ALPHA) .rippleHover(true) .create(); albumPic.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { albumDialog.dismiss(); getPicFromAlbum(); } }); cameraPic.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { albumDialog.dismiss(); getPicFromCamera(); } }); }
/** @Description: 瓷砖特效 */ private void initMaterialRipple() { alimonyET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); // 设置验证信息 alimonyET.addValidator( new METValidator("请输入整数~") { @Override public boolean isValid(@NonNull CharSequence text, boolean isEmpty) { String number = text.toString(); if ("".equals(number) || VerifyUtils.isDigit(number)) { return true; } return false; } }); // 动态特效 MaterialRippleLayout.on(commitBtn) .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_DARK)) .rippleAlpha(CommonConstant.RIPPLE_ALPHA) .rippleHover(true) .create(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_two_player); for (int i = 0; i < 9; i++) { if (i == 0) { ar_imageView[0] = (ImageView) findViewById(R.id.imageView); } else { String id = "imageView" + (i + 1); ar_imageView[i] = (ImageView) findViewById(getResources().getIdentifier(id, "id", getPackageName())); } } result = (TextView) findViewById(R.id.result); engine = new Engine(); Button button2 = (Button) findViewById(R.id.bt_new_game2); MaterialRippleLayout.on(button2) .rippleColor(Color.GRAY) .rippleHover(true) .rippleOverlay(true) .rippleAlpha(0.2f) .create(); }
/** @Description: 瓷砖特效 */ private void initMaterialRipple() { // 设置Spinner的Adapter String[] types = getResources().getStringArray(R.array.second_hand_type); List<String> typeList = Arrays.asList(types); MyArrayAdapter typeAdapter = new MyArrayAdapter(this, typeList); typeSp.setAdapter(typeAdapter); String[] bargains = getResources().getStringArray(R.array.second_hand_bargain); List<String> bargainList = Arrays.asList(bargains); MyArrayAdapter bargainAdapter = new MyArrayAdapter(this, bargainList); bargainSp.setAdapter(bargainAdapter); // 设置Padding titleET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); typeSp.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); priceET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); describeET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); bargainSp.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); qqET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); phoneET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0); // 设置验证信息 priceET.addValidator( new METValidator("只能输入整数~") { @Override public boolean isValid(@NonNull CharSequence text, boolean isEmpty) { String number = text.toString(); if ("".equals(number) || VerifyUtils.isDigit(number)) { return true; } return false; } }); qqET.addValidator( new METValidator("请输入正确的QQ格式~") { @Override public boolean isValid(@NonNull CharSequence text, boolean isEmpty) { String number = text.toString(); if ("".equals(number) || VerifyUtils.isDigit(number)) { return true; } return false; } }); phoneET.addValidator( new METValidator("请输入正确的联系号码格式~") { @Override public boolean isValid(@NonNull CharSequence text, boolean isEmpty) { String number = text.toString(); if ("".equals(number) || VerifyUtils.checkPhone(number)) { return true; } return false; } }); // 动态特效 MaterialRippleLayout.on(itemTitleRL) .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_LITHT)) .rippleAlpha(CommonConstant.RIPPLE_ALPHA) .rippleHover(true) .create(); MaterialRippleLayout.on(contactTitleRL) .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_LITHT)) .rippleAlpha(CommonConstant.RIPPLE_ALPHA) .rippleHover(true) .create(); }