Search in sources :

Example 11 with ValidatedEditTextPreference

use of com.android.settings.widget.ValidatedEditTextPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DeviceNamePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    ShadowApplication shadowApplication = ShadowApplication.getInstance();
    shadowApplication.setSystemService(Context.WIFI_SERVICE, mWifiManager);
    mContext = RuntimeEnvironment.application;
    mPreference = new ValidatedEditTextPreference(mContext);
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    final WifiConfiguration configuration = new WifiConfiguration();
    configuration.SSID = "test-ap";
    when(mWifiManager.getWifiApConfiguration()).thenReturn(configuration);
    mController = new DeviceNamePreferenceController(mContext, "test_key");
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
Also used : ValidatedEditTextPreference(com.android.settings.widget.ValidatedEditTextPreference) WifiConfiguration(android.net.wifi.WifiConfiguration) ShadowApplication(org.robolectric.shadows.ShadowApplication) Before(org.junit.Before)

Example 12 with ValidatedEditTextPreference

use of com.android.settings.widget.ValidatedEditTextPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiTetherPasswordPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mPreference = new ValidatedEditTextPreference(RuntimeEnvironment.application);
    mConfig = new WifiConfiguration();
    mConfig.SSID = "test_1234";
    mConfig.preSharedKey = "test_password";
    when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
    when(mWifiManager.getWifiApConfiguration()).thenReturn(mConfig);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[] { "1", "2" });
    when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    mController = new WifiTetherPasswordPreferenceController(mContext, mListener);
}
Also used : ValidatedEditTextPreference(com.android.settings.widget.ValidatedEditTextPreference) WifiConfiguration(android.net.wifi.WifiConfiguration) Before(org.junit.Before)

Example 13 with ValidatedEditTextPreference

use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.

the class WifiTetherSSIDPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    final WifiConfiguration config = mWifiManager.getWifiApConfiguration();
    if (config != null) {
        mSSID = config.SSID;
    } else {
        mSSID = DEFAULT_SSID;
    }
    ((ValidatedEditTextPreference) mPreference).setValidator(this);
    updateSsidDisplay((EditTextPreference) mPreference);
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) ValidatedEditTextPreference(com.android.settings.widget.ValidatedEditTextPreference)

Example 14 with ValidatedEditTextPreference

use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.

the class WifiTetherSSIDPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mPreference = new ValidatedEditTextPreference(RuntimeEnvironment.application);
    when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[] { "1", "2" });
    when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    mController = new WifiTetherSSIDPreferenceController(mContext, mListener);
}
Also used : ValidatedEditTextPreference(com.android.settings.widget.ValidatedEditTextPreference) Before(org.junit.Before)

Example 15 with ValidatedEditTextPreference

use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by DirtyUnicorns.

the class WifiTetherPasswordPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mPreference = new ValidatedEditTextPreference(RuntimeEnvironment.application);
    mConfig = new WifiConfiguration();
    mConfig.SSID = "test_1234";
    mConfig.preSharedKey = "test_password";
    when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
    when(mWifiManager.getWifiApConfiguration()).thenReturn(mConfig);
    when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
    when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[] { "1", "2" });
    when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
    when(mScreen.findPreference(anyString())).thenReturn(mPreference);
    mController = new WifiTetherPasswordPreferenceController(mContext, mListener);
}
Also used : ValidatedEditTextPreference(com.android.settings.widget.ValidatedEditTextPreference) WifiConfiguration(android.net.wifi.WifiConfiguration) Before(org.junit.Before)

Aggregations

ValidatedEditTextPreference (com.android.settings.widget.ValidatedEditTextPreference)27 WifiConfiguration (android.net.wifi.WifiConfiguration)15 Before (org.junit.Before)15 SoftApConfiguration (android.net.wifi.SoftApConfiguration)3 Intent (android.content.Intent)2 PreferenceManager (androidx.preference.PreferenceManager)1 ShadowApplication (org.robolectric.shadows.ShadowApplication)1