Java Code Examples for com.google.zxing.client.result.WifiParsedResult

The following examples show how to use com.google.zxing.client.result.WifiParsedResult. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 2
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 3
Source Project: weex   Source File: WifiResultHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 4
Source Project: Study_Android_Demo   Source File: WifiResultHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 5
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View v = inflater.inflate(R.layout.fragment_result_wifi, container, false);
    result = (WifiParsedResult) parsedResult;

    ssid = result.getSsid();
    String encryption = result.getNetworkEncryption();
    pw = result.getPassword();

    TextView resultField = (TextView) v.findViewById(R.id.result_field_wifi);
    TextView resultFieldEncryption = (TextView) v.findViewById(R.id.result_field_wifi_encryption);
    TextView resultFieldPassword = (TextView) v.findViewById(R.id.result_field_wifi_pw);
    resultField.setText("SSID: " + ssid);
    resultFieldEncryption.setText(getString(R.string.encryption) + ": " + encryption);
    resultFieldPassword.setText("PW: " + pw);

    return v;
}
 
Example 6
Source Project: barcodescanner-lib-aar   Source File: WifiResultHandler.java    License: MIT License 6 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 7
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
 
Example 8
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
 
Example 9
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
 
Example 10
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
 
Example 11
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
 
Example 12
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
 
Example 13
Source Project: weex   Source File: WifiConfigManager.java    License: Apache License 2.0 5 votes vote down vote up
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
 
Example 14
Source Project: weex   Source File: WifiConfigManager.java    License: Apache License 2.0 5 votes vote down vote up
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
 
Example 15
Source Project: weex   Source File: WifiConfigManager.java    License: Apache License 2.0 5 votes vote down vote up
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
 
Example 16
Source Project: Study_Android_Demo   Source File: WifiConfigManager.java    License: Apache License 2.0 5 votes vote down vote up
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
 
Example 17
Source Project: Study_Android_Demo   Source File: WifiConfigManager.java    License: Apache License 2.0 5 votes vote down vote up
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
 
Example 18
Source Project: Study_Android_Demo   Source File: WifiConfigManager.java    License: Apache License 2.0 5 votes vote down vote up
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
 
Example 19
Source Project: barcodescanner-lib-aar   Source File: WifiConfigManager.java    License: MIT License 5 votes vote down vote up
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
 
Example 20
Source Project: barcodescanner-lib-aar   Source File: WifiConfigManager.java    License: MIT License 5 votes vote down vote up
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
 
Example 21
Source Project: barcodescanner-lib-aar   Source File: WifiConfigManager.java    License: MIT License 5 votes vote down vote up
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
 
Example 22
Source Project: reacteu-app   Source File: WifiConfigManager.java    License: MIT License 5 votes vote down vote up
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
 
Example 23
Source Project: reacteu-app   Source File: WifiConfigManager.java    License: MIT License 5 votes vote down vote up
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
 
Example 24
Source Project: reacteu-app   Source File: WifiConfigManager.java    License: MIT License 5 votes vote down vote up
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
 
Example 25
Source Project: reacteu-app   Source File: WifiResultHandler.java    License: MIT License 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    Toast.makeText(getActivity(), fakeR.getId("string", "wifi_changing_network"), Toast.LENGTH_LONG).show();
    taskExec.execute(new WifiConfigManager(wifiManager), wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 26
Source Project: reacteu-app   Source File: WifiResultHandler.java    License: MIT License 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String wifiLabel = parent.getString(fakeR.getId("string", "wifi_ssid_label"));
  ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
  String typeLabel = parent.getString(fakeR.getId("string", "wifi_type_label"));
  ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
  return contents.toString();
}
 
Example 27
Source Project: android-apps   Source File: WifiResultHandler.java    License: MIT License 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  // Get the underlying wifi config
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  if (index == 0) {
    String ssid = wifiResult.getSsid();
    String password = wifiResult.getPassword();
    String networkType = wifiResult.getNetworkEncryption();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    Toast.makeText(getActivity(), R.string.wifi_changing_network, Toast.LENGTH_LONG).show();
    WifiConfigManager.configure(wifiManager, ssid, password, networkType);
    parent.restartPreviewAfterDelay(0L);
  }
}
 
Example 28
Source Project: android-apps   Source File: WifiResultHandler.java    License: MIT License 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String wifiLabel = parent.getString(R.string.wifi_ssid_label);
  ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
  String typeLabel = parent.getString(R.string.wifi_type_label);
  ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
  return contents.toString();
}
 
Example 29
Source Project: barterli_android   Source File: WifiResultHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    StringBuilder contents = new StringBuilder(50);
    String wifiLabel = parent.getString(R.string.wifi_ssid_label);
    ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
    String typeLabel = parent.getString(R.string.wifi_type_label);
    ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
    return contents.toString();
}
 
Example 30
@Override
public CharSequence getDisplayContents() {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    StringBuilder contents = new StringBuilder(50);
    String wifiLabel = parent.getString(R.string.wifi_ssid_label);
    ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
    String typeLabel = parent.getString(R.string.wifi_type_label);
    ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
    return contents.toString();
}