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

The following examples show how to use android.app.ProgressDialog#setTitle() . 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: DialogUtils.java    From DevUtils with Apache License 2.0 6 votes vote down vote up
/**
 * 创建加载中 Dialog ( 原生样式 )
 * @param context        {@link Context}
 * @param title          dialog 标题
 * @param content        dialog 内容
 * @param isCancel       是否可以返回键关闭
 * @param cancelListener 取消事件
 * @return {@link ProgressDialog}
 */
public static ProgressDialog createProgressDialog(final Context context, final String title, final String content, final boolean isCancel,
                                                  final DialogInterface.OnCancelListener cancelListener) {
    try {
        ProgressDialog dialog = new ProgressDialog(context);
        dialog.setTitle(title);
        dialog.setMessage(content);
        dialog.setIndeterminate(false);
        dialog.setCancelable(isCancel);
        dialog.setOnCancelListener(cancelListener);
        return dialog;
    } catch (Exception e) {
        LogPrintUtils.eTag(TAG, e, "createProgressDialog");
    }
    return null;
}
 
Example 2
Source File: MainActivity.java    From Android-Basics-Codes with Artistic License 2.0 6 votes vote down vote up
public void click4(View v){
	final ProgressDialog pd = new ProgressDialog(this);
	//���ý���������ʽ
	pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	//���ý��������ֵ
	pd.setMax(100);
	pd.setTitle("�����Թ��У����Ժ�");
	Thread t = new Thread(){
		@Override
		public void run() {
			try {
				for (int i = 0; i <= 100; i++) {
		pd.setProgress(i);
					sleep(50);
	}
} catch (InterruptedException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
			pd.dismiss();
		}
	};
	t.start();
	pd.show();
}
 
Example 3
Source File: ImportExportTask.java    From budget-watch with GNU General Public License v3.0 6 votes vote down vote up
protected void onPreExecute()
{
    progress = new ProgressDialog(activity);
    progress.setTitle(doImport ? R.string.importing : R.string.exporting);

    progress.setOnDismissListener(new DialogInterface.OnDismissListener()
    {
        @Override
        public void onDismiss(DialogInterface dialog)
        {
            ImportExportTask.this.cancel(true);
        }
    });

    progress.show();
}
 
Example 4
Source File: CheckupReminders.java    From Crimson with Apache License 2.0 6 votes vote down vote up
private void setReminder() {

        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle(getString(R.string.app_name));
        progressDialog.setMessage(getString(R.string.wait));
        progressDialog.setIndeterminate(true);
        progressDialog.setCancelable(false);

        String name = nameET.getText().toString();
        String address = addressET.getText().toString();
        String full_date = onDateEt.getText().toString();

        if (name.trim().length() > 0 && address.trim().length() > 0 && full_date.trim().length() > 0) {

            progressDialog.show();
            setReminderNow(name, address, full_date);

        } else
            Toast.makeText(this, getString(R.string.please_input), Toast.LENGTH_LONG).show();

    }
 
Example 5
Source File: PostsAdapter.java    From Hify with MIT License 5 votes vote down vote up
protected void onPreExecute(){
    mProgressDialog=new ProgressDialog(context);
    mProgressDialog.setIndeterminate(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setTitle("Please wait");
    mProgressDialog.setMessage("We are processing the image for sharing...");
    mProgressDialog.setCancelable(false);
    mProgressDialog.show();
    mProgressDialog.setProgress(0);
}
 
Example 6
Source File: MainActivity.java    From QNRTC-Android with Apache License 2.0 5 votes vote down vote up
private void createProgressDialog() {
    mProgressDialog = new ProgressDialog(MainActivity.this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setTitle(getString(R.string.updating));
    mProgressDialog.setIndeterminate(false);
    mProgressDialog.setMax(100);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setCanceledOnTouchOutside(false);
    mProgressDialog.show();
}
 
Example 7
Source File: BaseHelper.java    From letv with Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showProgress(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable) {
    ProgressDialog dialog = new ProgressDialog(context);
    dialog.setTitle(title);
    dialog.setMessage(message);
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(false);
    try {
        dialog.show();
    } catch (Exception e) {
    }
    return dialog;
}
 
Example 8
Source File: AccountSwitchActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void showSwitchDialog() {
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setTitle(R.string.atom_ui_setting_switch_account);
    mProgressDialog.setMessage(getText(R.string.atom_ui_tip_login_logining));
    mProgressDialog.setCanceledOnTouchOutside(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.show();
}
 
Example 9
Source File: VideoTrimmerActivity.java    From VideoTrimmer_Android with MIT License 5 votes vote down vote up
@Override
public void onTrimStarted() {
    // Create an indeterminate progress dialog
    mProgressDialog = new ProgressDialog(VideoTrimmerActivity.this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setTitle("Saving....");
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setCancelable(false);
    mProgressDialog.show();
}
 
Example 10
Source File: AccountManagementFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    setCancelable(false);
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setTitle(getString(R.string.wiping_profile_data_title));
    dialog.setMessage(getString(R.string.wiping_profile_data_message));
    dialog.setIndeterminate(true);
    return dialog;
}
 
Example 11
Source File: WeixinUtil.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
private static ProgressDialog show(Context context, CharSequence title,
                                  CharSequence message, boolean indeterminate,
                                  boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
    ProgressDialog dialog = new ProgressDialog(context,ProgressDialog.THEME_HOLO_LIGHT);
    dialog.setTitle(title);
    dialog.setMessage(message);
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(cancelable);
    dialog.setOnCancelListener(cancelListener);
    dialog.show();
    return dialog;
}
 
Example 12
Source File: SearchableItemActivity.java    From framework with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    progressDialog = new ProgressDialog(SearchableItemActivity.this);
    progressDialog.setTitle(R.string.title_please_wait);
    progressDialog.setMessage(OResource.string(SearchableItemActivity.this, R.string.title_working));
    progressDialog.setCancelable(false);
    progressDialog.show();
}
 
Example 13
Source File: AccountSettingsActivity.java    From zom-android-matrix with Apache License 2.0 5 votes vote down vote up
private void migrateAccountConfirmed ()
{

    if (!mIsMigrating) {

        mIsMigrating = true;

        Server[] servers = Server.getServers(this);
        final ProgressDialog progress = new ProgressDialog(this);
        progress.setIndeterminate(true);
        progress.setTitle(R.string.upgrade_progress_action);
        progress.show();

        MigrateAccountTask maTask = new MigrateAccountTask(this, (ImApp) getApplication(), mProviderId, mAccountId, new MigrateAccountTask.MigrateAccountListener() {
            @Override
            public void migrateComplete(OnboardingAccount account) {
                mIsMigrating = false;
                progress.dismiss();
                Toast.makeText(AccountSettingsActivity.this, R.string.upgrade_complete, Toast.LENGTH_SHORT).show();
                finish();
            }

            @Override
            public void migrateFailed(long providerId, long accountId) {
                Toast.makeText(AccountSettingsActivity.this, R.string.upgrade_failed, Toast.LENGTH_SHORT).show();
                mIsMigrating = false;
                progress.dismiss();

            }
        });
        maTask.execute(servers);
    }

}
 
Example 14
Source File: MainActivity.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
/**
 * 弹出下载对话框
 */
public void showDownloadDialog() {
    mDownloadDialog = new ProgressDialog(mContext);
    mDownloadDialog.setIcon(R.mipmap.ic_launcher);
    mDownloadDialog.setTitle("版本更新");
    mDownloadDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mDownloadDialog.setMessage("正在玩命下载中......");
    mDownloadDialog.getWindow().setGravity(Gravity.CENTER);
    mDownloadDialog.setMax(100);
    mDownloadDialog.show();
}
 
Example 15
Source File: DialogActivity.java    From sa-sdk-android with Apache License 2.0 5 votes vote down vote up
private void showWaitingDialog() {
    /* 等待Dialog具有屏蔽其他控件的交互能力
     * @setCancelable 为使屏幕不可点击,设置为不可取消(false)
     * 下载等事件完成后,主动调用函数关闭该Dialog
     */
    ProgressDialog waitingDialog =
            new ProgressDialog(DialogActivity.this);
    waitingDialog.setTitle("我是一个等待Dialog");
    waitingDialog.setMessage("等待中...");
    waitingDialog.setIndeterminate(true);
    waitingDialog.setCancelable(true);
    waitingDialog.show();
}
 
Example 16
Source File: AdoptDialogBuilder.java    From Hauk with Apache License 2.0 5 votes vote down vote up
/**
 * Called when the OK button is clicked in the dialog window.
 */
@Override
public final void onPositive() {
    // Get the user data.
    String nick = this.dialogTxtNick.getText().toString().trim();
    String adoptID = this.dialogTxtShare.getText().toString().trim();

    Log.v("User initiated adoption with nick=%s, id=%s", nick, adoptID); //NON-NLS

    // Create a processing dialog, since we are interacting with an external server, which can
    // take some time.
    final ProgressDialog progress = new ProgressDialog(this.ctx);
    progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progress.setTitle(R.string.progress_adopt_title);
    progress.setMessage(String.format(this.ctx.getString(R.string.progress_adopt_body), nick));
    progress.setIndeterminate(true);
    progress.setCancelable(false);
    progress.show();

    // Send the HTTP request to try and adopt the share.
    new AdoptSharePacket(this.ctx, this.share, adoptID, nick) {
        @Override
        public void onSuccessfulAdoption(String nickname) {
            Log.i("Adoption was successful for nick=%s", nickname); //NON-NLS
            progress.dismiss();
            AdoptDialogBuilder.this.onSuccess(nickname);
        }

        @Override
        protected void onFailure(Exception ex) {
            Log.w("Adoption failed", ex); //NON-NLS
            progress.dismiss();
            AdoptDialogBuilder.this.onFailure(ex);
        }
    }.send();
}
 
Example 17
Source File: LoginActivity.java    From cim with Apache License 2.0 5 votes vote down vote up
private void initViews() {

        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle("提示");
        progressDialog.setMessage("正在登录,请稍候......");
        progressDialog.setCancelable(false);
        progressDialog.setCanceledOnTouchOutside(false);
        accountEdit = (EditText) this.findViewById(R.id.account);
        loginButton = (Button) this.findViewById(R.id.login);
        loginButton.setOnClickListener(this);

    }
 
Example 18
Source File: MainActivity.java    From ArscEditor with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
	super.onPreExecute();
	// 初始化进度条
	dlg = new ProgressDialog(MainActivity.this);
	// 设置标题
	dlg.setTitle(R.string.parsing);
	// 设置按返回进度条不消失
	dlg.setCancelable(false);
	// 显示进度条
	dlg.show();

	// 如果储存Config的列表未初始化
	if (Configs == null) {
		// 初始化Config列表
		Configs = new ArrayList<String>();
	}

	// 检查是否发生改变
	for (String str : txtTranslated) {
		if (!str.equals(""))
			isChanged = true;
		break;
	}

	if (isChanged) {
		// 排序整理修改后的内容,以方便一一写入
		for (int i = 0; i < txtOriginal.size(); i++)
			mAndRes.mARSCDecoder.mTableStrings.sortStringBlock(txtOriginal.get(i), txtTranslated.get(i));
	}

	// 清除几个列表中的元素
	txtOriginal.clear();
	txtTranslated.clear();
	txtTranslated_Key.clear();
	Configs.clear();
}
 
Example 19
Source File: MainActivity.java    From android-video-transcoder with The Unlicense 4 votes vote down vote up
private void doConvert(String fromFile, String toFile){
	final ProgressDialog progress=new ProgressDialog(this);
	progress.setTitle("Compressing video");
	progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	progress.setCancelable(false);
	progress.setButton(ProgressDialog.BUTTON_POSITIVE, "Cancel", new DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface dialog, int which) {
			videoConverter.cancel();
			progress.dismiss();
		}
	});
	progress.show();

	VideoConverter.Callback callback=new VideoConverter.Callback() {
		@Override
		public void onProgressUpdated(final int done, final int total) {
			runOnUiThread(new Runnable() {
				@Override
				public void run() {
					progress.setMax(total);
					progress.setProgress(done);
				}
			});
		}

		@Override
		public void onConversionCompleted() {
			runOnUiThread(new Runnable() {
				@Override
				public void run() {
					progress.dismiss();
					videoConverter=null;
					Toast.makeText(MainActivity.this, "Done!", Toast.LENGTH_SHORT).show();
				}
			});
		}

		@Override
		public void onConversionFailed(final String error) {
			runOnUiThread(new Runnable() {
				@Override
				public void run() {
					progress.dismiss();
					new AlertDialog.Builder(MainActivity.this)
							.setTitle("Error")
							.setMessage(error)
							.setPositiveButton("OK", null)
							.show();
				}
			});
		}

		@Override
		public void onReady() {
			videoConverter.start();
		}
	};
	int scalingFactor=scalingFactorSlider.getProgress()+1;
	MediaMetadataRetriever mmr=new MediaMetadataRetriever();
	mmr.setDataSource(this, Uri.parse(fromFile));
	int vw=Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
	int vh=Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
	mmr.release();
	videoConverter=new VideoConverter(fromFile, toFile, videoBitrateSlider.getProgress(), audioBitrateSlider.getProgress(), Math.max(vw, vh)/scalingFactor, callback, this);
}
 
