public void updateView(int downLoadedBytes, int totalBytes, int status) {
    if (DownloadUtils.isDownloading(status)) {
      downloadProgress.setVisibility(View.VISIBLE);
      downloadProgress.setMax(0);
      downloadProgress.setProgress(0);
      downloadSize.setVisibility(View.VISIBLE);
      downloadPercent.setVisibility(View.VISIBLE);
      downloadCancel.setVisibility(View.VISIBLE);

      if (totalBytes < 0) {
        downloadProgress.setIndeterminate(true);
        downloadPercent.setText("0%");
        downloadSize.setText("0M/0M");
      } else {
        downloadProgress.setIndeterminate(false);
        downloadProgress.setMax(totalBytes);
        downloadProgress.setProgress(downLoadedBytes);
        downloadPercent.setText(DownloadUtils.getNotiPercent(downLoadedBytes, totalBytes));
        downloadSize.setText(
            DownloadUtils.getAppSize(downLoadedBytes) + "/" + DownloadUtils.getAppSize(totalBytes));
      }
    } else {
      downloadProgress.setMax(0);
      downloadProgress.setProgress(0);
      processView.setVisibility(View.GONE);

      if (status == DownloadManager.STATUS_FAILED) {
      } else if (status == DownloadManager.STATUS_SUCCESSFUL) {
      } else {
      }
    }
  }
Exemplo n.º 2
0
        @Override
        public View getView(int position, View v, ViewGroup parent) {

          Overførsler.Overførsel ovf = liste.get(position);
          AQuery aq;
          if (v == null) {
            v =
                getLayoutInflater(null)
                    .inflate(R.layout.nav1_overfoersler_listeelem, parent, false);
            v.setBackgroundResource(0);
            aq = new AQuery(v);
            aq.id(R.id.startStop).clicked(OverførslerFrag.this);
            aq.id(R.id.slet).clicked(OverførslerFrag.this);
          } else {
            aq = new AQuery(v);
          }
          // Skjul stiplet linje over øverste listeelement
          // aq.id(R.id.stiplet_linje).visibility(position == 0 ? View.INVISIBLE : View.VISIBLE);
          aq.id(R.id.startStop)
              .tag(ovf); // sæt udsendelsen ind som tag, så vi kan se dem i onClick()
          aq.id(R.id.slet).tag(ovf);
          if (App.PRODUKTION) aq.id(R.id.startStop).gone();
          if (App.PRODUKTION) aq.id(R.id.slet).gone();

          aq.id(R.id.linje1).text(ovf.trin.titel + "\n" + ovf.emne.navn);
          //              .textColor(hs.getStatus == DownloadManager.STATUS_SUCCESSFUL ? Color.BLACK
          // : App.color.grå60);

          //      aq.id(R.id.linje2).text(ovf.statusTekst()+"\n"+ovf.optagelse.url);
          aq.id(R.id.linje2).text(ovf.statusTekst());

          String status = ovf.getStatus();

          aq.id(R.id.slet).visibility(status == FÆRDIG ? View.GONE : View.VISIBLE);
          aq.id(R.id.startStop)
              .visibility(status == FÆRDIG ? View.GONE : View.VISIBLE)
              .image(
                  status == PAUSET
                      ? android.R.drawable.ic_media_play
                      : android.R.drawable.ic_media_pause);
          aq.id(R.id.progressBar).visibility(status == FÆRDIG ? View.GONE : View.VISIBLE);
          ProgressBar progressBar = aq.getProgressBar();
          if (App.fejlsøgning) {
            progressBar.setMax(1000);
            progressBar.setProgress((int) (1000 * Math.random()));
          } else {
            progressBar.setMax(ovf.filstørrelse);
            progressBar.setProgress(ovf.overført);
          }

          return v;
        }
