コード例 #1
0
 /** 请求餐厅菜品列表 */
 private void requestDishList(int page, int pageSize, ApiCallback<ApiModelList<Dish>> callback) {
   Address address = DishPolicy.get().getDishAddress();
   String lat = address.getLocation().getLatitude();
   String lon = address.getLocation().getLongitude();
   DishApi.getDishListFromRestaurant(
       mCategoryLayout.getCurrentTag(),
       mRestaurantId,
       lat,
       lon,
       mCategoryLayout.getOrderType(),
       mCategoryLayout.getOrderDirect(),
       page,
       pageSize,
       callback);
 }
コード例 #2
0
  @Override
  public void onStartUILoad() {
    super.onStartUILoad();

    if (!StringUtils.isEmpty(mRestaurantId)) {
      showLoading();
      RestaurantApi.getDishRestaurantDetail(
          mRestaurantId,
          new ApiCallback<Restaurant>() {
            @Override
            public void onResult(Restaurant result) {
              if (result.available()) {
                mRestaurant = result;
              } else {
                ToastAlarm.show(result.getErrorMsg());
              }

              if (mRestaurant != null && null != getContext()) {
                updateInfo();
                updatePreferential();
                updateCategoryAndOrder();
                requestDishList();
                startNoticeLoop();
              }
            }
          });

      DishApi.getDishNotice(
          DishApi.NOTICE_TYPE_RESTAURANT,
          mRestaurantId,
          new ApiCallback<Notice>() {
            @Override
            public void onResult(Notice result) {
              String title = null;
              if (result.available()) {
                title = result.getTitle();
              }
              if (!StringUtils.isEmpty(title)) {
                mRestaurantNoticeView.setVisibility(View.VISIBLE);
                mRestaurantNoticeContentView.setText(title);
                mRestaurantNoticeView.setOnClickListener(
                    new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                        if (mRestaurantNotice != null) {
                          LogGather.onEventDishRestaurantDetailGoNotice();
                          new NoticeListDialog(getContext(), mRestaurantNotice)
                              .setCloseClick(
                                  new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {}
                                  })
                              .setDialogIcon(R.drawable.app_ic_dialog_notice)
                              .show();
                        }
                      }
                    });
                mRestaurantNotice = result;
                mRestaurantNotice.setImage("");
              } else {
                mRestaurantNoticeView.setVisibility(View.GONE);
              }
            }
          });
    }
  }