private void getAttributes ( Context context , AttributeSet attrs ) { TypedArray typedArray = context . obtainStyledAttributes ( attrs , R . styleable . PinView ) ; if ( typedArray != null ) { try { mNumberPinBoxes = typedArray . getInteger ( R . styleable . PinView_numberPinBoxes , PinViewSettings . DEFAULT_NUMBER_PIN_BOXES ) ; mMaskPassword = typedArray . getBoolean ( R . styleable . PinView_password , PinViewSettings . DEFAULT_MASK_PASSWORD ) ; mNumberCharacters = typedArray . getInteger ( R . styleable . PinView_numberCharacters , PinViewSettings . DEFAULT_NUMBER_CHARACTERS ) ; mSplit = typedArray . getString ( R . styleable . PinView_split ) ; mKeyboardMandatory = typedArray . getBoolean ( R . styleable . PinView_keyboardMandatory , PinViewSettings . DEFAULT_KEYBOARD_MANDATORY ) ; mDeleteOnClick = typedArray . getBoolean ( R . styleable . PinView_deleteOnClick , PinViewSettings . DEFAULT_DELETE_ON_CLICK ) ; mNativePinBox = typedArray . getBoolean ( R . styleable . PinView_nativePinBox , PinViewSettings . DEFAULT_NATIVE_PIN_BOX ) ; mCustomDrawablePinBox = typedArray . getResourceId ( R . styleable . PinView_drawablePinBox , PinViewSettings . DEFAULT_CUSTOM_PIN_BOX ) ; mColorTextPinBoxes = typedArray . getColor ( R . styleable . PinView_colorTextPinBox , getResources ( ) . getColor ( PinViewSettings . DEFAULT_TEXT_COLOR_PIN_BOX ) ) ; mColorTextTitles = typedArray . getColor ( R . styleable . PinView_colorTextTitles , getResources ( ) . getColor ( PinViewSettings . DEFAULT_TEXT_COLOR_TITLES ) ) ; mColorSplit = typedArray . getColor ( R . styleable . PinView_colorSplit , getResources ( ) . getColor ( PinViewSettings . DEFAULT_COLOR_SPLIT ) ) ; mTextSizePinBoxes = typedArray . getDimension ( R . styleable . PinView_textSizePinBox , getResources ( ) . getDimension ( PinViewSettings . DEFAULT_TEXT_SIZE_PIN_BOX ) ) ; mTextSizeTitles = typedArray . getDimension ( R . styleable . PinView_textSizeTitles , getResources ( ) . getDimension ( PinViewSettings . DEFAULT_TEXT_SIZE_TITLES ) ) ; mSizeSplit = typedArray . getDimension ( R . styleable . PinView_sizeSplit , getResources ( ) . getDimension ( PinViewSettings . DEFAULT_SIZE_SPLIT ) ) ; int titles ; titles = typedArray . getResourceId ( R . styleable . PinView_titles , - 1 ) ; if ( titles != - 1 ) { setTitles ( getResources ( ) . getStringArray ( titles ) ) ; } if ( this . mNumberPinBoxes != 0 ) { setPin ( this . mNumberPinBoxes ) ; } } catch ( Exception e ) { Log . e ( LOG_TAG , "Error while creating the view PinView: " , e ) ; } finally { typedArray . recycle ( ) ; } } }
Retrieve styles attributes