Exemplo n.º 3
0
  public void runBattle() {

    if (fightingMonster != null) {

      // load monster on screen
      int counter = 0;
      while (fightingMonster.getImage() == null && counter != 1000) {}

      final ProgressBar progBar = (ProgressBar) findViewById(R.id.progressBar);
      progBar.setMax(fightingMonster.getHealth());
      progBar.setProgress(fightingMonster.getHealth());
      ImageView imgV = (ImageView) findViewById(R.id.myImageView);

      final ProgressBar userHealthBar = (ProgressBar) findViewById(R.id.userHealthBar);
      user.setHealth(12 * user.getLevel());
      userHealthBar.setMax(user.getHealth());
      userHealthBar.setProgress(user.getHealth());
      Random rndNumGen = new Random();
      // Generate 2 numbers (one for each combatant) who ever gets higher wins
      int playerScore = rndNumGen.nextInt(10);
      int monsterScore = rndNumGen.nextInt(9);
      imgV.setImageBitmap(fightingMonster.getImage());
      imgV.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Random rndNumGen = new Random();
              // Generate 2 numbers (one for each combatant) who ever gets higher wins
              int playerScore = rndNumGen.nextInt(10);
              int monsterScore = rndNumGen.nextInt(9);
              if (playerScore >= monsterScore) {
                fightingMonster.hit();
                userHealthBar.setProgress(user.getHealth());
              } else if (monsterScore >= playerScore) {
                user.hit();
                progBar.setProgress(fightingMonster.getHealth());
              }
              if (fightingMonster.getHealth() == 0) {
                Toast.makeText(MainActivity.this, "Health 0", Toast.LENGTH_LONG).show();
                user.increaseLevel();
                dbhelper.updateUser(user);

                loadMainPage(
                    "Congratulations you defeated "
                        + fightingMonster.getName()
                        + " your new level is "
                        + user.getLevel());
              }
            }
          });
    }
  }
  @Override
  public void getActionsLayout(Context ctx, final LinearLayout cont) {
    WindowManager mWinMgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
    int displayWidth = mWinMgr.getDefaultDisplay().getWidth();
    cont.removeAllViews();
    final TextView cmd = new TextView(ctx);

    cmd.setText(Html.fromHtml("<b>Reading:</b> " + getOutputCelsius() + "°C"));
    if (prefs.isLightThemeSelected()) cmd.setTextColor(ctx.getResources().getColor(R.color.black));
    RelativeLayout.LayoutParams lp =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    cmd.setLayoutParams(lp);
    lp.setMargins(2, 0, 0, 2);
    // cmd.setGravity(Gravity.TOP);
    cont.addView(cmd);

    ProgressBar par = new ProgressBar(ctx, null, android.R.attr.progressBarStyleHorizontal);
    // ProgressBar sfumata
    final ShapeDrawable pgDrawable =
        new ShapeDrawable(new RoundRectShape(Constants.roundedCorners, null, null));
    final LinearGradient gradient =
        new LinearGradient(
            0,
            0,
            displayWidth / 2,
            0,
            ctx.getResources().getColor(color.aa_blue),
            ctx.getResources().getColor(color.aa_red),
            android.graphics.Shader.TileMode.CLAMP);
    pgDrawable.getPaint().setStrokeWidth(3);
    pgDrawable.getPaint().setDither(true);
    pgDrawable.getPaint().setShader(gradient);

    ClipDrawable progress = new ClipDrawable(pgDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
    par.setProgressDrawable(progress);
    par.setBackgroundResource(android.R.drawable.progress_horizontal);

    RelativeLayout.LayoutParams lp2 =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    lp2.setMargins(2, 2, 4, 2);
    par.setLayoutParams(lp2);
    par.setMax(50);
    par.setProgress(20);
    par.setProgress(0);
    par.setMax(40);
    par.setProgress((int) getOutputFloat());

    cont.addView(par);
  }
 public void updateProgress(String id, int current, int total, String messString) {
   double cur = current;
   double tot = total;
   double result = (cur / tot) * 100;
   LNReaderApplication.getInstance().updateDownload(id, (int) result, messString);
   if (loadingBar != null && loadingBar.getVisibility() == View.VISIBLE) {
     loadingBar.setIndeterminate(false);
     loadingBar.setMax(total);
     loadingBar.setProgress(current);
     loadingBar.setProgress(0);
     loadingBar.setProgress(current);
     loadingBar.setMax(total);
   }
 }
  public void updateMetaUi() {
    Book book = mSpritzer.getBook();
    Metadata meta = book.getMetadata();
    Author author = meta.getAuthors().get(0);
    int curChapter = mSpritzer.getCurrentChapter();

    mAuthorView.setText(author.getFirstname() + " " + author.getLastname());
    mTitleView.setText(meta.getFirstTitle());
    String chapterText;
    if (book.getSpine().getResource(curChapter).getTitle() == null
        || book.getSpine().getResource(curChapter).getTitle().trim().compareTo("") == 0) {
      chapterText = String.format("Chapter %d", curChapter);
    } else {
      chapterText = book.getSpine().getResource(curChapter).getTitle();
    }

    int startSpan = chapterText.length();
    chapterText =
        String.format(
            "%s  %s m left",
            chapterText,
            (mSpritzer.getMinutesRemainingInQueue() == 0)
                ? "<1"
                : String.valueOf(mSpritzer.getMinutesRemainingInQueue()));
    int endSpan = chapterText.length();
    Spannable spanRange = new SpannableString(chapterText);
    TextAppearanceSpan tas = new TextAppearanceSpan(mChapterView.getContext(), R.style.MinutesToGo);
    spanRange.setSpan(tas, startSpan, endSpan, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    mChapterView.setText(spanRange);

    mProgress.setMax(mSpritzer.getMaxChapter());
    mProgress.setProgress(curChapter);
  }
  @Override
  @SuppressWarnings("deprecation")
  protected void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_init_splash);

    titleTextView = (TextView) findViewById(R.id.title_text);
    progressBarView = (ProgressBar) findViewById(R.id.progress_bar);

    progressBarView.setMax(100);

    if (!initializationFinished) {
      receiver = (DownloadProgressReceiver) getLastCustomNonConfigurationInstance();
      if (receiver != null) {
        receiver.setActivity(this);
        receiver.updateView();
      } else {
        receiver = new DownloadProgressReceiver(this);
        LocalBroadcastManager.getInstance(this)
            .registerReceiver(
                receiver, new IntentFilter(DownloadService.ACTION_DOWNLOAD_PROGRESS_UPDATED));
      }
    }

    if (savedInstanceState == null) {
      Intent intent = new Intent(this, DownloadService.class);
      startService(intent);
    }
  }
