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

The following examples show how to use android.app.ProgressDialog#setCancelable() . 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: ActivityUtils.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final ProgressDialog dialog = new ProgressDialog(getActivity());
    //
    Bundle b = getArguments();
    if (b != null) {
        String title = b.getString("title");
        String content = b.getString("content");
        dialog.setTitle(title);
        if (StringUtils.isEmpty(content))
            content = ActivityUtils.getSaying();
        dialog.setMessage(content);
    }


    dialog.setCanceledOnTouchOutside(true);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setIndeterminate(true);
    dialog.setCancelable(true);


    // etc...
    this.setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme);
    return dialog;
}
 
Example 2
Source File: LocationCloserBaseFragment.java    From edslite with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onResumeUI(Bundle args)
{
          Activity activity = getActivity();
          _dialog = new ProgressDialog(activity);
          _dialog.setMessage (activity.getText(R.string.closing));
          _dialog.setIndeterminate(true);
          _dialog.setCancelable(false);
          _dialog.setOnCancelListener(new DialogInterface.OnCancelListener()
          {
              @Override
              public void onCancel(DialogInterface dialog)
              {
                  CloseLocationTaskFragment f = (CloseLocationTaskFragment) getFragmentManager().findFragmentByTag(CloseLocationTaskFragment.TAG);
                  if(f!=null)
                      f.cancel();
              }
          });
          _dialog.show();
}
 
Example 3
Source File: MaoniDoorbellListener.java    From maoni with MIT License 6 votes vote down vote up
FeedbackSenderTask(Feedback feedback) {
    this.feedback = feedback;
    alertDialog = new ProgressDialog(mActivity);
    alertDialog.setTitle(mWaitDialogTitle);
    alertDialog.setMessage(mWaitDialogMessage);
    alertDialog.setIndeterminate(false);
    alertDialog.setCancelable(false);
    alertDialog.setCanceledOnTouchOutside(false);
    alertDialog.setMax(100);
    alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, mWaitDialogCancelButtonText,
            new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            FeedbackSenderTask.this.cancel();
        }
    });
    alertDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mActivity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            alertDialog.show();
        }
    });
    this.properties = new HashMap<>();
    this.tags = new ArrayList<>();
}
 
Example 4
Source File: CurrencyActivity.java    From Travel-Mate with MIT License 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_utilities_currency_converter);
    ButterKnife.bind(this);
    setTitle(R.string.text_currency);

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    mToken = sharedPreferences.getString(USER_TOKEN, null);
    mDialog = new ProgressDialog(this);
    mDialog.setMessage(getResources().getString(R.string.progress_wait));
    mDialog.setTitle(R.string.app_name);
    mDialog.setCancelable(false);

    sDefSystemLanguage = Locale.getDefault().getLanguage();

    currences_names = new ArrayList<>();
    mHandler = new Handler(Looper.getMainLooper());
    mContext = this;

    Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
}
 
Example 5
Source File: PlayerView.java    From qplayer-sdk with MIT License 5 votes vote down vote up
private void showWaitDialog () {
	m_dlgWait = new ProgressDialog(this);
	m_dlgWait.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	m_dlgWait.setMessage("wait...");
	m_dlgWait.setIndeterminate(false);
	m_dlgWait.setCancelable(true);
	m_dlgWait.show();
}
 
Example 6
Source File: updateComicDatabase.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    if (showProgress) {
        progress = new ProgressDialog(context);
        progress.setTitle(context.getResources().getString(R.string.update_database));
        progress.setMessage(context.getResources().getString(R.string.update_database_message));
        progress.setIndeterminate(false);
        progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        progress.setCancelable(false);
        progress.show();
    }
}
 
Example 7
Source File: UpdateCheckActivity.java    From kcanotify with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    is_finishing = isFinishing();
    mProgressDialog = new ProgressDialog(UpdateCheckActivity.this);
    mProgressDialog.setMessage(getStringWithLocale(R.string.download_progress));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setProgressNumberFormat("%1d file(s)");

    if (!is_finishing) {
        mProgressDialog.show();
    }
}
 
Example 8
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 9
Source File: MainActivity.java    From IPTVFree with Apache License 2.0 5 votes vote down vote up
/**
 * On click interface implemented
 * @param v View
 */
