@@ -69,7 +69,7 @@ public class InputContainer
6969 private final Paint keyBorderPaint ;
7070 private final Paint keyTextPaint ;
7171
72- public InputContainer (Context context , AttributeSet attributes ) {
72+ public InputContainer (final Context context , final AttributeSet attributes ) {
7373
7474 super (context , attributes );
7575
@@ -126,27 +126,30 @@ public interface OnInputListener {
126126 void onLongPress (String valueText );
127127 }
128128
129- public void setOnInputListener (OnInputListener listener ) {
129+ public void setOnInputListener (final OnInputListener listener ) {
130130 inputListener = listener ;
131131 }
132132
133- public void setKeyboard (Keyboard keyboard ) {
133+ public void setKeyboard (final Keyboard keyboard ) {
134134 this .keyboard = keyboard ;
135135 keyArray = keyboard .getKeyList ().toArray (new Keyboard .Key [0 ]);
136136 requestLayout ();
137137 }
138138
139- public void onClick (View view ) {
139+ public void onClick (final View view ) {
140140 }
141141
142142 @ Override
143- public void onMeasure (int widthMeasureSpec , int heightMeasureSpec ) {
144-
145- int paddingHorizontal = getPaddingLeft () + getPaddingRight ();
146- int paddingVertical = getPaddingTop () + getPaddingBottom ();
143+ public void onMeasure (
144+ final int widthMeasureSpec ,
145+ final int heightMeasureSpec
146+ )
147+ {
148+ final int paddingHorizontal = getPaddingLeft () + getPaddingRight ();
149+ final int paddingVertical = getPaddingTop () + getPaddingBottom ();
147150
148- int keyboardWidth ;
149- int keyboardHeight ;
151+ final int keyboardWidth ;
152+ final int keyboardHeight ;
150153 if (keyboard == null ) {
151154 keyboardWidth = 0 ;
152155 keyboardHeight = 0 ;
@@ -163,7 +166,7 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
163166 }
164167
165168 @ Override
166- public void onDraw (Canvas canvas ) {
169+ public void onDraw (final Canvas canvas ) {
167170
168171 if (keyboard == null ) {
169172 return ;
@@ -187,11 +190,11 @@ public void onDraw(Canvas canvas) {
187190 keyTextPaint .setColor (key .keyTextColour );
188191 keyTextPaint .setTextSize (key .keyTextSize );
189192
190- float key_text_x = (
193+ final float key_text_x = (
191194 key .width / 2f
192195 + key .keyTextOffsetX
193196 );
194- float key_text_y = (
197+ final float key_text_y = (
195198 (key .height - keyTextPaint .ascent () - keyTextPaint .descent ()) / 2f
196199 + key .keyTextOffsetY
197200 );
@@ -216,9 +219,9 @@ public void onDraw(Canvas canvas) {
216219 Lighten a dark colour and darken a light colour.
217220 Used for key press colour changes.
218221 */
219- private static int getContrastingColour (int colour ) {
222+ private static int getContrastingColour (final int colour ) {
220223
221- float [] colourHSL = new float [3 ];
224+ final float [] colourHSL = new float [3 ];
222225 ColorUtils .colorToHSL (colour , colourHSL );
223226
224227 float colourLightness = colourHSL [2 ];
@@ -240,21 +243,21 @@ Handle logic for multiple pointers (e.g. two-thumb typing).
240243 */
241244 @ SuppressLint ("ClickableViewAccessibility" )
242245 @ Override
243- public boolean onTouchEvent (MotionEvent motionEvent ) {
246+ public boolean onTouchEvent (final MotionEvent motionEvent ) {
244247
245248 if (motionEvent .getPointerCount () > 2 ) {
246249 abortAllKeyBehaviour ();
247250 return true ;
248251 }
249252
250- long eventTime = motionEvent .getEventTime ();
251- int eventAction = motionEvent .getActionMasked ();
252- int eventActionIndex = motionEvent .getActionIndex ();
253- int eventPointerId = motionEvent .getPointerId (eventActionIndex );
254- int eventPointerIndex = motionEvent .findPointerIndex (eventPointerId );
255- int eventPointerX = (int ) motionEvent .getX (eventPointerIndex );
256- int eventPointerY = (int ) motionEvent .getY (eventPointerIndex );
257- int eventMetaState = motionEvent .getMetaState ();
253+ final long eventTime = motionEvent .getEventTime ();
254+ final int eventAction = motionEvent .getActionMasked ();
255+ final int eventActionIndex = motionEvent .getActionIndex ();
256+ final int eventPointerId = motionEvent .getPointerId (eventActionIndex );
257+ final int eventPointerIndex = motionEvent .findPointerIndex (eventPointerId );
258+ final int eventPointerX = (int ) motionEvent .getX (eventPointerIndex );
259+ final int eventPointerY = (int ) motionEvent .getY (eventPointerIndex );
260+ final int eventMetaState = motionEvent .getMetaState ();
258261
259262 boolean eventHandled = true ;
260263
@@ -337,32 +340,32 @@ public boolean onTouchEvent(MotionEvent motionEvent) {
337340 }
338341
339342 private boolean sendSinglePointerMotionEvent (
340- long time ,
341- int action ,
342- int x ,
343- int y ,
344- int metaState
343+ final long time ,
344+ final int action ,
345+ final int x ,
346+ final int y ,
347+ final int metaState
345348 )
346349 {
347- MotionEvent sentEvent =
350+ final MotionEvent sentEvent =
348351 MotionEvent .obtain (time , time , action , x , y , metaState );
349352
350353 return onSinglePointerTouchEvent (sentEvent );
351354 }
352355
353- private boolean onSinglePointerTouchEvent (MotionEvent motionEvent ) {
356+ private boolean onSinglePointerTouchEvent (final MotionEvent motionEvent ) {
354357
355- int eventX = (int ) motionEvent .getX () - getPaddingLeft ();
356- int eventY = (int ) motionEvent .getY () - getPaddingTop ();
358+ final int eventX = (int ) motionEvent .getX () - getPaddingLeft ();
359+ final int eventY = (int ) motionEvent .getY () - getPaddingTop ();
357360
358- Keyboard .Key key = getKeyAtPoint (eventX , eventY );
361+ final Keyboard .Key key = getKeyAtPoint (eventX , eventY );
359362 if (key == null ) {
360363 abortAllKeyBehaviour ();
361364 return true ;
362365 }
363- String valueText = key .valueText ;
366+ final String valueText = key .valueText ;
364367
365- int eventAction = motionEvent .getAction ();
368+ final int eventAction = motionEvent .getAction ();
366369
367370 switch (eventAction ) {
368371
@@ -387,9 +390,9 @@ private boolean onSinglePointerTouchEvent(MotionEvent motionEvent) {
387390 return true ;
388391 }
389392
390- private Keyboard .Key getKeyAtPoint (int x , int y ) {
393+ private Keyboard .Key getKeyAtPoint (final int x , final int y ) {
391394
392- for (Keyboard .Key key : keyArray ) {
395+ for (final Keyboard .Key key : keyArray ) {
393396 if (key .containsPoint (x , y )) {
394397 return key ;
395398 }
@@ -398,12 +401,15 @@ private Keyboard.Key getKeyAtPoint(int x, int y) {
398401 return null ;
399402 }
400403
401- private void setCurrentlyPressedKey (Keyboard .Key key ) {
404+ private void setCurrentlyPressedKey (final Keyboard .Key key ) {
402405 currentlyPressedKey = key ;
403406 invalidate ();
404407 }
405408
406- private void sendAppropriateExtendedPressHandlerMessage (Keyboard .Key key ) {
409+ private void sendAppropriateExtendedPressHandlerMessage (
410+ final Keyboard .Key key
411+ )
412+ {
407413 if (key .isRepeatable ) {
408414 sendExtendedPressHandlerMessage (
409415 MESSAGE_KEY_REPEAT ,
@@ -419,8 +425,8 @@ else if (key.isLongPressable) {
419425 }
420426
421427 private void sendExtendedPressHandlerMessage (
422- int messageWhat ,
423- long delayMilliseconds
428+ final int messageWhat ,
429+ final long delayMilliseconds
424430 )
425431 {
426432 extendedPressHandler .sendMessageDelayed (
@@ -434,7 +440,7 @@ private void removeAllExtendedPressHandlerMessages() {
434440 removeExtendedPressHandlerMessages (MESSAGE_LONG_PRESS );
435441 }
436442
437- private void removeExtendedPressHandlerMessages (int messageWhat ) {
443+ private void removeExtendedPressHandlerMessages (final int messageWhat ) {
438444 extendedPressHandler .removeMessages (messageWhat );
439445 }
440446
0 commit comments