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 test: Manual Change-Id: I7a49ee401d5a5f3268cfaef1abee8153e913a8ce
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user