Exemplo n.º 8
0
  @Override
  public View getView(final int index, View itemView, final ViewGroup parent) {
    if (itemView == null) {
      itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.bookmark, parent, false);

      final BookmarkView text = (BookmarkView) itemView.findViewById(R.id.bookmarkName);
      text.setActions(actions);

      final ProgressBar bar = (ProgressBar) itemView.findViewById(R.id.bookmarkPage);
      bar.setProgressDrawable(
          context.getResources().getDrawable(R.drawable.viewer_goto_dlg_progress));
    }

    final Bookmark b = getBookmark(index);

    final TextView text = (TextView) itemView.findViewById(R.id.bookmarkName);
    text.setText(b.name);
    text.setTag(b);

    final ProgressBar bar = (ProgressBar) itemView.findViewById(R.id.bookmarkPage);
    bar.setMax(lastPage != null ? lastPage.index.viewIndex : 0);
    bar.setProgress(b.page.viewIndex);

    final View btn = itemView.findViewById(R.id.bookmark_remove);
    if (b.service) {
      btn.setVisibility(View.GONE);
    } else {
      btn.setVisibility(View.VISIBLE);
      btn.setOnClickListener(actions.getOrCreateAction(R.id.actions_showDeleteBookmarkDlg));
      btn.setTag(b);
    }

    return itemView;
  }
Exemplo n.º 9
0
 private void updateProgress() {
   int start = (int) (mInfo.start);
   int curr = (int) (mInfo.current);
   int end = (int) (mInfo.end);
   mProgress.setMax(end - start);
   mProgress.setProgress(curr - start);
 }
