예제 #1
0
  /**
   * Pushes data into list adapter.
   *
   * @param data the data to push
   */
  @UiThread
  protected void updateListView(PaginatedList<Artist> data) {
    if (loadingProgressBar.getVisibility() == View.VISIBLE)
      loadingProgressBar.setVisibility(View.INVISIBLE);

    if (data.getCount() <= 0) {
      Toast.makeText(this, "No singer was found", Toast.LENGTH_LONG).show();
      this.finish();
      return;
    }

    if (artistsFound == null) artistsFound = new PaginatedList<Artist>(data);
    else artistsFound.addItems(data.getItems());

    list = (ListView) findViewById(android.R.id.list);

    // If the adapter doesn't exist, we create one with the initial data.
    // If it exists, we update it.
    int currentPosition = -1;
    if (adapter == null) {
      adapter = new ArtistsListAdapter(this, data.getItems());
    } else {
      currentPosition = list.getFirstVisiblePosition();
      adapter.addItems(data.getItems());
    }
    list.setAdapter(adapter);

    list.setSelectionFromTop(currentPosition + 1, 0);

    if (artistsFound.getPaging().isLast()) list.removeFooterView(loadMoreProgress);

    this.isLoading = false;
  }
예제 #2
0
  public void m_click(View view) {
    if (progressBar.getVisibility() == View.VISIBLE) {
      progressBar.setProgress(0);

      new Thread(
              new Runnable() {
                @Override
                public void run() {
                  while (progressBar.getProgress() <= 80) {

                    int progress = progressBar.getProgress();
                    //						textView.setText(progress);
                    Message message = new Message();
                    message.obj = progress;
                    m_handler.sendMessage(message);
                    progress = progress + 1;
                    progressBar.setProgress(progress);

                    try {
                      Thread.sleep(10);
                    } catch (InterruptedException e) {
                      e.printStackTrace();
                    }
                  }
                }
              })
          .start();
    }
  }
 @Test
 public void testOnCreate_setsUpProgressBar() {
   ANDROID.assertThat(subject).isNotNull();
   ProgressBar progressBarSpinner = subject.getProgressBarSpinner();
   ANDROID.assertThat(progressBarSpinner).isNotNull();
   int visibility = progressBarSpinner.getVisibility();
   Assertions.assertThat(visibility).isEqualTo(View.VISIBLE);
 }
예제 #4
0
 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);
   }
 }
예제 #5
0
  @Override
  public void onResume() {
    super.onResume();

    if ((progressBar.getVisibility() == View.VISIBLE) && !working && onPause) {
      dismissProgressBar();
      onPause = false;
    }
  }
예제 #6
0
 @Override
 public void changeLoginState() {
   if (View.VISIBLE == progressBar.getVisibility()) {
     progressBar.setVisibility(View.GONE);
     loginForm.setVisibility(View.VISIBLE);
   } else {
     progressBar.setVisibility(View.VISIBLE);
     loginForm.setVisibility(View.INVISIBLE);
   }
 }
예제 #7
0
 private void toggleRefresh() {
   if (mProgressBar.getVisibility() == View.INVISIBLE) {
     mSummaryLabel.setText("Getting current weather...");
     mProgressBar.setVisibility(View.VISIBLE);
     mRefreshView.setVisibility(View.INVISIBLE);
   } else {
     mProgressBar.setVisibility(View.INVISIBLE);
     mRefreshView.setVisibility(View.VISIBLE);
   }
 }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    saveSettingsToBundle(outState);
    selectionStrategy.saveSelectionToBundle(outState, SELECTION_BUNDLE_KEY);
    if (activityCircle != null) {
      outState.putBoolean(ACTIVITY_CIRCLE_SHOW_KEY, activityCircle.getVisibility() == View.VISIBLE);
    }
  }
 public void onProgressChanged(WebView view, int progress) {
   if (progress < 100 && progressBar.getVisibility() == View.GONE) {
     progressBar.setVisibility(View.VISIBLE);
   }
   if (progressBar.isEnabled()) {
     progressBar.setProgress(progress);
   }
   if (progress == 100) {
     progressBar.setVisibility(View.GONE);
   }
 }
예제 #10
0
  private void startAnimation() {
    if (progressBar.getVisibility() == View.VISIBLE) {}

    if (null != iv_animation && iv_animation.getVisibility() == View.VISIBLE) {
      if (null != animationDrawable) {
        if (!animationDrawable.isRunning()) {
          animationDrawable.start();
        }
      }
    }
  }
예제 #11
0
 private void
     toggleRefresh() { // PSEUDO-Animation If the progress bar is invisible, make it visible and
   // the refresh button invisible
   if (mProgressBar.getVisibility() == View.INVISIBLE) {
     mProgressBar.setVisibility(View.VISIBLE);
     mRefreshButton.setVisibility(View.INVISIBLE);
   } else {
     mProgressBar.setVisibility(View.INVISIBLE);
     mRefreshButton.setVisibility(View.VISIBLE);
   }
 }
예제 #12
0
 private void checkSingleMessage(
     int messageResource, int messageVisibility, int progressBarvisibility) {
   assertEquals("message is not visible.", messageVisibility, message.getVisibility());
   assertEquals(
       "Message text is incorrect.",
       getActivity().getResources().getText(messageResource),
       message.getText());
   assertEquals(
       "ProgressBar visibility is not correct.",
       progressBarvisibility,
       progressBar.getVisibility());
 }
 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);
   }
 }
예제 #14
0
 public void hideLoader() {
   if (loaderView.getVisibility() != View.GONE) {
     loaderView
         .animate()
         .alpha(0f)
         .setListener(
             new AnimatorListenerAdapter() {
               @Override
               public void onAnimationEnd(Animator animation) {
                 loaderView.setVisibility(View.GONE);
               }
             });
   }
 }
예제 #15
0
 public final void showInvisibleViews() {
   if (View.INVISIBLE == mHeaderText.getVisibility()) {
     mHeaderText.setVisibility(View.VISIBLE);
   }
   if (View.INVISIBLE == mHeaderProgress.getVisibility()) {
     mHeaderProgress.setVisibility(View.VISIBLE);
   }
   if (View.INVISIBLE == mHeaderImage.getVisibility()) {
     mHeaderImage.setVisibility(View.VISIBLE);
   }
   if (View.INVISIBLE == mSubHeaderText.getVisibility()) {
     mSubHeaderText.setVisibility(View.VISIBLE);
   }
 }
예제 #16
0
 @Override
 public void onProgressChanged(WebView view, int newProgress) {
   super.onProgressChanged(view, newProgress);
   if (progressBar != null) {
     if (progressBar.getVisibility() != View.VISIBLE && newProgress != 100) {
       progressBar.setVisibility(View.VISIBLE);
     }
     if (newProgress == 100) {
       progressBar.setVisibility(View.GONE);
     } else {
       progressBar.setProgress(newProgress);
     }
   }
 }
예제 #17
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.home_fragment, container, false);
    // 判断网络是否连接
    ConnectivityManager connectivityManager =
        (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
    if (networkInfo == null || !networkInfo.isAvailable()) {
      Toast.makeText(getActivity(), "网络连接不可用", Toast.LENGTH_LONG).show();
    }
    requestQueue = Volley.newRequestQueue(getActivity());

    // 获取当前位置
    locateCurrentPosition();

    // 初始化主页标题栏
    initTitle();

    // 初始化gymList数据
    initGymData();
    gymAdapter = new GymAdapter(getActivity(), R.layout.gym_item, gymList);
    ListView listView = (ListView) view.findViewById(R.id.home_listview);

    headerView = LayoutInflater.from(getActivity()).inflate(R.layout.listview_header, null);
    // 初始化运动项目选择区域
    initSport();
    // 初始化广告区域
    initViewPager();
    progressBar = (ProgressBar) view.findViewById(R.id.home_progress_bar);
    if (progressBar.getVisibility() == View.GONE) {
      progressBar.setVisibility(View.VISIBLE);
    }

    listView.addHeaderView(headerView, null, false);
    listView.setAdapter(gymAdapter);
    // 设置listView点击事件
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Gym gym = gymList.get(position - 1); //
            SportVenueDetailActivity.actionStart(getActivity(), gym.getGymId(), gym.getGymName());
          }
        });

    return view;
  }
예제 #18
0
 private void handleAutoLoginState(int loginState) {
   /*
    * logining
    * success
    *
    *
    *
    * */
   if (loginState == YWLoginState.logining.getValue()) {
     if (progressBar.getVisibility() != View.VISIBLE) {
       progressBar.setVisibility(View.VISIBLE);
     }
     loginButton.setClickable(false);
   } else if (loginState == YWLoginState.success.getValue()) {
     loginButton.setClickable(true);
     progressBar.setVisibility(View.GONE);
     // TODO: 2015/12/16 登录成功将要跳转了
     //            Intent intent = new Intent(LoginActivity.this, FragmentTabs.class);
     //            LoginActivity.this.startActivity(intent);
     //            LoginActivity.this.finish();
   } else {
     YWIMKit ywimKit = LoginSampleHelper.getInstance().getIMKit();
     if (ywimKit != null) {
       if (ywimKit.getIMCore().getLoginState() == YWLoginState.success) {
         loginButton.setClickable(true);
         progressBar.setVisibility(View.GONE);
         // TODO: 2015/12/16 重连成功进入界面
         //                    Intent intent = new Intent(LoginActivity.this, FragmentTabs.class);
         //                    LoginActivity.this.startActivity(intent);
         //                    LoginActivity.this.finish();
         return;
       }
     }
     // 当作失败处理
     progressBar.setVisibility(View.GONE);
     loginButton.setClickable(true);
   }
 }
예제 #19
0
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case Constant.SHOW_RESPONSE:
              String response = (String) msg.obj;
              try {
                gymList.clear();
                gymList.addAll(JsonParse.ParseBriefGymInfo(response));
                gymAdapter.notifyDataSetChanged();

                if (progressBar.getVisibility() == View.VISIBLE) {
                  progressBar.setVisibility(View.GONE);
                }

              } catch (JSONException e) {
                e.printStackTrace();
              }

              break;
            default:
              homeViewPager.setCurrentItem(msg.what);
              super.handleMessage(msg);
          }
        }
예제 #20
0
 private ViewState onSaveViewState() {
   return new ViewState(mProgress.getVisibility(), mAdapter.isProgressVisible());
 }
예제 #21
0
  private void LoadWebView() {

    if (CheckConnection()) {

      Refresh.setEnabled(true);
      GetDataFromDatabase();

      // this is just ot remove the last comma on the strings
      if (sbCorrect != null) {
        int lastCommaCorrect = sbCorrect.length();
        int lastCommaWrong = sbWrong.length();

        sbCorrect.deleteCharAt(lastCommaCorrect - 1);
        sbWrong.deleteCharAt(lastCommaWrong - 1);

        String SiteAddress = "http://chart.apis.google.com/chart?";
        // We are testing for TAB Screen size here

        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);

        if (dm.heightPixels == 1024 && dm.widthPixels == 600) {

          PlusChartSize = "chs=600x400&";
        } else if (dm.heightPixels == 976 && dm.widthPixels == 600) {

          PlusChartSize = "chs=600x400&";
        } else {
          PlusChartSize = "chs=400x400&";
        }

        String PlusChartType = "cht=bvs&";
        String PlusChartColor = "chco=0000FF,FF0000&";
        String PlusVisibleAxis = "chxt=y&";

        // Get Max Value of Total
        Integer max = 0;
        max = TotalArrays.get(0);
        for (Integer i = 1; i < TotalArrays.size(); i++) {
          if (TotalArrays.get(i) > max) {
            max = TotalArrays.get(i);
          }
        }

        String PlusAxisRange = "chxr=0,0," + Integer.toString(max) + "&";

        String PlusLegend = "chdl=Correct Answers|Wrong Answers&";
        String PlusSeriesColors = "chco=0000FF,FF0000&";
        String PlusLegendPosition = "chdlp=b&chd=t:";
        String PlusCorrect = sbCorrect.toString();
        String PlusDivider = "|";
        String PlusWrong = sbWrong.toString();
        String PlusScaling = "&chds=0," + Integer.toString(max);

        sbGrand = new StringBuilder();
        sbGrand.append(SiteAddress);
        sbGrand.append(PlusChartSize);
        sbGrand.append(PlusChartType);
        sbGrand.append(PlusChartColor);
        sbGrand.append(PlusVisibleAxis);
        sbGrand.append(PlusAxisRange);
        sbGrand.append(PlusLegend);
        sbGrand.append(PlusSeriesColors);
        sbGrand.append(PlusLegendPosition);
        sbGrand.append(PlusCorrect);
        sbGrand.append(PlusDivider);
        sbGrand.append(PlusWrong);
        sbGrand.append(PlusScaling);

        Last = sbGrand.toString();

        // Now Download Image

        LoadImageFromWebOperations(Last);

        // image.setImageDrawable(drawable);

      } else {
        Toast.makeText(
                getBaseContext(),
                "You do not have any test result, click on Questions to start a test ",
                Toast.LENGTH_LONG)
            .show();
        if (Progress.getVisibility() == View.VISIBLE) {
          Progress.setVisibility(View.INVISIBLE);
        }
      }

    } else {
      Toast.makeText(getBaseContext(), "Internet connection is not available ! ", Toast.LENGTH_LONG)
          .show();
      if (Progress.getVisibility() == View.VISIBLE) {
        Progress.setVisibility(View.INVISIBLE);
      }
    }
  }
예제 #22
0
 /*
  * show progress bar at the bottom of the screen - used when getting newer comments
  */
 protected void showProgressFooter() {
   if (mProgressFooter == null || mProgressFooter.getVisibility() == View.VISIBLE) return;
   mProgressFooter.setVisibility(View.VISIBLE);
 }
예제 #23
0
 @Override
 public void onResume() {
   super.onResume();
   if (mSpinner != null && mSpinner.getVisibility() == View.GONE) hide_actionbar();
 }
예제 #24
0
 /*
  * hide the footer progress bar if it's showing
  */
 protected void hideProgressFooter() {
   if (mProgressFooter == null || mProgressFooter.getVisibility() != View.VISIBLE) return;
   mProgressFooter.setVisibility(View.INVISIBLE);
 }
예제 #25
0
 public boolean isLoading() {
   return amayaBar.getVisibility() == View.VISIBLE;
 }
예제 #26
0
 /**
  * Returns the visibility status for the progress bar.
  *
  * @param One of {@link View#VISIBLE}, {@link View#INVISIBLE}, or {@link View#GONE}.
  */
 public int getProgressBarVisibility() {
   return mProgress.getVisibility();
 }