Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c618e15 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix showing translated text if user switch back to original lauguage...

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

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

Change-Id: Icaa9ef2c757e7519b360aca5afcf3c15a09b9001
parents e77d0a17 7e2a96a4
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -369,6 +369,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) {
@@ -377,7 +381,6 @@ public class UiTranslationController {
                        }
                        return;
                    }
                    view.onVirtualViewTranslationResponses(virtualChildResponse);
                    if (view.getViewTranslationCallback() != null) {
                        view.getViewTranslationCallback().onShowTranslation(view);
                    }
@@ -425,6 +428,8 @@ public class UiTranslationController {
                            + " may be gone.");
                    continue;
                }
                int currentState;
                currentState = mCurrentState;
                mActivity.runOnUiThread(() -> {
                    ViewTranslationCallback callback = view.getViewTranslationCallback();
                    if (view.getViewTranslationResponse() != null
@@ -458,6 +463,9 @@ public class UiTranslationController {
                        callback.enableContentPadding();
                    }
                    view.onViewTranslationResponse(response);
                    if (currentState == STATE_UI_TRANSLATION_PAUSED) {
                        return;
                    }
                    callback.onShowTranslation(view);
                });
            }