示例#1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_message, container, false);
    loadMoreListView = (LoadMoreListView) rootView.findViewById(R.id.lv_product);
    pending_view = (RelativeLayout) rootView.findViewById(R.id.pending_view);
    swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_container);
    swipeLayout.setOnRefreshListener(this);
    loadMoreListView.setOnLoadMoreListener(this);
    // 加载颜色是循环播放的,只要没有完成刷新就会一直循环,color1>color2>color3>color4
    /*swipeLayout.setColorScheme(android.R.color.white,
    android.R.color.holo_green_light,
    android.R.color.holo_orange_light, android.R.color.holo_red_light); */

    swipeLayout.setColorScheme(
        android.R.color.holo_red_light,
        android.R.color.holo_green_light,
        android.R.color.holo_blue_bright,
        android.R.color.holo_orange_light);
    pending_view = (RelativeLayout) rootView.findViewById(R.id.pending_view);

    initDate();
    initListener();
    return rootView;
  }
示例#2
0
  private void initListener() {
    loadMoreListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> viewGroup, View view, int position, long id) {
            if (type != Constant.FRAGMENT_PERSONAL) {
              Message message = (Message) loadMoreListView.getItemAtPosition(position);
              Intent intent = new Intent();
              Bundle mBundle = new Bundle();
              mBundle.putSerializable(Constant.MESSAGE_DETAIL, message);
              intent.putExtras(mBundle);
              intent.setClass(context, MessageDetailActivity.class);
              context.startActivity(intent);
            }
          }
        });
  }