Merge "Fix showing translated text if user switch back to original lauguage quickly." into sc-v2-dev am: 7e2a96a463 am: 0c618e15a4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15938347

Change-Id: Ic4d6cc9d85ba62e8c8c6ef720ae6d2797f27130d
This commit is contained in:
TreeHugger Robot
2021-10-26 06:07:12 +00:00
committed by Automerger Merge Worker

View File

@@ -371,6 +371,10 @@ public class UiTranslationController {
Log.v(TAG, "onVirtualViewTranslationCompleted: received response for "
+ "AutofillId " + autofillId);
}
view.onVirtualViewTranslationResponses(virtualChildResponse);
if (mCurrentState == STATE_UI_TRANSLATION_PAUSED) {
return;
}
mActivity.runOnUiThread(() -> {
if (view.getViewTranslationCallback() == null) {
if (DEBUG) {
@@ -379,7 +383,6 @@ public class UiTranslationController {
}
return;
}
view.onVirtualViewTranslationResponses(virtualChildResponse);
if (view.getViewTranslationCallback() != null) {
view.getViewTranslationCallback().onShowTranslation(view);
}
@@ -427,6 +430,8 @@ public class UiTranslationController {
+ " may be gone.");
continue;
}
int currentState;
currentState = mCurrentState;
mActivity.runOnUiThread(() -> {
ViewTranslationCallback callback = view.getViewTranslationCallback();
if (view.getViewTranslationResponse() != null
@@ -460,6 +465,9 @@ public class UiTranslationController {
callback.enableContentPadding();
}
view.onViewTranslationResponse(response);
if (currentState == STATE_UI_TRANSLATION_PAUSED) {
return;
}
callback.onShowTranslation(view);
});
}