77 lines
2.8 KiB
Java
77 lines
2.8 KiB
Java
package com.ubt.jimu.base.dialog;
|
|
|
|
import android.R;
|
|
import android.app.DialogFragment;
|
|
import android.graphics.drawable.AnimationDrawable;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.AnimationUtils;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class WaitDialogSupport extends DialogFragment {
|
|
private AnimationDrawable backgroundAnimation;
|
|
private Animation rotateAnimaLow;
|
|
private String tip;
|
|
private TextView tipTv;
|
|
|
|
public static DialogFragment newInstance(String str) {
|
|
WaitDialogSupport waitDialogSupport = new WaitDialogSupport();
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString("tip", str);
|
|
waitDialogSupport.setArguments(bundle);
|
|
return waitDialogSupport;
|
|
}
|
|
|
|
@Override // android.app.DialogFragment
|
|
public void dismiss() {
|
|
try {
|
|
super.dismiss();
|
|
} catch (Throwable th) {
|
|
th.printStackTrace();
|
|
}
|
|
Animation animation = this.rotateAnimaLow;
|
|
if (animation != null) {
|
|
animation.cancel();
|
|
this.rotateAnimaLow = null;
|
|
}
|
|
AnimationDrawable animationDrawable = this.backgroundAnimation;
|
|
if (animationDrawable != null) {
|
|
animationDrawable.stop();
|
|
this.backgroundAnimation = null;
|
|
}
|
|
}
|
|
|
|
@Override // android.app.DialogFragment, android.app.Fragment
|
|
public void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
setStyle(0, R.style.Theme.Translucent.NoTitleBar.Fullscreen);
|
|
this.tip = getArguments().getString("tip");
|
|
}
|
|
|
|
@Override // android.app.Fragment
|
|
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
View inflate = layoutInflater.inflate(com.ubt.jimu.R.layout.dialog_wait, viewGroup, false);
|
|
ImageView imageView = (ImageView) inflate.findViewById(com.ubt.jimu.R.id.wait_dialog_img);
|
|
this.tipTv = (TextView) inflate.findViewById(com.ubt.jimu.R.id.dialog_wait_tv_loading_tips);
|
|
if (TextUtils.isEmpty(this.tip)) {
|
|
this.tipTv.setVisibility(8);
|
|
} else {
|
|
this.tipTv.setText(this.tip);
|
|
}
|
|
this.rotateAnimaLow = AnimationUtils.loadAnimation(getActivity(), com.ubt.jimu.R.anim.anima_dialog_wait);
|
|
imageView.startAnimation(this.rotateAnimaLow);
|
|
this.backgroundAnimation = (AnimationDrawable) imageView.getBackground();
|
|
AnimationDrawable animationDrawable = this.backgroundAnimation;
|
|
if (animationDrawable != null) {
|
|
animationDrawable.start();
|
|
}
|
|
return inflate;
|
|
}
|
|
}
|