update 对话框,相册相机
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.shayu.onetoone.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -15,8 +17,11 @@ import com.yunbao.common.utils.StringUtil;
|
||||
public class TipsDialog extends AbsDialogCenterPopupWindow {
|
||||
private String title, content;
|
||||
private OnDialogClickListener onDialogClickListener;
|
||||
TextView mTitle,mContent;
|
||||
Button mCancel,mApply;
|
||||
TextView mTitle, mContent;
|
||||
Button mCancel, mApply;
|
||||
ViewGroup viewGroup;
|
||||
View contentView;
|
||||
String cancelText, applyText;
|
||||
|
||||
public TipsDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
@@ -32,6 +37,21 @@ public class TipsDialog extends AbsDialogCenterPopupWindow {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TipsDialog setContentView(View contentView) {
|
||||
this.contentView = contentView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TipsDialog setCancelText(String cancelText) {
|
||||
this.cancelText = cancelText;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TipsDialog setApplyText(String applyText) {
|
||||
this.applyText = applyText;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TipsDialog setOnDialogClickListener(OnDialogClickListener onDialogClickListener) {
|
||||
this.onDialogClickListener = onDialogClickListener;
|
||||
return this;
|
||||
@@ -50,29 +70,38 @@ public class TipsDialog extends AbsDialogCenterPopupWindow {
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
mTitle=findViewById(R.id.title);
|
||||
mContent=findViewById(R.id.content);
|
||||
mCancel=findViewById(R.id.cancel);
|
||||
mApply=findViewById(R.id.apply);
|
||||
mTitle = findViewById(R.id.title);
|
||||
mContent = findViewById(R.id.content);
|
||||
mCancel = findViewById(R.id.cancel);
|
||||
mApply = findViewById(R.id.apply);
|
||||
viewGroup = findViewById(R.id.content_layout);
|
||||
|
||||
if(StringUtil.isEmpty(title)){
|
||||
if (StringUtil.isEmpty(title)) {
|
||||
mTitle.setVisibility(GONE);
|
||||
}else{
|
||||
} else {
|
||||
mTitle.setText(title);
|
||||
}
|
||||
if(StringUtil.isEmpty(content)){
|
||||
if (StringUtil.isEmpty(content)) {
|
||||
mContent.setVisibility(GONE);
|
||||
}else{
|
||||
} else {
|
||||
mContent.setText(content);
|
||||
}
|
||||
if (contentView != null) {
|
||||
viewGroup.addView(contentView);
|
||||
if (onDialogClickListener != null) {
|
||||
onDialogClickListener.onCreateView(contentView);
|
||||
}
|
||||
}
|
||||
mCancel.setText(cancelText);
|
||||
mApply.setText(applyText);
|
||||
mCancel.setOnClickListener(v -> {
|
||||
if(onDialogClickListener!=null){
|
||||
if (onDialogClickListener != null) {
|
||||
onDialogClickListener.onCancel(dialog);
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
mApply.setOnClickListener(v ->{
|
||||
if(onDialogClickListener!=null){
|
||||
mApply.setOnClickListener(v -> {
|
||||
if (onDialogClickListener != null) {
|
||||
onDialogClickListener.onApply(dialog);
|
||||
}
|
||||
dismiss();
|
||||
|
||||
Reference in New Issue
Block a user