/src/com/playcar/fragment/CarNearTrandsFragment.java

https://gitlab.com/Er_Hei/PlayCar · Java · 204 lines · 86 code · 45 blank · 73 comment · 0 complexity · 513b66eb4baf90fc042746dd7b745b0b MD5 · raw file

  1. package com.playcar.fragment;
  2. import android.app.Activity;
  3. import android.app.AlertDialog;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.support.v4.app.Fragment;
  7. import android.view.LayoutInflater;
  8. import android.view.View;
  9. import android.view.ViewGroup;
  10. import android.view.Window;
  11. import android.widget.AdapterView;
  12. import android.widget.ListView;
  13. import android.widget.TextView;
  14. import com.alibaba.fastjson.JSON;
  15. import com.alibaba.fastjson.JSONObject;
  16. import com.playcar.R;
  17. import com.playcar.activity.CarNearActivity;
  18. import java.util.ArrayList;
  19. import java.util.List;
  20. /**
  21. * Created by Aure on 15/9/23.
  22. */
  23. public class CarNearTrandsFragment extends Fragment {
  24. private Activity mActivity;
  25. private TextView mMsgTv;
  26. private String mMsgName;
  27. // private TodayOrderListAdapter adapter;
  28. private String orderStatus = "";
  29. // private PullToRefreshListView orderListView;
  30. // private List<OrderData> orderList;
  31. private int flag;
  32. private int pagenum = 1;
  33. private boolean isPullUp = false;
  34. //表示是否继续加载下一页
  35. private boolean notLoadNext = false;
  36. @Override
  37. public void onAttach(Activity activity) {
  38. super.onAttach(activity);
  39. this.mActivity = activity;
  40. }
  41. @Override
  42. public void onCreate(Bundle savedInstanceState) {
  43. super.onCreate(savedInstanceState);
  44. }
  45. @Override
  46. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  47. Bundle savedInstanceState) {
  48. return inflater.inflate(R.layout.car_near_trands_fragment, container, false);
  49. }
  50. @Override
  51. public void onViewCreated(View view, Bundle savedInstanceState) {
  52. super.onViewCreated(view, savedInstanceState);
  53. // initViews(view);
  54. }
  55. @Override
  56. public void onActivityCreated(Bundle savedInstanceState) {
  57. super.onActivityCreated(savedInstanceState);
  58. final CarNearActivity activity = ((CarNearActivity) getActivity());
  59. View fragmentView = activity.fragments.get(0).getView();
  60. // adapter = new TodayOrderListAdapter(mActivity,this);
  61. // orderListView = (PullToRefreshListView) fragmentView.findViewById(R.id.all_order_list_view);
  62. // orderListView.getRefreshableView().setAdapter(adapter);
  63. // orderList = new ArrayList<OrderData>();
  64. // OrderData d1 = new OrderData();
  65. // d1.setOrderNumber("12121212");
  66. //
  67. // OrderData d2 = new OrderData();
  68. // d2.setOrderNumber("12121212");
  69. //
  70. // OrderData d3 = new OrderData();
  71. // d3.setOrderNumber("12121212");
  72. //
  73. // orderList.add(d1);
  74. // orderList.add(d2);
  75. // orderList.add(d3);
  76. // orderListView.setOnLastItemVisibleListener(lastItemVisibleListener);
  77. // orderListView.getRefreshableView().setOnItemClickListener(itemClickListener);
  78. //
  79. // adapter.addAll(orderList);
  80. // adapter.notifyDataSetChanged();
  81. // orderListView.onRefreshComplete();
  82. // initDisplay();
  83. }
  84. // private void initDisplay() {
  85. //
  86. //
  87. // 下拉刷新
  88. // orderListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
  89. // @Override
  90. // public void onRefresh(PullToRefreshBase<ListView> refreshView) {
  91. // pagenum = 1;
  92. // isPullUp = false;
  93. // //
  94. // getOrderList(orderStatus);
  95. //
  96. // }
  97. // });
  98. // //上拉刷新
  99. //// orderListView.setOnLastItemVisibleListener(lastItemVisibleListener);
  100. //// orderListView.getRefreshableView().setOnItemClickListener(itemClickListener);
  101. // getOrderList(orderStatus);
  102. //
  103. //
  104. // }
  105. private AdapterView.OnItemClickListener itemClickListener = new AdapterView.OnItemClickListener() {
  106. @Override
  107. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  108. // String orderId = orderList.get(position - 1).getOrderId();
  109. // Intent jumpIntent = new Intent(mActivity,OrderInfoActivity.class);
  110. // Bundle bundle = new Bundle();
  111. // bundle.putString("orderId", orderId);
  112. //// bundle.putSerializable("order",orderList.get(position - 1));
  113. // jumpIntent.putExtras(bundle);
  114. // mActivity.startActivity(jumpIntent);
  115. }
  116. // }
  117. };
  118. // private PullToRefreshBase.OnLastItemVisibleListener lastItemVisibleListener = new PullToRefreshBase.OnLastItemVisibleListener() {
  119. // @Override
  120. // public void onLastItemVisible() {
  121. // if (notLoadNext || orderList.size() < Constants.PAGESIZE) {
  122. // return;
  123. // }
  124. // isPullUp = true;
  125. // //加载下一页
  126. // pagenum++;
  127. // //获取数据
  128. // getOrderList(orderStatus);
  129. // }
  130. // };
  131. @Override
  132. public void onStart() {
  133. super.onStart();
  134. }
  135. @Override
  136. public void onResume() {
  137. super.onResume();
  138. }
  139. @Override
  140. public void onPause() {
  141. super.onPause();
  142. }
  143. @Override
  144. public void onStop() {
  145. super.onStop();
  146. }
  147. @Override
  148. public void onDestroyView() {
  149. super.onDestroyView();
  150. }
  151. @Override
  152. public void onDestroy() {
  153. super.onDestroy();
  154. }
  155. @Override
  156. public void onDetach() {
  157. super.onDetach();
  158. }
  159. }