use of br.com.ilhasoft.support.validation.Validator in project open-event-orga-app by fossasia.
the class ChangePasswordFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.change_password_fragment, container, false);
validator = new Validator(binding);
AppCompatActivity activity = ((AppCompatActivity) getActivity());
activity.setSupportActionBar(binding.toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
return binding.getRoot();
}
use of br.com.ilhasoft.support.validation.Validator in project open-event-orga-app by fossasia.
the class CreateTicketFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.AppTheme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
binding = DataBindingUtil.inflate(localInflater, R.layout.ticket_create_layout, container, false);
validator = new Validator(binding.form);
binding.submit.setOnClickListener(view -> {
if (validator.validate())
getPresenter().createTicket();
});
return binding.getRoot();
}
use of br.com.ilhasoft.support.validation.Validator in project open-event-orga-app by fossasia.
the class CreateEventFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.event_create_layout, container, false);
validator = new Validator(binding.form);
AppCompatActivity activity = ((AppCompatActivity) getActivity());
activity.setSupportActionBar(binding.toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
setHasOptionsMenu(true);
binding.submit.setOnClickListener(view -> {
if (validator.validate())
getPresenter().createEvent();
});
// check if there's an google places API key
try {
ApplicationInfo ai = getContext().getPackageManager().getApplicationInfo(getContext().getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String placesApiKey = bundle.getString("com.google.android.geo.API_KEY");
if ("YOUR_API_KEY".equals(placesApiKey)) {
Timber.d("Add Google Places API key in AndroidManifest.xml file to use Place Picker.");
binding.form.buttonPlacePicker.setVisibility(View.GONE);
binding.form.layoutLatitude.setVisibility(View.VISIBLE);
binding.form.layoutLongitude.setVisibility(View.VISIBLE);
showLocationLayouts();
}
} catch (PackageManager.NameNotFoundException e) {
Timber.e(e, "Package name not found");
}
binding.form.buttonPlacePicker.setOnClickListener(view -> {
int errorCode = googleApiAvailabilityInstance.isGooglePlayServicesAvailable(getContext());
if (errorCode == ConnectionResult.SUCCESS) {
// SUCCESS
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
try {
startActivityForResult(builder.build(getActivity()), PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
Timber.d(e, "GooglePlayServicesRepairable");
} catch (GooglePlayServicesNotAvailableException e) {
Timber.d("GooglePlayServices NotAvailable => Updating or Unauthentic");
}
} else if (googleApiAvailabilityInstance.isUserResolvableError(errorCode)) {
// SERVICE_MISSING, SERVICE_VERSION_UPDATE_REQUIRED, SERVICE_DISABLED
googleApiAvailabilityInstance.getErrorDialog(getActivity(), errorCode, PLACE_PICKER_REQUEST, (dialog) -> {
showLocationLayouts();
});
} else {
// SERVICE_UPDATING, SERVICE_INVALID - can't use place picker - must enter manually
showLocationLayouts();
}
});
adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return binding.getRoot();
}
use of br.com.ilhasoft.support.validation.Validator in project open-event-orga-app by fossasia.
the class CreateCopyrightFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.AppTheme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
binding = DataBindingUtil.inflate(localInflater, R.layout.copyright_create_layout, container, false);
validator = new Validator(binding.form);
AppCompatActivity activity = ((AppCompatActivity) getActivity());
activity.setSupportActionBar(binding.toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
setHasOptionsMenu(true);
binding.submit.setOnClickListener(view -> {
if (validator.validate())
getPresenter().createCopyright();
});
return binding.getRoot();
}
use of br.com.ilhasoft.support.validation.Validator in project open-event-orga-app by fossasia.
the class ResetPasswordByTokenFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.reset_password_by_token_fragment, container, false);
validator = new Validator(binding);
return binding.getRoot();
}
Aggregations