Exemplo n.º 10
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    if (v == null) {
      LayoutInflater vi =
          (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v = vi.inflate(R.layout.storage_row, null);
    }
    Map<String, Object> map = items.get(position);
    if (map != null) {
      TextView storagePath = (TextView) v.findViewById(R.id.storage_path);

      if (storagePath != null) {
        String path = (String) map.get(STORAGE_PATH);
        String description = (String) map.get(STORAGE_DESCRIPTION);
        storagePath.setText(description + " (" + path + ")");
      }
      Long capacity = (Long) map.get(STORAGE_CAPACITY);
      if (capacity == null) {
        v.findViewById(R.id.used_space_row).setVisibility(View.GONE);
        v.findViewById(R.id.free_space_row).setVisibility(View.GONE);
        v.findViewById(R.id.used_space_bar).setVisibility(View.GONE);

        TextView capacityView = (TextView) v.findViewById(R.id.capacity_space);

        capacityView.setText(
            getContext().getResources().getString(R.string.unable_to_determine_capacity));

      } else {
        v.findViewById(R.id.used_space_row).setVisibility(View.VISIBLE);
        v.findViewById(R.id.free_space_row).setVisibility(View.VISIBLE);
        v.findViewById(R.id.used_space_bar).setVisibility(View.VISIBLE);

        long freeSpace = (Long) map.get(STORAGE_FREE_SPACE);
        long usedSpace = (Long) map.get(STORAGE_USED_SPACE);
        int colorIndex = (int) (usedSpace * colorUtils.getColorsCount() / capacity);

        TextView capacityView = (TextView) v.findViewById(R.id.capacity_space);
        TextView usedView = (TextView) v.findViewById(R.id.used_space);
        TextView freeView = (TextView) v.findViewById(R.id.free_space);

        ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.used_space_bar);
        progressBar.setMax(colorUtils.getColorsCount());
        progressBar.setProgressDrawable(colorUtils.getClipDrawable(colorIndex));
        progressBar.setBackgroundDrawable(progressHorizontal);
        progressBar.setProgress(colorIndex);

        if (capacityView != null) {
          capacityView.setText(Utils.stringFromFileSize(capacity));
        }
        if (usedView != null) {
          usedView.setText(Utils.stringFromFileSize(usedSpace));
        }
        if (freeView != null) {
          freeView.setText(Utils.stringFromFileSize(freeSpace));
        }
      }
    }
    return v;
  }
Exemplo n.º 11
0
 public TimeThread(GameActivity activity, ProgressBar timeBar, int maxValue) {
   _timeBar = timeBar;
   _main = activity;
   _currentValue = maxValue;
   _timeBar.setMax(maxValue);
   _timeBar.setProgress(_currentValue);
 }
Exemplo n.º 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.flash_card_activity);

    // Initialize fields
    initialize();

    try {
      SAXParserFactory spf = SAXParserFactory.newInstance();
      SAXParser sp = spf.newSAXParser();
      XMLReader xr = sp.getXMLReader();
      myParser = new XMLParser();
      xr.setContentHandler(myParser);
      xr.parse(new InputSource(this.getResources().openRawResource(R.raw.words)));
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      words = myParser.getWordsList();
      // db = dbh.getWritableDatabase();
      // myWords = dbh.getMyWordsList();
      displayWord(words.get(index));
    }

    pbProgress.setMax(words.size());
  }
Exemplo n.º 13
0
  public TiUIProgressBar(final TiViewProxy proxy) {
    super(proxy);

    view =
        new LinearLayout(proxy.getActivity()) {
          @Override
          protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            super.onLayout(changed, left, top, right, bottom);
            TiUIHelper.firePostLayoutEvent(proxy);
          }
        };
    view.setOrientation(LinearLayout.VERTICAL);
    label = new TextView(proxy.getActivity());
    label.setGravity(Gravity.TOP | Gravity.LEFT);
    label.setPadding(0, 0, 0, 0);
    label.setSingleLine(false);

    progress =
        new ProgressBar(proxy.getActivity(), null, android.R.attr.progressBarStyleHorizontal);
    progress.setIndeterminate(false);
    progress.setMax(1000);

    view.addView(label);
    view.addView(progress);

    setNativeView(view);
  }
