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

The following examples show how to use android.app.ProgressDialog#setProgressStyle() . 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: FragmentTestActivity.java    From android-task with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setMessage(getString(R.string.rotate_the_device));
    progressDialog.setCancelable(false);
    progressDialog.setIndeterminate(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (mTaskId != -1) {
                SimpleTask task = (SimpleTask) TaskExecutor.getInstance().getTask(mTaskId);
                if (task != null) {
                    task.cancel();
                }
            }
        }
    });

    return progressDialog;
}
 
Example 2
Source File: AbstractCreationTask.java    From droitatedDB with Apache License 2.0 6 votes vote down vote up
public AbstractCreationTask(final Context context, final CreationFinishedListener listener) {
	this.context = context;
	this.listener = listener;

	progressDialog = new ProgressDialog(context, ProgressDialog.THEME_HOLO_DARK);
	progressDialog.setTitle("Batch creation");
	progressDialog.setMessage(dialogMsg());
	progressDialog.setCancelable(true);
	progressDialog.setCanceledOnTouchOutside(false);
	progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	progressDialog.setMax(times());
	progressDialog.setProgress(0);

	if (times() == 1) {
		progressDialog.setIndeterminate(true);
	} else {
		progressDialog.setIndeterminate(false);
	}
}
 
Example 3
Source File: ProgressDialogFragment.java    From BambooPlayer with Apache License 2.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);
		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 4
Source File: StringAsyncTask.java    From geopaparazzi with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
    if (doProgress) {
        progressDialog = new ProgressDialog(context);
        if (title == null) {
            progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        } else {
            progressDialog.setTitle(title);
        }
        progressDialog.setMessage(message);
        progressDialog.setCancelable(cancelable);
        if (max == null) {
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.setIndeterminate(true);
        } else {
            progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            progressDialog.setIndeterminate(false);
            progressDialog.setProgress(0);
            progressDialog.setMax(max);
        }
        progressDialog.show();
    }
}
 
Example 5
Source File: FilesActivity.java    From dropbox-sdk-java with MIT License 5 votes vote down vote up
@Override
protected void loadData() {

    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setCancelable(false);
    dialog.setMessage("Loading");
    dialog.show();

    new ListFolderTask(DropboxClientFactory.getClient(), new ListFolderTask.Callback() {
        @Override
        public void onDataLoaded(ListFolderResult result) {
            dialog.dismiss();

            mFilesAdapter.setFiles(result.getEntries());
        }

        @Override
        public void onError(Exception e) {
            dialog.dismiss();

            Log.e(TAG, "Failed to list folder.", e);
            Toast.makeText(FilesActivity.this,
                    "An error has occurred",
                    Toast.LENGTH_SHORT)
                    .show();
        }
    }).execute(mPath);
}
 
Example 6
Source File: BitmapDialogCallback.java    From okhttp-OkGo with Apache License 2.0 5 votes vote down vote up
public BitmapDialogCallback(Activity activity) {
    super(1000, 1000);
    dialog = new ProgressDialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setMessage("请求网络中...");
}
 
Example 7
Source File: MainActivity.java    From BaoKanAndroid 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 8
Source File: DeleteFileUtils.java    From Gallery-example with GNU General Public License v3.0 5 votes vote down vote up
protected void onPreExecute() {

            progressDialog = new ProgressDialog(activity);
            progressDialog.setMessage(activity.getString(R.string.deleting));
            progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            progressDialog.setIndeterminate(true);
            progressDialog.setProgressNumberFormat(null);
            progressDialog.setProgressPercentFormat(null);
            progressDialog.setCancelable(false);
            progressDialog.show();
        }
 
Example 9
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 10
Source File: BleScanActivity.java    From BleLib with Apache License 2.0 5 votes vote down vote up
private void showDialog(String message) {
    progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setMessage(message);
    progressDialog.show();
}
 
Example 11
Source File: TextLoadTask.java    From JotaTextEditor with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onPreExecute()
    {
        super.onPreExecute();
        if ( mFileLoadListener!= null ){
            mFileLoadListener.onPreFileLoad();
        }
        mProgressDialog = new ProgressDialog(mActivity);
//        mProgressDialog.setTitle(R.string.spinner_message);
        mProgressDialog.setMessage(mActivity.getString(R.string.spinner_message));
        mProgressDialog.setIndeterminate(true);
        mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mProgressDialog.setCancelable(false);
        mProgressDialog.show();
    }
 
Example 12
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 13
Source File: ResetIngredients.java    From biermacht with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
  super.onPreExecute();
  progress = new ProgressDialog(this.context);
  progress.setMessage(this.message);
  progress.setIndeterminate(false);
  progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
  progress.setCancelable(false);
  progress.show();
}
 
