Example #1
0
  private void init() {
    mHeaderLinearLayout = (LinearLayout) mInflater.inflate(R.layout.player_list_header, null);
    headerArrow = (ImageView) mHeaderLinearLayout.findViewById(R.id.header_arrow);
    headerArrow.setImageBitmap(getOptsBitmap(R.drawable.refresh_list_pull_down));
    headerArrow.setVisibility(View.VISIBLE);
    headerTime = (TextView) mHeaderLinearLayout.findViewById(R.id.list_header_time);
    headerInfo = (TextView) mHeaderLinearLayout.findViewById(R.id.list_header_info);
    headerProgressBar = (ProgressBar) mHeaderLinearLayout.findViewById(R.id.header_progressBar);
    // 添加标题 下拉刷新
    //		addHeaderView(mHeaderLinearLayout);

    mFooterLinearLayout = (LinearLayout) mInflater.inflate(R.layout.player_list_footer, null);
    // addFooterView(mFooterLinearLayout);
    footerLoadMore =
        (TextView) mFooterLinearLayout.findViewById(R.id.refresh_list_footer_load_more);
    footerProgressBar =
        (ProgressBar) mFooterLinearLayout.findViewById(R.id.refresh_list_footer_progressbar);
    mFooterLinearLayout.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if ("点击加载".equals(footerLoadMore.getText())) {
              footerLoadMore.setText("正在加载..");
              footerProgressBar.setVisibility(View.VISIBLE);
              if (mRefreshListener != null) {
                mRefreshListener.more();
              }
            }
          }
        });

    this.setSelection(1);
    this.setOnScrollListener(this);
    measureView(mHeaderLinearLayout); // == mHeaderLinearLayout.measure(0,
    // 0);

    mHeaderHeight = mHeaderLinearLayout.getMeasuredHeight();

    mSimpleDateFormat = new SimpleDateFormat("MM-dd hh:mm");
    headerTime.setText("更新时间为: " + mSimpleDateFormat.format(new Date()));
    mRotationAnimUp =
        AnimatorBuilder.createRotationAnimator(
            0f,
            180f,
            AnimatorBuilder.RELATIVE_TO_SELF,
            0.5f,
            AnimatorBuilder.RELATIVE_TO_SELF,
            0.5f);
    mRotationAnimDown =
        AnimatorBuilder.createRotationAnimator(
            180f,
            0f,
            AnimatorBuilder.RELATIVE_TO_SELF,
            0.5f,
            AnimatorBuilder.RELATIVE_TO_SELF,
            0.5f);
  }