Exemplo n.º 14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detalle_pryecto1);

    init();

    nombreProyecto.setText(mProyecto.getNombre());
    dia.setText(String.valueOf(mProyecto.getDia()));
    inicio.setText(mProyecto.getFecha_inicio());
    fin.setText(mProyecto.getFecha_final());

    name = Environment.getExternalStorageDirectory() + "/TDC@/SeguimientoCaptura.jpg";

    mAvances = new ArrayList<>();

    imgToSendList = new ArrayList<>();
    try {
      avance_real_total = Float.parseFloat(mProyecto.getAvance_real());
      float real = Float.parseFloat(String.format(Locale.US, FLOAT_FORMAT, avance_real_total));
      float progra = Float.parseFloat(mProyecto.getAvance_programado());
      detalle_progreso.setText(
          "Progreso: " + String.format(Locale.US, FLOAT_FORMAT, avance_real_total) + "%");
      mProgressBar.setMax((100 * 10000));
      mProgressBar.setProgress((int) (real * 10000));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 15
0
        @Override
        public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();

          if (action.equalsIgnoreCase(ACTION_SHOW_PROGRESSBAR)) {
            setSupportProgressBarIndeterminateVisibility(true);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
          } else if (action.equalsIgnoreCase(ACTION_HIDE_PROGRESSBAR)) {
            setSupportProgressBarIndeterminateVisibility(false);
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
          } else if (action.equalsIgnoreCase(ACTION_SHOW_TEXTINFO)) {
            String info = intent.getStringExtra("info");
            int max = intent.getIntExtra("max", 0);
            int progress = intent.getIntExtra("progress", 100);
            mInfoText.setText(info);
            mInfoProgress.setMax(max);
            mInfoProgress.setProgress(progress);

            if (info == null) {
              /* Cancel any upcoming visibility change */
              mHandler.removeMessages(ACTIVITY_SHOW_INFOLAYOUT);
              mInfoLayout.setVisibility(View.GONE);
            } else {
              /* Slightly delay the appearance of the progress bar to avoid unnecessary flickering */
              if (!mHandler.hasMessages(ACTIVITY_SHOW_INFOLAYOUT)) {
                Message m = new Message();
                m.what = ACTIVITY_SHOW_INFOLAYOUT;
                mHandler.sendMessageDelayed(m, 300);
              }
            }
          }
        }
Exemplo n.º 16
0
  /**
   * @author lijing
   * @time 2014-7-22 下午3:31:38
   */
  private void initInfo() {
    webview = (WebView) layout.findViewById(R.id.webview);

    WebSettings webSettings = webview.getSettings(); // webView: 类WebView的实例
    webSettings.setJavaScriptEnabled(true);
    webSettings.setUseWideViewPort(true);
    webSettings.setSupportZoom(true);
    // webSettings.setBuiltInZoomControls(true);
    webSettings.setLoadWithOverviewMode(true);

    webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); // 就是这句
    pb = (ProgressBar) layout.findViewById(R.id.pb);
    pb.setMax(100);
    if (TextUtils.isEmpty(url)) return;
    webview.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
          }
        });
    webview.setWebChromeClient(
        new WebChromeClient() {
          @Override
          public void onProgressChanged(WebView view, int newProgress) {
            pb.setProgress(newProgress);
            if (newProgress == 100) {
              pb.setVisibility(View.GONE);
            }
            super.onProgressChanged(view, newProgress);
          }
        });
    webview.loadUrl(url);
  }
  /*-------------------------------------------------------------------------------------------------------------------------------------------------*/
  @Override
  public void onBeginningOfSpeech() {
    showSnackbar("Begin of speech Sphinx", Snackbar.LENGTH_LONG);

    progressBar.setIndeterminate(false);
    progressBar.setMax(10);
  }
 private ProgressBar initProgressbar(View view, int id) {
   ProgressBar ret = (ProgressBar) view.findViewById(id);
   ret.setProgress(0);
   ret.setMax(100);
   ret.setProgress(50);
   return ret;
 }
  private void bindView() {
    hideProgressDialog();

    icon.setVisibility(View.VISIBLE);
    icon.setImageResource(mFileObject.getIconResourceId());

    iconTxt.setVisibility(View.GONE);

    name.setText(mFileObject.getName());

    content.setText(Global.HumanReadableFilesize(mFileObject.getSize()));

    tvDownload.setText(
        String.format(
            downloadFormat,
            Global.HumanReadableFilesize(0.0),
            Global.HumanReadableFilesize(mFileObject.getSize())));
    progressBar.setMax(mFileObject.getSize());
    mainLayout.setVisibility(View.VISIBLE);

    mFile =
        FileUtil.getDestinationInExternalPublicDir(
            getFileDownloadPath(), mFileObject.getSaveName(mProjectObjectId));
    Log.d(TAG, "downloadId:" + downloadId);

    File file =
        FileUtil.getDestinationInExternalPublicDir(
            getFileDownloadPath(), mAttachmentFileObject.getSaveName(mProjectObjectId));
    if (file.exists() && file.isFile()) {
      showState(STATE_FINISHDOWNLOAD);
    } else {
      showState(STATE_NEEDDOWNLOAD);
    }
  }
