@Override protected void registerViews() { refreshScrollView.setOnRefreshListener( new OnRefreshListener2<ScrollView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ScrollView> refreshView) { refresh(); } @Override public void onPullUpToRefresh(PullToRefreshBase<ScrollView> refreshView) { pagenum++; getService(); } }); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick( AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong) { Bundle bundle = new Bundle(); bundle.putString("productId", localServices.get(paramInt).getId()); jump( LocalServiceDetailFragment.class.getName(), localServices.get(paramInt).getProductName(), bundle); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTextView = (TextView) findViewById(R.id.text); mPullToRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.pullscro); mPullToRefreshScrollView.setOnRefreshListener( new OnRefreshListener<ScrollView>() { @Override public void onRefresh(PullToRefreshBase<ScrollView> refreshView) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { new Thread().sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } protected void onPostExecute(Void result) { mTextView.setText("р╕╪ян╟"); mPullToRefreshScrollView.onRefreshComplete(); }; }.execute(); } }); }
@Override protected void registerViews() { refreshScrollView.setMode(PullToRefreshBase.Mode.PULL_FROM_START); refreshScrollView.setOnRefreshListener( new PullToRefreshBase.OnRefreshListener<ScrollView>() { @Override public void onRefresh(PullToRefreshBase<ScrollView> refreshView) { getProductClass(); } }); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { select(productClasses.get(i)); } }); }
@Override protected void reload() { super.reload(); refreshScrollView.setMode(Mode.BOTH); pagenum = 0; localServices.clear(); serviceAdapter.notifyDataSetChanged(); pagenum++; getService(); }
@Override protected void registerViews() { refreshScrollView.setOnRefreshListener( new OnRefreshListener<ScrollView>() { @Override public void onRefresh(PullToRefreshBase<ScrollView> refreshView) { new GetOrderWuliu().execute(); } }); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { // TODO Auto-generated method stub super.onViewCreated(view, savedInstanceState); httpUtils = new HttpUtils(); homeGrid = (GridView) view.findViewById(R.id.homeContentType); homeList = (ListView) view.findViewById(R.id.homeTuanGouList); homeRgs = (ViewGroup) view.findViewById(R.id.homePageRadio); homePager = (ViewPager) view.findViewById(R.id.homeAutoViewPager); pullToRefreshScrollView = (PullToRefreshScrollView) view.findViewById(R.id.homeRefreshScrollLayout); pullToRefreshScrollView.setMode(Mode.BOTH); // pullToRefreshScrollView.setOnRefreshListener(new OnScrollRefreshListener()); initGridView(); initHomeList(); initData(); AutoScrollViewPager autoViewPager = new AutoScrollViewPager(getActivity(), homePager, homeRgs); autoViewPager.startScroll(); }
@Override protected void initViews() { wuliuList.setAdapter(wuliuAdapter); refreshScrollView.setMode(Mode.PULL_FROM_START); }
private void init() { mScrollView = (PullToRefreshScrollView) findViewById(R.id.carts_list); mBottomLayout = (LinearLayout) findViewById(R.id.footer_bar); mEmptyLayout = (LinearLayout) findViewById(R.id.empty_layout); mToBuy = (Button) findViewById(R.id.to_buy); mToBuy.setOnClickListener(this); mTotalPrice = (TextView) findViewById(R.id.total_price); findViewById(R.id.sidebar).setOnClickListener(this); mListView = (ExpandListViewForScrollView) findViewById(R.id.cart_listview); // View footer = getLayoutInflater().inflate(R.layout.shopping_cart_footer, null); mHorizontalListView = (HorizontalListView) findViewById(R.id.like_listview); mCheckBox = (CheckBox) findViewById(R.id.all_check_box); mPayView = (Button) findViewById(R.id.pay); mLikeAdapter = new LikeAdapter(this); mPayView.setOnClickListener(this); mHorizontalListView.setAdapter(mLikeAdapter); mListView.setGroupIndicator(null); // mFragment = // ((ShoppingCartBaseFragment)getSupportFragmentManager().findFragmentById(R.id.fragment)); // mListView.addFooterView(footer); mAdapter = new CartAdapter(this); mListView.setAdapter(mAdapter); mHorizontalListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(ShoppingCartActivity.this, ProductInfoActivity.class); intent.putExtra("product", mLikeAdapter.getItem(position)); startActivity(intent); } }); // mListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { // @Override // public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, // int childPosition, long id) { // Intent intent = new Intent(ShoppingCartActivity.this, // ProductInfoActivity.class); // intent.putExtra("product", mAdapter.getChild(groupPosition, childPosition)); // startActivity(intent); // return true; // } // }); mAdapter.setmListener( new CartAdapter.CartListener() { @Override public void onCheck() { float total = 0; for (int i = 0; i < mAdapter.getChecked().size(); i++) { total += mAdapter.getChecked().get(i).getGoodsNumber() * mAdapter.getChecked().get(i).getMemberPrice(); } mTotalPrice.setText("¥ " + total); } }); mCheckBox.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { SparseBooleanArray checks = new SparseBooleanArray(); for (int i = 0; i < mStores.size(); i++) { checks.put(i, mCheckBox.isChecked()); } mAdapter.setChildIgnoreChange(false); mAdapter.setmGroupCheck(checks); mAdapter.notifyDataSetChanged(); } }); mScrollView.setOnRefreshListener( new PullToRefreshBase.OnRefreshListener<ScrollView>() { @Override public void onRefresh(PullToRefreshBase<ScrollView> refreshView) { if (user != null) { userId = user.getId(); token = user.getToken(); getCarts(); } else { mScrollView.onRefreshComplete(); } } }); }
@Override protected void initViews() { refreshScrollView.setMode(Mode.BOTH); listView.setAdapter(serviceAdapter); }