Exemplo n.º 1
0
  private void getData(final boolean isSave) {
    mProgressWheel.setVisibility(View.VISIBLE);
    mPickYmsView.setEnabled(false);
    mScrollView.setVisibility(View.GONE);
    mNoCourseLinearLayout.setVisibility(View.GONE);
    mHolidayTextView.setVisibility(View.GONE);
    mSwipeRefreshLayout.setEnabled(false);

    Helper.getCourseTimeTable(
        this,
        mYms.split(",")[0],
        mYms.split(",")[1],
        new CourseCallback() {

          @Override
          public void onSuccess(List<List<CourseModel>> modelList) {
            super.onSuccess(modelList);

            if (isSave
                && Memory.getBoolean(CourseActivity.this, Constant.PREF_COURSE_NOTIFY, false)) {
              AlarmHelper.setCourseNotification(CourseActivity.this, modelList);
            }

            mList = modelList;
            setUpCourseTable();
            mPickYmsView.setEnabled(true);
          }

          @Override
          public void onFail(String errorMessage) {
            super.onFail(errorMessage);

            mList.clear();
            isRetry = true;
            setUpCourseTable();
            mPickYmsView.setEnabled(true);
          }

          @Override
          public void onTokenExpired() {
            super.onTokenExpired();
            Utils.createTokenExpired(CourseActivity.this).show();
            mTracker.send(
                new HitBuilders.EventBuilder().setCategory("token").setAction("expired").build());
          }
        });
  }
Exemplo n.º 2
0
  private void getSemester() {
    Helper.getSemester(
        this,
        new SemesterCallback() {

          @Override
          public void onSuccess(List<SemesterModel> modelList, SemesterModel selectedModel) {
            super.onSuccess(modelList, selectedModel);
            mSemesterList = modelList;
            mSelectedModel = selectedModel;
            mYms = mSelectedModel.value;
            mPickYmsTextView.setText(mSelectedModel.text);
            getData(true);
          }

          @Override
          public void onFail(String errorMessage) {
            super.onFail(errorMessage);
            isRetry = true;
            setUpCourseTable();
          }
        });
  }