92 lines
3.2 KiB
Java
92 lines
3.2 KiB
Java
package com.ubt.jimu.widgets;
|
|
|
|
import android.app.Activity;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.WindowManager;
|
|
import android.widget.PopupWindow;
|
|
import android.widget.TextView;
|
|
import com.ubt.jimu.R;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class QuitPopupWindow implements View.OnClickListener {
|
|
private PopupWindow a;
|
|
private PopupWindowOnClickListener b;
|
|
private final TextView c;
|
|
private final TextView d;
|
|
private final TextView e;
|
|
|
|
public interface PopupWindowOnClickListener {
|
|
void s0();
|
|
|
|
void w0();
|
|
}
|
|
|
|
public QuitPopupWindow(final Activity activity) {
|
|
View inflate = LayoutInflater.from(activity).inflate(R.layout.popw_publish_layout, (ViewGroup) null, false);
|
|
this.a = new PopupWindow(inflate, -1, -1);
|
|
this.a.setOutsideTouchable(false);
|
|
this.a.setTouchable(true);
|
|
this.a.setAnimationStyle(R.style.popupWindow_anim_translate);
|
|
this.a.setOnDismissListener(new PopupWindow.OnDismissListener(this) { // from class: com.ubt.jimu.widgets.QuitPopupWindow.1
|
|
@Override // android.widget.PopupWindow.OnDismissListener
|
|
public void onDismiss() {
|
|
WindowManager.LayoutParams attributes = activity.getWindow().getAttributes();
|
|
attributes.alpha = 1.0f;
|
|
activity.getWindow().clearFlags(2);
|
|
activity.getWindow().setAttributes(attributes);
|
|
}
|
|
});
|
|
WindowManager.LayoutParams attributes = activity.getWindow().getAttributes();
|
|
attributes.alpha = 0.3f;
|
|
activity.getWindow().addFlags(2);
|
|
activity.getWindow().setAttributes(attributes);
|
|
this.e = (TextView) inflate.findViewById(R.id.tv_popup_cancel);
|
|
this.d = (TextView) inflate.findViewById(R.id.tv_popup_exit);
|
|
this.c = (TextView) inflate.findViewById(R.id.tv_popup_drafts);
|
|
this.e.setOnClickListener(this);
|
|
this.d.setOnClickListener(this);
|
|
this.c.setOnClickListener(this);
|
|
}
|
|
|
|
public void a(View view) {
|
|
this.a.showAtLocation(view, 80, 0, 0);
|
|
}
|
|
|
|
public boolean b() {
|
|
return this.a.isShowing();
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
switch (view.getId()) {
|
|
case R.id.tv_popup_cancel /* 2131297753 */:
|
|
a();
|
|
break;
|
|
case R.id.tv_popup_drafts /* 2131297754 */:
|
|
PopupWindowOnClickListener popupWindowOnClickListener = this.b;
|
|
if (popupWindowOnClickListener != null) {
|
|
popupWindowOnClickListener.s0();
|
|
break;
|
|
}
|
|
break;
|
|
case R.id.tv_popup_exit /* 2131297755 */:
|
|
PopupWindowOnClickListener popupWindowOnClickListener2 = this.b;
|
|
if (popupWindowOnClickListener2 != null) {
|
|
popupWindowOnClickListener2.w0();
|
|
}
|
|
a();
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void a() {
|
|
this.a.dismiss();
|
|
}
|
|
|
|
public void a(PopupWindowOnClickListener popupWindowOnClickListener) {
|
|
this.b = popupWindowOnClickListener;
|
|
}
|
|
}
|