File tree Expand file tree Collapse file tree 2 files changed +16
-31
lines changed
Expand file tree Collapse file tree 2 files changed +16
-31
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ public synchronized void setTextZoom(int textZoom) {
423423 * Gets the text zoom of the page in percent.
424424 *
425425 * @return the text zoom of the page in percent
426- * @see #setTextSizeZoom
426+ * @see #setTextZoom
427427 */
428428 public synchronized int getTextZoom () {
429429 throw new MustOverrideException ();
@@ -436,7 +436,7 @@ public synchronized int getTextZoom() {
436436 * @deprecated Use {@link #setTextZoom} instead.
437437 */
438438 public synchronized void setTextSize (TextSize t ) {
439- throw new MustOverrideException ( );
439+ setTextZoom ( t . value );
440440 }
441441
442442 /**
@@ -449,7 +449,20 @@ public synchronized void setTextSize(TextSize t) {
449449 * @deprecated Use {@link #getTextZoom} instead.
450450 */
451451 public synchronized TextSize getTextSize () {
452- throw new MustOverrideException ();
452+ TextSize closestSize = null ;
453+ int smallestDelta = Integer .MAX_VALUE ;
454+ int textSize = getTextZoom ();
455+ for (TextSize size : TextSize .values ()) {
456+ int delta = Math .abs (textSize - size .value );
457+ if (delta == 0 ) {
458+ return size ;
459+ }
460+ if (delta < smallestDelta ) {
461+ smallestDelta = delta ;
462+ closestSize = size ;
463+ }
464+ }
465+ return closestSize != null ? closestSize : TextSize .NORMAL ;
453466 }
454467
455468 /**
Original file line number Diff line number Diff line change @@ -664,34 +664,6 @@ public synchronized int getTextZoom() {
664664 return mTextSize ;
665665 }
666666
667- /**
668- * @see android.webkit.WebSettings#setTextSize(android.webkit.WebSettingsClassic.TextSize)
669- */
670- @ Override
671- public synchronized void setTextSize (TextSize t ) {
672- setTextZoom (t .value );
673- }
674-
675- /**
676- * @see android.webkit.WebSettings#getTextSize()
677- */
678- @ Override
679- public synchronized TextSize getTextSize () {
680- TextSize closestSize = null ;
681- int smallestDelta = Integer .MAX_VALUE ;
682- for (TextSize size : TextSize .values ()) {
683- int delta = Math .abs (mTextSize - size .value );
684- if (delta == 0 ) {
685- return size ;
686- }
687- if (delta < smallestDelta ) {
688- smallestDelta = delta ;
689- closestSize = size ;
690- }
691- }
692- return closestSize != null ? closestSize : TextSize .NORMAL ;
693- }
694-
695667 /**
696668 * Set the double-tap zoom of the page in percent. Default is 100.
697669 * @param doubleTapZoom A percent value for increasing or decreasing the double-tap zoom.
You can’t perform that action at this time.
0 commit comments