// Progressbar
  public void onProgressChanged(WebView view, int percentage) {
    progress.setVisibility(View.VISIBLE);
    progress.setProgress(percentage);

    // For more advnaced loading status
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      progress.setIndeterminate(percentage == 100);
      view.evaluateJavascript(
          "(function() { return document.readyState == \"complete\"; })();",
          new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String value) {
              if (value.equals("true")) {
                progress.setVisibility(View.INVISIBLE);
              } else {
                onProgressChanged(webView, 100);
              }
            }
          });
    } else {
      if (percentage == 100) {
        progress.setVisibility(View.GONE);
      }
    }
  }
  private void setReloadingState(boolean reloading) {
    LinearLayout llContent = (LinearLayout) getActivity().findViewById(R.id.llContent);
    RelativeLayout rlSplashScreen =
        (RelativeLayout) getActivity().findViewById(R.id.rlSplashScreen);
    ImageButton btnRefresh = (ImageButton) getActivity().findViewById(R.id.btnRefresh);
    ProgressBar pbRefreshing = (ProgressBar) getActivity().findViewById(R.id.pbRefreshing);

    _menuReload.setVisible(!reloading);
    _menuReloading.setVisible(reloading);

    if (reloading) {
      btnRefresh.setVisibility(View.INVISIBLE);
      llContent.setVisibility(View.INVISIBLE);

      pbRefreshing.setVisibility(View.VISIBLE);
      rlSplashScreen.setVisibility(View.VISIBLE);

      _menuReloading.setActionView(R.layout.menu_progress);
    } else {
      pbRefreshing.setVisibility(View.INVISIBLE);
      rlSplashScreen.setVisibility(View.GONE);

      btnRefresh.setVisibility(View.VISIBLE);
      llContent.setVisibility(View.VISIBLE);

      _menuReload.setIcon(R.drawable.ic_action_refresh);
      _menuReloading.setActionView(null);

      View control = null;
      for (int i = 0; i < llContent.getChildCount(); i++) {
        control = llContent.getChildAt(i);
        control.setVisibility(View.VISIBLE);
      }
    }
  }
 private void updateUi() {
   Integer solution = getSolution();
   String solutionString = solution == null ? "" : solution.toString();
   _tvSolution.setText(solutionString);
   if (_captcha == null) {
     findViewById(R.id.llCaptcha).setVisibility(View.INVISIBLE);
     _pbWait.setVisibility(View.VISIBLE);
     _tvSolution.setText("");
     _btDone.setEnabled(false);
   } else {
     // Set bitmap
     ImageView iv = ((ImageView) findViewById(R.id.ivCaptcha));
     Bitmap b = BitmapFactory.decodeByteArray(_captcha.png, 0, _captcha.png.length);
     iv.setImageBitmap(b);
     // Hide progress bar and show captcha
     findViewById(R.id.llCaptcha).setVisibility(View.VISIBLE);
     _pbWait.setVisibility(View.INVISIBLE);
     // Clear solution and enable button
     if (_isSolving) {
       _btDone.setEnabled(false);
       _btNew.setEnabled(false);
       _pbSolving.setVisibility(View.VISIBLE);
     } else {
       _btDone.setEnabled(solutionString.length() == _captcha.length);
       _btNew.setEnabled(true);
       _pbSolving.setVisibility(View.INVISIBLE);
     }
   }
 }
