示例#1
0
  @Override
  public void onRequestUpdate(MegaApiJava api, MegaRequest request) {
    log("onRequestUpdate: " + request.getRequestString());

    if (request.getType() == MegaRequest.TYPE_FETCH_NODES) {
      fetchingNodesBar.setVisibility(View.VISIBLE);
      fetchingNodesBar.getLayoutParams().width = 350;
      if (request.getTotalBytes() > 0) {
        double progressValue = 100.0 * request.getTransferredBytes() / request.getTotalBytes();
        if ((progressValue > 99) || (progressValue < 0)) {
          progressValue = 100;
          title.setText(getResources().getString(R.string.preparing_nodes));
        }
        log("progressValue = " + (int) progressValue);
        fetchingNodesBar.setProgress((int) progressValue);
      }
    }
  }