本文整理汇总了Java中fr.ganfra.materialspinner.MaterialSpinner类的典型用法代码示例。如果您正苦于以下问题:Java MaterialSpinner类的具体用法?Java MaterialSpinner怎么用?Java MaterialSpinner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaterialSpinner类属于fr.ganfra.materialspinner包,在下文中一共展示了MaterialSpinner类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: curpValido
import fr.ganfra.materialspinner.MaterialSpinner; //导入依赖的package包/类
public static boolean curpValido(EditText editTextCurp, EditText editTextNombre, EditText editTextApellidoPaterno,
EditText editTextApellidoMaterno, EditText editTextFechaNacimiento,
MaterialSpinner spinnerGenero, MaterialSpinner spinnerEstadoNacimiento) {
if (editTextCurp.getText().length() == 18) {
if (editTextNombre.getText().toString().length() != 0 &&
editTextApellidoPaterno.getText().toString().length() != 0 &&
editTextApellidoMaterno.getText().toString().length() != 0 &&
editTextFechaNacimiento.getText().toString().length() != 0 &&
spinnerGenero.getSelectedItemPosition() != 0 &&
spinnerEstadoNacimiento.getSelectedItemPosition() != 0) {
return true;
} else {
return false;
}
} else {
((TextInputLayout)editTextCurp.getParent().getParent()).setErrorEnabled(true);
((TextInputLayout)editTextCurp.getParent().getParent()).setError("CURP debe tener 18 caracteres");
return false;
}
}
开发者ID:ur13l,项目名称:Guanajoven,代码行数:21,代码来源:EditTextValidations.java
示例2: spinnerDatosCurpInvalido
import fr.ganfra.materialspinner.MaterialSpinner; //导入依赖的package包/类
public static boolean spinnerDatosCurpInvalido(MaterialSpinner spinner){
if(spinner.getSelectedItemPosition() == 0){
return true;
}
else{
return false;
}
}
开发者ID:ur13l,项目名称:Guanajoven,代码行数:9,代码来源:EditTextValidations.java
示例3: spinnerSinSeleccion
import fr.ganfra.materialspinner.MaterialSpinner; //导入依赖的package包/类
/**
* Función para mostrar un error en el spinner cuando la selección es nula.
* @param spinner: Objeto tipo MaterialSpinner.
* @return boolean.
*/
public static boolean spinnerSinSeleccion(MaterialSpinner spinner){
if(spinner.getSelectedItemPosition() == 0){
spinner.setError("Este campo es obligatorio");
return true;
}
else{
return false;
}
}
开发者ID:ur13l,项目名称:Guanajoven,代码行数:15,代码来源:EditTextValidations.java
示例4: validate
import fr.ganfra.materialspinner.MaterialSpinner; //导入依赖的package包/类
public static ValidationStatus validate(MaterialSpinner spinner) {
if (!(spinner.getTag(R.id.v_required) instanceof String) || !(spinner.getTag(R.id.error) instanceof String)) {
return new ValidationStatus(true, null);
}
Boolean isRequired = Boolean.valueOf((String) spinner.getTag(R.id.v_required));
if (!isRequired) {
return new ValidationStatus(true, null);
}
int selectedItemPosition = spinner.getSelectedItemPosition();
if(selectedItemPosition > 0) {
return new ValidationStatus(true, null);
}
return new ValidationStatus(false, (String) spinner.getTag(R.id.error));
}
开发者ID:vijayrawatsan,项目名称:android-json-form-wizard,代码行数:15,代码来源:SpinnerFactory.java
示例5: getViewsFromJson
import fr.ganfra.materialspinner.MaterialSpinner; //导入依赖的package包/类
@Override
public List<View> getViewsFromJson(String stepName, Context context, JSONObject jsonObject, CommonListener listener) throws Exception {
List<View> views = new ArrayList<>(1);
MaterialSpinner spinner = (MaterialSpinner) LayoutInflater.from(context).inflate(R.layout.item_spinner, null);
String hint = jsonObject.optString("hint");
if (!TextUtils.isEmpty(hint)) {
spinner.setHint(jsonObject.getString("hint"));
spinner.setFloatingLabelText(jsonObject.getString("hint"));
}
spinner.setId(ViewUtil.generateViewId());
spinner.setTag(R.id.key, jsonObject.getString("key"));
spinner.setTag(R.id.type, jsonObject.getString("type"));
JSONObject requiredObject = jsonObject.optJSONObject("v_required");
if (requiredObject != null) {
String requiredValue = requiredObject.getString("value");
if (!TextUtils.isEmpty(requiredValue)) {
spinner.setTag(R.id.v_required, requiredValue);
spinner.setTag(R.id.error, requiredObject.optString("err"));
}
}
String valueToSelect = "";
int indexToSelect = -1;
if (!TextUtils.isEmpty(jsonObject.optString("value"))) {
valueToSelect = jsonObject.optString("value");
}
JSONArray valuesJson = jsonObject.optJSONArray("values");
String[] values = null;
if (valuesJson != null && valuesJson.length() > 0) {
values = new String[valuesJson.length()];
for (int i = 0; i < valuesJson.length(); i++) {
values[i] = valuesJson.optString(i);
if (valueToSelect.equals(values[i])) {
indexToSelect = i;
}
}
}
if (values != null) {
spinner.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, values));
spinner.setSelection(indexToSelect + 1, true);
spinner.setOnItemSelectedListener(listener);
}
views.add(spinner);
return views;
}
开发者ID:vijayrawatsan,项目名称:android-json-form-wizard,代码行数:52,代码来源:SpinnerFactory.java
注:本文中的fr.ganfra.materialspinner.MaterialSpinner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论