Example #4
0
  private void setVisibility(int visibility) {

    if (visibility == CONNECT_VIEW) {
      rootview.setVisibility(View.GONE);
      connect_button_view.setVisibility(View.VISIBLE);
      textViewShowTime.setVisibility(View.GONE);
    } else if (visibility == TREATMENT_SERVICE_NOT_FOUND) {

      rootview.setVisibility(View.VISIBLE);
      connect_button_view.setVisibility(View.GONE);
      buttonStartTime.setVisibility(View.GONE);
      textViewShowTime.setVisibility(View.GONE);
      mProgressBar.setVisibility(View.GONE);
      delayCheckBox.setVisibility(View.GONE);

      // create progressdialog while connecting to the services
      progressDialog = new ProgressDialog(this);
      // show message
      progressDialog.setMessage("Connecting to the services");
      progressDialog.show();

    } else if (visibility == TREATMENT_SERVICE_FOUND) {
      rootview.setVisibility(View.VISIBLE);
      connect_button_view.setVisibility(View.GONE);
      buttonStartTime.setVisibility(View.VISIBLE);
      mProgressBar.setVisibility(View.VISIBLE);
      delayCheckBox.setVisibility(View.VISIBLE);

      // dismiss the progressdialog
      progressDialog.dismiss();
    }
  }
  private void setState(State state) {
    this.state = state;
    switch (state) {
      case PULL_TO_REFRESH:
        spinner.setVisibility(View.INVISIBLE);
        image.setVisibility(View.VISIBLE);
        text.setText(pullToRefreshText);

        if (showLastUpdatedText && lastUpdated != -1) {
          lastUpdatedTextView.setVisibility(View.VISIBLE);
          lastUpdatedTextView.setText(
              String.format(lastUpdatedText, lastUpdatedDateFormat.format(new Date(lastUpdated))));
        }

        break;

      case RELEASE_TO_REFRESH:
        spinner.setVisibility(View.INVISIBLE);
        image.setVisibility(View.VISIBLE);
        text.setText(releaseToRefreshText);
        break;

      case REFRESHING:
        setUiRefreshing();

        lastUpdated = System.currentTimeMillis();
        if (onRefreshListener == null) {
          setState(State.PULL_TO_REFRESH);
        } else {
          onRefreshListener.onRefresh();
        }

        break;
    }
  }
    public void addTask(ImageView iv, ProgressBar pb) {
      if (iv == null) return;
      iv.setVisibility(View.INVISIBLE);
      // check cache
      String url = (String) iv.getTag();
      if (url == null) return;
      Bitmap b;
      synchronized (cache) {
        b = cache.get(url);
      }
      if (b != null) {
        iv.setImageBitmap(b);
        iv.setVisibility(View.VISIBLE);
        if (pb != null) pb.setVisibility(View.GONE);
        return;
      }

      if (pb != null) pb.setVisibility(View.VISIBLE);

      // must load the image...
      if (!running) start();
      synchronized (tasks) {
        tasks.addLast(new ImageAndLoader(iv, pb));
        tasks.notify(); // notify any waiting threads
      }
    }
 /** 更新下拉头中的信息。 */
 private void updateHeaderView() {
   if (log.isDebugEnabled()) {
     log.debug(
         "updateHeaderView, current status :" + currentStatus + ", last status :" + lastStatus);
   }
   if (lastStatus != currentStatus) {
     if (currentStatus == STATUS_PULL_TO_REFRESH) {
       description.setText(getResources().getString(R.string.pull_to_refresh));
       arrow.setVisibility(View.VISIBLE);
       progressBar.setVisibility(View.GONE);
       rotateArrow();
     } else if (currentStatus == STATUS_RELEASE_TO_REFRESH) {
       description.setText(getResources().getString(R.string.release_to_refresh));
       arrow.setVisibility(View.VISIBLE);
       progressBar.setVisibility(View.GONE);
       rotateArrow();
     } else if (currentStatus == STATUS_REFRESHING) {
       description.setText(getResources().getString(R.string.refreshing));
       progressBar.setVisibility(View.VISIBLE);
       arrow.clearAnimation();
       arrow.setVisibility(View.GONE);
     }
     refreshUpdatedAtValue();
   }
 }
  // 当状态改变时候,调用该方法,以更新界面
  private void changeHeaderViewByState() {
    switch (state) {
      case RELEASE_To_REFRESH:
        arrowImageView.setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.GONE);
        tipsTextview.setVisibility(View.VISIBLE);
        lastUpdatedTextView.setVisibility(View.VISIBLE);

        arrowImageView.clearAnimation();
        arrowImageView.startAnimation(animation);

        tipsTextview.setText("松开刷新");

        // Log.v(TAG, "当前状态,松开刷新");
        break;
      case PULL_To_REFRESH:
        progressBar.setVisibility(View.GONE);
        tipsTextview.setVisibility(View.VISIBLE);
        lastUpdatedTextView.setVisibility(View.VISIBLE);
        arrowImageView.clearAnimation();
        arrowImageView.setVisibility(View.VISIBLE);
        // 是由RELEASE_To_REFRESH状态转变来的
        if (isBack) {
          isBack = false;
          arrowImageView.clearAnimation();
          arrowImageView.startAnimation(reverseAnimation);

          tipsTextview.setText("下拉刷新");
        } else {
          tipsTextview.setText("下拉刷新");
        }
        // Log.v(TAG, "当前状态,下拉刷新");
        break;

      case REFRESHING:
        headView.setPadding(0, 0, 0, 0);
        headView.invalidate();

        progressBar.setVisibility(View.VISIBLE);
        arrowImageView.clearAnimation();
        arrowImageView.setVisibility(View.GONE);
        tipsTextview.setText("正在刷新...");
        lastUpdatedTextView.setVisibility(View.VISIBLE);

        // Log.v(TAG, "当前状态,正在刷新...");
        break;
      case DONE:
        headView.setPadding(0, -1 * headContentHeight, 0, 0);
        headView.invalidate();

        progressBar.setVisibility(View.GONE);
        arrowImageView.clearAnimation();
        arrowImageView.setImageResource(R.drawable.xlistview_arrow);
        tipsTextview.setText("下拉刷新");
        lastUpdatedTextView.setVisibility(View.VISIBLE);

        // Log.v(TAG, "当前状态,done");
        break;
    }
  }
