Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.58 KB | None | 0 0
  1. {
  2. "PositionId": "574c1ccd02182121008b1980",
  3. "PositionRefNo": "00353","PositionInformation": {
  4. "LastActionTypeItem": null,
  5. "LastActionTime": null,
  6. "UseableActionTypes": [{
  7. "ActionType": "StartPosition",
  8. "ActionTypeDisplay": "Start"
  9. }],
  10. "LoadList": [{
  11. "Id": "5714ef197283771ac820269f",
  12. "OrderDate": "2016-04-18T17:25:00+03:00",
  13. "RefNo": "00265",
  14. "StatusName": "bla bla",
  15. "BranchName": "xxxxx",
  16. "ArrivalBranchName": "aaaaaa",
  17. "DepartureCityName": "bbbbb",
  18. "DepartureCountyName": "",
  19. "ArrivalCityName": "",
  20. "ArrivalCountyName": "",
  21. "OrderContent": "10 ",
  22. "UnloadingCustomerAddressType": "Warehouse"
  23. }, {
  24. "Id": "5714f761728377367414db0b",
  25. "OrderDate": "2016-04-18T18:02:00+03:00",
  26. "RefNo": "00266",
  27. "StatusName": "",
  28. "BranchName": "",
  29. "ArrivalBranchName": "",
  30. "DepartureCityName": "",
  31. "DepartureCountyName": "",
  32. "ArrivalCityName": "",
  33. "ArrivalCountyName": "",
  34. "OrderContent": "4 Palet",
  35. "UnloadingCustomerAddressType": "Warehouse"
  36. }, {
  37. "Id": "5716432372837636548073ae",
  38. "OrderDate": "2016-04-19T17:39:00+03:00",
  39. "RefNo": "00266-001",
  40. "StatusName": "",
  41. "BranchName": "",
  42. "ArrivalBranchName": "",
  43. "DepartureCityName": "",
  44. "DepartureCountyName": "",
  45. "ArrivalCityName": "",
  46. "ArrivalCountyName": "",
  47. "OrderContent": "1 Piece",
  48. "UnloadingCustomerAddressType": "www"
  49. }, {
  50. "Id": "571641967507d650b49c805a",
  51. "OrderDate": "2016-04-19T16:51:00+03:00",
  52. "RefNo": "00268",
  53. "StatusName": "cc",
  54. "BranchName": "dd",
  55. "ArrivalBranchName": "ee",
  56. "DepartureCityName": "ff",
  57. "DepartureCountyName": "gg",
  58. "ArrivalCityName": "g",
  59. "ArrivalCountyName": "",
  60. "OrderContent": "10 Palet",
  61. "UnloadingCustomerAddressType": ""
  62. }],
  63. "Status": true,
  64. "Message": "",
  65. }
  66. }
  67.  
  68. public class DomMobileLoadList {
  69.  
  70. private String PositionId;
  71. private String PositionRefNo;
  72. private String Message;
  73. private Boolean Status;
  74. private ArrayList<LoadList> LoadList;
  75. private ArrayList<PositionInformation> PositionInformation;
  76.  
  77.  
  78. public DomMobileLoadList(JSONObject jObj) throws JSONException
  79. {
  80. this.PositionId = jObj.isNull("PositionId") || jObj.getString("PositionId").equals("null") ? "" : jObj.optString("PositionId");
  81. this.PositionRefNo = jObj.isNull("PositionRefNo") || jObj.getString("PositionRefNo").equals("null") ? "" : jObj.optString("PositionRefNo");
  82. this.Message = jObj.isNull("Message") || jObj.getString("Message").equals("null") ? "" : jObj.optString("Message");
  83. this.Status = jObj.optBoolean("Status");
  84.  
  85. if(!jObj.isNull("LoadList"))
  86. {
  87. /*
  88. JSONObject jsonObject = jObj.getJSONObject("LoadList");
  89. this.LoadList = new ArrayList<LoadList>();
  90. this.LoadList.add(new LoadList(jsonObject));
  91. */
  92. this.LoadList = new ArrayList<LoadList>();
  93. JSONArray array = jObj.getJSONArray("LoadList");
  94. for (int i = 0; i < array.length(); i++)
  95. {
  96. this.LoadList.add(new LoadList(array.getJSONObject(i)));
  97. }
  98.  
  99. }
  100. if(!jObj.isNull("PositionInformation"))
  101. {
  102.  
  103. JSONObject jobposInfo = jObj.getJSONObject("PositionInformation");
  104. this.PositionInformation = new ArrayList<PositionInformation>();
  105. this.PositionInformation.add(new PositionInformation(jobposInfo));
  106.  
  107. }
  108. }
  109.  
  110.  
  111.  
  112.  
  113.  
  114. public String getPositionId() {
  115. return PositionId;
  116. }
  117.  
  118. public void setPositionId(String positionId) {
  119. PositionId = positionId;
  120. }
  121.  
  122. public String getPositionRefNo() {
  123. return PositionRefNo;
  124. }
  125.  
  126. public void setPositionRefNo(String positionRefNo) {
  127. PositionRefNo = positionRefNo;
  128. }
  129.  
  130. public String getMessage() {
  131. return Message;
  132. }
  133.  
  134. public void setMessage(String message) {
  135. Message = message;
  136. }
  137.  
  138. public Boolean getStatus() {
  139. return Status;
  140. }
  141.  
  142. public void setStatus(Boolean status) {
  143. Status = status;
  144. }
  145.  
  146. public ArrayList<LoadList> getLoadList() {
  147. return LoadList;
  148. }
  149.  
  150. public void setLoadList(ArrayList<LoadList> loadList) {
  151. LoadList = loadList;
  152. }
  153.  
  154. }
  155.  
  156. public class DomMobileLoadListAdapter extends BaseAdapter{
  157.  
  158. // LoadList vardฤฑ DomMobileLoadList olarak deฤŸiลŸtirdim .
  159. Activity activity;
  160. private ArrayList<DomMobileLoadList> items;
  161. private LayoutInflater inflater = null;
  162.  
  163. public DomMobileLoadListAdapter(Activity activity, ArrayList<DomMobileLoadList> items) {
  164. this.activity = activity;
  165. this.items = items;
  166. this.inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  167. }
  168.  
  169.  
  170. @Override
  171. public int getCount() {
  172. // TODO Auto-generated method stub
  173. return items.size();
  174.  
  175. }
  176.  
  177. @Override
  178. public Object getItem(int position) {
  179.  
  180. return position;
  181. }
  182.  
  183. public DomMobileLoadList getLast()
  184. {
  185. return this.items.get(getCount()-1);
  186. }
  187.  
  188. @Override
  189. public long getItemId(int position) {
  190. // TODO Auto-generated method stub
  191. return position;
  192. }
  193.  
  194. public void insertItem(int index, DomMobileLoadList item)
  195. {
  196. this.items.add(index, item);
  197. }
  198.  
  199. public void addItem(DomMobileLoadList item)
  200. {
  201. this.items.add(item);
  202. }
  203.  
  204. public ArrayList<DomMobileLoadList> getItems()
  205. {
  206. return this.items;
  207. }
  208.  
  209. public void removeItem(int position)
  210. {
  211. this.items.remove(position);
  212. }
  213.  
  214. public void removeItem(LoadList item)
  215. {
  216. this.items.remove(item);
  217. }
  218.  
  219. @SuppressWarnings("unused")
  220. @Override
  221. public View getView(int position, View convertView, ViewGroup parent) {
  222.  
  223. View vi = convertView;
  224. final DomMobileLoadList item = items.get(position);
  225.  
  226. if(convertView == null)
  227. vi = inflater.inflate(R.layout.dom_position_details, null);
  228. TextView txt_departurecityname=(TextView)vi.findViewById(R.id.departure_city_name);
  229. TextView txt_departurecountyname = (TextView)vi.findViewById(R.id.departure_countname);
  230. TextView txt_arrivalcityname = (TextView)vi.findViewById(R.id.arrival_cityname);
  231. TextView txt_arrivalcountyname = (TextView)vi.findViewById(R.id.arrival_countname);
  232. TextView txt_branchname = (TextView)vi.findViewById(R.id.txt_antrepo);
  233. TextView txt_ordercontent = (TextView)vi.findViewById(R.id.txt_ordercontent);
  234. TextView txt_unloadingcustomeraddresstype =(TextView)vi.findViewById(R.id.txt_unloadingcustomeraddresstype);
  235.  
  236. /*
  237. txt_departurecityname.setText(item.getDepartureCityName());
  238. txt_departurecountyname.setText(item.getDepartureCountyName());
  239. txt_arrivalcityname.setText(item.getArrivalCityName());
  240. txt_arrivalcountyname.setText(item.getArrivalCountyName());
  241. txt_branchname.setText(item.getBranchName());
  242. txt_ordercontent.setText(item.getOrderContent());
  243. txt_unloadingcustomeraddresstype.setText(item.getUnloadingCustomerAddressType());
  244. */
  245. for (int i = 0; i < item.getLoadList().size(); i++) {
  246.  
  247. txt_arrivalcityname.setText(item.getLoadList().get(i).getArrivalCityName());
  248. txt_departurecountyname.setText(item.getLoadList().get(i).getDepartureCountyName());
  249. txt_arrivalcityname.setText((item.getLoadList().get(i).getArrivalCityName()));
  250. txt_arrivalcountyname.setText((item.getLoadList().get(i).getArrivalCountyName()));
  251. txt_branchname.setText((item.getLoadList().get(i).getBranchName()));
  252. txt_ordercontent.setText((item.getLoadList().get(i).getOrderContent()));
  253. txt_unloadingcustomeraddresstype.setText((item.getLoadList().get(i).getUnloadingCustomerAddressType()));
  254.  
  255.  
  256. }
  257.  
  258. return vi;
  259. }
  260.  
  261. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement