Commit b53825c1 authored by ejcris's avatar ejcris

Removed errors with regards to creating new users.

parent 52e5e686
......@@ -78,9 +78,10 @@ public class Confirmation extends Dialog{
// TODO Auto-generated method stub
ParseUser user = ParseUser.getCurrentUser();
if(user!=null) {
double load = (double) user.get("load");
if(load>=totalCost){
user.put("load", load-totalCost);
String load = user.getString("load");
if(Double.parseDouble(load)>=totalCost){
user.put("load", Double.parseDouble(load)-totalCost);
user.saveInBackground();
//update noOfseats in buses
//send receipt
dismiss();
......
......@@ -18,7 +18,7 @@ import com.parse.ParseUser;
public class Login_Screen extends AppCompatActivity {
//public final static String EXTRA_MESSAGE = ;
String name, phone;
String name, password;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -38,10 +38,10 @@ public class Login_Screen extends AppCompatActivity {
EditText n = (EditText) findViewById(R.id.name);
name = n.getText().toString();
EditText p = (EditText) findViewById(R.id.phone);
phone = p.getText().toString();
EditText p = (EditText) findViewById(R.id.password);
password = p.getText().toString();
ParseUser.logInInBackground(name, phone, new LogInCallback() {
ParseUser.logInInBackground(name, password, new LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
Intent intent = new Intent(Login_Screen.this, ActionBarAttempt.class);
......
......@@ -33,7 +33,6 @@ public class Schedules extends Fragment {
String load;
View rootView;
SampleCustomAdapter adapter;
List<ParseObject> schedule;
ListView lv;
public void onCreate(Bundle savedInstanceState) {
......@@ -51,13 +50,10 @@ public class Schedules extends Fragment {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Schedule");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> schedule1, ParseException e) {
public void done(List<ParseObject> schedule, ParseException e) {
if (e == null) {
Log.d("Brand", "Retrieved " + schedule1.size() + " Brands");
Log.d("Brand", "Retrieved " + schedule.size() + " Brands");
schedule = schedule1;
//ListViewActivity lv = new ListViewActivity();
lv = (ListView) rootView.findViewById(R.id.list);
SampleCustomAdapter adapter2 = new SampleCustomAdapter(schedule);
......@@ -70,6 +66,7 @@ public class Schedules extends Fragment {
busSchedule = rootView.getContext().getSharedPreferences("bus", Context.MODE_PRIVATE);
SharedPreferences.Editor edit2 = busSchedule.edit();
//System.out.println(adapter.getObjectIDOfItem());
// edit2.putString("ID", adapter.getObjectIDOfItem());
TextView busNum = (TextView) rootView.findViewById(R.id.busNum);
......
......@@ -39,31 +39,37 @@ public class SignUp extends AppCompatActivity {
EditText n = (EditText) findViewById(R.id.name);
String name = n.getText().toString();
EditText p = (EditText) findViewById(R.id.phone);
String phone = p.getText().toString();
EditText pa = (EditText) findViewById(R.id.password);
String password = pa.getText().toString();
EditText ph = (EditText) findViewById(R.id.phone);
String phone = ph.getText().toString();
ParseUser user = new ParseUser();
user.setUsername(name);
user.setPassword(phone);
user.setPassword(password);
user.put("cellPhone", phone);
user.put("load", "0");
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
Intent intent = new Intent(SignUp.this, Login_Screen.class);
Intent intent = new Intent(SignUp.this, ActionBarAttempt.class);
//EditText editText = (EditText) findViewById(R.id.name);
//String message = editText.getText().toString();
//intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
} else {
System.out.println("DIDN'T WORK");
// Sign up didn't succeed. Look at the ParseException
Log.d("WHAT HAPPENED", e.getMessage());
// to figure out what went wrong
Toast.makeText(SignUp.this, "No internet connection", Toast.LENGTH_LONG).show();
}
}
});
}
});
}
......
......@@ -48,10 +48,9 @@
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:text="Cellphone Number"
android:text="Password"
android:ems="10"
android:id="@+id/phone"
android:id="@+id/password"
android:layout_weight="1"
android:layout_gravity="center_horizontal" />
......
......@@ -27,6 +27,14 @@
android:layout_height="wrap_content"
android:id="@+id/name"
android:text="Name"
android:layout_weight="2" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Password"
android:ems="10"
android:id="@+id/password"
android:layout_weight="2"
android:layout_gravity="center_horizontal" />
......
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