Commit fa09ded7 authored by Bhavesh Yadav's avatar Bhavesh Yadav

Misc changes - popup,text

parent 11089ae0
package com.example.infiniteLoop.parkingo; package com.example.infiniteLoop.parkingo;
import android.app.Activity; import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
...@@ -13,6 +14,7 @@ import static android.content.ContentValues.TAG; ...@@ -13,6 +14,7 @@ import static android.content.ContentValues.TAG;
public class checkin extends Activity { public class checkin extends Activity {
EditText name,mobile,vehicle,slot; EditText name,mobile,vehicle,slot;
ProgressDialog progress;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -55,6 +57,11 @@ public class checkin extends Activity { ...@@ -55,6 +57,11 @@ public class checkin extends Activity {
if(!cd.getName().isEmpty() && !cd.getSlot().isEmpty() && !cd.getVehicle_no().isEmpty()){ if(!cd.getName().isEmpty() && !cd.getSlot().isEmpty() && !cd.getVehicle_no().isEmpty()){
sqlite_ops so=new sqlite_ops(this); sqlite_ops so=new sqlite_ops(this);
so.check_in(cd,this); so.check_in(cd,this);
progress = new ProgressDialog(checkin.this);
progress.setTitle("Checking in");
progress.setMessage("Booking a slot...");
progress.setCancelable(false); // disable dismiss by tapping outside of the dialog
progress.show();
//add waiting popup //add waiting popup
} }
else{ else{
...@@ -64,6 +71,7 @@ public class checkin extends Activity { ...@@ -64,6 +71,7 @@ public class checkin extends Activity {
public void checkinSuccess(String ticketNo) { public void checkinSuccess(String ticketNo) {
progress.dismiss();
Intent i=new Intent(checkin.this,ticket.class); Intent i=new Intent(checkin.this,ticket.class);
i.putExtra("ticket_no",ticketNo); i.putExtra("ticket_no",ticketNo);
i.putExtra("checkin",1); i.putExtra("checkin",1);
...@@ -71,6 +79,7 @@ public class checkin extends Activity { ...@@ -71,6 +79,7 @@ public class checkin extends Activity {
} }
public void checkinFailure() { public void checkinFailure() {
progress.dismiss();
Toast.makeText(this,"Error in inserting data",Toast.LENGTH_SHORT).show(); Toast.makeText(this,"Error in inserting data",Toast.LENGTH_SHORT).show();
} }
......
...@@ -2,6 +2,7 @@ package com.example.infiniteLoop.parkingo; ...@@ -2,6 +2,7 @@ package com.example.infiniteLoop.parkingo;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
...@@ -25,6 +26,7 @@ public class checkout extends Activity { ...@@ -25,6 +26,7 @@ public class checkout extends Activity {
String slot_number,ticket_number; String slot_number,ticket_number;
LinearLayout innerll; LinearLayout innerll;
ArrayList ticketData; ArrayList ticketData;
ProgressDialog progress;
long checkInTimeLong; long checkInTimeLong;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -74,12 +76,18 @@ public class checkout extends Activity { ...@@ -74,12 +76,18 @@ public class checkout extends Activity {
else{ else{
sqlite_ops so=new sqlite_ops(this); sqlite_ops so=new sqlite_ops(this);
so.check_out(slot_number,ticket_number,checkInTimeLong,this); so.check_out(slot_number,ticket_number,checkInTimeLong,this);
progress = new ProgressDialog(checkout.this);
progress.setTitle("Checking out");
progress.setMessage("Calculating parking charge...");
progress.setCancelable(false); // disable dismiss by tapping outside of the dialog
progress.show();
} }
} }
} }
public void checkoutSuccess(Long checkoutDateTime,int charges) { public void checkoutSuccess(Long checkoutDateTime,int charges) {
progress.dismiss();
Intent i = new Intent(this, ticket.class); Intent i = new Intent(this, ticket.class);
long datetime = Long.parseLong(checkoutDateTime.toString()); long datetime = Long.parseLong(checkoutDateTime.toString());
Date date = new Date(datetime*1000); Date date = new Date(datetime*1000);
...@@ -95,6 +103,7 @@ public class checkout extends Activity { ...@@ -95,6 +103,7 @@ public class checkout extends Activity {
} }
public void checkoutFailed() { public void checkoutFailed() {
progress.dismiss();
Toast.makeText(this,"Error! Contact Developer",Toast.LENGTH_SHORT).show(); Toast.makeText(this,"Error! Contact Developer",Toast.LENGTH_SHORT).show();
} }
......
...@@ -67,7 +67,7 @@ public class ticket extends Activity { ...@@ -67,7 +67,7 @@ public class ticket extends Activity {
String[] checkoutdateandtime=checkout_date_data.split(" "); String[] checkoutdateandtime=checkout_date_data.split(" ");
checkout_date.setText(checkoutdateandtime[0]); checkout_date.setText(checkoutdateandtime[0]);
checkout_time.setText(checkoutdateandtime[1]); checkout_time.setText(checkoutdateandtime[1]);
charge_value.setText(ticketData.get(7).toString()); charge_value.setText("\u20B9 "+ticketData.get(7).toString());
}else { }else {
ticket_title.setText("Parking Ticket"); ticket_title.setText("Parking Ticket");
checkout_parent.setVisibility(View.GONE); checkout_parent.setVisibility(View.GONE);
...@@ -107,4 +107,6 @@ public class ticket extends Activity { ...@@ -107,4 +107,6 @@ public class ticket extends Activity {
startActivity(new Intent(this,dashboard.class)); startActivity(new Intent(this,dashboard.class));
finish(); finish();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment