Merge "Fix showing translated text if user switch back to original lauguage quickly." into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e2a96a463
@@ -369,6 +369,10 @@ public class UiTranslationController {
|
|||||||
Log.v(TAG, "onVirtualViewTranslationCompleted: received response for "
|
Log.v(TAG, "onVirtualViewTranslationCompleted: received response for "
|
||||||
+ "AutofillId " + autofillId);
|
+ "AutofillId " + autofillId);
|
||||||
}
|
}
|
||||||
|
view.onVirtualViewTranslationResponses(virtualChildResponse);
|
||||||
|
if (mCurrentState == STATE_UI_TRANSLATION_PAUSED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mActivity.runOnUiThread(() -> {
|
mActivity.runOnUiThread(() -> {
|
||||||
if (view.getViewTranslationCallback() == null) {
|
if (view.getViewTranslationCallback() == null) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@@ -377,7 +381,6 @@ public class UiTranslationController {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
view.onVirtualViewTranslationResponses(virtualChildResponse);
|
|
||||||
if (view.getViewTranslationCallback() != null) {
|
if (view.getViewTranslationCallback() != null) {
|
||||||
view.getViewTranslationCallback().onShowTranslation(view);
|
view.getViewTranslationCallback().onShowTranslation(view);
|
||||||
}
|
}
|
||||||
@@ -425,6 +428,8 @@ public class UiTranslationController {
|
|||||||
+ " may be gone.");
|
+ " may be gone.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
int currentState;
|
||||||
|
currentState = mCurrentState;
|
||||||
mActivity.runOnUiThread(() -> {
|
mActivity.runOnUiThread(() -> {
|
||||||
ViewTranslationCallback callback = view.getViewTranslationCallback();
|
ViewTranslationCallback callback = view.getViewTranslationCallback();
|
||||||
if (view.getViewTranslationResponse() != null
|
if (view.getViewTranslationResponse() != null
|
||||||
@@ -458,6 +463,9 @@ public class UiTranslationController {
|
|||||||
callback.enableContentPadding();
|
callback.enableContentPadding();
|
||||||
}
|
}
|
||||||
view.onViewTranslationResponse(response);
|
view.onViewTranslationResponse(response);
|
||||||
|
if (currentState == STATE_UI_TRANSLATION_PAUSED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
callback.onShowTranslation(view);
|
callback.onShowTranslation(view);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user