getMax ( )源码实例Demo

android.widget.ProgressBar#getMax ( )源码实例Demo

下面列出了android.widget.ProgressBar#getMax ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ExVidPlayer   文件: ExSimpleVpFragment.java
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;
}
 
源代码2 项目: ExVidPlayer   文件: ExVpCompleteFragment.java
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;
}
 
源代码3 项目: ExVidPlayer   文件: ExVpFragment.java
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;
}
 
源代码4 项目: BaseProject   文件: ViewUtil.java
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()
        ;
    }
}
 
源代码5 项目: coolreader   文件: BookOnlineActivity.java
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();
            }
        }
    }
}