use of com.android.settings.widget.ValidatedEditTextPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiTetherPasswordPreferenceController method updateDisplay.
@Override
public void updateDisplay() {
final WifiConfiguration config = mWifiManager.getWifiApConfiguration();
if (config == null || (config.getAuthType() == WifiConfiguration.KeyMgmt.WPA2_PSK && TextUtils.isEmpty(config.preSharedKey))) {
mPassword = generateRandomPassword();
} else {
mPassword = config.preSharedKey;
}
((ValidatedEditTextPreference) mPreference).setValidator(this);
((ValidatedEditTextPreference) mPreference).setIsPassword(true);
((ValidatedEditTextPreference) mPreference).setIsSummaryPassword(true);
updatePasswordDisplay((EditTextPreference) mPreference);
}
use of com.android.settings.widget.ValidatedEditTextPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiTetherSSIDPreferenceController method updateDisplay.
@Override
public void updateDisplay() {
final WifiConfiguration config = mWifiManager.getWifiApConfiguration();
if (config != null) {
mSSID = config.SSID;
} else {
mSSID = DEFAULT_SSID;
}
((ValidatedEditTextPreference) mPreference).setValidator(this);
if (mWifiManager.isWifiApEnabled() && config != null) {
final Intent intent = WifiDppUtils.getHotspotConfiguratorIntentOrNull(mContext, mWifiManager, config);
if (intent == null) {
Log.e(TAG, "Invalid security to share hotspot");
((WifiTetherSsidPreference) mPreference).setButtonVisible(false);
} else {
((WifiTetherSsidPreference) mPreference).setButtonOnClickListener(view -> shareHotspotNetwork(intent));
((WifiTetherSsidPreference) mPreference).setButtonVisible(true);
}
} else {
((WifiTetherSsidPreference) mPreference).setButtonVisible(false);
}
updateSsidDisplay((EditTextPreference) mPreference);
}
use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.
the class WifiTetherPasswordPreferenceController method updatePasswordDisplay.
private void updatePasswordDisplay(EditTextPreference preference) {
ValidatedEditTextPreference pref = (ValidatedEditTextPreference) preference;
pref.setText(mPassword);
if (!TextUtils.isEmpty(mPassword)) {
pref.setIsSummaryPassword(true);
pref.setSummary(mPassword);
pref.setVisible(true);
} else {
pref.setIsSummaryPassword(false);
pref.setSummary(R.string.wifi_hotspot_no_password_subtext);
pref.setVisible(false);
}
}
use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.
the class WifiTetherPasswordPreferenceController method updateDisplay.
@Override
public void updateDisplay() {
final SoftApConfiguration config = mWifiManager.getSoftApConfiguration();
if (config.getSecurityType() != SoftApConfiguration.SECURITY_TYPE_OPEN && TextUtils.isEmpty(config.getPassphrase())) {
mPassword = generateRandomPassword();
} else {
mPassword = config.getPassphrase();
}
mSecurityType = config.getSecurityType();
((ValidatedEditTextPreference) mPreference).setValidator(this);
((ValidatedEditTextPreference) mPreference).setIsPassword(true);
((ValidatedEditTextPreference) mPreference).setIsSummaryPassword(true);
updatePasswordDisplay((EditTextPreference) mPreference);
}
use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.
the class WifiTetherSSIDPreferenceController method updateDisplay.
@Override
public void updateDisplay() {
final SoftApConfiguration config = mWifiManager.getSoftApConfiguration();
if (config != null) {
mSSID = config.getSsid();
} else {
mSSID = DEFAULT_SSID;
}
((ValidatedEditTextPreference) mPreference).setValidator(this);
if (mWifiManager.isWifiApEnabled() && config != null) {
final Intent intent = WifiDppUtils.getHotspotConfiguratorIntentOrNull(mContext, mWifiManager, config);
if (intent == null) {
Log.e(TAG, "Invalid security to share hotspot");
((WifiTetherSsidPreference) mPreference).setButtonVisible(false);
} else {
((WifiTetherSsidPreference) mPreference).setButtonOnClickListener(view -> shareHotspotNetwork(intent));
((WifiTetherSsidPreference) mPreference).setButtonVisible(true);
}
} else {
((WifiTetherSsidPreference) mPreference).setButtonVisible(false);
}
updateSsidDisplay((EditTextPreference) mPreference);
}
Aggregations