Пример #1
0
 public Images(ParseObject parseObject) {
   if (!parseObject.isDataAvailable()) {
     parseObject.fetchIfNeededInBackground(
         new GetCallback<ParseObject>() {
           @Override
           public void done(ParseObject object, ParseException e) {
             mDownSized = new ImageConfigurationModel(object.getParseObject("downsized"));
             mDownSizedStill =
                 new ImageConfigurationModel(object.getParseObject("downsizedStill"));
             mOriginal = new ImageConfigurationModel(object.getParseObject("original"));
             mSmall = new ImageConfigurationModel(object.getParseObject("small"));
           }
         });
   } else {
     mOriginal = new ImageConfigurationModel(parseObject.getParseObject("original"));
     mDownSized = new ImageConfigurationModel(parseObject.getParseObject("downsized"));
     mDownSizedStill = new ImageConfigurationModel(parseObject.getParseObject("downsizedStill"));
     mSmall = new ImageConfigurationModel(parseObject.getParseObject("small"));
   }
 }
Пример #2
0
 public void setData(ParseObject object) {
   mId = object.getString("id");
   mType = object.getString("type");
   mContentType = object.getString("contentType");
   mRating = object.getString("rating");
   mCaption = object.getString("caption");
   mCreationDateTime = object.getString("creationDateTime");
   mTrendingDateTime = object.getString("trendingDateTime");
   mSourceUrl = object.getString("sourceUrl");
   mImages = new Images(object.getParseObject("images"));
 }
Пример #3
0
  public static List<ParseObject> getMessagesForRequest(ParseObject customerRequest) {
    if (allMessages == null) {
      return new ArrayList<ParseObject>();
    }

    List<ParseObject> messagesForRequest = new ArrayList<ParseObject>();
    for (ParseObject message : allMessages) {
      if (message.getParseObject("customerRequest").hasSameId(customerRequest)) {
        messagesForRequest.add(message);
      }
    }

    return messagesForRequest;
  }
  public static Board createBoard(ParseObject o) {
    if (o == null) {
      return null;
    }
    cache().put(o);

    Board board = new Board(o.getObjectId());
    if (o.has("category")) {
      board.setCategory(ParseHelper.createCategory(o.getParseObject("category")));
    }
    if (o.has("name")) {
      board.setName(o.getString("name"));
    }
    if (o.has("description")) {
      board.setDescription(o.getString("description"));
    }
    if (o.has("owner")) {
      board.setOwner(ParseHelper.createUser(o.getParseObject("owner")));
    }
    if (o.has("followers_count")) {
      board.setFollowersCount(o.getInt("followers_count"));
    }
    return board;
  }
 public static Pin createPin(ParseObject object) {
   cache().put(object);
   String title = getStringIfHas(object, "title");
   String description = getStringIfHas(object, "description");
   String image = getStringIfHas(object, "image");
   String linkUrl = getStringIfHas(object, "url");
   double aspectRatio = object.has("aspectratio") ? object.getDouble("aspectratio") : 1;
   ParseObject board = object.has("board") ? object.getParseObject("board") : null;
   return new Pin(
       object.getObjectId(),
       title,
       description,
       image,
       ParseHelper.createBoard(board),
       linkUrl,
       aspectRatio);
 }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View v = convertView;

      if (v == null) {
        LayoutInflater vi;
        vi = LayoutInflater.from(getContext());
        v = vi.inflate(R.layout.item_userbookinghistory, null);
      }

      final ParseObject userbooking = (ParseObject) getItem(position);

      if (userbooking != null) {
        TextView tv_bookedTime = (TextView) v.findViewById(R.id.tv_hotel_booked_time);
        TextView tv_hotel_name = (TextView) v.findViewById(R.id.tv_hotel_name);
        TextView tv_status = (TextView) v.findViewById(R.id.tv_status);

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-hh.mm.ss");
        ParseObject hotel = userbooking.getParseObject("BookedHotel");

        Date reservationTime = userbooking.getDate("ReservationTime");
        tv_bookedTime.setText(formatter.format(reservationTime));

        tv_hotel_name.setText(hotel.getString("Name"));

        int status = userbooking.getInt("BookingState");
        String status_message = "";

        if (status == 1) {
          status_message = "Under Process";
        } else if (status == 2) {
          status_message = "Confirmed";
        } else if (status == -1) {
          status_message = "Canceled";
        } else if (status == -2) {
          status_message = "Not Confirmed";
        }

        tv_status.setText(status_message);
      }

      return v;
    }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = inflater.inflate(layoutId, null);
      viewHolder.gridViewItem = (CardView) convertView.findViewById(R.id.historyOrderItemHOI);
      viewHolder.price = (TextView) convertView.findViewById(R.id.productPriceHOI);
      viewHolder.productImage = (ImageView) convertView.findViewById(R.id.productImageHOI);
      viewHolder.productName = (TextView) convertView.findViewById(R.id.productNameHOI);
      viewHolder.ratingBar = (RatingBar) convertView.findViewById(R.id.ratingBarGridItemHOI);
      viewHolder.quantity = (TextView) convertView.findViewById(R.id.productQuantityHOI);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    final ParseObject item = items.get(position);
    final ParseObject product = item.getParseObject(CART_PRODUCT_ID);
    final ViewHolder finalViewHolder = viewHolder;
    Log.w(TAG, position + "");
    finalViewHolder.quantity.setText(
        context.getString(R.string.quantity) + item.getNumber(SHIP_QUANTITY).toString());
    imageLoader.displayImage(
        product.getString(PRODUCT_THUMBNAIL_IMAGE), finalViewHolder.productImage, options);
    finalViewHolder.productName.setText(product.getString(PRODUCT_NAME));
    finalViewHolder.ratingBar.setRating(Float.parseFloat(product.getString(NUMBER_STAR)));
    finalViewHolder.price.setText(
        StringProcess.formatPrice((Integer) product.getNumber(PRODUCT_PRICE)));
    finalViewHolder.gridViewItem.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(context, ProductDetailActivity.class);
            intent.putExtra("productName", product.getString(PRODUCT_NAME));
            intent.putExtra("productId", product.getObjectId());
            context.startActivity(intent);
          }
        });

    return convertView;
  }