* commit '74d85949507f3d9fdc75ace2acbec1aa7503b034': Check for special char when renaming device for Wi-Fi direct.
This commit is contained in:
@@ -206,6 +206,19 @@ public class WifiP2pSettings extends SettingsPreferenceFragment
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
if (mWifiP2pManager != null) {
|
||||
String name = mDeviceNameText.getText().toString();
|
||||
if (name != null) {
|
||||
for (int i = 0; i < name.length(); i++) {
|
||||
char cur = name.charAt(i);
|
||||
if(!Character.isDigit(cur) && !Character.isLetter(cur)
|
||||
&& cur != '-' && cur != '_' && cur != ' ') {
|
||||
Toast.makeText(getActivity(),
|
||||
R.string.wifi_p2p_failed_rename_message,
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
mWifiP2pManager.setDeviceName(mChannel,
|
||||
mDeviceNameText.getText().toString(),
|
||||
new WifiP2pManager.ActionListener() {
|
||||
|
Reference in New Issue
Block a user