Search in sources :

Example 16 with LayoutPreference

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

Example 17 with LayoutPreference

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

Example 18 with LayoutPreference

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

Example 19 with LayoutPreference

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

Example 20 with LayoutPreference

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);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

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