50 lines
1018 B
Java
50 lines
1018 B
Java
|
|
package com.xscm.moduleutil.dialog;
|
|||
|
|
|
|||
|
|
import android.app.Dialog;
|
|||
|
|
import android.content.Context;
|
|||
|
|
import android.os.Bundle;
|
|||
|
|
import android.widget.TextView;
|
|||
|
|
import androidx.annotation.NonNull;
|
|||
|
|
import com.xscm.moduleutil.R;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* com.xscm.moduleutil.dialog
|
|||
|
|
* qx
|
|||
|
|
* 2025/10/27
|
|||
|
|
*/
|
|||
|
|
public class LoadingDialog extends Dialog {
|
|||
|
|
|
|||
|
|
|
|||
|
|
public LoadingDialog(@NonNull Context context) {
|
|||
|
|
super(context);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@Override
|
|||
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|||
|
|
super.onCreate(savedInstanceState);
|
|||
|
|
// 设置布局(这里假设你有一个R.layout.loading_dialog布局文件)
|
|||
|
|
setContentView(R.layout.loading_dialog);
|
|||
|
|
|
|||
|
|
// 设置不可取消
|
|||
|
|
setCancelable(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 显示加载对话框
|
|||
|
|
*/
|
|||
|
|
public void showLoading() {
|
|||
|
|
if (!isShowing()) {
|
|||
|
|
show();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 隐藏加载对话框
|
|||
|
|
*/
|
|||
|
|
public void hideLoading() {
|
|||
|
|
if (isShowing()) {
|
|||
|
|
dismiss();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|