private void initDate() { // 请求数据并初始化listView即三级目录列表 if (categoryBean != null) { int categoryID = categoryBean.getCategoryID(); RequstClient.getClassListLevel3( URLs.SORT_LIST_LEVEL3, categoryID + "", new CustomResponseHandler(getActivity()) { @Override public void onSuccess(int statusCode, Header[] headers, String content) { super.onSuccess(statusCode, headers, content); Gson gson = new Gson(); bean3 = gson.fromJson(content, ClassListLevel3Bean.class); if (bean3.type.equals("1")) { // Toast.makeText(getActivity(), "数据加载" + bean3.msg, 0).show(); adapter3 = new ClassList3Adapter(getActivity(), bean3); class_list_level3_lv.setAdapter(adapter3); adapter3.notifyDataSetChanged(); if (bean3.hotcommodity != null) { // 初始化横条 initScrollView(); } else { return; } } else { Toast.makeText(getActivity(), "数据异常!", 0).show(); return; } } }); } else { Toast.makeText(getActivity(), "获取数据异常...", Toast.LENGTH_LONG).show(); return; } }
private void initView() { category_line = v.findViewById(R.id.category_line); jianbian_left_iv = (ImageView) v.findViewById(R.id.jianbian_left_iv); jianbian_right_iv = (ImageView) v.findViewById(R.id.jianbian_right_iv); categoryBean = (CategoryBean) getArguments().getSerializable(INTENT_CATEGORY_BEAN); sc = (PullToRefreshScrollView) v.findViewById(R.id.class_list_level3_sc); sc.setMode(Mode.BOTH); sc.setEnabled(true); sc.setLoadingDrawable(null, Mode.BOTH); sc.getLoadingLayoutProxy().setLastUpdatedLabel(""); sc.getLoadingLayoutProxy().setPullLabel(""); sc.getLoadingLayoutProxy().setRefreshingLabel(""); sc.getLoadingLayoutProxy().setReleaseLabel(""); class_list_level3_lv = (MyListView) v.findViewById(R.id.class_list_level3_lv); class_list_level3_lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (bean3.category != null && bean3.category.size() != 0) { String id4 = bean3.category.get(arg2).ID; String categoryName = bean3.category.get(arg2).CATEGORY_NAME; Intent intent = new Intent(getActivity(), CategorySearchActivity.class); if ("全部".equals(categoryName)) { String two_category_id = categoryBean.getCategoryID() + ""; intent.putExtra(CategorySearchActivity.BUNDLE_MARK, "2"); intent.putExtra(CategorySearchActivity.BUNDLE_KEY_CATEGORY_ID, two_category_id); } else { intent.putExtra(CategorySearchActivity.BUNDLE_MARK, "3"); intent.putExtra(CategorySearchActivity.BUNDLE_KEY_CATEGORY_ID, id4); } startActivity(intent); } else { return; } } }); ab_back = (TextView) v.findViewById(R.id.ab_back); ab_title = (TextView) v.findViewById(R.id.ab_title); ab_right_btn1 = (ImageView) v.findViewById(R.id.ab_right_btn1); ab_right_btn2 = (ImageView) v.findViewById(R.id.ab_right_btn2); View line = v.findViewById(R.id.ab_line); line.setVisibility(View.VISIBLE); class_list_level3_load = (LinearLayout) v.findViewById(R.id.class_list_level3_load); ab_back.setOnClickListener(this); ab_right_btn1.setOnClickListener(this); ab_right_btn2.setOnClickListener(this); ab_right_btn2.setImageResource(R.drawable.ab_ic_search2); ab_right_btn1.setImageResource(R.drawable.ab_home_barcode); ab_right_btn1.setVisibility(View.VISIBLE); ab_right_btn2.setVisibility(View.VISIBLE); ab_title.setText(categoryBean.getCategoryName()); // 初始化数据 initDate(); }