Java Code Examples for android.widget.ProgressBar#getMax()
The following examples show how to use
android.widget.ProgressBar#getMax() .
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: ExSimpleVpFragment.java From ExVidPlayer with Apache License 2.0 | 6 votes |
private int extractDeltaScale(int availableSpace, float deltaX, ProgressBar progressBar) { int x = (int) deltaX; float scale; float progress = progressBar.getProgress(); final int max = progressBar.getMax(); if (x < 0) { scale = (float) (x) / (float) (max - availableSpace); progress = progress - (scale * progress); } else { scale = (float) (x) / (float) availableSpace; progress += scale * max; } return (int) progress; }
Example 2
Source File: ExVpCompleteFragment.java From ExVidPlayer with Apache License 2.0 | 6 votes |
private int extractDeltaScale(int availableSpace, float deltaX, ProgressBar progressBar) { int x = (int) deltaX; float scale; float progress = progressBar.getProgress(); final int max = progressBar.getMax(); if (x < 0) { scale = (float) (x) / (float) (max - availableSpace); progress = progress - (scale * progress); } else { scale = (float) (x) / (float) availableSpace; progress += scale * max; } return (int) progress; }
Example 3
Source File: ExVpFragment.java From ExVidPlayer with Apache License 2.0 | 6 votes |
private int extractDeltaScale(int availableSpace, float deltaX, ProgressBar progressBar) { int x = (int) deltaX; float scale; float progress = progressBar.getProgress(); final int max = progressBar.getMax(); if (x < 0) { scale = (float) (x) / (float) (max - availableSpace); progress = progress - (scale * progress); } else { scale = (float) (x) / (float) availableSpace; progress += scale * max; } return (int) progress; }
Example 4
Source File: ViewUtil.java From BaseProject with Apache License 2.0 | 5 votes |
public static void animProgressBar(ProgressBar pb, int fromValue, int toValue) { if (pb != null) { if (fromValue == -1) { fromValue = pb.getProgress(); } int maxProgress = pb.getMax(); if (toValue == -1 || toValue > maxProgress) { toValue = maxProgress; } animView(pb, "progress", fromValue, toValue) .setDuration(2000) .start() ; } }
Example 5
Source File: BookOnlineActivity.java From coolreader with MIT License | 4 votes |
public void handleMessage(Message msg) { if (msg.what == 1) { String url = (String) msg.obj; int length = msg.arg1; ProgressBar bar = ProgressBars.get(url); if (bar != null) { // 设置进度条按读取的length长度更新 bar.incrementProgressBy(length); if (bar.getProgress() == bar.getMax()) { notificationManager.cancel(notificationId); btnDownload.setText("下载"); // 下载完成后清除进度条并将map中的数据清空 LinearLayout layout = (LinearLayout) bar.getParent(); layout.removeView(bar); ProgressBars.remove(url); downloaders.get(url).delete(url); downloaders.get(url).reset(); downloaders.remove(url); new AlertDialog.Builder(BookOnlineActivity.this).setTitle("提示").setMessage("下载完成,是否将《"+bookNames[currentPosition]+"》加入书架?") .setPositiveButton("加入", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if(BookUtil.isExist( DbDataOperation.getBookInfo(resolver), SD_PATH+bookNames[currentPosition]+".txt")==true) { new AlertDialog.Builder(BookOnlineActivity.this).setTitle("提示").setMessage("此书在书架中已存在,无需继续添加!").setPositiveButton("确定", null).show(); } else { DbDataOperation.insertToBookInfo(resolver, bookNames[currentPosition], "未知", SD_PATH+bookNames[currentPosition]+".txt", TimeUtil.getCurrentTime(), TimeUtil.getCurrentTime(), 0, "未分类",BookUtil.getBookSize(SD_PATH+bookNames[currentPosition]+".txt"), "0.0%"); MainTabActivity.thMain.setCurrentTabByTag(MainTabActivity.TAB_BOOKSHELF); } } }).setNegativeButton("取消", null).show(); } } } }