@Override
public void onClick(View v) {
    int id = v.getId();
    switch (id){
        case R.id.fabMenu:
            animateFAB();
            break;
        case R.id.fabAdd:
            Utils.addFromURLOrFolder(MainActivity.this);
            closeFAB();
            break;
        case R.id.fabDownload:
            closeFAB();
            mProgressDialog = new ProgressDialog(MainActivity.this);
            mProgressDialog.setMessage(getResources().getString(R.string.download_message));
            mProgressDialog.setIndeterminate(true);
            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            mProgressDialog.setCancelable(true);
            final DownloadM3UList downloadTask = new DownloadM3UList(MainActivity.this);
            downloadTask.execute(URL);

            mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    downloadTask.cancel(true);
                }
            });
            break;
    }
}
 
Example 10
Source File: TraitEditorActivity.java    From Field-Book with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();

    dialog = new ProgressDialog(thisActivity);
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.setMessage(Html
            .fromHtml(thisActivity.getString(R.string.import_dialog_importing)));
    dialog.show();
}
 
Example 11
Source File: AppList.java    From CustomText with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
	dialog = new ProgressDialog(((ListView) findViewById(R.id.lstApps)).getContext());
	dialog.setMessage(getString(R.string.app_loading));
	dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	dialog.setCancelable(false);
	dialog.show();
}
 
Example 12
Source File: ComposeActivity.java    From MusicPlus with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_compose);
	svVideoPreview = findView(R.id.sv_video_preview);
	btnRecord = findView(R.id.btn_record);
	btnRecord.setOnClickListener(this);
	btnAddMusic = findView(R.id.btn_add_music);
	btnAddMusic.setOnClickListener(this); 
	containerAudioTracks = findView(R.id.container_musics);
	btnPreview = findView(R.id.btn_preview);
	btnPreview.setOnClickListener(this);
	btnRedoRecord = findView(R.id.btn_re_record);
	btnRedoRecord.setOnClickListener(this);
	
	videoRecorder = new VideoRecorder(this, svVideoPreview, TEMP_RECORD_VIDEO_FILE,recordBarrier);
	recordState = RECORD_STATE_INITIAL;
	
	isIncludeVideoAudio = getIntent().getBooleanExtra(EX_INCLUDE_VIDEO_AUDIO, false);
	
	LayoutParams lpPre = svVideoPreview.getLayoutParams();
	lpPre.height = 1080 * 640 / 480;
	svVideoPreview.setLayoutParams(lpPre);
	
	dlgDecoding = new ProgressDialog(this);
	dlgDecoding.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	dlgDecoding.setCancelable(false);
	dlgDecoding.setCanceledOnTouchOutside(false);
	dlgDecoding.setMax(MAX_PROGRESS);
	
	dlgMuxing = new ProgressDialog(this);
	dlgMuxing.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	dlgMuxing.setCancelable(false);
	dlgMuxing.setCanceledOnTouchOutside(false);
}
 
Example 13
Source File: WhatIfFavoritesFragment.java    From Easy_xkcd with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    progress = new ProgressDialog(getActivity());
    progress.setMessage(getResources().getString(R.string.loading_articles));
    progress.setIndeterminate(true);
    progress.setCancelable(false);
    progress.show();
}
 
Example 14
Source File: DialogCreator.java    From MissZzzReader with Apache License 2.0 5 votes vote down vote up
/**
     * 创建一个进度对话框(圆形、旋转)
     *
     * @param context
     * @param title
     * @param message
     * @return
     */
    public static ProgressDialog createProgressDialog
    (Context context, String title, String message/*,
             DialogInterface.OnClickListener positiveListener,DialogInterface.OnClickListener negativeListener*/) {

        final ProgressDialog progressDialog = new ProgressDialog(context);
//        normalDialog.setIcon(R.drawable.icon_dialog);
        if (!StringHelper.isEmpty(title)) {
            progressDialog.setTitle(title);
        }
        if (!StringHelper.isEmpty(message)) {
            progressDialog.setMessage(message);
        }
        progressDialog.setCancelable(false);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
      /*  progressDialog.setPositiveButton("确定",positiveListener);
        progressDialog.setNegativeButton("取消",negativeListener);*/
        // 显示
        MyApplication.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                try {
                    progressDialog.show();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        return progressDialog;
    }
 
Example 15
Source File: BasicFragment.java    From HouSi with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getString(R.string.checking_for_su));
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.show();
}
 
Example 16
Source File: OForm.java    From hr with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    mDialog = new ProgressDialog(mContext);
    mDialog.setTitle(mContext.getString(R.string.title_working));
    mDialog.setMessage(mContext.getString(R.string.title_please_wait));
    mDialog.setCancelable(false);
    mDialog.show();
}
 
