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
2023-06-08 13:52:06 -07:00
parent c8a2f9111b
commit dba7359d23
6 changed files with 53 additions and 13 deletions
@@ -76,11 +76,7 @@ public class WorkEduCard extends FrameLayout implements
super.onFinishInflate();
findViewById(R.id.action_btn).setOnClickListener(this);
StringCache cache = mActivityContext.getStringCache();
if (cache != null) {
TextView title = findViewById(R.id.work_apps_paused_title);
title.setText(cache.workProfileEdu);
}
updateStringFromCache();
}
@Override
@@ -121,4 +117,12 @@ public class WorkEduCard extends FrameLayout implements
public void setPosition(int position) {
mPosition = position;
}
public void updateStringFromCache() {
StringCache cache = mActivityContext.getStringCache();
if (cache != null) {
TextView title = findViewById(R.id.work_apps_paused_title);
title.setText(cache.workProfileEdu);
}
}
}