Virtual Trading v2.0.95版本的 MD5 值为:ef0f95d706f7364286da0edbbd29a27d
以下内容为反编译后的 AlphaDialog.java 源代码,内容仅作参考
package com.dreamers.AlphaDialog;
import android.R;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Toast;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
@DesignerComponent(category = ComponentCategory.EXTENSION, iconName = "https://res.cloudinary.com/dzqb4drjv/image/upload/v1608883763/circular-speech-bubble_c0z91r.png", nonVisible = true, version = 1)
@SimpleObject(external = true)
public class AlphaDialog extends AndroidNonvisibleComponent {
private Context context;
private Dialog dialog;
private WindowManager.LayoutParams params;
private Toast toast;
private View toastView;
private boolean wrap;
public AlphaDialog(ComponentContainer componentContainer) {
super(componentContainer.$form());
this.dialog = null;
this.wrap = true;
this.toastView = null;
this.context = componentContainer.$context();
this.params = new WindowManager.LayoutParams();
}
@SimpleFunction
public void CreateDialog(AndroidViewComponent androidViewComponent, boolean z) {
View view = androidViewComponent.getView();
view.setVisibility(0);
if (view.getParent() != null) {
((ViewGroup) view.getParent()).removeView(view);
}
Dialog dialog = new Dialog(this.context);
this.dialog = dialog;
dialog.setCancelable(z);
this.dialog.requestWindowFeature(1);
this.dialog.setContentView(view);
this.dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
AlphaDialog.this.OnDismiss();
}
});
this.dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
AlphaDialog.this.OnShow();
}
});
}
@SimpleFunction
public void Dismiss() {
Dialog dialog = this.dialog;
if (dialog != null) {
dialog.dismiss();
}
}
@SimpleProperty
public int LongLength() {
return 1;
}
@SimpleEvent
public void OnDismiss() {
EventDispatcher.dispatchEvent(this, "OnDismiss", new Object[0]);
}
@SimpleEvent
public void OnShow() {
EventDispatcher.dispatchEvent(this, "OnShow", new Object[0]);
}
@SimpleProperty
public int ShortLength() {
return 0;
}
@SimpleFunction
public void Show() {
WindowManager.LayoutParams layoutParams;
int i;
Dialog dialog = this.dialog;
if (dialog != null) {
this.params.copyFrom(dialog.getWindow().getAttributes());
this.dialog.show();
this.dialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
if (this.wrap) {
layoutParams = this.params;
i = -2;
} else {
layoutParams = this.params;
i = -1;
}
layoutParams.width = i;
this.params.height = i;
this.dialog.getWindow().setAttributes(this.params);
}
}
@SimpleFunction
public void ShowToast(AndroidViewComponent androidViewComponent, int i) {
try {
if (this.toastView == null || this.toastView != androidViewComponent.getView()) {
View view = androidViewComponent.getView();
this.toastView = view;
if (view.getParent() != null) {
((ViewGroup) this.toastView.getParent()).removeView(this.toastView);
}
}
this.toastView.setVisibility(0);
Toast toast = new Toast(this.context);
this.toast = toast;
toast.setView(this.toastView);
this.toast.setDuration(i);
this.toast.show();
} catch (Exception e) {
Toast.makeText(this.context, "" + e, 1).show();
}
}
@SimpleProperty
public void WrapContent(boolean z) {
this.wrap = z;
}
@SimpleProperty
public boolean WrapContent() {
return this.wrap;
}
}