Exemplo n.º 20
0
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.downloader);

    _downloadingText = (TextView) findViewById(R.id.downloadDownloadingText);
    _infoText = (TextView) findViewById(R.id.downloadInfoText);
    _progressBar = (ProgressBar) findViewById(R.id.downloadProgressBar);
    _progressText = (TextView) findViewById(R.id.downloadProgressText);

    _progressBar.setMax(100);

    _handler = new DownloadMessageHandler(this);

    final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    _wifiLock =
        wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, DownloadActivity.class.getName());

    scheduleDownloadingTextAnimation();

    final Intent intent = getIntent();
    final EpisodeModel episode =
        (EpisodeModel) intent.getSerializableExtra(getString(R.string.key_episode));

    final ProgrammeModel programme = episode.getProgramme();
    final String programmeName = programme.getName();
    final String name = episode.getName();
    final Date date = episode.getDate();
    final String dateStr = DATE_FORMAT.format(date);
    setTitle(getString(R.string.download_title) + " - " + programmeName);
    _infoText.setText(programmeName + " " + dateStr + "\n" + name);

    new Downloader(this, episode, 10, _wifiLock, _handler).start();
  }
Exemplo n.º 21
0
    public ViewHolder(View rootView) {
      speedometer = (SpeedometerGauge) rootView.findViewById(R.id.speedometer);

      connectedView = (TextView) rootView.findViewById(R.id.cinf_connected_textview);
      strengthBarView = (TextView) rootView.findViewById(R.id.cinf_strength_bar_view);
      strengthOnProgressBarView =
          (TextView) rootView.findViewById(R.id.cinf_strength_percent_progressbar_now_textView);

      progressBar = (ProgressBar) rootView.findViewById(R.id.cinf_quality_progressbar_now);
      progressBar.setMax(100);

      mChartChannels = (LinearLayout) rootView.findViewById(R.id.cinf_channel_chart);

      ssidView = (TextView) rootView.findViewById(R.id.cinf_ssid_view);
      bssidView = (TextView) rootView.findViewById(R.id.cinf_bssid_view);
      macView = (TextView) rootView.findViewById(R.id.cinf_mac_view);
      speedView = (TextView) rootView.findViewById(R.id.cinf_speed_view);
      strengthbView = (TextView) rootView.findViewById(R.id.cinf_strength_view);
      encryptionView = (TextView) rootView.findViewById(R.id.cinf_encryption_view);
      channelView = (TextView) rootView.findViewById(R.id.cinf_channel_view);
      frequecyView = (TextView) rootView.findViewById(R.id.cinf_frequency_view);
      ipView = (TextView) rootView.findViewById(R.id.cinf_ip_view);
      netmaskView = (TextView) rootView.findViewById(R.id.cinf_netmask_view);
      gatewayView = (TextView) rootView.findViewById(R.id.cinf_gateway_view);
      dhcpView = (TextView) rootView.findViewById(R.id.cinf_dhcp_view);
      dns1View = (TextView) rootView.findViewById(R.id.cinf_dns1_view);
      dns2View = (TextView) rootView.findViewById(R.id.cinf_dns2_view);
      dhsp1View = (TextView) rootView.findViewById(R.id.cinf_dhspl_view);
    }
