本文整理汇总了Java中android.app.ProgressDialog.setProgress方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressDialog.setProgress方法的具体用法?Java ProgressDialog.setProgress怎么用?Java ProgressDialog.setProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ProgressDialog
的用法示例。
在下文中一共展示了ProgressDialog.setProgress方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle args = getArguments();
int size = args.getInt(ARG_SIZE);
String message = args.getString(ARG_MESSAGE);
messagingListener = new SimpleMessagingListener() {
@Override
public void updateProgress(int progress) {
dialog.setProgress(progress);
}
};
messagingController = MessagingController.getInstance(getActivity());
messagingController.addListener(messagingListener);
dialog = new ProgressDialog(getActivity());
dialog.setMessage(message);
dialog.setMax(size);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setProgress(0);
dialog.show();
return dialog;
}
示例2: openFileWithUI
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void openFileWithUI(File inputFile) {
final Activity activity = this;
final ProgressDialog pd = new ProgressDialog(activity);
pd.setTitle(getString(R.string.reading_dialog_title));
pd.setMessage(getString(R.string.reading_dialog_text));
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setMax(100);
pd.setProgress(0);
pd.setIndeterminate(true);
pd.setCancelable(false);
pd.show();
new FileOpenThread(inputFile, this, (o, n) -> {
pd.setIndeterminate(false);
pd.setProgress(n);
}, pd::dismiss, bookOpeningResult -> {
if (bookOpeningResult != null) {
addNewBookToBooksList(bookOpeningResult);
}
}).start();
}
示例3: queryCredit
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void queryCredit() {
if (WifiUtility.isNetworkAvailable(getActivity())) {
if(Utility.checkAccount(getActivity())) {
pd = new ProgressDialog(getActivity());
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setProgress(0);
pd.setTitle(getString(R.string.credit_updating));
pd.setCancelable(false);
pd.show();
nextThread = new Thread(new CreditLoginRunnable(creditLoginHandler));
loginNportal();
}
} else {
Toast.makeText(getActivity(), R.string.check_network_available,
Toast.LENGTH_LONG).show();
}
}
示例4: onPreExecute
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
m_dialog = new ProgressDialog(m_context);
m_dialog.setCancelable(true);
m_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
m_dialog.setProgress(0);
m_dialog.setMax(getExternalNotes().size());
m_dialog.show();
}
示例5: onPreExecute
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
m_dialog = new ProgressDialog(m_context);
m_dialog.setCancelable(true);
m_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
m_dialog.setProgress(0);
m_dialog.setMax(m_numberOfNotes);
m_dialog.show();
}
示例6: setUpProgressDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
static void setUpProgressDialog(Context context) {
mProgressDialog = new ProgressDialog(context);
mProgressDialog.setCancelable(false);
mProgressDialog.setMessage(context.getString(R.string.loading));
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setProgress(0);
mProgressDialog.setMax(100);
}
示例7: createProgressDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
private ProgressDialog createProgressDialog(Context context) {
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.setMessage("Loading");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);
progressDialog.setProgress(0);
return progressDialog;
}
示例8: progressUpdater
import android.app.ProgressDialog; //导入方法依赖的package包/类
public Runnable progressUpdater(final ProgressDialog progressDialog, final int progress, final String msg) {
return new Runnable() {
@Override
public void run() {
if(progressDialog!=null) {
progressDialog.setProgress(progress);
progressDialog.setMessage(msg);
}
}
};
}
示例9: RunAndGetDeterminantWithAdjoint
import android.app.ProgressDialog; //导入方法依赖的package包/类
public void RunAndGetDeterminantWithAdjoint(final int i, final ProgressDialog progressDialog) {
Runnable runnable = new Runnable() {
@Override
public void run() {
Message message = new Message();
Bundle bundle = new Bundle();
float detr = (float) SquareList.get(i).GetDeterminant(progressDialog);
if (detr == 0.0f) {
myHandler.postDelayed(new Runnable() {
@Override
public void run() {
Toast.makeText(getContext(), R.string.NoInverse, Toast.LENGTH_SHORT).show();
}
}, 0);
progressDialog.dismiss();
} else {
progressDialog.setProgress(0);
bundle.putFloat("DETERMINANT", detr);
Matrix res = SquareList.get(i).ReturnAdjoint(progressDialog);
bundle.putAll(res.GetDataBundled());
message.setData(bundle);
myHandler.sendMessage(message);
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
示例10: getXApplicationList
import android.app.ProgressDialog; //导入方法依赖的package包/类
public static List<ApplicationInfoEx> getXApplicationList(Context context, ProgressDialog dialog) {
// Get references
PackageManager pm = context.getPackageManager();
// Get app list
SparseArray<ApplicationInfoEx> mapApp = new SparseArray<ApplicationInfoEx>();
List<ApplicationInfoEx> listApp = new ArrayList<ApplicationInfoEx>();
List<ApplicationInfo> listAppInfo = pm.getInstalledApplications(PackageManager.GET_META_DATA);
if (dialog != null)
dialog.setMax(listAppInfo.size());
for (int app = 0; app < listAppInfo.size(); app++) {
if (dialog != null)
dialog.setProgress(app + 1);
ApplicationInfo appInfo = listAppInfo.get(app);
Util.log(null, Log.INFO, "package=" + appInfo.packageName + " uid=" + appInfo.uid);
ApplicationInfoEx appInfoEx = new ApplicationInfoEx(context, appInfo.uid);
if (mapApp.get(appInfoEx.getUid()) == null) {
mapApp.put(appInfoEx.getUid(), appInfoEx);
listApp.add(appInfoEx);
}
}
// Sort result
Collections.sort(listApp);
return listApp;
}
示例11: download
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void download() {
String url = "http://downloads.easemob.com/downloads/easemob-sdk-3.3.1_r1.zip";
String dirPath = getExternalCacheDir().getAbsolutePath();
String fileName = "download_test.zip";
final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setTitle("更新");
progressDialog.setMessage("更新中,请稍候...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setMax(100);
progressDialog.setProgress(10);
progressDialog.setCancelable(false);
final DownloadHelper downloadHelper = new DownloadHelper(url, dirPath, fileName);
downloadHelper.downloadFile(new DownloadListener() {
@Override
public void update(long bytesRead, long contentLength) {
Logger.e("----bytesRead=" + bytesRead);
Logger.e("----contentLength=" + contentLength);
progressDialog.setProgress((int) ((100 * bytesRead) / contentLength));
}
@Override
public void onSuccess(File file) {
progressDialog.cancel();
Logger.e(file.getAbsolutePath() + "----" + file.length());
}
@Override
public void onFailure(Throwable t) {
progressDialog.cancel();
Logger.e("----" + t.toString());
}
});
progressDialog.setButton3("取消下载", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
downloadHelper.cancelDownload();
}
});
progressDialog.show();
}
示例12: pasteFiles
import android.app.ProgressDialog; //导入方法依赖的package包/类
public void pasteFiles(final File destination) {
final Operations op = Operations.getInstance(mContext);
final List<FileItem> selectedItems = op.getSelectedFiles();
final Operations.FILE_OPERATIONS operation = op.getOperation();
if(destination.canWrite()) {
if (selectedItems != null && selectedItems.size() > 0) {
final ProgressDialog progressDialog = new ProgressDialog(mContext);
String title = "Please Wait... ";
progressDialog.setTitle(title);
if (operation == Operations.FILE_OPERATIONS.COPY)
progressDialog.setTitle("Copying " + title);
else if (operation == Operations.FILE_OPERATIONS.CUT)
progressDialog.setTitle("Moving " + title);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);
progressDialog.setMessage("");
progressDialog.setProgress(0);
progressDialog.show();
executor.execute(new Runnable() {
@Override
public void run() {
int i = 0;
float TOTAL_ITEMS = selectedItems.size();
try {
for (; i < selectedItems.size(); i++) {
mUIUpdateHandler.post(mHelper.progressUpdater(progressDialog, (int) ((i / TOTAL_ITEMS) * 100), "File: " + selectedItems.get(i).getFile().getName()));
if (selectedItems.get(i).getFile().isDirectory()) {
if (operation == Operations.FILE_OPERATIONS.CUT)
FileUtils.moveDirectory(selectedItems.get(i).getFile(), new File(destination, selectedItems.get(i).getFile().getName()));
else if (operation == Operations.FILE_OPERATIONS.COPY)
FileUtils.copyDirectory(selectedItems.get(i).getFile(), new File(destination, selectedItems.get(i).getFile().getName()));
} else {
if (operation == Operations.FILE_OPERATIONS.CUT)
FileUtils.moveFile(selectedItems.get(i).getFile(), new File(destination, selectedItems.get(i).getFile().getName()));
else if (operation == Operations.FILE_OPERATIONS.COPY)
FileUtils.copyFile(selectedItems.get(i).getFile(), new File(destination, selectedItems.get(i).getFile().getName()));
}
}
mUIUpdateHandler.post(new Runnable() {
@Override
public void run() {
op.resetOperation();
}
});
mUIUpdateHandler.post(mHelper.toggleProgressBarVisibility(progressDialog));
mUIUpdateHandler.post(mHelper.updateRunner());
} catch (IOException e) {
e.printStackTrace();
mUIUpdateHandler.post(mHelper.toggleProgressBarVisibility(progressDialog));
mUIUpdateHandler.post(mHelper.errorRunner("An error occurred while pasting "));
}
}
});
} else {
UIUtils.ShowToast("No Items Selected!", mContext);
}
} else {
UIUtils.ShowToast("No Write permissions for the paste directory",mContext);
}
}
示例13: GetDeterminant
import android.app.ProgressDialog; //导入方法依赖的package包/类
public double GetDeterminant(ProgressDialog px) {
double Result = 0;
int total = 0;
int flag = 0, a = 0, b = 0;
int Order = this.GetRow();
if (Order == 1) {
Result = this.Elements[0][0];
px.setProgress(100);
return Result;
}
if (Order == 2) {
float l = this.Elements[0][0] * this.Elements[1][1];
float m = this.Elements[1][0] * this.Elements[0][1];
Result = l - m;
px.setProgress(100);
return Result;
} else {
for (; flag < Order; flag++) {
Matrix pointer = new Matrix(Order - 1);
for (int i = 1; i < Order; i++) {
px.setProgress((total * 100) / (Order * Order));
total++;
for (int j = 0; j < Order; j++) {
if (flag != j) {
float pg = this.Elements[i][j];
pointer.PushAt(a, b, pg);
b++;
}
}
a++;
b = 0;
}
a = 0;
b = 0;
double z = pointer.GetDeterminant();
Result += Math.pow(-1, flag) * (this.Elements[0][flag] * z);
}
}
px.setProgress(100);
return Result;
}
示例14: MakeAdjoint
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void MakeAdjoint(ProgressDialog Progress) {
int Order = this.GetCol();
Matrix base = new Matrix(Order);
int flag, a = 0, b = 0;
if (Order == 2) {
float buffer = this.Elements[0][0];
this.Elements[0][0] = this.Elements[1][1];
this.Elements[1][1] = buffer;
this.Elements[1][0] *= (-1);
this.Elements[0][1] *= (-1);
buffer = this.Elements[1][0];
this.Elements[1][0] = this.Elements[0][1];
this.Elements[0][1] = buffer;
this.SquareTranspose();
Progress.setProgress(100);
} else {
for (int k = 0; k < Order; k++) {
Progress.setProgress((k * 100) / Order);
for (flag = 0; flag < Order; flag++) {
Progress.setSecondaryProgress((flag * 100) / Order);
Matrix pointer = new Matrix(Order - 1);
for (int i = 0; i < Order; i++) {
for (int j = 0; j < Order; j++) {
if ((flag != j) && (k != i)) {
float pg = this.Elements[i][j];
pointer.PushAt(a, b, pg);
b++;
}
}
if (k != i)
a++;
b = 0;
}
float z = (float) pointer.GetDeterminant();
int variable = k + flag;
base.Elements[k][flag] = (float) Math.pow((-1), variable) * z;
a = 0;
b = 0;
}
}
this.CopyFrom(base);
this.SquareTranspose();
Progress.setProgress(100);
}
}