Search in sources :

Example 1 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by LineageOS.

the class LockscreenDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final LockScreenNotificationPreferenceController notificationController = new LockScreenNotificationPreferenceController(context, KEY_LOCK_SCREEN_NOTIFICATON, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
    lifecycle.addObserver(notificationController);
    controllers.add(notificationController);
    final AddUserWhenLockedPreferenceController addUserWhenLockedController = new AddUserWhenLockedPreferenceController(context);
    lifecycle.addObserver(addUserWhenLockedController);
    controllers.add(addUserWhenLockedController);
    mOwnerInfoPreferenceController = new OwnerInfoPreferenceController(context, this, lifecycle);
    controllers.add(mOwnerInfoPreferenceController);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) AddUserWhenLockedPreferenceController(com.android.settings.accounts.AddUserWhenLockedPreferenceController)

Example 2 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by LineageOS.

the class BatteryHeaderPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    mContext = spy(RuntimeEnvironment.application);
    mBatteryMeterView = new BatteryMeterView(mContext);
    mBatteryPercentText = new TextView(mContext);
    mSummary = new TextView(mContext);
    ShadowEntityHeaderController.setUseMock(mEntityHeaderController);
    mSummary2 = new TextView(mContext);
    mBatteryIntent = new Intent();
    mBatteryIntent.putExtra(BatteryManager.EXTRA_LEVEL, BATTERY_LEVEL);
    mBatteryIntent.putExtra(BatteryManager.EXTRA_SCALE, 100);
    mBatteryIntent.putExtra(BatteryManager.EXTRA_PLUGGED, 1);
    doReturn(mBatteryIntent).when(mContext).registerReceiver(any(), any());
    mBatteryLayoutPref = new LayoutPreference(mContext, R.layout.battery_header);
    doReturn(mBatteryLayoutPref).when(mPreferenceScreen).findPreference(BatteryHeaderPreferenceController.KEY_BATTERY_HEADER);
    mBatteryInfo.batteryLevel = BATTERY_LEVEL;
    mController = new BatteryHeaderPreferenceController(mContext, mActivity, mPreferenceFragment, mLifecycle);
    mController.mBatteryMeterView = mBatteryMeterView;
    mController.mBatteryPercentText = mBatteryPercentText;
    mController.mSummary1 = mSummary;
    mController.mSummary2 = mSummary2;
}
Also used : LayoutPreference(com.android.settings.applications.LayoutPreference) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) TextView(android.widget.TextView) Intent(android.content.Intent) Before(org.junit.Before)

Example 3 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by LineageOS.

the class LocationPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    mController = new LocationPreferenceController(mContext, mLifecycle);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 4 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by LineageOS.

the class MobileNetworkPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 5 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by LineageOS.

the class WpsPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mLifecycle = new Lifecycle();
    when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
    when(mScreen.findPreference(anyString())).thenReturn(mWpsPushPref).thenReturn(mWpsPinPref);
    mController = new WpsPreferenceController(mContext, mLifecycle, mWifiManager, mFragmentManager);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Aggregations

Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)205 Before (org.junit.Before)169 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)29 ArrayList (java.util.ArrayList)29 TextView (android.widget.TextView)13 Handler (android.os.Handler)8 SettingsActivity (com.android.settings.SettingsActivity)8 SwitchBar (com.android.settings.widget.SwitchBar)8 BluetoothManager (android.bluetooth.BluetoothManager)7 Intent (android.content.Intent)7 LinkProperties (android.net.LinkProperties)7 Network (android.net.Network)7 NetworkRequest (android.net.NetworkRequest)7 Bundle (android.os.Bundle)7 Preference (androidx.preference.Preference)7 PreferenceManager (androidx.preference.PreferenceManager)7 LockScreenNotificationPreferenceController (com.android.settings.notification.LockScreenNotificationPreferenceController)7 MasterSwitchPreference (com.android.settings.widget.MasterSwitchPreference)7 Account (android.accounts.Account)6 SwitchPreference (android.support.v14.preference.SwitchPreference)6