void netConnectedAtLeader(NetInfo[] nets) { for (NetInfo net : nets) { StringBuilder sb = new StringBuilder(); sb.append("SSID: ").append(net.name); sb.append("; passwd: ").append(net.pass); sb.append("; encryption: ").append(NetInfo.NetEncryptionName(net.encrypt)); // update GUI switch (net.type) { case NetInfo.WiFi: wifiInfo.setText(sb); if (connNets[NetInfo.WiFi] != null && connNets[NetInfo.WiFi].encrypt != NetInfo.NoPass) { groupPasswd.setVisibility(View.VISIBLE); } break; case NetInfo.WiFiDirect: wifiDirectInfo.setText(sb); break; case NetInfo.WiFiHotspot: if (WifiHotspotTransport.Unknown.equals(net.name)) { wifiHotspotInfo.setText(NetInfo.NetTypeName(net.type) + ": " + checkSetting); hotspotLockedInfo.setVisibility(View.VISIBLE); } else { wifiHotspotInfo.setText(sb); hotspotLockedInfo.setVisibility(View.GONE); } break; } } }
void showGroup(int grpNo) { groupRole.setVisibility(View.GONE); groupNType.setVisibility(View.GONE); groupPasswd.setVisibility(View.GONE); hotspotLockedInfo.setVisibility(View.GONE); groupQRCode.setVisibility(View.GONE); groupProg.setVisibility(View.GONE); switch (grpNo) { case -1: groupClose.setVisibility(View.GONE); groupProg.setVisibility(View.VISIBLE); break; case 1: groupRole.setVisibility(View.VISIBLE); break; case 2: groupNType.setVisibility(View.VISIBLE); if (connNets[NetInfo.WiFi] != null && connNets[NetInfo.WiFi].encrypt != NetInfo.NoPass) { groupPasswd.setVisibility(View.VISIBLE); } if (connNets[NetInfo.WiFiHotspot] != null && WifiHotspotTransport.Unknown.equals(connNets[NetInfo.WiFiHotspot].name)) { wifiHotspotInfo.setText(NetInfo.NetTypeName(NetInfo.WiFiHotspot) + ": " + checkSetting); hotspotLockedInfo.setVisibility(View.VISIBLE); } break; case 3: groupNType.setVisibility(View.VISIBLE); if (connNets[NetInfo.WiFi] != null && connNets[NetInfo.WiFi].encrypt != NetInfo.NoPass) { groupPasswd.setVisibility(View.VISIBLE); } if (connNets[NetInfo.WiFiHotspot] != null && WifiHotspotTransport.Unknown.equals(connNets[NetInfo.WiFiHotspot].name)) { wifiHotspotInfo.setText(NetInfo.NetTypeName(NetInfo.WiFiHotspot) + ": " + checkSetting); hotspotLockedInfo.setVisibility(View.VISIBLE); } groupQRCode.setVisibility(View.VISIBLE); break; } }