Exemplo n.º 1
0
        public void onClick(View view) {
          final int position = Integer.parseInt(view.getTag().toString());
          final Dialog dialog = new Dialog(MenuActivity.this, R.style.TANCStyle);

          ImageView dishPicView;

          dialog.setContentView(R.layout.dish_detail);
          dishPicView = (ImageView) dialog.findViewById(R.id.dishBigPic);
          dialog.setCancelable(true);

          FileInputStream isBigPic = getPic(mDishes.getDish(position).getPic());
          if (isBigPic != null) {
            Bitmap photo = BitmapFactory.decodeStream(isBigPic);
            Drawable drawable = new BitmapDrawable(photo);
            dishPicView.setBackgroundDrawable(drawable);
          } else {
            dishPicView.setBackgroundResource(R.drawable.no_pic_bigl);
          }

          Button btnCancel = (Button) dialog.findViewById(R.id.btnCancel);
          btnCancel.setOnClickListener(
              new Button.OnClickListener() {
                public void onClick(View view) {
                  dialog.cancel();
                }
              });
          dialog.show();
        }
Exemplo n.º 2
0
 private void updateDishes(final int position) {
   mDishes.clear();
   mDishLstAdapter.notifyDataSetChanged();
   new Thread() {
     public void run() {
       int ret =
           mDishes.setCategory(
               mCategories.getCategoryId(position), mCategories.getTableName(position));
       handler.sendEmptyMessage(ret);
     }
   }.start();
 }
Exemplo n.º 3
0
  private View getFastOrderMenu(int position, View convertView) {
    ItemViewHolder viewHolder;
    Dish dishDetail = mDishes.getDish(position);

    if (convertView == null) {
      viewHolder = new ItemViewHolder();
      convertView = LayoutInflater.from(MenuActivity.this).inflate(R.layout.item_fastorder, null);
      viewHolder.findViews(convertView, ItemViewHolder.ITEM_FASTORDER_VIEW);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ItemViewHolder) convertView.getTag();
    }

    viewHolder.setData(dishDetail);
    viewHolder.setOnClickListener();
    viewHolder.setTag(position);
    return convertView;
  }
Exemplo n.º 4
0
 public void onClick(View v) {
   final int position = Integer.parseInt(v.getTag().toString());
   mMyOrder.add(mDishes.getDish(position), 1, Info.getTableId(), 0);
   updateOrderedDishCount();
   mDishLstAdapter.notifyDataSetChanged();
 }