Loading core/java/android/view/translation/UiTranslationController.java +9 −5 Original line number Diff line number Diff line Loading @@ -431,15 +431,19 @@ public class UiTranslationController { continue; } mActivity.runOnUiThread(() -> { ViewTranslationCallback callback = view.getViewTranslationCallback(); if (view.getViewTranslationResponse() != null && view.getViewTranslationResponse().equals(response)) { if (callback instanceof TextViewTranslationCallback) { if (((TextViewTranslationCallback) callback).isShowingTranslation()) { if (DEBUG) { Log.d(TAG, "Duplicate ViewTranslationResponse for " + autofillId + ". Ignoring."); } return; } ViewTranslationCallback callback = view.getViewTranslationCallback(); } } if (callback == null) { if (view instanceof TextView) { // developer doesn't provide their override, we set the default TextView Loading core/java/android/widget/TextViewTranslationCallback.java +7 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,12 @@ public class TextViewTranslationCallback implements ViewTranslationCallback { */ @Override public boolean onShowTranslation(@NonNull View view) { if (mIsShowingTranslation) { if (DEBUG) { Log.d(TAG, view + " is already showing translated text."); } return false; } ViewTranslationResponse response = view.getViewTranslationResponse(); if (response == null) { Log.e(TAG, "onShowTranslation() shouldn't be called before " Loading Loading @@ -152,7 +158,7 @@ public class TextViewTranslationCallback implements ViewTranslationCallback { return true; } boolean isShowingTranslation() { public boolean isShowingTranslation() { return mIsShowingTranslation; } Loading Loading
core/java/android/view/translation/UiTranslationController.java +9 −5 Original line number Diff line number Diff line Loading @@ -431,15 +431,19 @@ public class UiTranslationController { continue; } mActivity.runOnUiThread(() -> { ViewTranslationCallback callback = view.getViewTranslationCallback(); if (view.getViewTranslationResponse() != null && view.getViewTranslationResponse().equals(response)) { if (callback instanceof TextViewTranslationCallback) { if (((TextViewTranslationCallback) callback).isShowingTranslation()) { if (DEBUG) { Log.d(TAG, "Duplicate ViewTranslationResponse for " + autofillId + ". Ignoring."); } return; } ViewTranslationCallback callback = view.getViewTranslationCallback(); } } if (callback == null) { if (view instanceof TextView) { // developer doesn't provide their override, we set the default TextView Loading
core/java/android/widget/TextViewTranslationCallback.java +7 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,12 @@ public class TextViewTranslationCallback implements ViewTranslationCallback { */ @Override public boolean onShowTranslation(@NonNull View view) { if (mIsShowingTranslation) { if (DEBUG) { Log.d(TAG, view + " is already showing translated text."); } return false; } ViewTranslationResponse response = view.getViewTranslationResponse(); if (response == null) { Log.e(TAG, "onShowTranslation() shouldn't be called before " Loading Loading @@ -152,7 +158,7 @@ public class TextViewTranslationCallback implements ViewTranslationCallback { return true; } boolean isShowingTranslation() { public boolean isShowingTranslation() { return mIsShowingTranslation; } Loading