Search in sources :

Example 1 with ValidatedEditTextPreference

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

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 2 with ValidatedEditTextPreference

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

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 3 with ValidatedEditTextPreference

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

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 4 with ValidatedEditTextPreference

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

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 5 with ValidatedEditTextPreference

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

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)

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