本文整理汇总了Java中android.app.ProgressDialog.isShowing方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressDialog.isShowing方法的具体用法?Java ProgressDialog.isShowing怎么用?Java ProgressDialog.isShowing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ProgressDialog
的用法示例。
在下文中一共展示了ProgressDialog.isShowing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupViewsForLogin
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void setupViewsForLogin(boolean loading){
btnLogin.setEnabled(!loading);
if(loading) {
mDialog = new ProgressDialog(this);
mDialog.setIndeterminate(true);
mDialog.setMessage(getString(R.string.text_loading_login));
mDialog.show();
}else if(mDialog.isShowing()){
mDialog.dismiss();
}
}
示例2: showProgressDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void showProgressDialog(
@Nullable final String message,
final boolean cancelable,
@Nullable final DialogInterface.OnCancelListener cancelListener) {
final ProgressDialog prevDialog = dialogAtomicReference.getAndSet(null);
if (prevDialog != null && prevDialog.isShowing()) {
runOnUiThread(new Runnable() {
@Override
public void run() {
prevDialog.dismiss();
}
});
}
runOnUiThread(new Runnable() {
@Override
public void run() {
final ProgressDialog newDialog = ProgressDialog.show(
// Context
MainActivity.this,
// Title
null,
// Message
message,
// Indeterminate
true,
// Cancelable
cancelable,
// CancelListener
cancelListener
);
if (!dialogAtomicReference.compareAndSet(null, newDialog)) {
newDialog.dismiss();
}
}
});
}
示例3: dismissProgressDialogIfShowing
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void dismissProgressDialogIfShowing() {
final ProgressDialog prevDialog = dialogAtomicReference.getAndSet(null);
if (prevDialog != null && prevDialog.isShowing()) {
runOnUiThread(new Runnable() {
@Override
public void run() {
prevDialog.dismiss();
}
});
}
}
示例4: dismiss
import android.app.ProgressDialog; //导入方法依赖的package包/类
public static void dismiss(ProgressDialog progress) {
if (progress != null && progress.isShowing()){
progress.dismiss();
}
}