@@ -191,7 +191,7 @@ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
191191 }
192192 int duration = (int )(e2 .getEventTime () - e1 .getEventTime ());
193193 if (duration < 1 || duration > 100 ) duration = 10 ;
194- mScroller .startScroll (mCurrentPos , 0 , distance , 0 , ( int ) duration );
194+ mScroller .startScroll (mCurrentPos , 0 , distance , 0 , duration );
195195 postInvalidateOnAnimation ();
196196 return true ;
197197 }
@@ -396,7 +396,7 @@ public float getDecimalCredit() {
396396
397397 // Return the length of the exponent representation for the given exponent, in
398398 // characters.
399- private final int expLen (int exp ) {
399+ private int expLen (int exp ) {
400400 if (exp == 0 ) return 0 ;
401401 final int abs_exp_digits = (int ) Math .ceil (Math .log10 (Math .abs ((double )exp ))
402402 + 0.0000000001d /* Round whole numbers to next integer */ );
@@ -481,13 +481,13 @@ private void initPositions(int initPrecOffset, int msdIndex, int lsdOffset,
481481 mLsdOffset = lsdOffset ;
482482 mAppendExponent = false ;
483483 // Prevent scrolling past initial position, which is calculated to show leading digits.
484- mCurrentPos = mMinPos = ( int ) Math .round (initPrecOffset * mCharWidth );
484+ mCurrentPos = mMinPos = Math .round (initPrecOffset * mCharWidth );
485485 if (msdIndex == Evaluator .INVALID_MSD ) {
486486 // Possible zero value
487487 if (lsdOffset == Integer .MIN_VALUE ) {
488488 // Definite zero value.
489489 mMaxPos = mMinPos ;
490- mMaxCharOffset = ( int ) Math .round (mMaxPos /mCharWidth );
490+ mMaxCharOffset = Math .round (mMaxPos /mCharWidth );
491491 mScrollable = false ;
492492 } else {
493493 // May be very small nonzero value. Allow user to find out.
@@ -542,7 +542,7 @@ private void initPositions(int initPrecOffset, int msdIndex, int lsdOffset,
542542 } else {
543543 mMaxCharOffset = Math .min (newMaxCharOffset , MAX_RIGHT_SCROLL );
544544 }
545- mMaxPos = Math .min (( int ) Math .round (mMaxCharOffset * mCharWidth ),
545+ mMaxPos = Math .min (Math .round (mMaxCharOffset * mCharWidth ),
546546 MAX_RIGHT_SCROLL );
547547 } else if (!mWholePartFits && !mScrollable ) {
548548 // Corner case in which entire number fits, but not with grouping separators. We
@@ -563,7 +563,7 @@ private void initPositions(int initPrecOffset, int msdIndex, int lsdOffset,
563563 mAppendExponent = true ;
564564 }
565565 } else {
566- mMaxPos = Math .min (( int ) Math .round (mMaxCharOffset * mCharWidth ),
566+ mMaxPos = Math .min (Math .round (mMaxCharOffset * mCharWidth ),
567567 MAX_RIGHT_SCROLL );
568568 }
569569 if (!mScrollable ) {
@@ -762,8 +762,6 @@ private String formatResult(String in, int precOffset, int maxDigs, boolean trun
762762 }
763763 final float len = orig_length + nCommaChars ;
764764 int deletedChars = 0 ;
765- final float ellipsisCredit = getNoEllipsisCredit ();
766- final float decimalCredit = getDecimalCredit ();
767765 final float effectiveLen = len - (decIndex == -1 ? 0 : getDecimalCredit ());
768766 final float ellipsisAdjustment =
769767 needEllipsis ? mNoExponentCredit : getNoEllipsisCredit ();
@@ -867,7 +865,6 @@ public String getFullCopyText() {
867865 */
868866 @ Override
869867 public int getMaxChars () {
870- int result ;
871868 synchronized (mWidthLock ) {
872869 return (int ) Math .floor (mWidthConstraint / mCharWidth );
873870 }
@@ -885,7 +882,7 @@ public boolean isScrollable() {
885882 * UI thread only.
886883 */
887884 int getCharOffset (int pos ) {
888- return ( int ) Math .round (pos / mCharWidth ); // Lock not needed.
885+ return Math .round (pos / mCharWidth ); // Lock not needed.
889886 }
890887
891888 void clear () {
@@ -1042,43 +1039,33 @@ public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
10421039 }
10431040 }
10441041 };
1045- setOnLongClickListener (new View .OnLongClickListener () {
1046- @ Override
1047- public boolean onLongClick (View v ) {
1048- if (mValid ) {
1049- mActionMode = startActionMode (mCopyActionModeCallback ,
1050- ActionMode .TYPE_FLOATING );
1051- return true ;
1052- }
1053- return false ;
1042+ setOnLongClickListener (v -> {
1043+ if (mValid ) {
1044+ mActionMode = startActionMode (mCopyActionModeCallback ,
1045+ ActionMode .TYPE_FLOATING );
1046+ return true ;
10541047 }
1048+ return false ;
10551049 });
10561050 }
10571051
10581052 /**
10591053 * Use ContextMenu for copy/memory support on L and lower.
10601054 */
10611055 private void setupContextMenu () {
1062- setOnCreateContextMenuListener (new OnCreateContextMenuListener () {
1063- @ Override
1064- public void onCreateContextMenu (ContextMenu contextMenu , View view ,
1065- ContextMenu .ContextMenuInfo contextMenuInfo ) {
1066- final MenuInflater inflater = new MenuInflater (getContext ());
1067- createContextMenu (inflater , contextMenu );
1068- mContextMenu = contextMenu ;
1069- for (int i = 0 ; i < contextMenu .size (); i ++) {
1070- contextMenu .getItem (i ).setOnMenuItemClickListener (CalculatorResult .this );
1071- }
1056+ setOnCreateContextMenuListener ((contextMenu , view , contextMenuInfo ) -> {
1057+ final MenuInflater inflater = new MenuInflater (getContext ());
1058+ createContextMenu (inflater , contextMenu );
1059+ mContextMenu = contextMenu ;
1060+ for (int i = 0 ; i < contextMenu .size (); i ++) {
1061+ contextMenu .getItem (i ).setOnMenuItemClickListener (CalculatorResult .this );
10721062 }
10731063 });
1074- setOnLongClickListener (new View .OnLongClickListener () {
1075- @ Override
1076- public boolean onLongClick (View v ) {
1077- if (mValid ) {
1078- return showContextMenu ();
1079- }
1080- return false ;
1064+ setOnLongClickListener (v -> {
1065+ if (mValid ) {
1066+ return showContextMenu ();
10811067 }
1068+ return false ;
10821069 });
10831070 }
10841071
@@ -1116,12 +1103,6 @@ private void unhighlightResult() {
11161103 text .removeSpan (mHighlightSpan );
11171104 }
11181105
1119- private void setPrimaryClip (ClipData clip ) {
1120- ClipboardManager clipboard = (ClipboardManager ) getContext ().
1121- getSystemService (Context .CLIPBOARD_SERVICE );
1122- clipboard .setPrimaryClip (clip );
1123- }
1124-
11251106 private void copyContent () {
11261107 final CharSequence text = getFullCopyText ();
11271108 ClipboardManager clipboard =
0 commit comments