use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EntityHeaderControllerTest method testBuildView_withContext_shouldBuildPreferenceAllowedBelowDivider.
@Test
public void testBuildView_withContext_shouldBuildPreferenceAllowedBelowDivider() {
mController = EntityHeaderController.newInstance(mActivity, mFragment, null);
Preference preference = mController.done(mActivity, mShadowContext);
assertThat(preference instanceof LayoutPreference).isTrue();
assertThat(((LayoutPreference) preference).isAllowDividerBelow()).isTrue();
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DarkModeActivationPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final LayoutPreference preference = screen.findPreference(getPreferenceKey());
mTurnOnButton = preference.findViewById(R.id.dark_ui_turn_on_button);
mTurnOnButton.setOnClickListener(mListener);
mTurnOffButton = preference.findViewById(R.id.dark_ui_turn_off_button);
mTurnOffButton.setOnClickListener(mListener);
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NightDisplayActivationPreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final LayoutPreference preference = screen.findPreference(getPreferenceKey());
mTurnOnButton = preference.findViewById(R.id.night_display_turn_on_button);
mTurnOnButton.setOnClickListener(mListener);
mTurnOffButton = preference.findViewById(R.id.night_display_turn_off_button);
mTurnOffButton.setOnClickListener(mListener);
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HeaderPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
if (mAppRow != null && mFragment != null) {
Activity activity = null;
if (mStarted) {
// don't call done on an activity if it hasn't started yet
activity = mFragment.getActivity();
}
if (activity == null) {
return;
}
LayoutPreference pref = (LayoutPreference) preference;
mHeaderController = EntityHeaderController.newInstance(activity, mFragment, pref.findViewById(R.id.entity_header));
pref = mHeaderController.setIcon(mAppRow.icon).setLabel(getLabel()).setSummary(getSummary()).setPackageName(mAppRow.pkg).setUid(mAppRow.uid).setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, EntityHeaderController.ActionType.ACTION_NONE).setHasAppInfoLink(true).setRecyclerView(mFragment.getListView(), mFragment.getSettingsLifecycle()).done(activity, mContext);
pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE);
}
}
use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BlockPreferenceController method updateState.
public void updateState(Preference preference) {
LayoutPreference pref = (LayoutPreference) preference;
pref.setSelectable(false);
SwitchBar bar = pref.findViewById(R.id.switch_bar);
if (bar != null) {
bar.setSwitchBarText(R.string.notification_switch_label, R.string.notification_switch_label);
bar.show();
try {
bar.addOnSwitchChangeListener(this);
} catch (IllegalStateException e) {
// an exception is thrown if you try to add the listener twice
}
bar.setDisabledByAdmin(mAdmin);
if (mChannel != null && !isChannelBlockable()) {
bar.setEnabled(false);
}
if (mChannelGroup != null && !isChannelGroupBlockable()) {
bar.setEnabled(false);
}
if (mChannel == null && mAppRow.systemApp && (!mAppRow.banned || mAppRow.lockedImportance)) {
bar.setEnabled(false);
}
if (mChannel != null) {
bar.setChecked(!mAppRow.banned && mChannel.getImportance() != NotificationManager.IMPORTANCE_NONE);
} else if (mChannelGroup != null) {
bar.setChecked(!mAppRow.banned && !mChannelGroup.isBlocked());
} else {
bar.setChecked(!mAppRow.banned);
}
}
}
Aggregations