use of com.manan.dev.ec2018app.Utilities.TicketsGenerator in project EC2018App by Manan-YMCA.
the class QRCodeActivity method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.qrcode_dialog_box, container, false);
if (mContext == null) {
mContext = getActivity();
}
String qrcodestring = getArguments().getString("qrcodestring");
eventId = getArguments().getString("eventid");
activity = getArguments().getInt("activity");
paymentStatus = getArguments().getInt("paymentStatus");
arrivalStatus = getArguments().getInt("arrivalStatus");
qrTicketImage = (ImageView) rootView.findViewById(R.id.qr_ticket);
eventName = (TextView) rootView.findViewById(R.id.tv_event_name);
eventDate = (TextView) rootView.findViewById(R.id.tv_event_date);
eventTime = (TextView) rootView.findViewById(R.id.tv_event_time);
fees = (TextView) rootView.findViewById(R.id.eventfees);
status = (TextView) rootView.findViewById(R.id.iv_event_fees_status);
back = (ImageView) rootView.findViewById(R.id.iv_cross);
getEventDetails = new DatabaseController(getActivity());
eventDetails = getEventDetails.retreiveEventsByID(eventId);
eventName.setText(eventDetails.getmName());
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getDialog().dismiss();
}
});
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(eventDetails.getmStartTime());
SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd, yyyy", Locale.ENGLISH);
String formattedDate = sdf.format(cal.getTime());
SimpleDateFormat sdf1 = new SimpleDateFormat("kk:mm", Locale.US);
String formattedTime = sdf1.format(cal.getTime());
eventDate.setText(formattedDate);
eventTime.setText(formattedTime);
fees.setText(String.valueOf("RS " + eventDetails.getmFees()));
TicketsGenerator ticketsGenerator = new TicketsGenerator();
Bitmap qrTicket = ticketsGenerator.GenerateClick(qrcodestring, mContext, (int) getResources().getDimension(R.dimen.threefifty), (int) getResources().getDimension(R.dimen.twoforty), 120, 120);
qrTicketImage.setImageBitmap(qrTicket);
if (String.valueOf(eventDetails.getmFees()).equals("0")) {
status.setTextColor(mContext.getResources().getColor(R.color.status_free));
status.setText("FREE");
} else if (String.valueOf(paymentStatus).equals("0")) {
status.setTextColor(mContext.getResources().getColor(R.color.primaryFocused));
status.setText("PENDING");
} else {
status.setTextColor(mContext.getResources().getColor(R.color.status_paid));
status.setText("PAID");
}
if (arrivalStatus == 1) {
qrTicketImage.setImageResource(R.drawable.arrived_qr);
}
return rootView;
}
use of com.manan.dev.ec2018app.Utilities.TicketsGenerator in project EC2018App by Manan-YMCA.
the class TicketLayoutAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
final QRTicketModel singleItem = itemsList.get(position);
EventDetails currEvent = new EventDetails();
DatabaseController mDatabaseController = new DatabaseController(mContext);
currEvent = mDatabaseController.retreiveEventsByID(singleItem.getEventID());
if (currEvent.getmFees() == 0) {
holder.feeStatus.setTextColor(mContext.getResources().getColor(R.color.status_free));
holder.feeStatus.setText("FREE");
} else if (singleItem.getPaymentStatus() == 0) {
holder.feeStatus.setTextColor(mContext.getResources().getColor(R.color.primaryFocused));
holder.feeStatus.setText("PENDING");
} else if (singleItem.getPaymentStatus() == 1) {
holder.feeStatus.setTextColor(mContext.getResources().getColor(R.color.status_paid));
holder.feeStatus.setText("PAID");
}
mProgress = new ProgressDialog(mContext);
mProgress.setMessage("Showing your ticket.");
mProgress.setTitle("Loading...");
mProgress.setCanceledOnTouchOutside(false);
TicketsGenerator generate = new TicketsGenerator();
Bitmap currTicket = generate.GenerateClick(singleItem.getQRcode(), mContext, (int) mContext.getResources().getDimension(R.dimen.onefifty), (int) mContext.getResources().getDimension(R.dimen.onefifty), 80, 80);
holder.itemImage.setImageBitmap(currTicket);
holder.eventName.setText(currEvent.getmName());
holder.eventFee.setText("RS " + String.valueOf(currEvent.getmFees()));
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(currEvent.getmStartTime());
SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd, yyyy", Locale.ENGLISH);
String formattedDate = sdf.format(cal.getTime());
holder.eventDate.setText(formattedDate);
SimpleDateFormat sdf1 = new SimpleDateFormat("kk:mm", Locale.US);
String formattedTime = sdf1.format(cal.getTime());
holder.eventTime.setText(formattedTime);
fm = ((Activity) mContext).getFragmentManager();
// final EventDetails finalCurrEvent = currEvent;
// holder.cardView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// // mProgress.show();
//
// holder.pb.setVisibility(View.VISIBLE);
//
// MDToast.makeText(mContext, "Loading Ticket...", Toast.LENGTH_SHORT, MDToast.TYPE_INFO).show();
// Bundle bundle = new Bundle();
// bundle.putString("qrcodestring", singleItem.getQRcode());
// bundle.putString("eventid", finalCurrEvent.getmEventId());
// bundle.putInt("activity", 0);
// bundle.putInt("paymentStatus", singleItem.getPaymentStatus());
// bundle.putInt("arrivalStatus", singleItem.getArrivalStatus());
// // set Fragmentclass Arguments
//
// QRCodeActivity fragobj = new QRCodeActivity();
// fragobj.setArguments(bundle);
// fragobj.show(fm, "TAG");
// }
// });
}
Aggregations