Example 14
Source File: DownloadFromUrlActivity.java    From Instagram-Profile-Downloader with MIT License 5 votes vote down vote up
protected void onPreExecute() {
    super.onPreExecute();
    progressDialog = new ProgressDialog(context);
    progressDialog.setMessage("Downloading video...");
    progressDialog.setProgressStyle(1);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setMax(100);
    progressDialog.show();
    //Toast.makeText(getActivity(), "Downloading video....", Toast.LENGTH_SHORT).show();
}
 
Example 15
Source File: MainActivity.java    From biermacht with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
  super.onPreExecute();
  Log.d("MainActivity", "About to load recipes from file - starting progress spinner");
  progress = new ProgressDialog(MainActivity.this);
  progress.setMessage("Loading...");
  progress.setIndeterminate(false);
  progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
  progress.setCancelable(false);
  progress.show();
}
 
Example 16
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 17
Source File: LrcJaeger.java    From LrcJaeger with Apache License 2.0 5 votes vote down vote up
private void download(final ArrayList<SongItem> listAll, final LrcJaeger activity) {
    if (listAll.size() > 0) {
        final ProgressDialog progressDialog = new ProgressDialog(activity);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        progressDialog.setTitle(activity.getString(R.string.title_downloading));
        progressDialog.setProgress(0);
        progressDialog.setMax(listAll.size());
        progressDialog.show();

        activity.mTask = new BulkDownloadTask(new BulkDownloadTask.EventListener() {
            @Override
            public void onFinish(int downloaded) {
                progressDialog.dismiss();
                sendEmptyMessage(MSG_UPDATE_LRC_ICON_ALL);

                String text = String.format(activity.getString(R.string.toast_lrc_downloaded),
                        downloaded, listAll.size());
                Toast.makeText(activity, text, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onProgressUpdate(int progress) {
                progressDialog.setProgress(progress);
            }
        });
        activity.mTask.execute(listAll.toArray(new SongItem[1]));
    }
}
 
Example 18
Source File: MainActivity.java    From XposedAppLocale with Apache License 2.0 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);

    prefsFile.setReadable(true, false);
    mPrefs = getSharedPreferences(Common.PREFS, Context.MODE_WORLD_READABLE);

    languages = new ArrayList<>();
    LocaleList localeList = new LocaleList(getApplicationContext(), "");
    languages.addAll(localeList.getDescriptionList());
    languages.remove(0);

    checkItems = new boolean[languages.size()];
    String[] langs = mPrefs.getString("languages", "").split(",");
    for (int i = 0; i < langs.length; i++) {
        int index = languages.indexOf(localeList.getDescriptionList().get(localeList.getLocalePos(langs[i])));
        if (index > -1) {
            checkItems[index] = true;
        }
    }

    tmpCheckItems = Arrays.copyOf(checkItems, checkItems.length);

    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addItemDecoration(new DividerDecoration(this));

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mRecyclerView.scrollToPosition(0);
        }
    });

    pm = getPackageManager();
    List<PackageInfo> packages = pm.getInstalledPackages(0);

    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setMax(packages.size());
    mProgressDialog.setMessage(getString(R.string.loading_apps));
    mProgressDialog.setCancelable(false);

    new GetAppsTask().execute(packages);
}
 
Example 19
Source File: BankCardActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 4 votes vote down vote up
private void getData(final boolean needDialog) {
    final ProgressDialog dialog = new ProgressDialog(BankCardActivity.this);
    if (needDialog) {

        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setMessage("正在加载...");
        dialog.show();
    }
    
    Map<String, String> map = new HashMap<String, String>();

    map.put("hxid", MYApplication.getInstance().getUserName());

    LoadDataFromServer task = new LoadDataFromServer(BankCardActivity.this,
            Constant.URL_CARDS, map);

    task.getData(new DataCallBack() {

        @Override
        public void onDataCallBack(JSONObject data) {
            if (needDialog && dialog.isShowing()) {
                dialog.dismiss();
            }
            if (data == null) {

                Toast.makeText(getApplicationContext(), "访问服务器错误,更新失敗...",
                        Toast.LENGTH_SHORT).show();
                return;

            }
            int code = data.getInteger("code");
            if (code == 1) {
                datas = data.getJSONArray("data");
                adapter = new MyAdapter(BankCardActivity.this, datas);
                listView.setAdapter(adapter);
                ACache.get(getApplicationContext()).put(Constant.CARDLIST,
                        datas);
            } else {

                Toast.makeText(getApplicationContext(), "更新失敗...",
                        Toast.LENGTH_SHORT).show();
            }
        }
    });
}
 
Example 20
Source File: BaseFragmentActivity.java    From Broadsheet.ie-Android with MIT License 3 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mProgressDialog = new ProgressDialog(this);

    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

    EasyTracker.getInstance().setContext(this);

}