Fix title clipped for "Custom settings for schedule"

Set rule to header, switch and action buttons controllers before their
isAvailable() is called in onCreate().

Fix: 228262001
Test: manual
Change-Id: Idc0ea779ab768497a8426ac847c4bbb2c6c4faea
This commit is contained in:
Chaohui Wang
2022-04-06 12:06:08 +08:00
parent ab8467e872
commit 5d0057615a
5 changed files with 40 additions and 63 deletions

View File

@@ -48,6 +48,11 @@ public class ZenAutomaticRuleSwitchPreferenceController extends
return KEY;
}
void setIdAndRule(String id, AutomaticZenRule rule) {
mId = id;
mRule = rule;
}
@Override
public boolean isAvailable() {
return mRule != null && mId != null;
@@ -74,11 +79,6 @@ public class ZenAutomaticRuleSwitchPreferenceController extends
}
}
public void onResume(AutomaticZenRule rule, String id) {
mRule = rule;
mId = id;
}
public void updateState(Preference preference) {
if (mRule != null) {
mSwitchBar.updateStatus(mRule.isEnabled());