コード例 #1
0
 /** 更新餐厅信息 */
 private void updateInfo() {
   ImageFetcher.asInstance()
       .loadRoundedCorner(mRestaurant.getImage(), mRestaurantImageView, ScreenUtils.dip2px(1));
   mScoreCountView.setText(mRestaurant.getGrade());
   mSaleCountView.setText(mRestaurant.getSale());
   setTitle(mRestaurant.getName());
 }
コード例 #2
0
  /** 更新分类和排序 */
  private void updateCategoryAndOrder() {

    final List<Tags> categorys = mRestaurant.getCategorys();
    if (!ListUtils.isEmpty(categorys)) {
      mCategoryLayout.setCurrentTag("全部");
      mCategoryLayout.updateView(categorys);
      mAdapter.addView(mCategoryLayout);
    }
  }
コード例 #3
0
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);
    setUseShopCartPolice(true);
    mLoadingDialog = new LoadingDialog(activity);
    mLoadingDialog.cancelable(false);

    Bundle bundle = getArguments();
    if (bundle != null) {
      mRestaurantId = bundle.getString(EXTRA_RESTAURANT_ID);
      mRestaurant = (Restaurant) bundle.getSerializable(EXTRA_RESTAURANT);
      if (mRestaurant != null) {
        mRestaurantId = mRestaurant.getId();
      }
    }

    mAdapter = new MergeAdapter();
  }
コード例 #4
0
  /** 更新优惠信息 */
  private void updatePreferential() {
    final Notice preferentialNotice = new Notice();
    List<Notice.Note> notes = new ArrayList<>();
    preferentialNotice.setNotes(notes);
    // 配送信息
    Tags deliveryTag = mRestaurant.getDeliveryTag();

    // 优惠列表
    final List<Tags> preferentialList = mRestaurant.getPerferentials();
    mPreferentialViewGroup = new LinearLayout(getContext());
    mPreferentialViewGroup.setOrientation(LinearLayout.VERTICAL);

    // 设置优惠信息
    if (!ListUtils.isEmpty(preferentialList)) {
      Notice.Note note = new Notice.Note();
      notes.add(note);
      note.title = "优惠信息";
      note.items = new ArrayList<>();

      for (Tags tag : preferentialList) {
        Notice.NoteItem item = new Notice.NoteItem();
        item.name = tag.getName();
        item.icon = tag.getIcon();
        note.items.add(item);
      }
      Tags tags = ListUtils.getItem(preferentialList, 0);
      if (tags != null) {
        final View item = View.inflate(getContext(), R.layout.view_dish_preferential, null);
        mPreferentialViewGroup.addView(item);
        final ImageView icon = (ImageView) item.findViewById(R.id.app_dish_preferential_icon);
        final TextView name = (TextView) item.findViewById(R.id.app_dish_preferential_name);
        name.setText(tags.getName());
        ImageFetcher.asInstance()
            .load(tags.getIcon(), icon, R.drawable.app_bt_address_icon_default);
        if (deliveryTag != null) {
          preferentialList.add(deliveryTag);
        }
        if (preferentialList.size() > 1) {
          mLoopTime = 0;
          final PropertyValuesHolder rotationTo =
              PropertyValuesHolder.ofFloat("rotationX", 0f, 90f);
          final PropertyValuesHolder rotationBack =
              PropertyValuesHolder.ofFloat("rotationX", 90f, 0f);
          ObjectAnimator rotationToAnimator =
              ObjectAnimator.ofPropertyValuesHolder(name, rotationTo).setDuration(300);
          ObjectAnimator rotationBackAnimator =
              ObjectAnimator.ofPropertyValuesHolder(name, rotationBack).setDuration(300);
          mLoopAnimator = new AnimatorSet();
          mLoopAnimator.playSequentially(rotationToAnimator, rotationBackAnimator);
          rotationToAnimator.addUpdateListener(
              new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                  float rotationX = (float) valueAnimator.getAnimatedValue();
                  if (Float.compare(rotationX, 90) == 0) {
                    Tags current = preferentialList.get(mLoopTime++ % preferentialList.size());
                    name.setText(current.getName());
                    ImageFetcher.asInstance().load(current.getIcon(), icon);
                  }
                }
              });
        }
      }
    }

    // 设置配送信息
    if (deliveryTag != null) {
      Notice.Note note = new Notice.Note();
      notes.add(note);
      note.title = "配送信息";
      note.items = new ArrayList<>();
      Notice.NoteItem noteItem = new Notice.NoteItem();
      noteItem.name = deliveryTag.getName();
      noteItem.icon = deliveryTag.getIcon();
      note.items.add(noteItem);

      //            View item = View.inflate(getContext(), R.layout.view_dish_preferential, null);
      //            mPreferentialViewGroup.addView(item);
      //            final ImageView icon = (ImageView)
      // item.findViewById(R.id.app_dish_preferential_icon);
      //            final TextView name = (TextView)
      // item.findViewById(R.id.app_dish_preferential_name);
      //            name.setText(deliveryTag.getName());
      //            ImageFetcher.asInstance().load(deliveryTag.getIcon(), icon);
    }

    if (mPreferentialViewGroup.getChildCount() > 0) {
      if (null != mNoticeView) {
        mNoticeView.removeAllViews();
        mNoticeView.addView(mPreferentialViewGroup);
      }
      //            mAdapter.addView(mPreferentialViewGroup);
      mPreferentialViewGroup.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              new NoticeListDialog(getContext(), preferentialNotice)
                  .setCloseClick(
                      new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {}
                      })
                  .setDialogIcon(R.drawable.app_ic_dialog_preferential)
                  .show();
            }
          });

      ////            增加底部的灰色间隔
      //            View view = new View(getContext());
      //
      // view.setBackgroundColor(getContext().getResources().getColor(R.color.uikit_grey_light));
      //            ScreenUtils.resizeViewWithSpecial(view, ScreenUtils.getScreenWidthInt(),
      // ScreenUtils.dip2px(8));
      //            mPreferentialViewGroup.addView(view);
    }
  }