STEP - 1 : Add Internet Permission
STEP - 2 : Glide in App Level Gradle
// GLIDEcompile 'com.github.bumptech.glide:glide:3.8.0'
STEP - 3 :
public class ProgressClass { private static ProgressClass progressClass = null; private Dialog dialog; private ProgressClass() { } public static ProgressClass getProgressInstance() { if(progressClass == null) { synchronized (ProgressClass.class) { if (progressClass == null) { progressClass = new ProgressClass(); } } } return progressClass; } public void showDialog(Activity activity){ dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setContentView(R.layout.layout_progress_dialog); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); ImageView progressImage = (ImageView) dialog.findViewById(R.id.idPregress); Glide.with(activity) .load(R.drawable.gif_progress1) .into(progressImage); dialog.show(); } public void showDialog(Context activity){ dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(false); dialog.setContentView(R.layout.layout_progress_dialog); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); ImageView progressImage = (ImageView) dialog.findViewById(R.id.idPregress); Glide.with(activity) .load(R.drawable.gif_progress1) .into(progressImage); dialog.show(); } public void stopProgress(){ dialog.dismiss(); } }
No comments:
Post a Comment