Exemplo n.º 22
0
  private void createProgressBarForRouting() {
    FrameLayout parent = (FrameLayout) mapView.getParent();
    FrameLayout.LayoutParams params =
        new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT,
            Gravity.CENTER_HORIZONTAL | Gravity.TOP);
    DisplayMetrics dm = getResources().getDisplayMetrics();
    params.topMargin = (int) (60 * dm.density);
    final ProgressBar pb = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    pb.setIndeterminate(false);
    pb.setMax(100);
    pb.setLayoutParams(params);
    pb.setVisibility(View.GONE);

    parent.addView(pb);
    app.getRoutingHelper()
        .setProgressBar(
            new RouteCalculationProgressCallback() {

              @Override
              public void updateProgress(int progress) {
                pb.setVisibility(View.VISIBLE);
                pb.setProgress(progress);
              }

              @Override
              public void finish() {
                pb.setVisibility(View.GONE);
              }
            });
  }
  // /////////////////////////////////////////////////////////////
  // ITEM LINE
  // ////////////////////////////////////////////////////////////
  @Override
  protected void updateTopText(ProgressViewHolder vh, Node item) {
    ProgressBar progressView =
        (ProgressBar) ((View) vh.topText.getParent()).findViewById(R.id.status_progress);

    if (item instanceof NodePlaceHolder) {
      vh.topText.setText(item.getName());
      vh.topText.setEnabled(false);
      long totalSize = ((NodePlaceHolder) item).getLength();

      if ((Integer) item.getPropertyValue(PublicAPIPropertyIds.REQUEST_STATUS)
          == Operation.STATUS_PAUSED) {
        progressView.setVisibility(View.GONE);
      } else {
        progressView.setVisibility(View.VISIBLE);
        progressView.setIndeterminate(false);
        if (totalSize == -1) {
          progressView.setMax(MAX_PROGRESS);
          progressView.setProgress(0);
        } else {
          long progress = ((NodePlaceHolder) item).getProgress();
          float value = (((float) progress / ((float) totalSize)) * MAX_PROGRESS);
          int percentage = Math.round(value);

          if (percentage == MAX_PROGRESS) {
            if ((Integer) item.getPropertyValue(PublicAPIPropertyIds.REQUEST_TYPE)
                == DownloadRequest.TYPE_ID) {
              progressView.setVisibility(View.GONE);
              super.updateTopText(vh, item);
              vh.bottomText.setVisibility(View.VISIBLE);
              super.updateBottomText(vh, item);
              super.updateIcon(vh, item);
            } else {
              progressView.setIndeterminate(true);
            }
          } else {
            progressView.setIndeterminate(false);
            progressView.setMax(MAX_PROGRESS);
            progressView.setProgress(percentage);
          }
        }
      }
    } else {
      progressView.setVisibility(View.GONE);
      super.updateTopText(vh, item);
    }
  }
Exemplo n.º 24
0
 @OnClick(R.id.btnRunThread)
 public void onClickBtnRunThread(Button button) {
   isCancel = false;
   int max = 100;
   pbJob.setProgress(0); // 초기값 설정
   pbJob.setMax(max); // 최대값 설정
   invokeBackground("runThread", max);
 }
Exemplo n.º 25
0
  public void LevelUp(View view) {
    mProgress.setProgress(user.get_curr_exp());
    mProgress.setMax(user.get_max_exp()); // TO DO: Set scaling of max EXP

    /*Intent intent = new Intent(this, Test_Activity.class);
    intent.putExtra("user", user);
    startActivityForResult(intent, 42);*/
  }
 public void setMax(int max) {
   if (mProgress != null) {
     mProgress.setMax(max);
     onProgressChanged();
   } else {
     mMax = max;
   }
 }