Example #9
0
 /**
  * 显示加载
  *
  * @param flag
  */
 public void showProgress(boolean flag) {
   if (flag) {
     mProgressBar.setVisibility(VISIBLE);
   } else {
     mProgressBar.setVisibility(View.GONE);
   }
 }
Example #10
0
 /**
  * Set the enabled state of the progress bar.
  *
  * @param One of {@link View#VISIBLE}, {@link View#INVISIBLE}, or {@link View#GONE}.
  */
 public void setProgressBarVisibility(int visibility) {
   int count = mActionsView.getChildCount();
   //		Log.e("ProgressBar", "visibility is "+(visibility == VISIBLE ? "VISIBLE" : "GONE")+" count
   // is "+count+" "+visibility);
   if (count <= 0) {
     mProgress.setVisibility(visibility);
     return;
   }
   mProgress.setVisibility(GONE);
   for (int i = count - 1; i >= 0; i--) {
     View view = mActionsView.getChildAt(i);
     ProgressBar progressbar = (ProgressBar) view.findViewById(R.id.actionbar_progress);
     if (progressbar != null) {
       View item = view.findViewById(R.id.actionbar_item);
       if (visibility == VISIBLE) {
         if (item != null) item.setVisibility(View.GONE);
         progressbar.setVisibility(VISIBLE);
       } else {
         if (item != null) item.setVisibility(View.VISIBLE);
         progressbar.setVisibility(GONE);
       }
       break;
     }
   }
 }
        public void handleMessage(Message msg) {
          int p = msg.getData().getInt("PERCENT");

          // 當事件進度抵達100時,關掉/隱藏 progressDialog/progressBar
          if (p > 100) {
            if (which_progress.equals("progress_dialog")) {
              myDialog.dismiss();

              // Button3 & Button4:ProgressBar.
            } else if (which_progress.equals("progress_bar1")) {
              progressbar1.setVisibility(View.GONE);
              text_progressbar1.setText("Button3");
            } else {
              progressbar2.setVisibility(View.GONE);
              text_progressbar2.setText("Button4");
              text_percent.setText("100%");
            }

          } else {
            if (which_progress.equals("progress_dialog")) {
              myDialog.setProgress(p);

              // Button4:ProgressBar Horizontal.
            } else if (which_progress.equals("progress_bar2")) {
              progressbar2.setProgress(p);
              text_percent.setText(p + "%");
            }
          }
        }
  /** 刷新下拉控件的布局 */
  private void refreshState() {
    switch (mCurrrentState) {
      case STATE_PULL_REFRESH:
        tvTitle.setText("下拉刷新");
        ivArrow.setVisibility(View.VISIBLE);
        pbProgress.setVisibility(View.INVISIBLE);
        ivArrow.startAnimation(animDown);
        break;
      case STATE_RELEASE_REFRESH:
        tvTitle.setText("松开刷新");
        ivArrow.setVisibility(View.VISIBLE);
        pbProgress.setVisibility(View.INVISIBLE);
        ivArrow.startAnimation(animUp);
        break;
      case STATE_REFRESHING:
        tvTitle.setText("正在刷新...");
        ivArrow.clearAnimation(); // 必须先清除动画,才能隐藏
        ivArrow.setVisibility(View.INVISIBLE);
        pbProgress.setVisibility(View.VISIBLE);

        if (mListener != null) {
          mListener.onRefresh();
        }
        break;

      default:
        break;
    }
  }
 private void changeViewState(State state) {
   mState = state;
   switch (state) {
     default:
     case BEFORE_SEARCH:
       mBtnStartSearch.setVisibility(View.VISIBLE);
       mBtnSave.setVisibility(View.GONE);
       mProgressBar.setVisibility(View.GONE);
       mEtName.setVisibility(View.GONE);
       mTxtStatus.setVisibility(View.VISIBLE);
       break;
     case SEARCH:
       mBtnStartSearch.setVisibility(View.VISIBLE);
       mBtnSave.setVisibility(View.GONE);
       mProgressBar.setVisibility(View.VISIBLE);
       mEtName.setVisibility(View.GONE);
       mTxtStatus.setVisibility(View.VISIBLE);
       break;
     case BEACON_FOUND:
       mBtnStartSearch.setVisibility(View.GONE);
       mBtnSave.setVisibility(View.VISIBLE);
       mProgressBar.setVisibility(View.GONE);
       mEtName.setVisibility(View.VISIBLE);
       mTxtStatus.setVisibility(View.VISIBLE);
       invalidateOptionsMenu();
       break;
   }
 }
  public void updateProgress(boolean updateOnlyProgress) {
    BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask =
        downloadListIndexThread.getCurrentRunningTask();
    if (updateOnlyProgress) {
      if (!basicProgressAsyncTask.isIndeterminate()) {
        progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() + "%");
        determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage());
      }
    } else {
      boolean visible =
          basicProgressAsyncTask != null && basicProgressAsyncTask.getStatus() != Status.FINISHED;
      progressView.setVisibility(visible ? View.VISIBLE : View.GONE);
      if (visible) {
        boolean indeterminate = basicProgressAsyncTask.isIndeterminate();
        indeterminateProgressBar.setVisibility(!indeterminate ? View.GONE : View.VISIBLE);
        determinateProgressBar.setVisibility(indeterminate ? View.GONE : View.VISIBLE);
        cancel.setVisibility(indeterminate ? View.GONE : View.VISIBLE);
        progressPercent.setVisibility(indeterminate ? View.GONE : View.VISIBLE);

        progressMessage.setText(basicProgressAsyncTask.getDescription());
        if (!indeterminate) {
          progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() + "%");
          determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage());
        }
      }
      updateDownloadButton(false);
    }
  }