Example 20
Source File: MainActivity.java    From android-packet-capture with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final Button bt = (Button)findViewById(R.id.button_packet_capture);
    progressbox = new ProgressDialog(this);
    progressbox.setTitle("Initialising");
    progressbox.setMessage("Requesting root permissions..");
    progressbox.setIndeterminate(true);
    progressbox.setCancelable(false);
    progressbox.show();
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            final Boolean isRootAvailable = Shell.SU.available();
            Boolean processExists = false;
            String pid = null;
            if(isRootAvailable) {
                List<String> out = Shell.SH.run("ps | grep tcpdump.bin");
                if(out.size() == 1) {
                    processExists = true;
                    pid = (out.get(0).split("\\s+"))[1];
                }
                else if(out.size() == 0) {
                    if (loadTcpdumpFromAssets() != 0)
                        throw new RuntimeException("Copying tcpdump binary failed.");
                }
                else
                    throw new RuntimeException("Searching for running process returned unexpected result.");
            }

            final Boolean processExistsFinal = processExists;
            final String pidFinal = pid;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (!isRootAvailable) {
                        ((TextView)findViewById(R.id.main_tv)).setText("Root permission denied or phone is not rooted!");
                        (findViewById(R.id.button_packet_capture)).setEnabled(false);
                    }
                    else {
                        if(processExistsFinal){
                            ((TextView)findViewById(R.id.main_tv)).setText("Tcpdump already running at pid: " + pidFinal );
                            bt.setText("Stop  Capture");
                            bt.setTag(1);
                        }
                        else {
                            ((TextView)findViewById(R.id.main_tv)).setText("Initialization Successful.");
                            bt.setTag(0);
                        }
                    }
                }
            });
            progressbox.dismiss();
        }
    };
    new Thread(runnable).start();
}