Search in sources :

Example 1 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiDetailPreferenceController method setupEntityHeader.

private void setupEntityHeader(PreferenceScreen screen) {
    LayoutPreference headerPref = screen.findPreference(KEY_HEADER);
    if (usingDataUsageHeader(mContext)) {
        headerPref.setVisible(false);
        mDataUsageSummaryPref = screen.findPreference(KEY_DATA_USAGE_HEADER);
        mDataUsageSummaryPref.setVisible(true);
        mSummaryHeaderController = new WifiDataUsageSummaryPreferenceController(mFragment.getActivity(), mLifecycle, (PreferenceFragmentCompat) mFragment, mAccessPoint.getSsid());
        return;
    }
    mEntityHeaderController = EntityHeaderController.newInstance(mFragment.getActivity(), mFragment, headerPref.findViewById(R.id.entity_header));
    ImageView iconView = headerPref.findViewById(R.id.entity_header_icon);
    iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    mEntityHeaderController.setLabel(mAccessPoint.getTitle());
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) WifiDataUsageSummaryPreferenceController(com.android.settings.datausage.WifiDataUsageSummaryPreferenceController) PreferenceFragmentCompat(androidx.preference.PreferenceFragmentCompat) ImageView(android.widget.ImageView)

Example 2 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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)

Example 3 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AdvancedBluetoothDetailsHeaderControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mController = new AdvancedBluetoothDetailsHeaderController(mContext, "pref_Key");
    when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
    mController.init(mCachedDevice);
    mLayoutPreference = new LayoutPreference(mContext, LayoutInflater.from(mContext).inflate(R.layout.advanced_bt_entity_header, null));
    mController.mLayoutPreference = mLayoutPreference;
    mController.mBluetoothAdapter = mBluetoothAdapter;
    when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
    when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) Before(org.junit.Before)

Example 4 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ColorModePreferenceFragmentTest method addStaticPreferences_shouldAddPreviewImage.

@Test
public void addStaticPreferences_shouldAddPreviewImage() {
    PreferenceScreen mockPreferenceScreen = mock(PreferenceScreen.class);
    LayoutPreference mockPreview = mock(LayoutPreference.class);
    ArgumentCaptor<Preference> preferenceCaptor = ArgumentCaptor.forClass(Preference.class);
    mFragment.configureAndInstallPreview(mockPreview, mockPreferenceScreen);
    verify(mockPreview, times(1)).setSelectable(false);
    verify(mockPreferenceScreen, times(1)).addPreference(preferenceCaptor.capture());
    assertThat(preferenceCaptor.getValue()).isEqualTo(mockPreview);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) PreferenceScreen(androidx.preference.PreferenceScreen) LayoutPreference(com.android.settingslib.widget.LayoutPreference) Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 5 with LayoutPreference

use of com.android.settingslib.widget.LayoutPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NightDisplayActivationPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mColorDisplayManager = mContext.getSystemService(ColorDisplayManager.class);
    mPreference = new LayoutPreference(mContext, R.layout.night_display_activation_button);
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    mPreferenceController = new NightDisplayActivationPreferenceController(mContext, "night_display_activation");
    mPreferenceController.displayPreference(mScreen);
}
Also used : LayoutPreference(com.android.settingslib.widget.LayoutPreference) ColorDisplayManager(android.hardware.display.ColorDisplayManager) Before(org.junit.Before)

Aggregations

LayoutPreference (com.android.settingslib.widget.LayoutPreference)34 Before (org.junit.Before)6 Preference (androidx.preference.Preference)5 Button (android.widget.Button)4 View (android.view.View)3 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)3 Test (org.junit.Test)3 Activity (android.app.Activity)2 Intent (android.content.Intent)2 PreferenceScreen (androidx.preference.PreferenceScreen)2 Context (android.content.Context)1 UserInfo (android.content.pm.UserInfo)1 Resources (android.content.res.Resources)1 ColorDisplayManager (android.hardware.display.ColorDisplayManager)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 PowerManager (android.os.PowerManager)1 UserManager (android.os.UserManager)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1