mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 09:26:51 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user