use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenAutomaticRuleSwitchPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
LayoutPreference pref = screen.findPreference(KEY);
mSwitchBar = pref.findViewById(R.id.switch_bar);
if (mSwitchBar != null) {
mSwitchBar.setSwitchBarText(R.string.zen_mode_use_automatic_rule, R.string.zen_mode_use_automatic_rule);
try {
pref.setOnPreferenceClickListener(preference -> {
mRule.setEnabled(!mRule.isEnabled());
mBackend.updateZenRule(mId, mRule);
return true;
});
mSwitchBar.addOnSwitchChangeListener(this);
} catch (IllegalStateException e) {
// an exception is thrown if you try to add the listener twice
}
mSwitchBar.show();
}
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsPreferenceFragment method setHeaderView.
protected void setHeaderView(View view) {
mHeader = new LayoutPreference(getPrefContext(), view);
addPreferenceToTop(mHeader);
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsPreferenceFragment method setHeaderView.
protected void setHeaderView(int resource) {
mHeader = new LayoutPreference(getPrefContext(), resource);
addPreferenceToTop(mHeader);
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDetailsHeaderController method init.
@Override
protected void init(PreferenceScreen screen) {
final LayoutPreference headerPreference = screen.findPreference(KEY_DEVICE_HEADER);
mHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPreference.findViewById(R.id.entity_header));
screen.addPreference(headerPreference);
}
use of com.android.settingslib.widget.LayoutPreference in project android_packages_apps_Settings by omnirom.
the class AccountHeaderPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
FakeFeatureFactory.setupForTest();
mHeaderPreference = new LayoutPreference(RuntimeEnvironment.application, R.layout.settings_entity_header);
doReturn(RuntimeEnvironment.application).when(mActivity).getApplicationContext();
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
}
Aggregations