Initial commit
This commit is contained in:
112
sources/com/ubt/jimu/dialog/RedirectDialog.java
Normal file
112
sources/com/ubt/jimu/dialog/RedirectDialog.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package com.ubt.jimu.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import com.ubtech.view.dialog.BaseDialog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RedirectDialog extends BaseDialog {
|
||||
private int b;
|
||||
private String c;
|
||||
private DialogInterface.OnClickListener d;
|
||||
private View e;
|
||||
|
||||
public RedirectDialog(Context context) {
|
||||
super(context);
|
||||
this.e = LayoutInflater.from(context).inflate(R.layout.redirect_dialog, (ViewGroup) null);
|
||||
}
|
||||
|
||||
private void b() {
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
int a = DisplayUtil.a(this.a, R.dimen.theme_big_dialog_window_width);
|
||||
int a2 = DisplayUtil.a(this.a, R.dimen.theme_big_dialog_window_height);
|
||||
attributes.width = a;
|
||||
attributes.height = a2;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
requestWindowFeature(1);
|
||||
setContentView(this.e);
|
||||
setCanceledOnTouchOutside(false);
|
||||
b();
|
||||
ImageView imageView = (ImageView) this.e.findViewById(R.id.iv_img);
|
||||
int i = this.b;
|
||||
if (i != 0) {
|
||||
imageView.setImageResource(i);
|
||||
imageView.setVisibility(0);
|
||||
}
|
||||
TextView textView = (TextView) this.e.findViewById(R.id.tv_tips);
|
||||
if (!TextUtils.isEmpty(this.c)) {
|
||||
textView.setText(this.c);
|
||||
textView.setVisibility(0);
|
||||
textView.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
}
|
||||
((Button) this.e.findViewById(R.id.btn_ok)).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.dialog.a
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
RedirectDialog.this.a(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Context a;
|
||||
private int b;
|
||||
private String c;
|
||||
private DialogInterface.OnClickListener d;
|
||||
|
||||
public Builder(Context context) {
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
public RedirectDialog a() {
|
||||
RedirectDialog redirectDialog = new RedirectDialog(this.a);
|
||||
redirectDialog.b = this.b;
|
||||
redirectDialog.c = this.c;
|
||||
redirectDialog.d = this.d;
|
||||
redirectDialog.a();
|
||||
return redirectDialog;
|
||||
}
|
||||
|
||||
public Builder a(int i) {
|
||||
this.b = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(String str) {
|
||||
this.c = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(DialogInterface.OnClickListener onClickListener) {
|
||||
this.d = onClickListener;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
DialogInterface.OnClickListener onClickListener = this.d;
|
||||
if (onClickListener != null) {
|
||||
onClickListener.onClick(this, 0);
|
||||
} else {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user