コード例 #1
0
  /** 更新分类和排序 */
  private void updateCategoryAndOrder() {

    final List<Tags> categorys = mRestaurant.getCategorys();
    if (!ListUtils.isEmpty(categorys)) {
      mCategoryLayout.setCurrentTag("全部");
      mCategoryLayout.updateView(categorys);
      mAdapter.addView(mCategoryLayout);
    }
  }
コード例 #2
0
 /** 修改适配器模式 */
 private void changeAdapterMode(View v) {
   if (null != mPullToZoomListView) {}
   if (null != mDishAdapter) {
     boolean isSingle = mDishAdapter.getMode().equals(DishDetailAdapter.DISH_MODE_SINGLE);
     mDishAdapter.setMode(
         isSingle ? DishDetailAdapter.DISH_MODE_DOUBLE : DishDetailAdapter.DISH_MODE_SINGLE);
     mTitleBarCategoryLayout
         .getmOrderByChooseView()
         .setSwitchImg(
             isSingle ? R.drawable.app_ic_layout_mode_big : R.drawable.app_ic_layout_mode_small);
     mCategoryLayout
         .getmOrderByChooseView()
         .setSwitchImg(
             isSingle ? R.drawable.app_ic_layout_mode_big : R.drawable.app_ic_layout_mode_small);
     mDishAdapter.notifyDataSetChanged();
     mAdapter.notifyDataSetChanged();
     if (null != mPullToZoomListView && mPullToZoomListView.getAdapter() != null) {
       if (mDishAdapter.getMode().equals(DishDetailAdapter.DISH_MODE_SINGLE)) {
         int scrollToPosition =
             Math.max(
                 0,
                 (mPullToZoomListView.getFirstVisiblePosition()
                             + mPullToZoomListView.getFirstVisiblePosition() % 2)
                         * 2
                     - 2);
         mPullToZoomListView.smoothScrollToPosition(
             Math.min(scrollToPosition, mPullToZoomListView.getCount() - 1));
       } else {
         int scrollToPosition =
             Math.max(
                 0,
                 (mPullToZoomListView.getFirstVisiblePosition()
                         + mPullToZoomListView.getFirstVisiblePosition() % 2)
                     / 2);
         mPullToZoomListView.smoothScrollToPosition(
             Math.min(scrollToPosition, mPullToZoomListView.getCount() - 1));
       }
     }
   }
 }