コード例 #1
0
 private TableLayout selectCourseTable() {
   if ((Utils.isWide(this) || Utils.isLand(this)) && isHoliday) {
     if (isHolidayNight || isNight) {
       return (TableLayout)
           LayoutInflater.from(this).inflate(R.layout.table_course_holiday_night, null);
     } else if (isHolidayB || isB) {
       return (TableLayout)
           LayoutInflater.from(this).inflate(R.layout.table_course_holiday_b, null);
     } else {
       return (TableLayout) LayoutInflater.from(this).inflate(R.layout.table_course_holiday, null);
     }
   } else {
     if (isHoliday) {
       mHolidayTextView.setVisibility(View.VISIBLE);
     } else {
       mHolidayTextView.setVisibility(View.GONE);
     }
     if (isNight) {
       return (TableLayout)
           LayoutInflater.from(this).inflate(R.layout.table_course_normal_night, null);
     } else if (isB) {
       return (TableLayout)
           LayoutInflater.from(this).inflate(R.layout.table_course_normal_b, null);
     } else {
       return (TableLayout) LayoutInflater.from(this).inflate(R.layout.table_course_normal, null);
     }
   }
 }
コード例 #2
0
 private void setUpPullRefresh() {
   mSwipeRefreshLayout.setOnRefreshListener(this);
   mSwipeRefreshLayout.setColorSchemeColors(Utils.getSwipeRefreshColors(this));
 }
コード例 #3
0
  private void setUpViews() {
    setUpPullRefresh();
    mHolidayTextView.setText(getString(R.string.course_holiday, "\uD83D\uDE06"));

    Bitmap sourceBitmap =
        Utils.convertDrawableToBitmap(
            getResources().getDrawable(R.drawable.ic_keyboard_arrow_down_white_24dp));
    int color = getResources().getColor(R.color.accent);
    mPickYmsImageView.setImageBitmap(Utils.changeImageColor(sourceBitmap, color));

    mScrollView.scrollTo(0, mPos);
    mPickYmsView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mSelectedModel == null) {
              return;
            }
            mTracker.send(
                new HitBuilders.EventBuilder().setCategory("pick yms").setAction("click").build());
            Intent intent = new Intent(CourseActivity.this, PickSemesterActivity.class);
            intent.putExtra("mSemesterList", new Gson().toJson(mSemesterList));
            intent.putExtra("mSelectedModel", new Gson().toJson(mSelectedModel));
            startActivityForResult(intent, Constant.REQUEST_PICK_SEMESTER);
          }
        });
    mNoCourseLinearLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (isRetry) {
              mTracker.send(
                  new HitBuilders.EventBuilder()
                      .setCategory("retry")
                      .setAction("click")
                      .setLabel((mSemesterList == null) + "")
                      .build());
              isRetry = false;
              if (mSemesterList == null || mSelectedModel == null) {
                getSemester();
              } else {
                getData(false);
              }
            } else {
              if (mSemesterList == null || mSelectedModel == null) {
                getSemester();
                return;
              }
              mTracker.send(
                  new HitBuilders.EventBuilder()
                      .setCategory("pick yms")
                      .setAction("click")
                      .build());
              Intent intent = new Intent(CourseActivity.this, PickSemesterActivity.class);
              intent.putExtra("mSemesterList", new Gson().toJson(mSemesterList));
              intent.putExtra("mSelectedModel", new Gson().toJson(mSelectedModel));
              startActivityForResult(intent, Constant.REQUEST_PICK_SEMESTER);
            }
          }
        });

    if (mSelectedModel != null && mSemesterList != null) {
      mPickYmsTextView.setText(mSelectedModel.text);
      setUpCourseTable();
    } else {
      mPickYmsView.setEnabled(false);
      getSemester();
    }
  }