Commit 884561f5 authored by mengcuiguang's avatar mengcuiguang

修改加载框

parent ac2f1ffe
...@@ -174,6 +174,7 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base ...@@ -174,6 +174,7 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
try { try {
if (this.getWindow() != null && !this.isFinishing()) { if (this.getWindow() != null && !this.isFinishing()) {
if (progressDialog != null && progressDialog.isShowing()) { if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.clear();
progressDialog.dismiss(); progressDialog.dismiss();
progressDialog = null; progressDialog = null;
} }
......
...@@ -98,6 +98,7 @@ public abstract class BaseFragment extends BaseAppFragment { ...@@ -98,6 +98,7 @@ public abstract class BaseFragment extends BaseAppFragment {
try { try {
if (getActivity().getWindow() != null && !getActivity().isFinishing()) { if (getActivity().getWindow() != null && !getActivity().isFinishing()) {
if (progressDialog != null && progressDialog.isShowing()) { if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.clear();
progressDialog.dismiss(); progressDialog.dismiss();
progressDialog = null; progressDialog = null;
} }
......
...@@ -11,11 +11,13 @@ import android.view.Gravity; ...@@ -11,11 +11,13 @@ import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import com.mints.flowbox.R; import com.mints.flowbox.R;
import com.mints.library.utils.GlideUtils;
/** /**
* 描述:加载中dialog * 描述:加载中dialog
...@@ -30,17 +32,20 @@ public class LoadingDialog extends Dialog { ...@@ -30,17 +32,20 @@ public class LoadingDialog extends Dialog {
private LayoutParams lp; private LayoutParams lp;
private TextView loadtext; private TextView loadtext;
private LinearLayout loading_ll; private LinearLayout loading_ll;
private ImageView loading_iv;
public LoadingDialog(Context context) { public LoadingDialog(Context context) {
super(context, R.style.dialog); super(context, R.style.dialog);
this.mContext = context; this.mContext = context;
inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.loadingdialog, null); View layout = inflater.inflate(R.layout.loadingdialog, null);
if (android.os.Build.VERSION.SDK_INT > 22) {//android 6.0替换clip的加载动画 // if (android.os.Build.VERSION.SDK_INT > 22) {//android 6.0替换clip的加载动画
final Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.ufo_loading_refresh); // final Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.ufo_loading_refresh);
ProgressBar loading_bar = (ProgressBar) layout.findViewById(R.id.loading_bar); // ProgressBar loading_bar = (ProgressBar) layout.findViewById(R.id.loading_bar);
loading_bar.setIndeterminateDrawable(drawable); // loading_bar.setIndeterminateDrawable(drawable);
} // }
loading_iv = (ImageView) layout.findViewById(R.id.loading_iv);
GlideUtils.loadImageViewGif(context,R.drawable.ic_loading,loading_iv);
loadtext = (TextView) layout.findViewById(R.id.loading_text); loadtext = (TextView) layout.findViewById(R.id.loading_text);
loading_ll = (LinearLayout) layout.findViewById(R.id.loading_ll); loading_ll = (LinearLayout) layout.findViewById(R.id.loading_ll);
setContentView(layout); setContentView(layout);
...@@ -66,4 +71,7 @@ public class LoadingDialog extends Dialog { ...@@ -66,4 +71,7 @@ public class LoadingDialog extends Dialog {
} }
} }
public void clear(){
GlideUtils.clear(mContext,loading_iv);
}
} }
\ No newline at end of file
...@@ -152,4 +152,9 @@ public class GlideUtils { ...@@ -152,4 +152,9 @@ public class GlideUtils {
void gifPlayComplete(); void gifPlayComplete();
} }
public static void clear(Context context,ImageView iv){
if(iv!=null){
Glide.with(context).clear(iv);
}
}
} }
...@@ -11,11 +11,16 @@ ...@@ -11,11 +11,16 @@
<!-- 正在加载 --> <!-- 正在加载 -->
<ProgressBar <!-- <ProgressBar-->
android:id="@+id/loading_bar" <!-- android:id="@+id/loading_bar"-->
style="@style/loading_small" <!-- style="@style/loading_small"-->
<!-- android:layout_width="74dip"-->
<!-- android:layout_height="74dip" />-->
<ImageView
android:id="@+id/loading_iv"
android:layout_width="74dip" android:layout_width="74dip"
android:layout_height="74dip" /> android:layout_height="74dip"/>
<LinearLayout <LinearLayout
android:id="@+id/loading_ll" android:id="@+id/loading_ll"
...@@ -30,7 +35,7 @@ ...@@ -30,7 +35,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="加载中..." android:text="加载中..."
android:textColor="@color/white" android:textColor="@color/color_3D5AFE"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment