Commit b2c43ec1 authored by Sam's avatar Sam

Commit v7

parent b5208790
...@@ -71,10 +71,6 @@ public class Receipt extends AppCompatActivity implements View.OnClickListener { ...@@ -71,10 +71,6 @@ public class Receipt extends AppCompatActivity implements View.OnClickListener {
mainMenu_btn.setOnClickListener(this); mainMenu_btn.setOnClickListener(this);
initDatabase(); initDatabase();
userDetailsReceipt();
displayItemsOnReceipt();
} }
public void initDatabase() { public void initDatabase() {
...@@ -82,20 +78,22 @@ public class Receipt extends AppCompatActivity implements View.OnClickListener { ...@@ -82,20 +78,22 @@ public class Receipt extends AppCompatActivity implements View.OnClickListener {
allQuantities = getIntent().getStringArrayListExtra("allQuantities"); allQuantities = getIntent().getStringArrayListExtra("allQuantities");
allPrices = getIntent().getStringArrayListExtra("allPrices"); allPrices = getIntent().getStringArrayListExtra("allPrices");
bookingID = getIntent().getIntExtra("bookingID", 0); bookingID = getIntent().getIntExtra("bookingID", 0);
usersReceipt();
Log.d("Receipt", String.valueOf(bookingID)); Log.d("Receipt", String.valueOf(bookingID));
Log.d("Receipt", String.valueOf(allItems)); Log.d("Receipt", String.valueOf(allItems));
Log.d("Receipt", String.valueOf(allQuantities)); Log.d("Receipt", String.valueOf(allQuantities));
Log.d("Receipt", String.valueOf(MainActivity.usernameG)); Log.d("Receipt", String.valueOf(MainActivity.usernameG));
usersReceipt();
} }
//creates user receipt of the database //creates user receipt of the database
private void usersReceipt() { private void usersReceipt() {
StringRequest stringRequest = new StringRequest(Request.Method.POST, userReceiptUrl, (Response.Listener<String>) response -> { StringRequest stringRequest = new StringRequest(Request.Method.POST, userReceiptUrl, (Response.Listener<String>) response -> {
Log.d("usernameG", MainActivity.usernameG);
Log.d("responseuserR", response); Log.d("responseuserR", response);
if(response.equals("success")) { if(response.equals("success")) {
userDetailsReceipt();
displayItemsOnReceipt();
if (allItems.size() > 0) { if (allItems.size() > 0) {
for (int i = 0; i < allItems.size(); i++) { for (int i = 0; i < allItems.size(); i++) {
......
...@@ -123,6 +123,11 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -123,6 +123,11 @@ public class register extends AppCompatActivity implements View.OnClickListener
setParams(ErrorMessageuserName); setParams(ErrorMessageuserName);
ErrorMessageuserName.setText(message); ErrorMessageuserName.setText(message);
} }
else if(username.length() > 30){
message = getString(R.string.reister_username);
setParams(ErrorMessageuserName);
ErrorMessageuserName.setText(message);
}
else{ else{
ResetParams(ErrorMessageuserName); ResetParams(ErrorMessageuserName);
} }
...@@ -140,9 +145,12 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -140,9 +145,12 @@ public class register extends AppCompatActivity implements View.OnClickListener
setParams(ErrorMessagepassword2); setParams(ErrorMessagepassword2);
ErrorMessagepassword2.setText(message); ErrorMessagepassword2.setText(message);
} else { }
else{
ResetParams(ErrorMessagepassword2); ResetParams(ErrorMessagepassword2);
}
if(password.equals(password2) && password2.length() >= 7 && password.length() >= 7 && username.length() >= 5 && lastname.length() >= 3 && firstname.length() >= 2) {
addAccount(firstname, lastname, username, password); addAccount(firstname, lastname, username, password);
return false; return false;
} }
......
...@@ -207,6 +207,7 @@ ...@@ -207,6 +207,7 @@
android:layout_below="@+id/ErrorMessageuserName"> android:layout_below="@+id/ErrorMessageuserName">
<EditText <EditText
android:maxLength="30"
android:id="@+id/username_EditText" android:id="@+id/username_EditText"
style="@style/input_text_theme" style="@style/input_text_theme"
android:autofillHints="" android:autofillHints=""
......
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