Fix custom buttons with translated string

The reason why the buttons aren't being updated with the translated string is because the cache the views get the string from is not updated/loaded with the new language.
Rather, the update happens after the view has been inflated. With this change, when the string cache updates in bindStringCache(), we update the UI right then.

bug: 280958663
bug: 288442609
test: Manual
Change-Id: I7a49ee401d5a5f3268cfaef1abee8153e913a8ce
(cherry picked from commit 076dcdfd54)
This commit is contained in:
Brandon Dayauon committed 2023-06-28 21:49:25 +00:00
1 parent c8a2f9111b
commit dba7359d23
6 files changed
+53 -13

No files matched your search

@@ -92,10 +92,7 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
}
setInsets(mActivityContext.getDeviceProfile().getInsets());
StringCache cache = mActivityContext.getStringCache();
if (cache != null) {
mTextView.setText(cache.workProfilePauseButton);
}
updateStringFromCache();
getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
}
@@ -213,4 +210,11 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
public int getScrollThreshold() {
return mScrollThreshold;
}
public void updateStringFromCache(){
StringCache cache = mActivityContext.getStringCache();
if (cache != null) {
mTextView.setText(cache.workProfilePauseButton);
}
}
}