public SharesModel(ParseObject parseObject, Context context) { startDay = HelperClass.getStringFormatDate(parseObject.getDate("share_due_date"), context); shareOrder = parseObject.getInt("share_order"); isShareDelivered = parseObject.getBoolean("share_status"); jamId = parseObject.getString("shares_jamNo"); shareOwnerId = parseObject.getString("share_owner_id"); shareId = parseObject.getObjectId(); sharePaidAmount = parseObject.getInt("share_paid_amount"); }
@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; }