Java Code Examples for android.app.ProgressDialog#setContentView()

The following examples show how to use android.app.ProgressDialog#setContentView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LaunchFragment.java    From weMessage with GNU Affero General Public License v3.0 6 votes vote down vote up
private void showProgressDialog(final View view, String title, String message){
    final ProgressDialog progressDialog = new ProgressDialog(getActivity());
    ProgressDialogLayout progressDialogLayout = (ProgressDialogLayout) getActivity().getLayoutInflater().inflate(R.layout.progress_dialog_layout, null);

    progressDialog.setCancelable(false);

    progressDialogLayout.setTitle(title);
    progressDialogLayout.setMessage(message);
    progressDialogLayout.setButton(getString(R.string.word_cancel), new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            serviceConnection.scheduleTask(new Runnable() {
                @Override
                public void run() {
                    serviceConnection.getConnectionService().endService();
                }
            });
            progressDialog.dismiss();
            generateInvalidSnackBar(view, getString(R.string.connection_cancelled)).show();
            loginProgressDialog = null;
        }
    });
    progressDialog.show();
    progressDialog.setContentView(progressDialogLayout);
    loginProgressDialog = progressDialog;
}
 
Example 2
Source File: LoadingDialog.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
public static ProgressDialog createProgressDialog(Context context,
		String text) {
	final ProgressDialog dlg = new ProgressDialog(context, R.style.Theme_Dialog_Default);

	dlg.show();
	dlg.setContentView(R.layout.loading_layout);
	LinearLayout root = (LinearLayout) dlg
			.findViewById(R.id.progressDialog);
	root.setGravity(android.view.Gravity.CENTER);
	root.getBackground().setAlpha(100);// 0~255透明度值 ,0为完全透明,255为不透明
	LoadingView mLoadView = new LoadingView(context);
	mLoadView.setDrawableResId(R.drawable.loading_img);
	root.addView(mLoadView);
	TextView alert = new TextView(context);
	alert.setGravity(android.view.Gravity.CENTER);
	alert.setHeight(50);
	alert.setText(text);
	alert.setTextColor(0xFFFFFFFF);
	root.addView(alert);
	dlg.setCanceledOnTouchOutside(false);
	return dlg;
}
 
Example 3
Source File: CommonUtils.java    From InstantAppStarter with MIT License 5 votes vote down vote up
public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();
    if (progressDialog.getWindow() != null) {
        progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.progress_dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);
    return progressDialog;
}
 
Example 4
Source File: MainActivity.java    From Android-Example with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
      ProgressDialog dialog;
      dialog = ProgressDialog.show(MainActivity.this,null,null);
      dialog.setContentView(R.layout.progressbar);
      dialog.show();

}
 
Example 5
Source File: CommonUtils.java    From android-mvp-interactor-architecture with Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();
    if (progressDialog.getWindow() != null) {
        progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.progress_dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    return progressDialog;
}
 
Example 6
Source File: CommonUtils.java    From android-mvvm-architecture with Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();
    if (progressDialog.getWindow() != null) {
        progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.progress_dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    return progressDialog;
}
 
Example 7
Source File: CommonUtils.java    From android-mvp-architecture with Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();
    if (progressDialog.getWindow() != null) {
        progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.progress_dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    return progressDialog;
}
 
Example 8
Source File: UiUtils.java    From EosCommander with MIT License 5 votes vote down vote up
public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();
    if (progressDialog.getWindow() != null) {
        progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.progress_dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    return progressDialog;
}
 
Example 9
Source File: DialogUtils.java    From Android-MVP-Sample-Application with Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showLoadingDialog(Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.show();
    if (progressDialog.getWindow() != null) {
        progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    progressDialog.setContentView(R.layout.progress_dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);
    return progressDialog;
}
 
Example 10
Source File: MainActivity.java    From ello-android with MIT License 5 votes vote down vote up
private ProgressDialog createProgressDialog(Context mContext) {
    ProgressDialog dialog = new ProgressDialog(mContext);
    try {
        dialog.show();
    } catch (WindowManager.BadTokenException e) {}
    dialog.setCancelable(false);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.setContentView(R.layout.progress_dialog);
    return dialog;
}
 
Example 11
Source File: LoadingDialog.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
public LoadingDialog(Context context, String text) {
	this.context = context;
	this.handler = new MyHandler();
	dlg = new ProgressDialog(context, R.style.Theme_Dialog_Default);

	dlg.show();
	dlg.setContentView(R.layout.loading_layout);
	LinearLayout root = (LinearLayout) dlg
			.findViewById(R.id.progressDialog);
	root.setGravity(android.view.Gravity.CENTER);
	root.getBackground().setAlpha(100);// 0~255透明度值 ,0为完全透明,255为不透明
	mLoadView = new LoadingView(context);
	mLoadView.setDrawableResId(R.drawable.loading_img);
	root.addView(mLoadView);

	imgView = new ImageView(context);
	imgView.setImageResource(R.drawable.loading_img);
	root.addView(imgView);
	imgView.setVisibility(View.GONE);

	alert = new TextView(context);
	alert.setGravity(android.view.Gravity.CENTER);
	alert.setHeight(50);
	alert.setText(text);
	alert.setTextColor(0xFFFFFFFF);
	root.addView(alert);
	dlg.setCanceledOnTouchOutside(false);

}
 
Example 12
Source File: LoadingDialog.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
public LoadingDialog(Context context, int resLayoutId, int resImgId,
		String text, boolean isCanceledOnTouchOutside) {
	this.context = context;
	this.handler = new MyHandler();

	dlg = new ProgressDialog(context, R.style.Theme_Dialog_Default);

	dlg.show();
	dlg.setContentView(resLayoutId);
	LinearLayout root = (LinearLayout) dlg
			.findViewById(R.id.progressDialog);
	root.setGravity(android.view.Gravity.CENTER);
	root.getBackground().setAlpha(100);// 0~255透明度值 ,0为完全透明,255为不透明
	mLoadView = new LoadingView(context);
	mLoadView.setDrawableResId(resImgId);
	root.addView(mLoadView);

	imgView = new ImageView(context);
	imgView.setImageResource(R.drawable.loading_img);
	root.addView(imgView);
	imgView.setVisibility(View.GONE);

	alert = new TextView(context);
	alert.setGravity(android.view.Gravity.CENTER);
	alert.setHeight(50);
	alert.setText(text);
	alert.setTextColor(0xFFFFFFFF);
	root.addView(alert);
	dlg.setCanceledOnTouchOutside(isCanceledOnTouchOutside);

}
 
Example 13
Source File: ProofActivity.java    From Mupdf with Apache License 2.0 5 votes vote down vote up
private static ProgressDialog createAndShowWaitSpinner(Context mContext)
{
	ProgressDialog dialog = new ProgressDialog(mContext);
	try {
		dialog.show();
	}
	catch (WindowManager.BadTokenException e) {
	}
	dialog.setCancelable(false);
	dialog.setIndeterminate(true);
	dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
	dialog.setContentView(R.layout.wait_spinner);
	return dialog;
}