Пример #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setAbContentView(R.layout.im_message_list);

    AbTitleBar mAbTitleBar = this.getTitleBar();
    mAbTitleBar.setTitleText(R.string.message_name);
    mAbTitleBar.setLogo(R.drawable.button_selector_back);
    mAbTitleBar.setTitleBarBackground(R.drawable.top_bg);
    mAbTitleBar.setTitleTextMargin(10, 0, 0, 0);
    mAbTitleBar.setLogoLine(R.drawable.line);

    application = (MyApplication) getApplication();

    // 初始化AbSqliteStorage
    mAbSqliteStorage = AbSqliteStorage.getInstance(this);
    // 数据业务类
    mIMMsgDao = new IMMsgDao(this);

    // 获取ListView对象
    mAbPullToRefreshView = (AbPullToRefreshView) this.findViewById(R.id.mPullRefreshView);
    mListView = (ListView) this.findViewById(R.id.mListView);

    // 打开关闭下拉刷新加载更多功能
    mAbPullToRefreshView.setOnHeaderRefreshListener(this);
    mAbPullToRefreshView.setOnFooterLoadListener(this);

    // 设置进度条的样式
    mAbPullToRefreshView
        .getHeaderView()
        .setHeaderProgressBarDrawable(
            this.getResources().getDrawable(R.drawable.progress_circular));
    mAbPullToRefreshView
        .getFooterView()
        .setFooterProgressBarDrawable(
            this.getResources().getDrawable(R.drawable.progress_circular));
    // mAbPullListView.getHeaderView().setHeaderProgressBarDrawable(this.getResources().getDrawable(R.drawable.progress_circular2));
    // mAbPullListView.getFooterView().setFooterProgressBarDrawable(this.getResources().getDrawable(R.drawable.progress_circular2));

    // ListView数据
    list = new ArrayList<IMMessage>();

    // 使用自定义的Adapter
    myListViewAdapter = new MessageListAdapter(this, list);
    mListView.setAdapter(myListViewAdapter);
    // item被点击事件
    mListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {}
        });
  }
  private void initMainView() {
    view =
        LayoutInflater.from(getActivity())
            .inflate(
                R.layout.layout_main_action_frame,
                (ViewGroup) getActivity().findViewById(R.id.vp_content),
                false);
    // tv_empty = (TextView) view.findViewById(R.id.tv_empty);
    listView = (ListView) view.findViewById(R.id.lv_action);
    // progressBar = (ProgressBar) view.findViewById(R.id.progress_order);
    mAbPullToRefreshView = (AbPullToRefreshView) view.findViewById(R.id.mPullRefreshView);
    // 设置进度条的样式
    mAbPullToRefreshView
        .getHeaderView()
        .setHeaderProgressBarDrawable(
            this.getResources().getDrawable(R.drawable.progress_circular));
    mAbPullToRefreshView
        .getFooterView()
        .setFooterProgressBarDrawable(
            this.getResources().getDrawable(R.drawable.progress_circular));

    listView.setAdapter(myOrderListAdapter);
  }
 private void initListener() {
   // 设置监听器
   mAbPullToRefreshView.setOnHeaderRefreshListener(this);
   mAbPullToRefreshView.setOnFooterLoadListener(this);
   // listView.setOnItemClickListener(this);
 }