use of net.iGap.observers.interfaces.OnInfoCountryResponse in project iGap-Android by KianIranian-STDG.
the class UserProfileViewModel method setCountry.
public void setCountry(StructCountry country) {
new RequestInfoCountry().infoCountry(country.getAbbreviation(), new OnInfoCountryResponse() {
@Override
public void onInfoCountryResponse(final int callingCode, final String name, final String pattern, final String regexR) {
G.handler.post(() -> {
referralCountryCodeObservableField.set("+" + callingCode);
});
}
@Override
public void onError(int majorCode, int minorCode) {
}
});
referralNumberObservableField.set("");
}
use of net.iGap.observers.interfaces.OnInfoCountryResponse in project iGap-Android by KianIranian-STDG.
the class FragmentAddContactViewModel method setCountry.
public void setCountry(@NotNull StructCountry country) {
showProgress.set(View.VISIBLE);
new RequestInfoCountry().infoCountry(country.getAbbreviation(), new OnInfoCountryResponse() {
@Override
public void onInfoCountryResponse(final int callingCode, final String name, final String pattern, final String regexR) {
G.runOnUiThread(() -> {
showProgress.set(View.GONE);
hasError.setValue(false);
countryCode.setValue("+" + callingCode);
if (pattern.equals("")) {
phoneNumberMask.setValue("##################");
} else {
phoneNumberMask.setValue(pattern.replace("X", "#").replace(" ", "-"));
}
});
}
@Override
public void onError(int majorCode, int minorCode) {
G.handler.post(() -> {
showProgress.set(View.GONE);
hasError.setValue(true);
});
}
});
}
Aggregations