jimu-decompiled/sources/com/ubt/jimu/widgets/UniversalPopupWindow.java
2025-05-13 19:24:51 +02:00

101 lines
3.1 KiB
Java

package com.ubt.jimu.widgets;
import android.content.Context;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.ubt.jimu.R;
import com.ubt.jimu.utils.LogUtils;
/* loaded from: classes2.dex */
public class UniversalPopupWindow extends PopupWindow {
private static UniversalPopupWindow g;
private PopupWindow b;
private TextView c;
private TextView d;
private TextView e;
private UniversalPopupWindowListener f;
private Context a = this.a;
private Context a = this.a;
public interface UniversalPopupWindowListener {
void a();
void onCancel();
}
private UniversalPopupWindow(Context context) {
View inflate = View.inflate(context, R.layout.layout_universal_popupwindow, null);
this.b = new PopupWindow(inflate, -1, -1);
this.b.setOutsideTouchable(false);
this.b.setTouchable(true);
this.b.setAnimationStyle(R.style.popupWindow_anim_shop);
b(inflate);
a();
}
public UniversalPopupWindow c(String str) {
this.e.setText(str);
return g;
}
private void a() {
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.UniversalPopupWindow.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
LogUtils.c("点击");
UniversalPopupWindow.this.b.dismiss();
if (UniversalPopupWindow.this.f != null) {
UniversalPopupWindow.this.f.onCancel();
}
}
});
this.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.widgets.UniversalPopupWindow.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (UniversalPopupWindow.this.f != null) {
UniversalPopupWindow.this.f.a();
}
UniversalPopupWindow.this.b.dismiss();
}
});
}
private void b(View view) {
this.c = (TextView) view.findViewById(R.id.tv_cancel);
this.d = (TextView) view.findViewById(R.id.tv_ok);
this.e = (TextView) view.findViewById(R.id.tv_content);
}
public static UniversalPopupWindow a(Context context) {
if (g == null) {
g = new UniversalPopupWindow(context);
}
g.a(context.getResources().getString(R.string.btn_cancel_publish));
g.b(context.getResources().getString(R.string.ok));
return g;
}
public UniversalPopupWindow b(String str) {
this.d.setText(str);
return g;
}
public void a(View view) {
PopupWindow popupWindow = this.b;
if (popupWindow != null) {
popupWindow.showAtLocation(view, 80, 0, 0);
}
}
public UniversalPopupWindow a(String str) {
this.c.setText(str);
return g;
}
public UniversalPopupWindow a(UniversalPopupWindowListener universalPopupWindowListener) {
this.f = universalPopupWindowListener;
return g;
}
}