Example 17
Source File: ContextUtils.java    From WayHoo with Apache License 2.0 4 votes vote down vote up
public static ProgressDialog createProgressDialog(Context context) {
	ProgressDialog dialog = new ProgressDialog(context);
	dialog.setIndeterminate(true);
	dialog.setCancelable(true);
	return dialog;
}
 
Example 18
Source File: Noapp.java    From WhatsApp-Cleaner with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.no_app);

    SharedPreferences sharedPreferences = this.getSharedPreferences("Network",0);
    boolean status = sharedPreferences.getBoolean("Status",false);

    progressDialog = new ProgressDialog(this);
    progressDialog.setMessage("Please Wait");
    progressDialog.setCancelable(false);
    progressDialog.show();

    settings = getSharedPreferences(PREFS, MODE_PRIVATE);


    // First time running app?
    if (!settings.contains("lastRun"))
        enableNotification(null);
    else
        recordRunTime();

    Log.v(TAG, "Starting CheckRecentRun service...");
    startService(new Intent(this, CheckRecentRun.class));

    if (!status) {
        progressDialog.dismiss();
        Toast.makeText(Noapp.this, "Please Install WhatsApp Messenger", Toast.LENGTH_LONG).show();
        finishAffinity();

    } else {
        mAdView = findViewById(R.id.adView);
        mAdView.loadAd(new AdRequest.Builder().addTestDevice("623B1B7759D51209294A77125459D9B7").addTestDevice("C07AF1687B80C3A74C718498EF9B938A").build());

        mAdView.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {
                progressDialog.dismiss();
                if (!mAdView.isLoading()) {
                    mAdView.loadAd(new AdRequest.Builder().addTestDevice("623B1B7759D51209294A77125459D9B7").addTestDevice("C07AF1687B80C3A74C718498EF9B938A").build());
                }
                finishAffinity();
            }

            @Override
            public void onAdLoaded() {
                Log.e("Banner", "Loaded");
                progressDialog.dismiss();
                Toast.makeText(Noapp.this, "Please Install WhatsApp Messenger", Toast.LENGTH_LONG).show();
            }

            @Override
            public void onAdFailedToLoad(int i) {
                Log.e("Bannercode", String.valueOf(i));
                progressDialog.dismiss();
                Toast.makeText(Noapp.this, "Please Install WhatsApp Messenger", Toast.LENGTH_LONG).show();
                finishAffinity();
            }
        });

    }
}
 
Example 19
Source File: ToolsSampleInstaller.java    From Beats with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void extract() {
	/*
	DialogInterface.OnClickListener extract_action = new DialogInterface.OnClickListener() {
		public void onClick(DialogInterface dialog, int id) {
			Tools.track("Extract samples");
			extractSampleZip();
			dialog.cancel();
		}
	};

	Tools.alert(
			Tools.getString(R.string.Button_install),
			R.drawable.icon_zip,
			Tools.getString(R.string.ToolsUnzipper_install_ask) +
			Tools.getString(R.string.Tools_sample_zip) +
			Tools.getString(R.string.ToolsUnzipper_install_ask_location) +
			Tools.getSongsDir(),
			Tools.getString(R.string.Button_yes),
			extract_action,
			Tools.getString(R.string.Button_no),
			Tools.cancel_action,
			-1
			);
	*/
	extractingBar =	new ProgressDialog(a);
	extractingBar.setCancelable(false);
	extractingBar.setMessage(
			Tools.getString(message)
			);
	extractingBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	extractingBar.setOwnerActivity(a);
	extractingBar.show();
	
	extracthandler = new Handler() {
		public void handleMessage(Message msg) {
			try {
				if (extractingBar != null) extractingBar.dismiss();
			} catch (IllegalArgumentException e) {
				ToolsTracker.error("ToolsSampleInstaller.handleMessage", e, path);
				if (Tools.getBooleanSetting(R.string.debugLogCat, R.string.debugLogCatDefault)) {
					Tools.toast(Tools.getString(R.string.Tools_window_error));
				}
			}
			if (success) {
				new ToolsUnzipper(a, path, true).unzip();
			} else {
				Tools.error(
						errorMsg,
						Tools.cancel_action
						);
			}
		}
	};
	
	// Just extract anyway without prompt
	new Thread(this).start();
}
 
Example 20
Source File: PstDetailFragment.java    From Presentation with Apache License 2.0 4 votes vote down vote up
DownloadListener() {
    mDialog = new ProgressDialog(mContext);
    mDialog.setMessage(getString(R.string.stand_by));
    mDialog.setCancelable(false);
}