Search in sources :

Example 36 with LayoutPreference

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();
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) LayoutPreference(com.android.settingslib.widget.LayoutPreference) Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 37 with LayoutPreference

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);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 38 with LayoutPreference

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);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference)

Example 39 with LayoutPreference

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);
    }
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) Activity(android.app.Activity)

Example 40 with LayoutPreference

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);
        }
    }
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) SwitchBar(com.android.settings.widget.SwitchBar)

Aggregations

LayoutPreference (com.android.settingslib.widget.LayoutPreference)61 Before (org.junit.Before)10 Preference (androidx.preference.Preference)8 Activity (android.app.Activity)5 View (android.view.View)5 Button (android.widget.Button)5 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)5 Test (org.junit.Test)5 ImageView (android.widget.ImageView)3 PreferenceManager (androidx.preference.PreferenceManager)3 PreferenceScreen (androidx.preference.PreferenceScreen)3 Intent (android.content.Intent)2 UserInfo (android.content.pm.UserInfo)2 Resources (android.content.res.Resources)2 Bundle (android.os.Bundle)2 RemoteException (android.os.RemoteException)2 UserManager (android.os.UserManager)2 TextView (android.widget.TextView)2 PreferenceFragmentCompat (androidx.preference.PreferenceFragmentCompat)2 WifiDataUsageSummaryPreferenceController (com.android.settings.datausage.WifiDataUsageSummaryPreferenceController)2