Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Update LoadingDialog.java #17

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class LoadingDialog implements FinishDrawListener {
public final String TAG = "LoadingDialog";
public static final int STYLE_RING = 0;
public static final int STYLE_LINE = 1;
private Context mContext;

private LVCircularRing mLoadingView;
private Dialog mLoadingDialog;
Expand Down Expand Up @@ -62,7 +61,6 @@ public enum Speed {
private DismissListener d;

public LoadingDialog(Context context) {
mContext = context;
// 首先得到整个View
@SuppressWarnings("all")
View view = LayoutInflater.from(context).inflate(
Expand All @@ -86,7 +84,6 @@ public void onBackPressed() {
mLoadingDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mContext = null;
if (d != null) d.dimiss();
}
});
Expand Down Expand Up @@ -200,6 +197,14 @@ public void show() {
}
}

/**
* Whether the dialog is currently showing
* 当前dialog是否正在显示
*/
public boolean isShowing() {
return mLoadingDialog != null && mLoadingDialog.isShowing();
}

/**
* set load style
* 设置load的样式,目前支持转圈圈和菊花转圈圈
Expand Down Expand Up @@ -427,6 +432,19 @@ public LoadingDialog setTextSize(float size) {
return this;
}

/**
* set the size of load text size
* 设置加载字体大小
*
* @param size 尺寸,单位px
* @return 这个对象
*/
public LoadingDialog setTextSizeWithPx(float size) {
if (size < 0) return this;
loadingText.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
return this;
}

public static void initStyle(StyleManager style) {
if (style != null)
s = style;
Expand Down