Example #15
0
  @Override
  public void updateProgress(boolean updateOnlyProgress) {
    BasicProgressAsyncTask<?, ?, ?> basicProgressAsyncTask =
        DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
    // needed when rotation is performed and progress can be null
    if (progressView == null) {
      return;
    }
    if (updateOnlyProgress) {
      if (!basicProgressAsyncTask.isIndeterminate()) {
        progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() + "%");
        determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage());
      }
    } else {
      boolean visible =
          basicProgressAsyncTask != null
              && basicProgressAsyncTask.getStatus() != AsyncTask.Status.FINISHED;
      progressView.setVisibility(visible ? View.VISIBLE : View.GONE);
      if (visible) {
        boolean indeterminate = basicProgressAsyncTask.isIndeterminate();
        indeterminateProgressBar.setVisibility(!indeterminate ? View.GONE : View.VISIBLE);
        determinateProgressBar.setVisibility(indeterminate ? View.GONE : View.VISIBLE);
        cancel.setVisibility(indeterminate ? View.GONE : View.VISIBLE);
        progressPercent.setVisibility(indeterminate ? View.GONE : View.VISIBLE);

        progressMessage.setText(basicProgressAsyncTask.getDescription());
        if (!indeterminate) {
          progressPercent.setText(basicProgressAsyncTask.getProgressPercentage() + "%");
          determinateProgressBar.setProgress(basicProgressAsyncTask.getProgressPercentage());
        }
      }
      updateDownloadButton(false);
    }
  }
  public void onScroll(
      AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

    if (mOnScrollListener != null) {
      mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
    }

    if (mOnLoadMoreListener != null) {

      if (visibleItemCount == totalItemCount) {
        mProgressBarLoadMore.setVisibility(View.GONE);
        // mLabLoadMore.setVisibility(View.GONE);
        return;
      }

      boolean loadMore = firstVisibleItem + visibleItemCount >= totalItemCount;

      if (!mIsLoadingMore && loadMore && mCurrentScrollState != SCROLL_STATE_IDLE) {
        mProgressBarLoadMore.setVisibility(View.VISIBLE);
        // mLabLoadMore.setVisibility(View.VISIBLE);
        mIsLoadingMore = true;
        //                setSelection(getPositionForView(mFooterView));
        //                smoothScrollToPosition(mFooterView.getBottom());
        onLoadMore();
      }
    }
  }
  public void getCarList() {

    sensorDlProgress.setVisibility(View.VISIBLE);
    sensorSpinner.setVisibility(View.GONE);
    sensorRetryButton.setVisibility(View.GONE);

    sensors = new ArrayList<Car>();

    if (((SettingsActivity) getContext()).isConnectedToInternet()) {
      try {
        new SensorDownloadTask().execute().get();
      } catch (Exception e) {
        logger.warn(e.getMessage(), e);
        Toast.makeText(getContext(), "Could not retrieve cars from server", Toast.LENGTH_SHORT)
            .show();
      }
      // TODO add possibility to update cache
      //			downloadSensors(true);
    } else {
      getCarsFromCache();
    }
    if (sensors.isEmpty()) {
      logger.warn("Got no cars neither from server nor from cache.");
      // TODO show warning that no cars were found i18n
      Toast.makeText(
              getContext(),
              "Could not retrieve cars from server or local cache",
              Toast.LENGTH_SHORT)
          .show();
    }
    sensorDlProgress.setVisibility(View.GONE);
    sensorSpinner.setVisibility(View.VISIBLE);
  }
  private void refreshPage(State state) {
    progressBar.setVisibility(View.GONE);
    errorMessage.setVisibility(View.GONE);
    listView.setVisibility(View.GONE);
    switch (state) {
      case LOADING:
        progressBar.setVisibility(View.VISIBLE);
        break;
      case LOADED:
        if (friendListAdapter.isEmpty()) {
          errorMessage.setVisibility(View.VISIBLE);

          errorMessage.setText(R.string.error_no_friends_connected);
          searchText.setEnabled(false);
        } else {
          listView.setVisibility(View.VISIBLE);

          searchText.setEnabled(true);
        }
        break;
      case ERROR:
        errorMessage.setVisibility(View.VISIBLE);
        break;
    }
    refreshMenu();
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.action_refresh:
        {
          mListView.setAdapter(null);
          mLoadingBar.setVisibility(View.VISIBLE);

          // notify user
          Toast.makeText(this, getString(R.string.toast_refresh), Toast.LENGTH_SHORT).show();

          refresh(false);
        }
        break;
      case R.id.action_refresh_cache:
        {
          mListView.setAdapter(null);
          mLoadingBar.setVisibility(View.VISIBLE);

          // notify user
          Toast.makeText(this, getString(R.string.toast_refresh_cache), Toast.LENGTH_SHORT).show();

          refresh(true);
          // RequestManager.getRequestQueue().start();
        }
        break;
      default:
        break;
    }
    return super.onOptionsItemSelected(item);
  }
  @Override
  public void sendQqEntity(QqLoginEntity entity, int channel) {
    // TODO Auto-generated method stub
    super.sendQqEntity(entity, channel);

    findViewById(R.id.layout_qq_login).setEnabled(false);
    findViewById(R.id.layout_phone).setEnabled(false);

    bindPhone.setVisibility(View.GONE);
    bindQQ.setVisibility(View.GONE);

    if (mToken == null) {
      if (channel == 1) {
        phoneNum.setText(getString(R.string.login_loading));
        phoneBar.setVisibility(View.VISIBLE);
      } else if (channel == 2) {
        qqBar.setVisibility(View.VISIBLE);
        qqName.setText(getString(R.string.login_loading));
        findViewById(R.id.qq_arrow).setVisibility(View.GONE);
      }
    } else {

      if (channel == 1) {
        phoneBar.setVisibility(View.VISIBLE);
        phoneNum.setText(getString(R.string.bind_loading));
      } else if (channel == 2) {
        qqBar.setVisibility(View.VISIBLE);
        qqName.setText(getString(R.string.bind_loading));
      }
    }
  }
