积累工具类
Posted yangms
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了积累工具类相关的知识,希望对你有一定的参考价值。
DialogUtils
public class DialogUtils { public interface OnOkOrCancelClickListener{ void clickLeftCancelButton(); void clickRightOKButton(); } public static void createDialogForPortrait(Context context, String content, final OnOkOrCancelClickListener onOkOrCancelClickListener) { final NormalDialog dialog = new NormalDialog(context); dialog.isTitleShow(false)// .bgColor(Color.parseColor("#383838"))// .cornerRadius(5)// .content(content)// .contentGravity(Gravity.CENTER)// .contentTextColor(Color.parseColor("#ffffff"))// .dividerColor(Color.parseColor("#222222"))// .btnTextSize(15.5f, 15.5f)// .btnTextColor(Color.parseColor("#ffffff"), Color.parseColor("#ffffff"))// .btnPressColor(Color.parseColor("#2B2B2B"))// .widthScale(0.8f)// .autoDismiss(false) .show(); dialog.setCanceledOnTouchOutside(false);//点击屏幕外是否小时dialog,true消失,false不消失 dialog.setOnBtnClickL( new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickLeftCancelButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }, new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickRightOKButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }); } public static void createDialogForPortrait(Context context,String[] btnTexts, String content, final OnOkOrCancelClickListener onOkOrCancelClickListener) { //如果需要显示 final NormalDialog dialog = new NormalDialog(context); dialog.isTitleShow(false)// .bgColor(Color.parseColor("#383838"))// .cornerRadius(5)// .content(content)// .contentGravity(Gravity.CENTER)// .contentTextColor(Color.parseColor("#ffffff"))// .dividerColor(Color.parseColor("#222222"))// .btnTextSize(15.5f, 15.5f)// .btnTextColor(Color.parseColor("#ffffff"), Color.parseColor("#ffffff"))// .btnPressColor(Color.parseColor("#2B2B2B"))// .widthScale(0.80f)// .btnText(btnTexts) .autoDismiss(false) .show(); dialog.setCanceledOnTouchOutside(false); dialog.setOnBtnClickL( new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickLeftCancelButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }, new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickRightOKButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }); } }
需要添加依赖:
implementation ‘com.flyco.dialog:FlycoDialog_Lib:[email protected]‘
详细内容可以查看这个开源框架,gitHub地址为:https://github.com/H07000223/FlycoDialog_Master
以上是关于积累工具类的主要内容,如果未能解决你的问题,请参考以下文章
elasticsearch代码片段,及工具类SearchEsUtil.java