@Override public void initData() { super.initData(); urls = getIntent().getStringArrayExtra("urls"); descs = getIntent().getStringArrayExtra("descs"); oldposition = getIntent().getIntExtra("position", 0); mCurrentStep.setText((oldposition + 1) + "/" + urls.length); mViewPager.setAdapter(new MyPagerAdapter()); mViewPager.setOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels) {} @Override public void onPageSelected(int position) { mCurrentStep.setText((position + 1) + "/" + urls.length); } @Override public void onPageScrollStateChanged(int state) {} }); mViewPager.setCurrentItem(oldposition); }
@SuppressWarnings("deprecation") @Override public void initWidget() { super.initWidget(); gestureDetector = new GestureDetector(this); // 手势滑动 titleImg.setBackgroundResource(R.drawable.title_splb); foodBtn.setText("食品"); textileBtn.setText("家纺"); washBtn.setText("洗护"); // 分类下的彩色条 gestureDetector = new GestureDetector(this); // 手势滑动 windowsWidth = this.getWindowManager().getDefaultDisplay().getWidth(); int offset = ListUtils.dip2px(aty, 30); btnSelected.getLayoutParams().width = windowsWidth / 3 - offset; listView = (ListView) this.findViewById(R.id.private_order_list); listView.setAdapter(adapter); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Bundle bundle = new Bundle(); bundle.putString("name", list.get(position).getName()); bundle.putString("description", list.get(position).getName()); bundle.putString("address", list.get(position).getName()); bundle.putString("path", list.get(position).getImagePath()); bundle.putString("type", list.get(position).getType()); MemberShoppeActivity.this.showActivity(aty, TypeDetailActivity.class, bundle); } }); }
@Override public void initData() { super.initData(); mList = new ArrayList<ItemBean>(); for (int i = 0; i < 100; i++) { mList.add(new ItemBean(R.mipmap.ic_launcher, "标题" + i, "内容" + i)); } }
@Override public void widgetClick(View v) { super.widgetClick(v); if (v.getId() == R.id.private_order_back) { this.finish(); } else { if (v.getId() == R.id.private_order_item1) { if (curBtn != 1) { clickBtn = 1; moveAnimation(curBtn - clickBtn); curBtn = 1; } } else if (v.getId() == R.id.private_order_item2) { if (curBtn != 2) { clickBtn = 2; moveAnimation(curBtn - clickBtn); curBtn = 2; } } else if (v.getId() == R.id.private_order_item3) { if (curBtn != 3) { clickBtn = 3; moveAnimation(curBtn - clickBtn); curBtn = 3; } } if (curBtn == 1) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "food"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 2) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk)); type = "textile"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } else if (curBtn == 3) { foodBtn.setTextColor(this.getResources().getColor(R.color.ajk)); textileBtn.setTextColor(this.getResources().getColor(R.color.ajk)); washBtn.setTextColor(this.getResources().getColor(R.color.ajk_selected)); type = "wash"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); } } }
@Override public void widgetClick(View v) { super.widgetClick(v); switch (v.getId()) { case R.id.btn_setting: showActivity(aty, setting.class); break; } }
@SuppressWarnings("unchecked") @Override public void handleMessage(Message msg) { if (msg.what == 1) { list = (ArrayList<MemberShoppeModel>) msg.obj; adapter.setList(list); adapter.notifyDataSetChanged(); } super.handleMessage(msg); }
@Override public void initData() { super.initData(); ActivityManager.getInstace().addActivity(aty); adapter = new MemberShoppeListAdapter(list, aty); type = "food"; HttpMemberShoppeRequest request = new HttpMemberShoppeRequest(aty, mHandler, 1); request.getMemberShoppeInit(type, -1); request.start(); }
@Override public void initData() { super.initData(); // 获取返回数据的基础类型 通用属性都有 data属性还是还是json 如果需要解析 再次解析 Entity entity = JSON.parseObject(jsos, Entity.class); // 继续解析data data里面有pages currentPage count maxCount 还有list数组 CookbookListData data1 = JSON.parseObject(entity.getData().toString(), CookbookListData.class); ArrayList<CookBook> cookBooks = data1.getList(); CookBook cookBook1 = cookBooks.get(0); textView.setText(cookBook1 + "\n\n" + entity.toString()); textView2.setText(data1.toString() + "\n\n" + cookBooks.toString() + "\n\n"); }
@Override public void initWidget() { super.initWidget(); mListView.setAdapter(new MyAdapter(aty, mList)); }
@Override public void initDataFromThread() { super.initDataFromThread(); }
@Override public boolean dispatchTouchEvent(MotionEvent ev) { gestureDetector.onTouchEvent(ev); super.dispatchTouchEvent(ev); return false; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }