mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Fix bug change default address
This commit is contained in:
@@ -418,16 +418,24 @@ public class AddressManagerActivity extends AppCompatActivity {
|
|||||||
customViewDialog.dismiss();
|
customViewDialog.dismiss();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//If this is a edit form
|
//If this is a edit address form
|
||||||
if(validData(oldAddress.getAddress(), oldAddress.getWard(), oldAddress.getDistrict())){
|
if(validData(oldAddress.getAddress(), oldAddress.getWard(), oldAddress.getDistrict())){
|
||||||
|
|
||||||
|
//Get value checkbox set default address
|
||||||
|
boolean isChecked = default_address_checkbox.isChecked();
|
||||||
|
|
||||||
|
//If this address is default address, set isChecked to true
|
||||||
|
if(oldAddress.getId() == Common.CURRENT_USER.getDefaultAddress()){
|
||||||
|
isChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
//Change information address
|
//Change information address
|
||||||
oldAddress.setAddress(address);
|
oldAddress.setAddress(address);
|
||||||
oldAddress.setWard(ward);
|
oldAddress.setWard(ward);
|
||||||
oldAddress.setDistrict(district);
|
oldAddress.setDistrict(district);
|
||||||
|
|
||||||
//Call api to change address
|
//Call api to change address
|
||||||
editAddress(Common.CURRENT_USER.getId(), oldAddress, oldAddress.getId(), default_address_checkbox.isChecked());
|
editAddress(Common.CURRENT_USER.getId(), oldAddress, oldAddress.getId(), isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
customViewDialog.dismiss();
|
customViewDialog.dismiss();
|
||||||
|
|||||||
Reference in New Issue
Block a user