Example #21
0
  public void populateSonglist() {
    SWITCH_VIEW = SONG_VIEW;
    pb.setVisibility(View.VISIBLE);
    Log.i("LIST FRAG", "POPULATING SONG LIST");
    songlist_header_textview.setText("Songs");
    database.open();
    songList = database.getFullList();
    // database.close();

    detector = new GestureDetector(this, this);

    adapter = new ReadLisstAdapter(this, songList, lv);
    lv.setTextFilterEnabled(true);

    lv.setAdapter(adapter);
    lv.setSelection(StaticMusic.smoothScrollTo);
    lv.setFastScrollEnabled(true);
    lv.setOnTouchListener(
        new OnTouchListener() {
          public boolean onTouch(View view, MotionEvent e) {
            detector.onTouchEvent(e);
            return false;
          }
        });
    adapter.imageLoader.loadImage(StaticMusic.smoothScrollTo, StaticMusic.smoothScrollTo + 8);
    pb.setVisibility(View.INVISIBLE);
    Log.i("INSTANT", "registered content observer");
    if (Math.abs(previousTime - System.currentTimeMillis()) / 1000 > 10) {
      previousTime = System.currentTimeMillis();
      databaseUpdateThread = new DatabaseUpdateThread(this, this);
      databaseUpdateThread.setPriority(Thread.MIN_PRIORITY);
      databaseUpdateThread.start();
      Log.i("Song list fragment", "After update thread creation");
    }
  }