Exemplo n.º 27
0
 /**
  * Method invoked from the rename task when an update is required.
  *
  * @param position Current number of renamed files.
  * @param count The number of total files to be renamed.
  * @param message The message to be displayed on progress dialog.
  */
 @Override
 public void onTaskUpdate(int position, int count, String message) {
   mRenameProgressMessage.setText(message);
   if (position == 0) {
     mRenameProgressBar.setIndeterminate(false);
     mRenameProgressBar.setMax(count);
   }
   mRenameProgressBar.setProgress(position);
 }
  @Override
  public void parseJson(int code, JSONObject response, String tag, int pos, Object data)
      throws JSONException {
    if (tag.equals(urlFiles)) {
      if (code == 0) {
        hideProgressDialog();
        JSONObject file = response.getJSONObject("data").getJSONObject("file");
        mFileObject = new AttachmentFileObject(file);
        downloadId = downloadList.getLong(mFileObject.file_id, 0L);

        icon.setVisibility(View.VISIBLE);
        icon.setImageResource(mFileObject.getIconResourceId());

        iconTxt.setVisibility(View.GONE);

        name.setText(mFileObject.name);

        content.setText(Global.HumanReadableFilesize(mFileObject.size));

        tvDownload.setText(
            String.format(
                downloadFormat,
                Global.HumanReadableFilesize(0.0),
                Global.HumanReadableFilesize(mFileObject.size)));
        progressBar.setMax(mFileObject.size);
        mainLayout.setVisibility(View.VISIBLE);

        mFile = FileUtil.getDestinationInExternalPublicDir(getFileDownloadPath(), mFileObject.name);
        Log.d(TAG, "downloadId:" + downloadId);
        if (mFile.exists() && mFile.isFile() && mFile.length() == mFileObject.size) {
          Log.d(TAG, "mFile exists:");
          if (downloadId != 0L) {
            updateView();
          }
          showState(STATE_FINISHDOWNLOAD);
        } else {
          Log.d(TAG, "mFile not exists:");
          showState(STATE_NEEDDOWNLOAD);
        }

      } else {
        hideProgressDialog();
        showErrorMsg(code, response);
      }
    } else if (tag.equals(HOST_FILE_DELETE)) {
      if (code == 0) {
        hideProgressDialog();
        showButtomToast("删除完成");
        Intent resultIntent = new Intent();
        resultIntent.putExtra("mAttachmentFileObject", mAttachmentFileObject);
        setResult(RESULT_OK, resultIntent);
        finish();
      } else {
        showErrorMsg(code, response);
      }
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.progress_activity);

    pb = (ProgressBar) findViewById(R.id.progressBar3);
    pb.setMax(100);
  }
Exemplo n.º 30
0
  private void doShowAnalogValue(int newValue) {
    if (analogWriteView != null) {
      analogWriteView.setVisibility(View.GONE);
      analogWriteView = null;
    }

    ViewGroup parent = (ViewGroup) view.getParent();

    if (pinBackgroundAnim != null) {
      pinBackgroundAnim.cancel();
    }

    if (analogReadView == null) {
      analogReadView = Ui.findView(parent, R.id.tinker_analog_read_main);
    }

    // If the view does not exist, inflate it
    if (analogReadView == null) {
      LayoutInflater inflater =
          (LayoutInflater) view.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      if (pinType == PinType.A) {
        analogReadView = inflater.inflate(R.layout.tinker_analog_read_left, parent, false);
        parent.addView(analogReadView);
      } else if (pinType == PinType.D) {
        analogReadView = inflater.inflate(R.layout.tinker_analog_read_right, parent, false);
        parent.addView(analogReadView, 0);
      } else if (pinType == PinType.T) {
        analogReadView = inflater.inflate(R.layout.tinker_analog_read_right, parent, false);
        parent.addView(analogReadView, 0);
      }
    }

    analogReadView.setVisibility(View.VISIBLE);
    // Find the existing views and set the values
    ProgressBar barGraph = Ui.findView(analogReadView, R.id.tinker_analog_read_progress);
    TextView readValue = Ui.findView(analogReadView, R.id.tinker_analog_read_value);

    if (PinAction.ANALOG_READ.equals(configuredAction)) {
      barGraph.setProgressDrawable(
          view.getContext().getResources().getDrawable(R.drawable.progress_emerald));
    } else {
      barGraph.setProgressDrawable(
          view.getContext().getResources().getDrawable(R.drawable.progress_sunflower));
    }

    int max = 1;
    if (configuredAction == PinAction.ANALOG_READ) {
      max = ANALOG_READ_MAX;
    } else if (configuredAction == PinAction.ANALOG_WRITE) {
      max = ANALOG_WRITE_MAX;
    }

    barGraph.setMax(max);
    barGraph.setProgress(newValue);
    readValue.setText(String.valueOf(newValue));
  }