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