Example #22
0
  public void closeCurrentTab(View v) {
    int pos = (Integer) v.getTag();
    ProgressBar PB = (ProgressBar) MainActivity.webLayout.findViewById(R.id.webpgbar);
    ImageButton BookmarkButton = (ImageButton) MainActivity.bar.findViewById(R.id.browser_bookmark);
    ImageButton refreshButton = (ImageButton) MainActivity.bar.findViewById(R.id.browser_refresh);

    if ((pos) <= (webWindows.size() - 1)) {
      webWindows.get(pos).loadUrl("about:blank");

      if (webLayout.findViewById(R.id.browser_page) == webWindows.get(pos)) {
        if ((pos - 1) >= 0) {
          ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).removeAllViews();
          ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).addView(webWindows.get(pos - 1));
          if (((TextView) bar.findViewById(R.id.browser_searchbar)) != null
              && webWindows.get(pos - 1).getUrl() != null) {
            webWindows.get(pos - 1).setUrlBarText(webWindows.get(pos - 1).getUrl());
          }
          if (webWindows.get(pos - 1).getProgress() < 100) {
            PB.setVisibility(View.VISIBLE);
            refreshButton.setImageResource(R.drawable.btn_toolbar_stop_loading_normal);
          } else {
            PB.setVisibility(View.INVISIBLE);
            refreshButton.setImageResource(R.drawable.btn_toolbar_reload_normal);
          }
          System.out.println("CLOSED" + webWindows.get(pos - 1).getProgress());

          // Find out if already a bookmark
          String bookmarkName = null;
          if (webWindows.get(pos - 1) != null && webWindows.get(pos - 1).getUrl() != null) {
            bookmarkName =
                BookmarksActivity.bookmarksMgr.root.containsBookmarkDeep(
                    webWindows.get(pos - 1).getUrl());
          }

          if (bookmarkName != null) {
            BookmarkButton.setImageResource(R.drawable.btn_omnibox_bookmark_selected_normal);
          } else {
            BookmarkButton.setImageResource(R.drawable.btn_omnibox_bookmark_normal);
          }
        } else {
          ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).removeAllViews();
          if (((TextView) bar.findViewById(R.id.browser_searchbar)) != null)
            ((TextView) bar.findViewById(R.id.browser_searchbar)).setText("");
          ImageView IV = new ImageView(ctxt);
          IV.setLayoutParams(
              new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          IV.setScaleType(ImageView.ScaleType.CENTER);
          IV.setImageResource(R.drawable.web_logo);
          ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).addView(IV);
          PB.setVisibility(View.INVISIBLE);
          BookmarkButton.setImageResource(R.drawable.btn_omnibox_bookmark_normal);
          refreshButton.setImageResource(R.drawable.btn_toolbar_reload_normal);
        }
      }

      webWindows.remove(pos);
    }
    browserListViewAdapter.notifyDataSetChanged();
  }
 @Override
 protected void postStatusMsg(int resId) {
   if (resId == R.string.player_preparing_msg) {
     progressIndicator.setVisibility(View.VISIBLE);
   } else {
     progressIndicator.setVisibility(View.INVISIBLE);
   }
 }
 public void updateProgress(int progress) {
   if (progress == progressBar.getMax() || progress == 0) {
     progressBar.setVisibility(View.INVISIBLE);
   } else {
     progressBar.setVisibility(View.VISIBLE);
   }
   progressBar.setProgress(progress);
 }
Example #25
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   Device device = getItem(position);
   if (convertView == null) {
     convertView =
         LayoutInflater.from(mContext).inflate(R.layout.item_device_list, parent, false);
   }
   TextView tvName = (TextView) convertView.findViewById(R.id.device_name);
   TextView tvIP = (TextView) convertView.findViewById(R.id.device_ip);
   TextView tvTraffic = (TextView) convertView.findViewById(R.id.device_traffic);
   View imgBlocked = convertView.findViewById(R.id.blocked);
   ProgressBar pbTrafficBar = (ProgressBar) convertView.findViewById(R.id.traffic_bar);
   tvName.setText(device.name());
   tvIP.setText(device.lastIP());
   imgBlocked.setVisibility(device.isBlocked() ? View.VISIBLE : View.GONE);
   if (device.isActive()) {
     pbTrafficBar.setVisibility(View.VISIBLE);
     tvName.setTextColor(Color.BLACK);
     tvTraffic.setText(String.format("%.2f", device.lastSpeed() / 1000) + " kb/s");
     if (mTotalTraffic > 0)
       pbTrafficBar.setProgress(Math.round(device.lastSpeed() / mTotalTraffic * 100));
     else pbTrafficBar.setProgress(0);
     if (device.prioritizedUntil() == Device.NOT_PRIORITIZED) {
       convertView.findViewById(R.id.priority).setVisibility(View.INVISIBLE);
     } else {
       if (device.prioritizedUntil() == Device.INDETERMINATE_PRIORITY) {
         ((TextView) convertView.findViewById(R.id.priority_until))
             .setText(R.string.indeterminite_priority_access);
         convertView.findViewById(R.id.until).setVisibility(View.INVISIBLE);
       } else {
         convertView.findViewById(R.id.until).setVisibility(View.VISIBLE);
         long now = System.currentTimeMillis() / 1000;
         if (device.prioritizedUntil() < now) {
           convertView.findViewById(R.id.priority).setVisibility(View.INVISIBLE);
           ((TextView) convertView.findViewById(R.id.priority_until))
               .setText(R.string.indeterminite_priority_access);
         } else {
           convertView.findViewById(R.id.priority).setVisibility(View.VISIBLE);
           Calendar undoTime = Calendar.getInstance();
           undoTime.setTimeInMillis(device.prioritizedUntil());
           String time =
               undoTime.get(Calendar.HOUR)
                   + ":"
                   + String.format("%02d", undoTime.get(Calendar.MINUTE));
           ((TextView) convertView.findViewById(R.id.priority_until))
               .setText(R.string.priority_access_until);
           ((TextView) convertView.findViewById(R.id.until)).setText(time);
         }
       }
     }
   } else {
     tvName.setTextColor(Color.GRAY);
     pbTrafficBar.setVisibility(View.GONE);
     tvTraffic.setText("");
     convertView.findViewById(R.id.priority).setVisibility(View.INVISIBLE);
   }
   return convertView;
 }
 /**
  * * Set whether to show the progress bar spinner
  *
  * @param show Whether to show
  */
 public void showLoading(boolean show) {
   if (show) {
     pb.setVisibility(View.VISIBLE);
     mic.setVisibility(View.INVISIBLE);
   } else {
     pb.setVisibility(View.INVISIBLE);
     mic.setVisibility(View.VISIBLE);
   }
 }
Example #27
0
 private void updateUI() {
   if (hasClickedLogin) {
     mProgressBar.setVisibility(View.VISIBLE);
     mLoginButton.setVisibility(View.INVISIBLE);
   } else {
     mProgressBar.setVisibility(View.INVISIBLE);
     mLoginButton.setVisibility(View.VISIBLE);
   }
 }
Example #28
0
 void switchButtonProgressDelete(boolean isLoading) {
   if (isLoading) {
     mDelete.setVisibility(Button.GONE);
     mProgressDelete.setVisibility(ProgressBar.VISIBLE);
   } else {
     mDelete.setVisibility(Button.VISIBLE);
     mProgressDelete.setVisibility(ProgressBar.GONE);
   }
 }
Example #29
0
 private void setSearchIndicator(boolean searching) {
   if (searching) {
     refreshButton.setVisibility(View.GONE);
     loadingSpinner.setVisibility(View.VISIBLE);
   } else {
     refreshButton.setVisibility(View.VISIBLE);
     loadingSpinner.setVisibility(View.GONE);
   }
 }
 private void toggleRefresh() {
   if (mProgressBar.getVisibility() == View.INVISIBLE) {
     mProgressBar.setVisibility(View.VISIBLE);
     mRefreshImageView.setVisibility(View.INVISIBLE);
   } else {
     mProgressBar.setVisibility(View.INVISIBLE);
     mRefreshImageView.setVisibility(View.VISIBLE);
   }
 }