From facb262e51ec75a0ad8d97ccb441e7bf41dfcbcd Mon Sep 17 00:00:00 2001 From: rigo9412 Date: Wed, 8 May 2019 19:26:42 -0500 Subject: [PATCH] agregar Field Text uppercase --- .idea/codeStyles/Project.xml | 25 ------------------- .idea/encodings.xml | 4 +++ .idea/misc.xml | 2 +- .../formulatorexample/MainActivity.kt | 5 ++-- .../ramos/formslibrary/model/FieldText.kt | 7 +++++- .../TimePickerDialogFixedNougatSpinner.kt | 13 +++++----- 6 files changed, 21 insertions(+), 35 deletions(-) create mode 100644 .idea/encodings.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 34dc27c..1bec35e 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -3,31 +3,6 @@ - - - - - - - - - - diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 0d45e8d..f5c6d9e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/app/src/main/java/com/rigoberto/formulatorexample/MainActivity.kt b/app/src/main/java/com/rigoberto/formulatorexample/MainActivity.kt index 320e106..44832cd 100644 --- a/app/src/main/java/com/rigoberto/formulatorexample/MainActivity.kt +++ b/app/src/main/java/com/rigoberto/formulatorexample/MainActivity.kt @@ -18,7 +18,8 @@ class MainActivity : AppCompatActivity() { btnForm.setOnClickListener { //val field1 = FieldImage(arrayListOf("nombre"),"Nombre*",false,"Campo requerido", TypeField.SELECT_IMAGE) - val field2 = FieldText(arrayListOf("hora"),"Hora de entrega*",false, TypeField.TEXT_HOURS,"Campo requerido") + val fieldRazonSocial = FieldText(arrayListOf("razonSocial"), "RazonSocial",true, TypeField.TEXT, + "Es requerido",150,true, arrayListOf() ) val fieldTipoFlotilla = FieldOptions(arrayListOf("tipoFlotilla"),"Tipo flotilla",TypeField.SELECT_OPTION, arrayListOf("1","2","3"), arrayListOf()) @@ -26,7 +27,7 @@ class MainActivity : AppCompatActivity() { val field3 = FieldText(arrayListOf("apellido_paterno"),"Apellido Paterno*",false, TypeField.TEXT_PHONE,"Campo requerido",140) val field32 = FieldText(arrayListOf("apellido_paterno"),"Apellido Paterno*",false, TypeField.TEXT_PHONE,"Campo requerido",140) //val field3 = Field(arrayListOf("apellido_materno"),"Apellido Materno*",true, TypeField.TEXT,"Campo requerido",140) - val form = Form("1","Informacion Personal", arrayListOf(field2,fieldTipoFlotilla,field3)) + val form = Form("1","Informacion Personal", arrayListOf(fieldRazonSocial,fieldTipoFlotilla,field3)) val i = Intent(this, FormsActivity::class.java) diff --git a/formslibrary/src/main/java/com/rigo/ramos/formslibrary/model/FieldText.kt b/formslibrary/src/main/java/com/rigo/ramos/formslibrary/model/FieldText.kt index 4dbaf56..2e973a1 100644 --- a/formslibrary/src/main/java/com/rigo/ramos/formslibrary/model/FieldText.kt +++ b/formslibrary/src/main/java/com/rigo/ramos/formslibrary/model/FieldText.kt @@ -111,7 +111,12 @@ open class FieldText() : Field(){ editText.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD editText.transformationMethod = PasswordTransformationMethod.getInstance() } - TypeField.TEXT -> editText.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE + TypeField.TEXT -> { + if(upperCase == true) + editText.filters = arrayOf(InputFilter.AllCaps()) + + editText.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE + } TypeField.TEXT_DATE-> { val pickerDialog = DatePickerDialog.OnDateSetListener { view, year, month, dayOfMonth -> diff --git a/formslibrary/src/main/java/com/rigo/ramos/formslibrary/views/TimePickerDialogFixedNougatSpinner.kt b/formslibrary/src/main/java/com/rigo/ramos/formslibrary/views/TimePickerDialogFixedNougatSpinner.kt index b3ad307..a24e42e 100644 --- a/formslibrary/src/main/java/com/rigo/ramos/formslibrary/views/TimePickerDialogFixedNougatSpinner.kt +++ b/formslibrary/src/main/java/com/rigo/ramos/formslibrary/views/TimePickerDialogFixedNougatSpinner.kt @@ -1,6 +1,7 @@ package com.rigo.ramos.formslibrary.views +import android.R import android.app.TimePickerDialog import android.content.Context import android.content.res.TypedArray @@ -8,7 +9,7 @@ import android.os.Build import android.util.AttributeSet import android.view.View import android.widget.TimePicker -import kotlinx.android.synthetic.main.notification_template_part_time.* + import java.lang.reflect.Constructor import java.lang.reflect.Field @@ -40,7 +41,7 @@ import android.content.DialogInterface class TimePickerDialogFixedNougatSpinner : TimePickerDialog { val TIME_PICKER_INTERVAL = 15 - private var callback: TimePickerDialog.OnTimeSetListener? = null + private var callback: OnTimeSetListener? = null private var mIgnoreEvent = false private var timePicker: TimePicker? = null private var lastHour = -1 @@ -56,7 +57,7 @@ class TimePickerDialogFixedNougatSpinner : TimePickerDialog { */ constructor( context: Context, - listener: TimePickerDialog.OnTimeSetListener, + listener: OnTimeSetListener, hourOfDay: Int, minute: Int, is24HourView: Boolean @@ -80,7 +81,7 @@ class TimePickerDialogFixedNougatSpinner : TimePickerDialog { constructor( context: Context, themeResId: Int, - listener: TimePickerDialog.OnTimeSetListener, + listener: OnTimeSetListener, hourOfDay: Int, minute: Int, is24HourView: Boolean @@ -110,7 +111,7 @@ class TimePickerDialogFixedNougatSpinner : TimePickerDialog { val styleableClass = Class.forName("com.android.internal.R\$styleable") val timePickerStyleableField = styleableClass.getField("TimePicker") val timePickerStyleable = timePickerStyleableField.get(null) as IntArray - val a = context.obtainStyledAttributes(null, timePickerStyleable, android.R.attr.timePickerStyle, 0) + val a = context.obtainStyledAttributes(null, timePickerStyleable, R.attr.timePickerStyle, 0) val timePickerModeStyleableField = styleableClass.getField("TimePicker_timePickerMode") val timePickerModeStyleable = timePickerModeStyleableField.getInt(null) val mode = a.getInt(timePickerModeStyleable, MODE_SPINNER) @@ -148,7 +149,7 @@ class TimePickerDialogFixedNougatSpinner : TimePickerDialog { timePicker, context, null, - android.R.attr.timePickerStyle, + R.attr.timePickerStyle, 0 ) delegateField.set(timePicker, delegate) // set the TimePicker.mDelegate to the spinner delegate