├── .gitattributes
├── .gitignore
└── wifi_set
├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── AndroidManifest.xml
├── bin
├── AndroidManifest.xml
├── GoGotest.apk
├── classes.dex
├── classes
│ └── com
│ │ └── ldm
│ │ └── test
│ │ ├── BuildConfig.class
│ │ ├── MainActivity$MyAsyncTask.class
│ │ ├── MainActivity.class
│ │ ├── R$attr.class
│ │ ├── R$dimen.class
│ │ ├── R$drawable.class
│ │ ├── R$id.class
│ │ ├── R$layout.class
│ │ ├── R$menu.class
│ │ ├── R$string.class
│ │ ├── R$style.class
│ │ ├── R.class
│ │ ├── WifiConnectActivity$1.class
│ │ ├── WifiConnectActivity$2.class
│ │ ├── WifiConnectActivity.class
│ │ └── utils
│ │ └── WifiUtils.class
├── dexedLibs
│ ├── android-support-v4-60b13a836b4b41385a9b23c0c13c2c5d.jar
│ ├── android-support-v4-675923138d2083521a4661b578dc2b20.jar
│ ├── android-support-v4-94ca78af2150a062b1d87782907f4d3e.jar
│ └── gogo-63e863a86cc9049f5cc15bc292107e0a.jar
├── gogo_jar.apk
├── jarlist.cache
├── res
│ └── crunch
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ │ └── drawable-xxhdpi
│ │ └── ic_launcher.png
├── resources.ap_
└── wifi_set.apk
├── gen
└── com
│ └── ldm
│ └── test
│ ├── BuildConfig.java
│ └── R.java
├── ic_launcher-web.png
├── libs
└── android-support-v4.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── layout
│ ├── activity_connect.xml
│ ├── activity_main.xml
│ ├── list_empty.xml
│ └── wifi_list_item.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── ldm
└── test
├── MainActivity.java
├── WifiConnectActivity.java
└── utils
└── WifiUtils.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 |
--------------------------------------------------------------------------------
/wifi_set/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/wifi_set/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | wifi_set
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/wifi_set/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/wifi_set/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/wifi_set/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/wifi_set/bin/GoGotest.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/GoGotest.apk
--------------------------------------------------------------------------------
/wifi_set/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes.dex
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/BuildConfig.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/MainActivity$MyAsyncTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/MainActivity$MyAsyncTask.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/MainActivity.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$attr.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$dimen.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$drawable.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$id.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$layout.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$menu.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$string.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R$style.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/R.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/WifiConnectActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/WifiConnectActivity$1.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/WifiConnectActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/WifiConnectActivity$2.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/WifiConnectActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/WifiConnectActivity.class
--------------------------------------------------------------------------------
/wifi_set/bin/classes/com/ldm/test/utils/WifiUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/classes/com/ldm/test/utils/WifiUtils.class
--------------------------------------------------------------------------------
/wifi_set/bin/dexedLibs/android-support-v4-60b13a836b4b41385a9b23c0c13c2c5d.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/dexedLibs/android-support-v4-60b13a836b4b41385a9b23c0c13c2c5d.jar
--------------------------------------------------------------------------------
/wifi_set/bin/dexedLibs/android-support-v4-675923138d2083521a4661b578dc2b20.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/dexedLibs/android-support-v4-675923138d2083521a4661b578dc2b20.jar
--------------------------------------------------------------------------------
/wifi_set/bin/dexedLibs/android-support-v4-94ca78af2150a062b1d87782907f4d3e.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/dexedLibs/android-support-v4-94ca78af2150a062b1d87782907f4d3e.jar
--------------------------------------------------------------------------------
/wifi_set/bin/dexedLibs/gogo-63e863a86cc9049f5cc15bc292107e0a.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/dexedLibs/gogo-63e863a86cc9049f5cc15bc292107e0a.jar
--------------------------------------------------------------------------------
/wifi_set/bin/gogo_jar.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/gogo_jar.apk
--------------------------------------------------------------------------------
/wifi_set/bin/jarlist.cache:
--------------------------------------------------------------------------------
1 | # cache for current jar dependency. DO NOT EDIT.
2 | # format is
3 | # Encoding is UTF-8
4 |
--------------------------------------------------------------------------------
/wifi_set/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/bin/res/crunch/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/res/crunch/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/bin/res/crunch/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/resources.ap_
--------------------------------------------------------------------------------
/wifi_set/bin/wifi_set.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/bin/wifi_set.apk
--------------------------------------------------------------------------------
/wifi_set/gen/com/ldm/test/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.ldm.test;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/wifi_set/gen/com/ldm/test/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.ldm.test;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class dimen {
14 | /** Default screen margins, per the Android Design guidelines.
15 |
16 | Customize dimensions originally defined in res/values/dimens.xml (such as
17 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
18 |
19 | */
20 | public static final int activity_horizontal_margin=0x7f040000;
21 | public static final int activity_vertical_margin=0x7f040001;
22 | }
23 | public static final class drawable {
24 | public static final int ic_launcher=0x7f020000;
25 | }
26 | public static final class id {
27 | public static final int action_settings=0x7f080008;
28 | public static final int connect_btn=0x7f080004;
29 | public static final int search_btn=0x7f080005;
30 | public static final int ssid=0x7f080007;
31 | public static final int wifi_lv=0x7f080006;
32 | public static final int wifi_pwd=0x7f080002;
33 | public static final int wifi_pwd_tv=0x7f080003;
34 | public static final int wifi_ssid=0x7f080000;
35 | public static final int wifi_ssid_tv=0x7f080001;
36 | }
37 | public static final class layout {
38 | public static final int activity_connect=0x7f030000;
39 | public static final int activity_main=0x7f030001;
40 | public static final int list_empty=0x7f030002;
41 | public static final int wifi_list_item=0x7f030003;
42 | }
43 | public static final class menu {
44 | public static final int main=0x7f070000;
45 | }
46 | public static final class string {
47 | public static final int action_settings=0x7f050001;
48 | public static final int app_name=0x7f050000;
49 | public static final int bell_tips=0x7f050003;
50 | public static final int device_id=0x7f050004;
51 | public static final int hello_world=0x7f050002;
52 | public static final int input_pwd_hint=0x7f050009;
53 | public static final int next=0x7f050007;
54 | public static final int sure=0x7f050008;
55 | public static final int wait_moment=0x7f05000a;
56 | public static final int wifi_pwd=0x7f050006;
57 | public static final int wifi_ssid=0x7f050005;
58 | }
59 | public static final class style {
60 | /**
61 | Base application theme, dependent on API level. This theme is replaced
62 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
63 |
64 |
65 | Theme customizations available in newer API levels can go in
66 | res/values-vXX/styles.xml, while customizations related to
67 | backward-compatibility can go here.
68 |
69 |
70 | Base application theme for API 11+. This theme completely replaces
71 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
72 |
73 | API 11 theme customizations can go here.
74 |
75 | Base application theme for API 14+. This theme completely replaces
76 | AppBaseTheme from BOTH res/values/styles.xml and
77 | res/values-v11/styles.xml on API 14+ devices.
78 |
79 | API 14 theme customizations can go here.
80 | */
81 | public static final int AppBaseTheme=0x7f060000;
82 | /** Application theme.
83 | All customizations that are NOT specific to a particular API-level can go here.
84 | */
85 | public static final int AppTheme=0x7f060001;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/wifi_set/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/ic_launcher-web.png
--------------------------------------------------------------------------------
/wifi_set/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/wifi_set/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/wifi_set/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 |
--------------------------------------------------------------------------------
/wifi_set/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ldm520/Android-wifi-scan/6e30cb8364b982ba4b13947bd117c289d7bb8755/wifi_set/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/wifi_set/res/layout/activity_connect.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
15 |
23 |
24 |
33 |
34 |
45 |
46 |
55 |
56 |
--------------------------------------------------------------------------------
/wifi_set/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
15 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/wifi_set/res/layout/list_empty.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/wifi_set/res/layout/wifi_list_item.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
16 |
17 |
--------------------------------------------------------------------------------
/wifi_set/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/wifi_set/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/wifi_set/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/wifi_set/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/wifi_set/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/wifi_set/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/wifi_set/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | GoGotest
5 | Settings
6 | Hello world!
7 | 请长按设置按钮5秒钟,听到语音提示后点击下一步进行操作!
8 | 设备ID:
9 | WIFI-SSID:
10 | WIFI密码:
11 | 下一步
12 | 确定
13 | 请输入密码
14 | 操作进行中,请稍后
15 |
16 |
17 |
--------------------------------------------------------------------------------
/wifi_set/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/wifi_set/src/com/ldm/test/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.ldm.test;
2 |
3 | import java.util.List;
4 |
5 | import android.app.Activity;
6 | import android.app.ProgressDialog;
7 | import android.content.Intent;
8 | import android.os.AsyncTask;
9 | import android.os.Bundle;
10 | import android.text.TextUtils;
11 | import android.view.View;
12 | import android.view.View.OnClickListener;
13 | import android.widget.AdapterView;
14 | import android.widget.AdapterView.OnItemClickListener;
15 | import android.widget.ArrayAdapter;
16 | import android.widget.Button;
17 | import android.widget.ListView;
18 | import android.widget.TextView;
19 |
20 | import com.ldm.test.utils.WifiUtils;
21 |
22 | /**
23 | * Search WIFI and show in ListView
24 | *
25 | */
26 | public class MainActivity extends Activity implements OnClickListener,
27 | OnItemClickListener {
28 | private Button search_btn;
29 | private ListView wifi_lv;
30 | private WifiUtils mUtils;
31 | private List result;
32 | private ProgressDialog progressdlg = null;
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_main);
38 | mUtils = new WifiUtils(this);
39 | findViews();
40 | setLiteners();
41 | }
42 |
43 | private void findViews() {
44 | this.search_btn = (Button) findViewById(R.id.search_btn);
45 | this.wifi_lv = (ListView) findViewById(R.id.wifi_lv);
46 | }
47 |
48 | private void setLiteners() {
49 | search_btn.setOnClickListener(this);
50 | wifi_lv.setOnItemClickListener(this);
51 | }
52 |
53 | @Override
54 | public void onClick(View v) {
55 | if (v.getId() == R.id.search_btn) {
56 | showDialog();
57 | new MyAsyncTask().execute();
58 | }
59 | }
60 |
61 | /**
62 | * init dialog and show
63 | */
64 | private void showDialog() {
65 | progressdlg = new ProgressDialog(this);
66 | progressdlg.setCanceledOnTouchOutside(false);
67 | progressdlg.setCancelable(false);
68 | progressdlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
69 | progressdlg.setMessage(getString(R.string.wait_moment));
70 | progressdlg.show();
71 | }
72 |
73 | /**
74 | * dismiss dialog
75 | */
76 | private void progressDismiss() {
77 | if (progressdlg != null) {
78 | progressdlg.dismiss();
79 | }
80 | }
81 |
82 | class MyAsyncTask extends AsyncTask {
83 |
84 | @Override
85 | protected Void doInBackground(Void... arg0) {
86 | //扫描附近WIFI信息
87 | result = mUtils.getScanWifiResult();
88 | return null;
89 | }
90 |
91 | @Override
92 | protected void onPostExecute(Void result) {
93 | super.onPostExecute(result);
94 | progressDismiss();
95 | initListViewData();
96 | }
97 | }
98 |
99 | private void initListViewData() {
100 | if (null != result && result.size() > 0) {
101 | wifi_lv.setAdapter(new ArrayAdapter(
102 | getApplicationContext(), R.layout.wifi_list_item,
103 | R.id.ssid, result));
104 | } else {
105 | wifi_lv.setEmptyView(findViewById(R.layout.list_empty));
106 | }
107 | }
108 |
109 | @Override
110 | public void onItemClick(AdapterView> arg0, View arg1, int arg2, long arg3) {
111 | TextView tv = (TextView) arg1.findViewById(R.id.ssid);
112 | if (!TextUtils.isEmpty(tv.getText().toString())) {
113 | Intent in = new Intent(MainActivity.this, WifiConnectActivity.class);
114 | in.putExtra("ssid", tv.getText().toString());
115 | startActivity(in);
116 | }
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/wifi_set/src/com/ldm/test/WifiConnectActivity.java:
--------------------------------------------------------------------------------
1 | package com.ldm.test;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.app.ProgressDialog;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.os.Looper;
9 | import android.text.TextUtils;
10 | import android.view.View;
11 | import android.view.View.OnClickListener;
12 | import android.widget.Button;
13 | import android.widget.EditText;
14 | import android.widget.TextView;
15 | import android.widget.Toast;
16 |
17 | import com.ldm.test.utils.WifiUtils;
18 | /**
19 | * 连接指定的WIFI
20 | *
21 | */
22 | public class WifiConnectActivity extends Activity implements OnClickListener {
23 | private Button connect_btn;
24 | private TextView wifi_ssid_tv;
25 | private EditText wifi_pwd_tv;
26 | private WifiUtils mUtils;
27 | // wifi之ssid
28 | private String ssid;
29 | private String pwd;
30 | private ProgressDialog progressdlg = null;
31 | @SuppressLint("HandlerLeak")
32 | private Handler mHandler = new Handler() {
33 | public void handleMessage(android.os.Message msg) {
34 | switch (msg.what) {
35 | case 0:
36 | showToast("WIFI连接成功");
37 | finish();
38 | break;
39 | case 1:
40 | showToast("WIFI连接失败");
41 | break;
42 |
43 | }
44 | progressDismiss();
45 | }
46 | };
47 |
48 | @Override
49 | protected void onCreate(Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 | setContentView(R.layout.activity_connect);
52 | mUtils = new WifiUtils(this);
53 | findViews();
54 | setLiteners();
55 | initDatas();
56 | }
57 |
58 | /**
59 | * init dialog
60 | */
61 | private void progressDialog() {
62 | progressdlg = new ProgressDialog(this);
63 | progressdlg.setCanceledOnTouchOutside(false);
64 | progressdlg.setCancelable(false);
65 | progressdlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
66 | progressdlg.setMessage(getString(R.string.wait_moment));
67 | progressdlg.show();
68 | }
69 |
70 | /**
71 | * dissmiss dialog
72 | */
73 | private void progressDismiss() {
74 | if (progressdlg != null) {
75 | progressdlg.dismiss();
76 | }
77 | }
78 |
79 | private void initDatas() {
80 | ssid = getIntent().getStringExtra("ssid");
81 | if (!TextUtils.isEmpty(ssid)) {
82 | ssid = ssid.replace("\"", "");
83 | }
84 | this.wifi_ssid_tv.setText(ssid);
85 | }
86 |
87 | private void findViews() {
88 | this.connect_btn = (Button) findViewById(R.id.connect_btn);
89 | this.wifi_ssid_tv = (TextView) findViewById(R.id.wifi_ssid_tv);
90 | this.wifi_pwd_tv = (EditText) findViewById(R.id.wifi_pwd_tv);
91 | }
92 |
93 | private void setLiteners() {
94 | connect_btn.setOnClickListener(this);
95 | }
96 |
97 | @Override
98 | public void onClick(View v) {
99 | if (v.getId() == R.id.connect_btn) {// 下一步操作
100 | pwd = wifi_pwd_tv.getText().toString();
101 | // 判断密码输入情况
102 | if (TextUtils.isEmpty(pwd)) {
103 | Toast.makeText(this, "请输入wifi密码", Toast.LENGTH_SHORT).show();
104 | return;
105 | }
106 | progressDialog();
107 | // 在子线程中处理各种业务
108 | dealWithConnect(ssid, pwd);
109 | }
110 | }
111 |
112 | private void dealWithConnect(final String ssid, final String pwd) {
113 | new Thread(new Runnable() {
114 | @Override
115 | public void run() {
116 | Looper.prepare();
117 | // 检验密码输入是否正确
118 | boolean pwdSucess = mUtils.connectWifiTest(ssid, pwd);
119 | try {
120 | Thread.sleep(4000);
121 | } catch (Exception e) {
122 | e.printStackTrace();
123 | }
124 | if (pwdSucess) {
125 | mHandler.sendEmptyMessage(0);
126 | } else {
127 | mHandler.sendEmptyMessage(1);
128 | }
129 | }
130 | }).start();
131 | }
132 |
133 | private void showToast(String str) {
134 | Toast.makeText(WifiConnectActivity.this, str, Toast.LENGTH_SHORT).show();
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/wifi_set/src/com/ldm/test/utils/WifiUtils.java:
--------------------------------------------------------------------------------
1 | package com.ldm.test.utils;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.content.Context;
7 | import android.net.ConnectivityManager;
8 | import android.net.NetworkInfo;
9 | import android.net.NetworkInfo.State;
10 | import android.net.wifi.ScanResult;
11 | import android.net.wifi.WifiConfiguration;
12 | import android.net.wifi.WifiInfo;
13 | import android.net.wifi.WifiManager;
14 |
15 | public class WifiUtils {
16 | // 上下文Context对象
17 | private Context mContext;
18 | // WifiManager对象
19 | private WifiManager mWifiManager;
20 |
21 | public WifiUtils(Context mContext) {
22 | this.mContext = mContext;
23 | mWifiManager = (WifiManager) mContext
24 | .getSystemService(Context.WIFI_SERVICE);
25 | }
26 |
27 | /**
28 | * 判断手机是否连接在Wifi上
29 | */
30 | public boolean isConnectWifi() {
31 | // 获取ConnectivityManager对象
32 | ConnectivityManager conMgr = (ConnectivityManager) mContext
33 | .getSystemService(Context.CONNECTIVITY_SERVICE);
34 | // 获取NetworkInfo对象
35 | NetworkInfo info = conMgr.getActiveNetworkInfo();
36 | // 获取连接的方式为wifi
37 | State wifi = conMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
38 | .getState();
39 |
40 | if (info != null && info.isAvailable() && wifi == State.CONNECTED)
41 |
42 | {
43 | return true;
44 | } else {
45 | return false;
46 | }
47 |
48 | }
49 |
50 | /**
51 | * 获取当前手机所连接的wifi信息
52 | */
53 | public WifiInfo getCurrentWifiInfo() {
54 | return mWifiManager.getConnectionInfo();
55 | }
56 |
57 | /**
58 | * 添加一个网络并连接 传入参数:WIFI发生配置类WifiConfiguration
59 | */
60 | public boolean addNetwork(WifiConfiguration wcg) {
61 | int wcgID = mWifiManager.addNetwork(wcg);
62 | return mWifiManager.enableNetwork(wcgID, true);
63 | }
64 |
65 | /**
66 | * 搜索附近的热点信息,并返回所有热点为信息的SSID集合数据
67 | */
68 | public List getScanWifiResult() {
69 | // 扫描的热点数据
70 | List resultList;
71 | // 开始扫描热点
72 | mWifiManager.startScan();
73 | resultList = mWifiManager.getScanResults();
74 | ArrayList ssids = new ArrayList();
75 | if (resultList != null) {
76 | for (ScanResult scan : resultList) {
77 | ssids.add(scan.SSID);// 遍历数据,取得ssid数据集
78 | }
79 | }
80 | return ssids;
81 | }
82 |
83 | /**
84 | * 连接wifi 参数:wifi的ssid及wifi的密码
85 | */
86 | public boolean connectWifiTest(final String ssid, final String pwd) {
87 | boolean isSuccess = false;
88 | boolean flag = false;
89 | mWifiManager.disconnect();
90 | boolean addSucess = addNetwork(CreateWifiInfo(ssid, pwd, 3));
91 | if (addSucess) {
92 | while (!flag && !isSuccess) {
93 | try {
94 | Thread.sleep(10000);
95 | } catch (InterruptedException e1) {
96 | e1.printStackTrace();
97 | }
98 | String currSSID = getCurrentWifiInfo().getSSID();
99 | if (currSSID != null)
100 | currSSID = currSSID.replace("\"", "");
101 | int currIp = getCurrentWifiInfo().getIpAddress();
102 | if (currSSID != null && currSSID.equals(ssid) && currIp != 0) {
103 | isSuccess = true;
104 | } else {
105 | flag = true;
106 | }
107 | }
108 | }
109 | return isSuccess;
110 |
111 | }
112 |
113 | /**
114 | * 创建WifiConfiguration对象 分为三种情况:1没有密码;2用wep加密;3用wpa加密
115 | *
116 | * @param SSID
117 | * @param Password
118 | * @param Type
119 | * @return
120 | */
121 | public WifiConfiguration CreateWifiInfo(String SSID, String Password,
122 | int Type) {
123 | WifiConfiguration config = new WifiConfiguration();
124 | config.allowedAuthAlgorithms.clear();
125 | config.allowedGroupCiphers.clear();
126 | config.allowedKeyManagement.clear();
127 | config.allowedPairwiseCiphers.clear();
128 | config.allowedProtocols.clear();
129 | config.SSID = "\"" + SSID + "\"";
130 |
131 | WifiConfiguration tempConfig = this.IsExsits(SSID);
132 | if (tempConfig != null) {
133 | mWifiManager.removeNetwork(tempConfig.networkId);
134 | }
135 |
136 | if (Type == 1) // WIFICIPHER_NOPASS
137 | {
138 | config.wepKeys[0] = "";
139 | config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
140 | config.wepTxKeyIndex = 0;
141 | }
142 | if (Type == 2) // WIFICIPHER_WEP
143 | {
144 | config.hiddenSSID = true;
145 | config.wepKeys[0] = "\"" + Password + "\"";
146 | config.allowedAuthAlgorithms
147 | .set(WifiConfiguration.AuthAlgorithm.SHARED);
148 | config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
149 | config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
150 | config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
151 | config.allowedGroupCiphers
152 | .set(WifiConfiguration.GroupCipher.WEP104);
153 | config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
154 | config.wepTxKeyIndex = 0;
155 | }
156 | if (Type == 3) // WIFICIPHER_WPA
157 | {
158 | config.preSharedKey = "\"" + Password + "\"";
159 | config.hiddenSSID = true;
160 | config.allowedAuthAlgorithms
161 | .set(WifiConfiguration.AuthAlgorithm.OPEN);
162 | config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
163 | config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
164 | config.allowedPairwiseCiphers
165 | .set(WifiConfiguration.PairwiseCipher.TKIP);
166 | // config.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
167 | config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
168 | config.allowedPairwiseCiphers
169 | .set(WifiConfiguration.PairwiseCipher.CCMP);
170 | config.status = WifiConfiguration.Status.ENABLED;
171 | }
172 | return config;
173 | }
174 |
175 | private WifiConfiguration IsExsits(String SSID) {
176 | List existingConfigs = mWifiManager
177 | .getConfiguredNetworks();
178 | for (WifiConfiguration existingConfig : existingConfigs) {
179 | if (existingConfig.SSID.equals("\"" + SSID + "\"")) {
180 | return existingConfig;
181 | }
182 | }
183 | return null;
184 | }
185 |
186 | }
187 |
--------------------------------------------------------------------------------