.
This commit is contained in:
@@ -199,11 +199,11 @@ public class EditProfileInfoActivity extends AppCompatActivity implements
|
||||
country_N_states_map.put(country, states);
|
||||
}
|
||||
|
||||
binding.countrySpinner.selectItemByIndex(countryList.indexOf(country));
|
||||
try {
|
||||
binding.countrySpinner.selectItemByIndex(countryList.indexOf(country));
|
||||
binding.stateSpinner.selectItemByIndex(country_N_states_map.get(country).indexOf(state));
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "Couldn't load state.", Toast.LENGTH_SHORT).show();
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -303,8 +303,17 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
patientData.city = binding.town.getText().toString();
|
||||
patientData.post_code = binding.zipCode.getText().toString();
|
||||
|
||||
patientData.country = countryList.get(binding.countrySpinner.getSelectedIndex());
|
||||
patientData.state = country_N_states_map.get(patientData.country).get(binding.stateSpinner.getSelectedIndex());
|
||||
try {
|
||||
patientData.country = countryList.get(binding.countrySpinner.getSelectedIndex());
|
||||
} catch (Exception e) {
|
||||
patientData.country = "";
|
||||
}
|
||||
|
||||
try {
|
||||
patientData.state = country_N_states_map.get(patientData.country).get(binding.stateSpinner.getSelectedIndex());
|
||||
} catch (Exception e) {
|
||||
patientData.state = "";
|
||||
}
|
||||
|
||||
patientData.lat = String.valueOf(currentLocation.latitude);
|
||||
patientData.lng = String.valueOf(currentLocation.longitude);
|
||||
@@ -334,33 +343,33 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
// binding.street.setError("Required");
|
||||
// }
|
||||
|
||||
if (binding.town.getText().toString().trim().isEmpty()) {
|
||||
// allOkay = false;
|
||||
// binding.town.setError("Required");
|
||||
Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (binding.zipCode.getText().toString().trim().isEmpty()) {
|
||||
// allOkay = false;
|
||||
// binding.zipCode.setError("Required");
|
||||
Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (binding.countrySpinner.getSelectedIndex() == -1) {
|
||||
// allOkay = false;
|
||||
// binding.countrySpinner.setError("Required");
|
||||
Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (binding.stateSpinner.getSelectedIndex() == -1) {
|
||||
// allOkay = false;
|
||||
// binding.stateSpinner.setError("Required");
|
||||
Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
// if (binding.town.getText().toString().trim().isEmpty()) {
|
||||
//// allOkay = false;
|
||||
//// binding.town.setError("Required");
|
||||
// Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (binding.zipCode.getText().toString().trim().isEmpty()) {
|
||||
//// allOkay = false;
|
||||
//// binding.zipCode.setError("Required");
|
||||
// Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (binding.countrySpinner.getSelectedIndex() == -1) {
|
||||
//// allOkay = false;
|
||||
//// binding.countrySpinner.setError("Required");
|
||||
// Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (binding.stateSpinner.getSelectedIndex() == -1) {
|
||||
//// allOkay = false;
|
||||
//// binding.stateSpinner.setError("Required");
|
||||
// Toast.makeText(requireContext(), "Select a valid location.", Toast.LENGTH_SHORT).show();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (currentLocation == null && allOkay) {
|
||||
allOkay = false;
|
||||
|
||||
Reference in New Issue
Block a user