=UTF-8
3 |
--------------------------------------------------------------------------------
/Bluetooth/.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 |
--------------------------------------------------------------------------------
/Bluetooth/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Bluetooth/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/Bluetooth$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/Bluetooth$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/Bluetooth$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/Bluetooth$2.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/Bluetooth$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/Bluetooth$3.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/Bluetooth$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/Bluetooth$4.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/Bluetooth.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/Bluetooth.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/BluetoothClient.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/BluetoothClient.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/BuildConfig.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/ComminuteActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/ComminuteActivity$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/ComminuteActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/ComminuteActivity$2.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/ComminuteActivity$BluetoothReceiver.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/ComminuteActivity$BluetoothReceiver.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/ComminuteActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/ComminuteActivity.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/MainActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/MainActivity$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/MainActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/MainActivity$2.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/MainActivity$BluetoothReceiver$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/MainActivity$BluetoothReceiver$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/MainActivity$BluetoothReceiver.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/MainActivity$BluetoothReceiver.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/MainActivity.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/OpenService$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/OpenService$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/OpenService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/OpenService.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$array.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$array.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$attr.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$drawable.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$id.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$layout.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$string.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$style.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R$styleable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R$styleable.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/R.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SearchActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SearchActivity$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SearchActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SearchActivity$2.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SearchActivity$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SearchActivity$3.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SearchActivity$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SearchActivity$4.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SearchActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SearchActivity.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SettingActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SettingActivity$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SettingActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SettingActivity$2.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SettingActivity$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SettingActivity$3.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SettingActivity$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SettingActivity$4.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SettingActivity$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SettingActivity$5.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/SettingActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/SettingActivity.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/bean/PropertiesProvider.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/bean/PropertiesProvider.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/utils/BlueSearchUtils$1$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/utils/BlueSearchUtils$1$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/utils/BlueSearchUtils$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/utils/BlueSearchUtils$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/utils/BlueSearchUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/utils/BlueSearchUtils.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/utils/BluetoothUtils$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/utils/BluetoothUtils$1.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/utils/BluetoothUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/utils/BluetoothUtils.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/utils/LockUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/utils/LockUtils.class
--------------------------------------------------------------------------------
/Bluetooth/bin/classes/com/immqy/widget/SwitchButton.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/bin/classes/com/immqy/widget/SwitchButton.class
--------------------------------------------------------------------------------
/Bluetooth/gen/com/immqy/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.immqy;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/Bluetooth/gen/com/immqy/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.immqy;
9 |
10 | public final class R {
11 | public static final class array {
12 | public static final int array_spinner=0x7f050000;
13 | }
14 | public static final class attr {
15 | /** Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
16 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
17 | in (inches), mm (millimeters).
18 |
This may also be a reference to a resource (in the form
19 | "@[package :]type :name
") or
20 | theme attribute (in the form
21 | "?[package :][type :]name
")
22 | containing a value of this type.
23 | */
24 | public static final int switchMinWidth=0x7f010007;
25 | /**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
26 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
27 | in (inches), mm (millimeters).
28 |
This may also be a reference to a resource (in the form
29 | "@[package :]type :name
") or
30 | theme attribute (in the form
31 | "?[package :][type :]name
")
32 | containing a value of this type.
33 | */
34 | public static final int switchPadding=0x7f010008;
35 | /**
Must be a reference to another resource, in the form "@[+][package :]type :name
"
36 | or to a theme attribute in the form "?[package :][type :]name
".
37 | */
38 | public static final int switchStyle=0x7f010000;
39 | /**
Must be a reference to another resource, in the form "@[+][package :]type :name
"
40 | or to a theme attribute in the form "?[package :][type :]name
".
41 | */
42 | public static final int switchTextAppearance=0x7f010006;
43 | /**
Must be a boolean value, either "true
" or "false
".
44 |
This may also be a reference to a resource (in the form
45 | "@[package :]type :name
") or
46 | theme attribute (in the form
47 | "?[package :][type :]name
")
48 | containing a value of this type.
49 | */
50 | public static final int textAllCaps=0x7f010009;
51 | /**
Must be a reference to another resource, in the form "@[+][package :]type :name
"
52 | or to a theme attribute in the form "?[package :][type :]name
".
53 | */
54 | public static final int textOff=0x7f010004;
55 | /**
Must be a reference to another resource, in the form "@[+][package :]type :name
"
56 | or to a theme attribute in the form "?[package :][type :]name
".
57 | */
58 | public static final int textOn=0x7f010003;
59 | /**
Must be a reference to another resource, in the form "@[+][package :]type :name
"
60 | or to a theme attribute in the form "?[package :][type :]name
".
61 | */
62 | public static final int thumb=0x7f010001;
63 | /**
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
64 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
65 | in (inches), mm (millimeters).
66 |
This may also be a reference to a resource (in the form
67 | "@[package :]type :name
") or
68 | theme attribute (in the form
69 | "?[package :][type :]name
")
70 | containing a value of this type.
71 | */
72 | public static final int thumbTextPadding=0x7f010005;
73 | /**
Must be a reference to another resource, in the form "@[+][package :]type :name
"
74 | or to a theme attribute in the form "?[package :][type :]name
".
75 | */
76 | public static final int track=0x7f010002;
77 | }
78 | public static final class drawable {
79 | public static final int app_image=0x7f020000;
80 | public static final int background_color=0x7f02001b;
81 | public static final int bkg_switch=0x7f020001;
82 | public static final int btn_slip=0x7f020002;
83 | public static final int ic_launcher=0x7f020003;
84 | public static final int lock=0x7f020004;
85 | public static final int open_lock=0x7f020005;
86 | public static final int setting_switch=0x7f020006;
87 | public static final int setting_switch_off_bg=0x7f020007;
88 | public static final int setting_switch_on_bg=0x7f020008;
89 | public static final int switch_bg_disabled_holo_dark=0x7f020009;
90 | public static final int switch_bg_disabled_holo_light=0x7f02000a;
91 | public static final int switch_bg_focused_holo_dark=0x7f02000b;
92 | public static final int switch_bg_focused_holo_light=0x7f02000c;
93 | public static final int switch_bg_holo_dark=0x7f02000d;
94 | public static final int switch_bg_holo_light=0x7f02000e;
95 | public static final int switch_inner_holo_dark=0x7f02000f;
96 | public static final int switch_inner_holo_light=0x7f020010;
97 | public static final int switch_thumb_activated_holo_dark=0x7f020011;
98 | public static final int switch_thumb_activated_holo_light=0x7f020012;
99 | public static final int switch_thumb_disabled_holo_dark=0x7f020013;
100 | public static final int switch_thumb_disabled_holo_light=0x7f020014;
101 | public static final int switch_thumb_holo_dark=0x7f020015;
102 | public static final int switch_thumb_holo_light=0x7f020016;
103 | public static final int switch_thumb_pressed_holo_dark=0x7f020017;
104 | public static final int switch_thumb_pressed_holo_light=0x7f020018;
105 | public static final int switch_track_holo_dark=0x7f020019;
106 | public static final int switch_track_holo_light=0x7f02001a;
107 | }
108 | public static final class id {
109 | public static final int automatic=0x7f07000d;
110 | public static final int choices=0x7f07000c;
111 | public static final int delay=0x7f070009;
112 | public static final int disAutomatic=0x7f07000e;
113 | public static final int image=0x7f07000b;
114 | public static final int item=0x7f070012;
115 | public static final int key=0x7f070011;
116 | public static final int list=0x7f070006;
117 | public static final int lockBt=0x7f070005;
118 | public static final int messageText=0x7f070003;
119 | public static final int openBt=0x7f070001;
120 | public static final int save=0x7f070010;
121 | public static final int sendBt=0x7f070002;
122 | public static final int setting=0x7f070000;
123 | public static final int settingBt=0x7f070004;
124 | public static final int spinner=0x7f07000a;
125 | public static final int switch_button=0x7f070008;
126 | public static final int text=0x7f070007;
127 | public static final int time=0x7f07000f;
128 | }
129 | public static final class layout {
130 | public static final int anothermainlayout=0x7f030000;
131 | public static final int automatic_open_layout=0x7f030001;
132 | public static final int connect_layout=0x7f030002;
133 | public static final int disautomatic_layout=0x7f030003;
134 | public static final int disautomatic_open_layout=0x7f030004;
135 | public static final int main=0x7f030005;
136 | public static final int search_layout=0x7f030006;
137 | public static final int searchlayout=0x7f030007;
138 | public static final int setting_layout=0x7f030008;
139 | public static final int settinglayout=0x7f030009;
140 | public static final int spinner_item=0x7f03000a;
141 | }
142 | public static final class string {
143 | public static final int app_name=0x7f040000;
144 | public static final int switch_off=0x7f040001;
145 | public static final int switch_on=0x7f040002;
146 | }
147 | public static final class style {
148 | public static final int AppTheme=0x7f060000;
149 | public static final int holo_SwitchStyle=0x7f060001;
150 | public static final int light_SwitchStyle=0x7f060002;
151 | }
152 | public static final class styleable {
153 | /** Attributes that can be used with a Switch.
154 |
Includes the following attributes:
155 |
156 |
157 |
158 | Attribute Description
159 | {@link #Switch_switchMinWidth com.immqy:switchMinWidth}
160 | {@link #Switch_switchPadding com.immqy:switchPadding}
161 | {@link #Switch_switchTextAppearance com.immqy:switchTextAppearance}
162 | {@link #Switch_textOff com.immqy:textOff}
163 | {@link #Switch_textOn com.immqy:textOn}
164 | {@link #Switch_thumb com.immqy:thumb}
165 | {@link #Switch_thumbTextPadding com.immqy:thumbTextPadding}
166 | {@link #Switch_track com.immqy:track}
167 |
168 | @see #Switch_switchMinWidth
169 | @see #Switch_switchPadding
170 | @see #Switch_switchTextAppearance
171 | @see #Switch_textOff
172 | @see #Switch_textOn
173 | @see #Switch_thumb
174 | @see #Switch_thumbTextPadding
175 | @see #Switch_track
176 | */
177 | public static final int[] Switch = {
178 | 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004,
179 | 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008
180 | };
181 | /**
182 | This symbol is the offset where the {@link com.immqy.R.attr#switchMinWidth}
183 | attribute's value can be found in the {@link #Switch} array.
184 |
185 |
186 |
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
187 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
188 | in (inches), mm (millimeters).
189 |
This may also be a reference to a resource (in the form
190 | "@[package :]type :name
") or
191 | theme attribute (in the form
192 | "?[package :][type :]name
")
193 | containing a value of this type.
194 | @attr name com.immqy:switchMinWidth
195 | */
196 | public static final int Switch_switchMinWidth = 6;
197 | /**
198 |
This symbol is the offset where the {@link com.immqy.R.attr#switchPadding}
199 | attribute's value can be found in the {@link #Switch} array.
200 |
201 |
202 |
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
203 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
204 | in (inches), mm (millimeters).
205 |
This may also be a reference to a resource (in the form
206 | "@[package :]type :name
") or
207 | theme attribute (in the form
208 | "?[package :][type :]name
")
209 | containing a value of this type.
210 | @attr name com.immqy:switchPadding
211 | */
212 | public static final int Switch_switchPadding = 7;
213 | /**
214 |
This symbol is the offset where the {@link com.immqy.R.attr#switchTextAppearance}
215 | attribute's value can be found in the {@link #Switch} array.
216 |
217 |
218 |
Must be a reference to another resource, in the form "@[+][package :]type :name
"
219 | or to a theme attribute in the form "?[package :][type :]name
".
220 | @attr name com.immqy:switchTextAppearance
221 | */
222 | public static final int Switch_switchTextAppearance = 5;
223 | /**
224 |
This symbol is the offset where the {@link com.immqy.R.attr#textOff}
225 | attribute's value can be found in the {@link #Switch} array.
226 |
227 |
228 |
Must be a reference to another resource, in the form "@[+][package :]type :name
"
229 | or to a theme attribute in the form "?[package :][type :]name
".
230 | @attr name com.immqy:textOff
231 | */
232 | public static final int Switch_textOff = 3;
233 | /**
234 |
This symbol is the offset where the {@link com.immqy.R.attr#textOn}
235 | attribute's value can be found in the {@link #Switch} array.
236 |
237 |
238 |
Must be a reference to another resource, in the form "@[+][package :]type :name
"
239 | or to a theme attribute in the form "?[package :][type :]name
".
240 | @attr name com.immqy:textOn
241 | */
242 | public static final int Switch_textOn = 2;
243 | /**
244 |
This symbol is the offset where the {@link com.immqy.R.attr#thumb}
245 | attribute's value can be found in the {@link #Switch} array.
246 |
247 |
248 |
Must be a reference to another resource, in the form "@[+][package :]type :name
"
249 | or to a theme attribute in the form "?[package :][type :]name
".
250 | @attr name com.immqy:thumb
251 | */
252 | public static final int Switch_thumb = 0;
253 | /**
254 |
This symbol is the offset where the {@link com.immqy.R.attr#thumbTextPadding}
255 | attribute's value can be found in the {@link #Switch} array.
256 |
257 |
258 |
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp
".
259 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
260 | in (inches), mm (millimeters).
261 |
This may also be a reference to a resource (in the form
262 | "@[package :]type :name
") or
263 | theme attribute (in the form
264 | "?[package :][type :]name
")
265 | containing a value of this type.
266 | @attr name com.immqy:thumbTextPadding
267 | */
268 | public static final int Switch_thumbTextPadding = 4;
269 | /**
270 |
This symbol is the offset where the {@link com.immqy.R.attr#track}
271 | attribute's value can be found in the {@link #Switch} array.
272 |
273 |
274 |
Must be a reference to another resource, in the form "@[+][package :]type :name
"
275 | or to a theme attribute in the form "?[package :][type :]name
".
276 | @attr name com.immqy:track
277 | */
278 | public static final int Switch_track = 1;
279 | /** Attributes that can be used with a TextAppearance.
280 |
Includes the following attributes:
281 |
282 |
283 |
284 | Attribute Description
285 | {@link #TextAppearance_android_textColor android:textColor}
286 | {@link #TextAppearance_android_textColorHighlight android:textColorHighlight}
287 | {@link #TextAppearance_android_textColorHint android:textColorHint}
288 | {@link #TextAppearance_android_textColorLink android:textColorLink}
289 | {@link #TextAppearance_android_textSize android:textSize}
290 | {@link #TextAppearance_android_textStyle android:textStyle}
291 | {@link #TextAppearance_android_typeface android:typeface}
292 | {@link #TextAppearance_textAllCaps com.immqy:textAllCaps}
293 |
294 | @see #TextAppearance_android_textColor
295 | @see #TextAppearance_android_textColorHighlight
296 | @see #TextAppearance_android_textColorHint
297 | @see #TextAppearance_android_textColorLink
298 | @see #TextAppearance_android_textSize
299 | @see #TextAppearance_android_textStyle
300 | @see #TextAppearance_android_typeface
301 | @see #TextAppearance_textAllCaps
302 | */
303 | public static final int[] TextAppearance = {
304 | 0x01010095, 0x01010096, 0x01010097, 0x01010098,
305 | 0x01010099, 0x0101009a, 0x0101009b, 0x7f010009
306 | };
307 | /**
308 | This symbol is the offset where the {@link android.R.attr#textColor}
309 | attribute's value can be found in the {@link #TextAppearance} array.
310 | @attr name android:textColor
311 | */
312 | public static final int TextAppearance_android_textColor = 3;
313 | /**
314 |
This symbol is the offset where the {@link android.R.attr#textColorHighlight}
315 | attribute's value can be found in the {@link #TextAppearance} array.
316 | @attr name android:textColorHighlight
317 | */
318 | public static final int TextAppearance_android_textColorHighlight = 4;
319 | /**
320 |
This symbol is the offset where the {@link android.R.attr#textColorHint}
321 | attribute's value can be found in the {@link #TextAppearance} array.
322 | @attr name android:textColorHint
323 | */
324 | public static final int TextAppearance_android_textColorHint = 5;
325 | /**
326 |
This symbol is the offset where the {@link android.R.attr#textColorLink}
327 | attribute's value can be found in the {@link #TextAppearance} array.
328 | @attr name android:textColorLink
329 | */
330 | public static final int TextAppearance_android_textColorLink = 6;
331 | /**
332 |
This symbol is the offset where the {@link android.R.attr#textSize}
333 | attribute's value can be found in the {@link #TextAppearance} array.
334 | @attr name android:textSize
335 | */
336 | public static final int TextAppearance_android_textSize = 0;
337 | /**
338 |
This symbol is the offset where the {@link android.R.attr#textStyle}
339 | attribute's value can be found in the {@link #TextAppearance} array.
340 | @attr name android:textStyle
341 | */
342 | public static final int TextAppearance_android_textStyle = 2;
343 | /**
344 |
This symbol is the offset where the {@link android.R.attr#typeface}
345 | attribute's value can be found in the {@link #TextAppearance} array.
346 | @attr name android:typeface
347 | */
348 | public static final int TextAppearance_android_typeface = 1;
349 | /**
350 |
This symbol is the offset where the {@link com.immqy.R.attr#textAllCaps}
351 | attribute's value can be found in the {@link #TextAppearance} array.
352 |
353 |
354 |
Must be a boolean value, either "true
" or "false
".
355 |
This may also be a reference to a resource (in the form
356 | "@[package :]type :name
") or
357 | theme attribute (in the form
358 | "?[package :][type :]name
")
359 | containing a value of this type.
360 | @attr name com.immqy:textAllCaps
361 | */
362 | public static final int TextAppearance_textAllCaps = 7;
363 | /** Attributes that can be used with a Theme.
364 |
Includes the following attributes:
365 |
366 |
367 |
368 | Attribute Description
369 | {@link #Theme_switchStyle com.immqy:switchStyle}
370 |
371 | @see #Theme_switchStyle
372 | */
373 | public static final int[] Theme = {
374 | 0x7f010000
375 | };
376 | /**
377 | This symbol is the offset where the {@link com.immqy.R.attr#switchStyle}
378 | attribute's value can be found in the {@link #Theme} array.
379 |
380 |
381 |
Must be a reference to another resource, in the form "@[+][package :]type :name
"
382 | or to a theme attribute in the form "?[package :][type :]name
".
383 | @attr name com.immqy:switchStyle
384 | */
385 | public static final int Theme_switchStyle = 0;
386 | };
387 | }
388 |
--------------------------------------------------------------------------------
/Bluetooth/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/Bluetooth/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 |
--------------------------------------------------------------------------------
/Bluetooth/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 |
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/bkg_switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/bkg_switch.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/btn_slip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/btn_slip.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/lock.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/lock.jpg
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/open_lock.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/open_lock.jpg
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/setting_switch.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/setting_switch.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/setting_switch_off_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/setting_switch_off_bg.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/setting_switch_on_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/setting_switch_on_bg.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_bg_disabled_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_bg_disabled_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_bg_disabled_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_bg_disabled_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_bg_focused_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_bg_focused_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_bg_focused_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_bg_focused_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_bg_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_bg_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_bg_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_bg_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_activated_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_activated_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_activated_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_activated_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_disabled_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_disabled_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_disabled_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_disabled_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_pressed_holo_dark.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_pressed_holo_dark.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable-hdpi/switch_thumb_pressed_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable-hdpi/switch_thumb_pressed_holo_light.9.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable/app_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sheep0704/DuBluetooth/22da9132d4865eca844e3c976653089360c8ac69/Bluetooth/res/drawable/app_image.png
--------------------------------------------------------------------------------
/Bluetooth/res/drawable/switch_inner_holo_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Bluetooth/res/drawable/switch_inner_holo_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Bluetooth/res/drawable/switch_track_holo_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Bluetooth/res/drawable/switch_track_holo_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/anothermainlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
14 |
19 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/automatic_open_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/connect_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/disautomatic_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
14 |
19 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/disautomatic_open_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
21 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/search_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
12 |
13 |
17 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/searchlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/setting_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
26 |
35 |
36 |
44 |
53 |
54 |
61 |
62 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/settinglayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
19 |
20 |
26 |
27 |
31 |
32 |
38 |
39 |
44 |
49 |
50 |
54 |
--------------------------------------------------------------------------------
/Bluetooth/res/layout/spinner_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
--------------------------------------------------------------------------------
/Bluetooth/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
11 |
12 |
14 |
15 |
17 |
18 |
20 |
21 |
23 |
24 |
26 |
27 |
29 |
30 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
51 |
52 |
--------------------------------------------------------------------------------
/Bluetooth/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 智能蓝牙开锁
4 | #ffffff
5 | 关
6 | 开
7 |
8 |
9 | - 5秒
10 | - 15秒
11 | - 30秒
12 | - 1分钟
13 | - 5分钟
14 | - 15分钟
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Bluetooth/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
25 |
26 |
45 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/Bluetooth.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import android.bluetooth.BluetoothDevice;
4 | import android.bluetooth.BluetoothSocket;
5 | import android.os.Handler;
6 | import android.os.Message;
7 | import android.util.Log;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.OutputStream;
11 | import java.lang.reflect.Method;
12 | import com.immqy.utils.BluetoothUtils;
13 |
14 | /**
15 | * 蓝牙设备连接
16 | * @see BluetoothSocket
17 | * @author KARL-Dujinyang
18 | * @author https://github.com/sheep0704
19 | */
20 | public class Bluetooth {
21 | public static final int CONNECT_FAILED = 0;
22 | public static final int CONNECT_SUCCESS = 1;
23 | public static final int WRITE_FAILED = 2;
24 | public static final int READ_FAILED = 3;
25 | public static final int DATA = 4;
26 |
27 |
28 | private BluetoothDevice device;
29 | private Handler handler;
30 | private static BluetoothSocket socket;
31 |
32 | public Bluetooth(BluetoothDevice device, Handler handler) {
33 | this.device = device;
34 | this.handler = handler;
35 | }
36 |
37 | /**
38 | * BluetoothSocket消息
39 | * @param msg
40 | */
41 | public void connect(String msg) {
42 | Thread thread = new Thread(new Runnable() {
43 | public void run() {
44 | BluetoothSocket tmp = null;
45 | Method method;
46 | try {
47 | method = device.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
48 | tmp = (BluetoothSocket) method.invoke(device, 1);
49 | } catch (Exception e) {
50 | Log.e("CreateSocket", e.toString());
51 | }
52 | socket = tmp;
53 | try {
54 | socket.connect();
55 | } catch (Exception e) {
56 | setState(CONNECT_FAILED);
57 | Log.e("Connect", e.toString());
58 | }
59 | setState(CONNECT_SUCCESS);
60 | }
61 | });
62 | thread.start();
63 | }
64 |
65 |
66 | /**
67 | * 连接
68 | */
69 | public void connect() {
70 | Thread thread = new Thread(new Runnable() {
71 | public void run() {
72 | BluetoothSocket tmp = null;
73 | Method method;
74 | try {
75 | method = device.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
76 | tmp = (BluetoothSocket) method.invoke(device, 1);
77 | } catch (Exception e) {
78 | Log.e("CreateSocket", e.toString());
79 | }
80 | socket = tmp;
81 | try {
82 | socket.connect();
83 | } catch (Exception e) {
84 | setState(CONNECT_FAILED);
85 | Log.e("Connect", e.toString());
86 | }
87 | setState(CONNECT_SUCCESS);
88 | }
89 | });
90 | thread.start();
91 | }
92 |
93 | /**
94 | * 发送数据
95 | * @param bytes
96 | */
97 | public void sendKey(final byte[] bytes) {
98 | Thread thread = new Thread(new Runnable() {
99 | @Override
100 | public void run() {
101 | try {
102 | OutputStream out = socket.getOutputStream();
103 | for (byte b : bytes) {
104 | out.write(b);
105 | Thread.sleep(10);
106 | }
107 | out.flush();
108 | } catch (Exception e) {
109 | setState(WRITE_FAILED);
110 | Log.e("Write", e.toString());
111 | }
112 | try {
113 | while (true) {
114 | if (!BluetoothUtils.isReceiver) {
115 | read(socket.getInputStream(), 0);
116 | break;
117 | } else {
118 | break;
119 | }
120 | }
121 | } catch (Exception e) {
122 | setState(READ_FAILED);
123 | Log.e("Read", e.toString());
124 | }
125 | }
126 | });
127 | thread.start();
128 | }
129 |
130 |
131 | public void comminute(final byte[] bytes, final int type) {
132 | Thread thread = new Thread(new Runnable() {
133 | @Override
134 | public void run() {
135 | try {
136 | OutputStream out = socket.getOutputStream();
137 | out.write(bytes);
138 | Thread.sleep(40);
139 | out.flush();
140 | } catch (Exception e) {
141 | setState(WRITE_FAILED);
142 | Log.e("Write", e.toString());
143 | }
144 | try {
145 | read(socket.getInputStream(), type);
146 | } catch (Exception e) {
147 | setState(READ_FAILED);
148 | Log.e("Read", e.toString());
149 | }
150 | }
151 |
152 | });
153 | thread.start();
154 | }
155 |
156 | public void close() {
157 | try {
158 | if (socket != null) {
159 | socket.close();
160 | }
161 | } catch (Exception e) {
162 | Log.e("Close", e.toString());
163 | }
164 | }
165 |
166 | /**
167 | * 读
168 | * @param in
169 | * @param type
170 | * @throws IOException
171 | */
172 | private void read(InputStream in, int type) throws IOException {
173 | int count = 4;
174 | byte[] bytes = new byte[4];
175 | int realCount = 0;
176 | while (realCount < count) {
177 | realCount += in.read(bytes, realCount, count - realCount);
178 | }
179 | String message = BluetoothUtils.bytesToHexString(bytes);
180 | Message msg = handler.obtainMessage();
181 | msg.what = DATA;
182 | msg.obj = message;
183 | msg.arg1 = type;
184 | handler.sendMessage(msg);
185 | }
186 |
187 | /**
188 | * 设置状态
189 | * @param state
190 | */
191 | private void setState(int state) {
192 | Message msg = handler.obtainMessage();
193 | msg.what = state;
194 | handler.sendMessage(msg);
195 | }
196 | }
197 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/BluetoothClient.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import android.bluetooth.BluetoothAdapter;
4 | import android.bluetooth.BluetoothDevice;
5 | import android.bluetooth.BluetoothSocket;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.widget.Toast;
9 |
10 | /**
11 | * 蓝牙客户端
12 | * @author KARL-Dujinyang
13 | * @author https://github.com/sheep0704
14 | */
15 | public class BluetoothClient {
16 | private boolean isConnectSuccess;
17 | private BluetoothDevice device;
18 | private BluetoothSocket socket;
19 | private Context context;
20 |
21 | public BluetoothClient(Context context) {
22 | isConnectSuccess = false;
23 | this.context = context;
24 | }
25 |
26 | private void search() {
27 | BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
28 | if (!adapter.isEnabled()) {
29 | adapter.enable();
30 | }
31 | Intent enable = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
32 | enable.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 3600); //3600为蓝牙设备可见时间
33 | Toast.makeText(context, "设备可以被查找", Toast.LENGTH_LONG).show();
34 | context.startActivity(enable);
35 | Intent searchIntent = new Intent(context, SearchActivity.class);
36 | context.startActivity(searchIntent);
37 | }
38 |
39 | public void connect() throws InterruptedException {
40 | search();
41 | Thread.sleep(100);
42 | Toast.makeText(context, "连接到设备", Toast.LENGTH_LONG).show();
43 | isConnectSuccess = true;
44 | }
45 |
46 | public boolean isConnectSuccess() {
47 | return this.isConnectSuccess;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/ComminuteActivity.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.app.Activity;
7 | import android.bluetooth.BluetoothAdapter;
8 | import android.bluetooth.BluetoothDevice;
9 | import android.content.BroadcastReceiver;
10 | import android.content.Context;
11 | import android.content.Intent;
12 | import android.content.IntentFilter;
13 | import android.os.Bundle;
14 | import android.os.Handler;
15 | import android.os.Message;
16 | import android.util.Log;
17 | import android.view.View;
18 | import android.widget.AdapterView;
19 | import android.widget.ArrayAdapter;
20 | import android.widget.ListView;
21 | import android.widget.Toast;
22 |
23 | /**
24 | * 展示列表
25 | * @author KARL-Dujinyang
26 | * @author https://github.com/sheep0704
27 | */
28 | public class ComminuteActivity extends Activity {
29 |
30 | private BluetoothReceiver receiver;
31 | private BluetoothAdapter bluetoothAdapter;
32 | private List devices;
33 | private List deviceList;
34 | private Bluetooth client;
35 | private final String lockName = "dujinyang";
36 | private String message = "000001";
37 | private ListView listView;
38 |
39 | @Override
40 | public void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | setContentView(R.layout.search_layout);
43 |
44 | listView = (ListView) this.findViewById(R.id.list);
45 | deviceList = new ArrayList();
46 | devices = new ArrayList();
47 | bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
48 | bluetoothAdapter.startDiscovery();
49 | IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
50 | receiver = new BluetoothReceiver();
51 | registerReceiver(receiver, filter);
52 |
53 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
54 | @Override
55 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
56 | bluetoothAdapter.cancelDiscovery();
57 | setContentView(R.layout.connect_layout);
58 | BluetoothDevice device = deviceList.get(position);
59 | client = new Bluetooth(device, handler);
60 | try {
61 | client.connect(message);
62 | } catch (Exception e) {
63 | Log.e("TAG", e.toString());
64 | }
65 | }
66 | });
67 | }
68 |
69 | @Override
70 | protected void onDestroy() {
71 | unregisterReceiver(receiver);
72 | super.onDestroy();
73 | }
74 |
75 |
76 | /**
77 | * 收取Toast
78 | */
79 | private final Handler handler = new Handler() {
80 | @Override
81 | public void handleMessage(Message msg) {
82 | switch (msg.what) {
83 | case Bluetooth.CONNECT_FAILED:
84 | Toast.makeText(ComminuteActivity.this, "连接失败", Toast.LENGTH_LONG).show();
85 | try {
86 | client.connect(message);
87 | } catch (Exception e) {
88 | Log.e("TAG", e.toString());
89 | }
90 | break;
91 | case Bluetooth.CONNECT_SUCCESS:
92 | Toast.makeText(ComminuteActivity.this, "连接成功", Toast.LENGTH_LONG).show();
93 | break;
94 | case Bluetooth.READ_FAILED:
95 | Toast.makeText(ComminuteActivity.this, "读取失败", Toast.LENGTH_LONG).show();
96 | break;
97 | case Bluetooth.WRITE_FAILED:
98 | Toast.makeText(ComminuteActivity.this, "写入失败", Toast.LENGTH_LONG).show();
99 | break;
100 | case Bluetooth.DATA:
101 | Toast.makeText(ComminuteActivity.this, msg.arg1 + "", Toast.LENGTH_LONG).show();
102 | break;
103 | }
104 | }
105 | };
106 |
107 | private class BluetoothReceiver extends BroadcastReceiver {
108 | @Override
109 | public void onReceive(Context context, Intent intent) {
110 | String action = intent.getAction();
111 | if (BluetoothDevice.ACTION_FOUND.equals(action)) {
112 | BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
113 | if (isLock(device)) {
114 | devices.add(device.getName());
115 | }
116 | deviceList.add(device);
117 | }
118 | showDevices();
119 | }
120 | }
121 |
122 | private boolean isLock(BluetoothDevice device) {
123 | boolean isLockName = (device.getName()).equals(lockName);
124 | boolean isSingleDevice = devices.indexOf(device.getName()) == -1;
125 | return isLockName && isSingleDevice;
126 | }
127 |
128 | private void showDevices() {
129 | ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,
130 | devices);
131 | listView.setAdapter(adapter);
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import android.app.Activity;
4 | import android.bluetooth.BluetoothAdapter;
5 | import android.bluetooth.BluetoothDevice;
6 | import android.content.BroadcastReceiver;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.content.IntentFilter;
10 | import android.content.res.Resources;
11 | import android.graphics.drawable.Drawable;
12 | import android.net.Uri;
13 | import android.os.Bundle;
14 | import android.util.Log;
15 | import android.view.KeyEvent;
16 | import android.view.View;
17 | import android.widget.Button;
18 | import android.widget.ImageButton;
19 | import android.widget.Toast;
20 |
21 | import com.immqy.bean.PropertiesProvider;
22 | import com.immqy.utils.BluetoothUtils;
23 |
24 |
25 | /**
26 | *
27 | * Main测试
28 | * @author KARL-Dujinyang
29 | * @author https://github.com/sheep0704
30 | *
31 | */
32 | public class MainActivity extends Activity {
33 | private BluetoothDevice device;
34 | public static Bluetooth bluetooth;
35 | private ImageButton lockBt;
36 | public static BluetoothReceiver receiver;
37 | private BluetoothAdapter bluetoothAdapter;
38 | private final String lockName = "BOLUTEK";
39 | private final byte[] openLockBytes = {(byte) 0x55, (byte) 0x01, (byte) 0x05, (byte) 0xAA};
40 | private boolean isAutomatic;
41 | private PropertiesProvider provider;
42 |
43 | @Override
44 | public void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.main);
47 | BluetoothUtils.setContext(MainActivity.this);
48 | Resources resource = getResources();
49 | Drawable drawable = resource.getDrawable(R.drawable.background_color);
50 | this.getWindow().setBackgroundDrawable(drawable);
51 | provider = new PropertiesProvider(MainActivity.this);
52 | if((provider.get("isAutomatic"))!=null){
53 | isAutomatic = Boolean.valueOf(provider.get("isAutomatic").toString());
54 | }else{
55 | isAutomatic = false;
56 | }
57 |
58 | bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
59 | if (!bluetoothAdapter.isEnabled()) {
60 | bluetoothAdapter.enable();
61 | Toast.makeText(this, "蓝牙打开中...", Toast.LENGTH_LONG).show();
62 | receiveDevice();
63 | } else {
64 | receiveDevice();
65 | }
66 |
67 |
68 | Button settingBt = (Button) this.findViewById(R.id.settingBt);
69 | lockBt = (ImageButton) this.findViewById(R.id.lockBt);
70 |
71 | lockBt.setOnClickListener(new View.OnClickListener() {
72 | @Override
73 | public void onClick(View v) {
74 | Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
75 | intent.setType("image/*");
76 | startActivityForResult(intent, 1);
77 | }
78 | });
79 | settingBt.setOnClickListener(new View.OnClickListener() {
80 | @Override
81 | public void onClick(View v) {
82 | Intent intent = new Intent(MainActivity.this, SettingActivity.class);
83 | startActivity(intent);
84 | }
85 | });
86 | }
87 |
88 | //返回消息处理
89 | @Override
90 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
91 | if (resultCode == RESULT_OK) {
92 | Uri uri = data.getData();
93 | try {
94 | bluetooth.comminute(openLockBytes, 1);
95 | Thread.sleep(100);
96 | String path = BluetoothUtils.getPath(uri, MainActivity.this);
97 | bluetooth.sendKey((BluetoothUtils.createKey(path)).getBytes());
98 | Thread.sleep(100);
99 | lockBt.setImageDrawable(getResources().getDrawable(R.drawable.open_lock));
100 | } catch (Exception e) {
101 | Log.e("openKey", e.toString());
102 | }
103 | }
104 | super.onActivityResult(requestCode, resultCode, data);
105 | }
106 |
107 |
108 | public boolean onKeyDown(int keyCode, KeyEvent event) {
109 | if (keyCode == KeyEvent.KEYCODE_BACK) {
110 | this.finish();
111 | return true;
112 | }
113 | return super.onKeyDown(keyCode, event);
114 | }
115 |
116 | @Override
117 | protected void onDestroy() {
118 | try {
119 | stopService(new Intent(MainActivity.this, OpenService.class));
120 | unregisterReceiver(receiver);
121 | bluetooth.close();
122 |
123 | } catch (Exception e) {
124 | Log.e("Close", e.toString());
125 | }
126 | super.onDestroy();
127 | }
128 |
129 | private class BluetoothReceiver extends BroadcastReceiver {
130 |
131 | @Override
132 | public void onReceive(Context context, Intent intent) {
133 | String action = intent.getAction();
134 |
135 | if (BluetoothDevice.ACTION_FOUND.equals(action)) {
136 | BluetoothDevice receiverDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
137 | if (isLock(receiverDevice)) {
138 | device = receiverDevice;
139 | }
140 | }
141 | bluetooth = new Bluetooth(device, BluetoothUtils.readState());
142 |
143 | bluetooth.connect();
144 | Thread thread = new Thread(new Runnable() {
145 |
146 | @Override
147 | public void run() {
148 | while (true) {
149 | if (BluetoothUtils.isConnect) {
150 | try {
151 | if (isAutomatic) {
152 | startService(new Intent(MainActivity.this, OpenService.class));
153 | break;
154 | }
155 | } catch (Exception e) {
156 | break;
157 | }
158 | }
159 | }
160 | }
161 | });
162 | thread.start();
163 | }
164 |
165 | }
166 |
167 | //查看
168 | private void receiveDevice() {
169 | bluetoothAdapter.startDiscovery();
170 | IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
171 | receiver = new BluetoothReceiver();
172 | registerReceiver(receiver, filter);
173 | }
174 |
175 | private boolean isLock(BluetoothDevice device) {
176 | return (device.getName()).equals(lockName);
177 | }
178 | }
179 |
180 |
181 |
182 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/OpenService.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import com.immqy.bean.PropertiesProvider;
4 | import com.immqy.utils.BluetoothUtils;
5 |
6 | import android.app.Service;
7 | import android.content.Intent;
8 | import android.os.IBinder;
9 | import android.os.Looper;
10 | import android.widget.Toast;
11 |
12 | /**
13 | * 服务
14 | * @author KARL-Dujinyang
15 | * @author https://github.com/sheep0704
16 | */
17 | public class OpenService extends Service {
18 | private final byte[] openLockBytes = {(byte) 0x55, (byte) 0x01, (byte) 0x05, (byte) 0xAA};
19 | public static Bluetooth bluetooth;
20 | private Thread thread;
21 | private static boolean isReceiver = false;
22 |
23 | @Override
24 | public IBinder onBind(Intent intent) {
25 | return null; //To change body of implemented methods use File | Settings | File Templates.
26 | }
27 |
28 | @Override
29 | public void onCreate() {
30 | super.onCreate();
31 | }
32 |
33 | @Override
34 | public int onStartCommand(Intent intent, int flags, int startId) {
35 | Toast.makeText(this, "自动开锁开始启动", Toast.LENGTH_SHORT).show();
36 | bluetooth = MainActivity.bluetooth;
37 | PropertiesProvider provider = new PropertiesProvider(getApplicationContext());
38 | final String path = provider.get("image").toString();
39 | final int time = Integer.valueOf(provider.get("time").toString());
40 |
41 | thread = new Thread(new Runnable() {
42 |
43 |
44 | @Override
45 | public void run() {
46 | Looper.prepare();
47 | while (true) {
48 | try {
49 | while (!isReceiver) {
50 | bluetooth.comminute(openLockBytes, 2);
51 | Thread.sleep(100);
52 | bluetooth.sendKey(BluetoothUtils.createKey(path).getBytes());
53 | }
54 |
55 | Thread.sleep(time * 1000);
56 | bluetooth.comminute(openLockBytes, 2);
57 | Thread.sleep(100);
58 | bluetooth.sendKey(BluetoothUtils.createKey(path).getBytes());
59 | break;
60 | } catch (Exception e) {
61 | break;
62 | }
63 | }
64 | Looper.loop();
65 | }
66 |
67 |
68 | }
69 |
70 | );
71 | thread.start();
72 |
73 | return super.
74 |
75 | onStartCommand(intent, flags, startId);
76 |
77 | }
78 |
79 | @Override
80 | public void onDestroy() {
81 | try {
82 | Toast.makeText(this, "自动开锁停止", Toast.LENGTH_LONG).show();
83 | thread.wait();
84 | } catch (Exception e) {
85 |
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/SearchActivity.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.app.ListActivity;
7 | import android.bluetooth.BluetoothAdapter;
8 | import android.bluetooth.BluetoothDevice;
9 | import android.content.BroadcastReceiver;
10 | import android.content.Context;
11 | import android.content.DialogInterface;
12 | import android.content.Intent;
13 | import android.content.IntentFilter;
14 | import android.os.Bundle;
15 | import android.os.Handler;
16 | import android.view.View;
17 | import android.view.WindowManager;
18 | import android.widget.ArrayAdapter;
19 | import android.widget.ListView;
20 |
21 | import com.immqy.utils.BlueSearchUtils;
22 |
23 | /**
24 | *
25 | * @author KARL-Dujinyang
26 | * @author https://github.com/sheep0704
27 | */
28 | public class SearchActivity extends ListActivity {
29 |
30 | private Handler handler = new Handler();
31 | private BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
32 | private List devices = new ArrayList();
33 | private boolean isSearchSuccess;
34 |
35 | private Runnable searchWork = new Runnable() {
36 | public void run() {
37 | bluetoothAdapter.startDiscovery();
38 | while (true) {
39 | if (isSearchSuccess) {
40 | break;
41 | }
42 | try {
43 | Thread.sleep(100);
44 | } catch (InterruptedException e) {
45 | //TODO Handle the exception
46 | }
47 | }
48 | }
49 | };
50 |
51 | private BroadcastReceiver resultReceiver = new BroadcastReceiver() {
52 | @Override
53 | public void onReceive(Context context, Intent intent) {
54 | BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
55 | devices.add(device);
56 | showDevices();
57 | }
58 | };
59 |
60 |
61 | private BroadcastReceiver searchReceiver = new BroadcastReceiver() {
62 | @Override
63 | public void onReceive(Context context, Intent intent) {
64 | unregisterReceiver(resultReceiver);
65 | unregisterReceiver(this);
66 | isSearchSuccess = true;
67 | }
68 | };
69 |
70 |
71 |
72 |
73 | /**
74 | * 展示设备
75 | */
76 | protected void showDevices() {
77 | List list = new ArrayList();
78 | list.add("ha");
79 | for (int i = 0, size = devices.size(); i < size; i++) {
80 | StringBuilder stringBuilder = new StringBuilder();
81 | BluetoothDevice device = devices.get(i);
82 | stringBuilder.append(device.getAddress());
83 | stringBuilder.append('\n');
84 | stringBuilder.append(device.getName());
85 | String deviceInfo = stringBuilder.toString();
86 | list.add(deviceInfo);
87 | }
88 | final ArrayAdapter adapter = new ArrayAdapter(this,
89 | android.R.layout.simple_list_item_1, list);
90 | setListAdapter(adapter);
91 | }
92 |
93 | protected void onCreate(Bundle savedInstanceState) {
94 | super.onCreate(savedInstanceState);
95 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
96 | WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
97 | setContentView(R.layout.searchlayout);
98 | if (!bluetoothAdapter.isEnabled()) {
99 | finish();
100 | return;
101 | }
102 |
103 | IntentFilter searchFilter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
104 | registerReceiver(searchReceiver, searchFilter);
105 | IntentFilter resultFilter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
106 | registerReceiver(resultReceiver, resultFilter);
107 | BlueSearchUtils.indeterminate(SearchActivity.this, handler, "搜索中...", searchWork, new DialogInterface.OnDismissListener() {
108 | @Override
109 | public void onDismiss(DialogInterface dialog) {
110 | while (bluetoothAdapter.isDiscovering()) {
111 | bluetoothAdapter.cancelDiscovery();
112 | }
113 | isSearchSuccess = true;
114 | }
115 | }, true);
116 | }
117 |
118 |
119 |
120 | protected void onListItemClick(ListView listView, View view, int position, long id) {
121 | Intent result = new Intent();
122 | result.putExtra(BluetoothDevice.EXTRA_DEVICE, devices.get(position));
123 | setResult(RESULT_OK, result);
124 | finish();
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/SettingActivity.java:
--------------------------------------------------------------------------------
1 | package com.immqy;
2 |
3 | import android.app.Activity;
4 | import android.app.ProgressDialog;
5 | import android.content.Intent;
6 | import android.content.pm.ApplicationInfo;
7 | import android.content.res.Resources;
8 | import android.graphics.Bitmap;
9 | import android.graphics.BitmapFactory;
10 | import android.graphics.drawable.Drawable;
11 | import android.net.Uri;
12 | import android.os.Bundle;
13 | import android.os.Looper;
14 | import android.util.Log;
15 | import android.view.View;
16 | import android.widget.AdapterView;
17 | import android.widget.ArrayAdapter;
18 | import android.widget.Button;
19 | import android.widget.CompoundButton;
20 | import android.widget.ImageView;
21 | import android.widget.Spinner;
22 | import android.widget.TextView;
23 |
24 | import com.immqy.bean.PropertiesProvider;
25 | import com.immqy.utils.BluetoothUtils;
26 | import com.immqy.widget.SwitchButton;
27 |
28 | /**
29 | * 设置选项
30 | * @author KARL-Dujinyang
31 | * @author https://github.com/sheep0704
32 | */
33 | public class SettingActivity extends Activity {
34 | private final byte[] keySettingBytes = {(byte) 0x55, (byte) 0x01, (byte) 0x01, (byte) 0xAA};
35 | private Bluetooth bluetooth;
36 | private TextView delayTime;
37 | private ArrayAdapter adapter;
38 | private PropertiesProvider provider;
39 | private String key;
40 | private ImageView imageView;
41 | private Uri uri;
42 | private boolean isAutomatic = false;
43 | private int timePosition;
44 |
45 | @Override
46 | public void onCreate(Bundle savedInstanceState) {
47 | super.onCreate(savedInstanceState);
48 | setContentView(R.layout.setting_layout);
49 | Resources resource = getResources();
50 | Drawable drawable = resource.getDrawable(R.drawable.background_color);
51 | this.getWindow().setBackgroundDrawable(drawable);
52 | bluetooth = MainActivity.bluetooth;
53 | imageView = (ImageView) findViewById(R.id.image);
54 | ApplicationInfo appInfo = getApplicationInfo();
55 | int imageID = getResources().getIdentifier("image", "drawable", appInfo.packageName);
56 | Bitmap bitmap = BitmapFactory.decodeResource(getResources(), imageID);
57 | imageView.setImageBitmap(bitmap);
58 | provider = new PropertiesProvider(this);
59 |
60 |
61 | Spinner spinner = (Spinner) this.findViewById(R.id.spinner);
62 | delayTime = (TextView) this.findViewById(R.id.delay);
63 | adapter = ArrayAdapter.createFromResource(this, R.array.array_spinner,
64 | android.R.layout.simple_spinner_item);
65 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
66 |
67 | spinner.setAdapter(adapter);
68 | spinner.setPrompt("请选择开锁延时时间");
69 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
70 | @Override
71 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
72 | delayTime.setText("开锁延时时间:" + adapter.getItem(position));
73 | String timeStr = adapter.getItem(position).toString();
74 | timePosition = position;
75 | int time = 0;
76 | if (timeStr.indexOf("分") == -1) {
77 | time = Integer.valueOf(timeStr.substring(0, timeStr.length() - 1));
78 | } else {
79 | time = Integer.valueOf(timeStr.substring(0, timeStr.length() - 2)) * 60;
80 | }
81 |
82 | provider.save("time", time);
83 | provider.save("position", position);
84 | }
85 |
86 | @Override
87 | public void onNothingSelected(AdapterView> parent) {
88 | //To change body of implemented methods use File | Settings | File Templates.
89 | }
90 | });
91 |
92 | spinner.setVisibility(View.VISIBLE);
93 |
94 | SwitchButton slidBt = (SwitchButton) this.findViewById(R.id.switch_button);
95 | try {
96 | isAutomatic = Boolean.valueOf((provider.get("isAutomatic")).toString());
97 | timePosition = Integer.valueOf(provider.get("position").toString());
98 |
99 | } catch (NullPointerException e) {
100 | slidBt.setChecked(false);
101 | timePosition = 0;
102 | }
103 | slidBt.setChecked(isAutomatic);
104 | spinner.setSelection(timePosition);
105 | delayTime.setText("开锁延时时间:" + adapter.getItem(timePosition));
106 |
107 | slidBt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
108 |
109 | @Override
110 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
111 | provider.save("isAutomatic", isChecked);
112 | }
113 | });
114 |
115 |
116 | Button settingBt = (Button) this.findViewById(R.id.settingBt);
117 | Button sendBt = (Button) this.findViewById(R.id.sendBt);
118 | settingBt.setOnClickListener(new View.OnClickListener() {
119 |
120 | @Override
121 | public void onClick(View v) {
122 | Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
123 | intent.setType("image/*");
124 | startActivityForResult(intent, 1);
125 | }
126 | });
127 |
128 | sendBt.setOnClickListener(new View.OnClickListener() {
129 |
130 | @Override
131 | public void onClick(View v) {
132 | sendKey();
133 | }
134 | });
135 | }
136 |
137 | @Override
138 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
139 | if (resultCode == RESULT_OK) {
140 | uri = data.getData();
141 | try {
142 | Bitmap bitmap = BluetoothUtils.getBitmap(uri, SettingActivity.this);
143 | imageView.setImageBitmap(bitmap);
144 | String path = BluetoothUtils.getPath(uri, SettingActivity.this);
145 | provider.save("image", path);
146 | key = BluetoothUtils.createKey(path);
147 | bluetooth.comminute(keySettingBytes, 0);
148 | } catch (Exception e) {
149 | Log.e("showKey", e.toString());
150 | }
151 | }
152 | super.onActivityResult(requestCode, resultCode, data);
153 | }
154 |
155 |
156 | private void sendKey() {
157 | final ProgressDialog progressDialog = ProgressDialog.show(SettingActivity.this,
158 | "发送", "正在发送中...");
159 | Thread thread = new Thread() {
160 | @Override
161 | public void run() {
162 | Looper.prepare();
163 | try {
164 | bluetooth.sendKey(key.getBytes());
165 | progressDialog.dismiss();
166 | } catch (Exception e) {
167 | progressDialog.dismiss();
168 | Log.e("SendKey", e.toString());
169 | }
170 | Looper.loop();
171 | }
172 | };
173 | thread.start();
174 | }
175 |
176 |
177 | }
178 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/bean/PropertiesProvider.java:
--------------------------------------------------------------------------------
1 | package com.immqy.bean;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.util.Log;
6 |
7 | import java.io.FileInputStream;
8 | import java.io.FileOutputStream;
9 | import java.util.Properties;
10 |
11 | /**
12 | * 配置:保存到value.cfg里面
13 | * @author KARL-Dujinyang
14 | * @author https://github.com/sheep0704
15 | */
16 | public class PropertiesProvider {
17 | private Properties properties;
18 | private Context context;
19 | private String fileName = "immqy.cfg";
20 |
21 | public PropertiesProvider(Context context) {
22 | this.properties = new Properties();
23 | this.context = context;
24 | }
25 |
26 | @SuppressLint("WorldWriteableFiles")
27 | @SuppressWarnings("deprecation")
28 | public boolean save(String key, Object value) {
29 | properties.put(key, String.valueOf(value));
30 | try {
31 | FileOutputStream outputStream = context.openFileOutput(fileName, Context.MODE_WORLD_WRITEABLE);
32 | properties.store(outputStream, "");
33 | outputStream.close();
34 | } catch (Exception e) {
35 | Log.e("TAG", e.toString());
36 | return false;
37 | }
38 | return true;
39 | }
40 |
41 | public Object get(String key) {
42 | try {
43 | FileInputStream inputStream = context.openFileInput(fileName);
44 | properties.load(inputStream);
45 | inputStream.close();
46 | } catch (Exception e) {
47 | Log.e("TAG", e.toString());
48 | return null;
49 | }
50 | return properties.getProperty(key);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/utils/BlueSearchUtils.java:
--------------------------------------------------------------------------------
1 | package com.immqy.utils;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 | import android.content.DialogInterface.OnDismissListener;
6 | import android.os.Handler;
7 |
8 | /**
9 | *
10 | * 描述:蓝牙开发辅助类 -- 查询
11 | *
12 | * @author KARL-Dujinyang
13 | * @author https://github.com/sheep0704
14 | */
15 | public class BlueSearchUtils {
16 |
17 | /**
18 | * 标识
19 | * @param context
20 | * @param handler
21 | * @param message
22 | * @param runnable
23 | * @param dismissListener
24 | */
25 | public static void indeterminate(Context context, Handler handler, String message, final Runnable runnable, OnDismissListener dismissListener){
26 | try {
27 | indeterminateInternal(context, handler, message, runnable, dismissListener, true);
28 | }catch (Exception e) {
29 | e.printStackTrace();
30 | }
31 | }
32 |
33 | /**
34 | * 回调监听
35 | * @param context
36 | * @param handler
37 | * @param message
38 | * @param runnable
39 | * @param dismissListener
40 | * @param cancelable
41 | */
42 | public static void indeterminate(Context context, Handler handler, String message, final Runnable runnable, OnDismissListener dismissListener,
43 | boolean cancelable) {
44 | try {
45 | indeterminateInternal(context, handler, message, runnable, dismissListener, cancelable);
46 | } catch (Exception e) {
47 | e.printStackTrace();
48 | }
49 | }
50 |
51 | private static ProgressDialog createProgressDialog(Context context, String message) {
52 | ProgressDialog dialog = new ProgressDialog(context);
53 | dialog.setIndeterminate(false);
54 | dialog.setMessage(message);
55 | return dialog;
56 | }
57 |
58 | /**
59 | * 开启线程
60 | * @param context
61 | * @param handler
62 | * @param message
63 | * @param runnable
64 | * @param dismissListener
65 | * @param cancelable
66 | */
67 | private static void indeterminateInternal(Context context, final Handler handler, String message, final Runnable runnable,
68 | OnDismissListener dismissListener, boolean cancelable){
69 | final ProgressDialog dialog = createProgressDialog(context, message);
70 | dialog.setCancelable(cancelable);
71 | if (dismissListener != null){
72 | dialog.setOnDismissListener(dismissListener);
73 | }
74 | dialog.show();
75 | new Thread() {
76 | @Override
77 | public void run(){
78 | runnable.run();
79 | handler.post(new Runnable() {
80 | public void run(){
81 | try {
82 | dialog.dismiss();
83 | }
84 | catch (Exception e){
85 | e.printStackTrace();
86 | }
87 | }
88 | });
89 | };
90 | }.start();
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/utils/BluetoothUtils.java:
--------------------------------------------------------------------------------
1 | package com.immqy.utils;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.bluetooth.BluetoothAdapter;
5 | import android.content.Context;
6 | import android.content.res.AssetFileDescriptor;
7 | import android.database.Cursor;
8 | import android.graphics.Bitmap;
9 | import android.graphics.BitmapFactory;
10 | import android.net.Uri;
11 | import android.os.Environment;
12 | import android.os.Handler;
13 | import android.os.Message;
14 | import android.provider.MediaStore;
15 | import android.util.Log;
16 | import android.widget.Toast;
17 |
18 | import java.io.File;
19 | import java.io.FileInputStream;
20 | import java.io.FileNotFoundException;
21 | import java.io.IOException;
22 | import java.security.MessageDigest;
23 |
24 | import com.immqy.Bluetooth;
25 |
26 | /**
27 | *
28 | * 辅助工具类
29 | *
30 | * @author KARL-Dujinyang
31 | * @author https://github.com/sheep0704
32 | */
33 | public class BluetoothUtils {
34 | private static Toast toast;
35 | public static boolean isReceiver = false;
36 | public static boolean isConnect = false;
37 |
38 |
39 | public static void setContext(Context context) {
40 | toast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
41 | }
42 |
43 |
44 | public static void setContext(Context context,String msg) {
45 | toast = Toast.makeText(context, msg , Toast.LENGTH_SHORT);
46 | }
47 |
48 | /**
49 | * 转换
50 | * @param bytes
51 | * @return String
52 | */
53 | @SuppressLint("DefaultLocale")
54 | public static String bytesToHexString(byte[] bytes) {
55 | String result = "";
56 | for (int i = 0; i < bytes.length; i++) {
57 | String hexString = Integer.toHexString(bytes[i] & 0xFF);
58 | if (hexString.length() == 1) {
59 | hexString = '0' + hexString;
60 | }
61 | result += hexString.toUpperCase();
62 | }
63 | return result;
64 | }
65 |
66 |
67 | /**
68 | * 给蓝牙handler使用
69 | * @return
70 | */
71 | public static Handler readState() {
72 | final Handler handler = new Handler() {
73 | @Override
74 | public void handleMessage(Message msg) {
75 | switch (msg.what) {
76 | case Bluetooth.CONNECT_FAILED:
77 | toast.setText("连接失败");
78 | toast.show();
79 | break;
80 | case Bluetooth.CONNECT_SUCCESS:
81 | toast.setText("连接成功");
82 | toast.show();
83 | isConnect = true;
84 | break;
85 | case Bluetooth.READ_FAILED:
86 | toast.setText("读取失败");
87 | toast.show();
88 | break;
89 | case Bluetooth.WRITE_FAILED:
90 | toast.setText("写入失败");
91 | toast.show();
92 | break;
93 | case Bluetooth.DATA:
94 | String message = (String) msg.obj;
95 | switch (msg.arg1) {
96 | case 0:
97 | if (message.equals("550201AA")) {
98 | toast.setText("请保存Key");
99 | toast.show();
100 | break;
101 | } else if (message.equals("550103AA")) {
102 | toast.setText("Key设置失败!");
103 | toast.show();
104 | break;
105 | } else if (message.equals("550102AA")) {
106 | toast.setText("Key设置成功!");
107 | toast.show();
108 | break;
109 | } else if (message.equals("550104AA")) {
110 | toast.setText("请再保存一次Key!");
111 | toast.show();
112 | break;
113 | } else if (message.equals("550106AA")) {
114 | toast.setText("开锁成功");
115 | isReceiver = true;
116 | toast.show();
117 | break;
118 | } else if (message.equals("550107AA")) {
119 | toast.setText("开锁失败");
120 | toast.show();
121 | break;
122 | } else {
123 | toast.setText("未知错误!");
124 | toast.show();
125 | break;
126 | }
127 | case 1:
128 | if (message.equals("550205AA")) {
129 | toast.setText("请按一下锁");
130 | toast.show();
131 | break;
132 | } else if (message.equals("550108AA")) {
133 | toast.setText("密码错误");
134 | toast.show();
135 | break;
136 | } else {
137 | toast.setText("未知错误!");
138 | toast.show();
139 | break;
140 | }
141 | case 2:
142 | if (message.equals("550205AA")) {
143 | toast.setText("正开锁中");
144 | toast.show();
145 | break;
146 | } else if (message.equals("550108AA")) {
147 | toast.setText("密码错误");
148 | toast.show();
149 | break;
150 | } else {
151 | toast.setText(message);
152 | toast.show();
153 | break;
154 | }
155 | default:
156 | break;
157 | }
158 | default:
159 | break;
160 | }
161 | }
162 | };
163 | return handler;
164 | }
165 |
166 | public static String getPath(Uri uri, Context context) {
167 | String[] data = {MediaStore.Images.Media.DATA};
168 | Cursor cursor = context.getContentResolver().query(uri, data, null, null, null);
169 | int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
170 | cursor.moveToFirst();
171 | String path = cursor.getString(columnIndex);
172 | return path;
173 | }
174 |
175 |
176 | public static Bitmap getBitmap(Uri uri, Context context) {
177 | Bitmap bitmap = null;
178 | BitmapFactory.Options options = new BitmapFactory.Options();
179 | options.inSampleSize = 5;
180 | File sdkRoot = Environment.getExternalStorageDirectory();
181 | sdkRoot.mkdir();
182 | AssetFileDescriptor fileDescriptor = null;
183 | try {
184 | fileDescriptor = context.getContentResolver().openAssetFileDescriptor(uri, "r");
185 | } catch (FileNotFoundException e) {
186 | e.printStackTrace();
187 | } finally {
188 | try {
189 | bitmap = BitmapFactory.decodeFileDescriptor(fileDescriptor.getFileDescriptor(), null, options);
190 | fileDescriptor.close();
191 | } catch (IOException e) {
192 | Log.e("CreateBitmap", e.toString());
193 | }
194 | }
195 | return bitmap;
196 | }
197 |
198 | public static String createKey(String path) {
199 | String result = "";
200 | File file = new File(path);
201 | int len;
202 | byte[] keyByte = new byte[128];
203 | MessageDigest digest = null;
204 | try {
205 | digest = MessageDigest.getInstance("MD5");
206 | FileInputStream inputStream = new FileInputStream(file);
207 | while ((len = inputStream.read(keyByte, 0, 64)) != -1) {
208 | digest.update(keyByte, 0, len);
209 | }
210 | inputStream.close();
211 | } catch (Exception e) {
212 | Log.e("CreateKey", e.toString());
213 | }
214 | byte[] digestKey = digest.digest();
215 | result += BluetoothUtils.bytesToHexString(digestKey);
216 | byte[] bytes = {(byte) 0x00};
217 | String bluetoothAddress = (BluetoothAdapter.getDefaultAdapter()).getAddress();
218 | String address = bluetoothAddress.replace(":", "");
219 | String byteStr = BluetoothUtils.bytesToHexString(bytes);
220 | while (result.getBytes().length != 52) {
221 | result += byteStr;
222 | }
223 | result += address;
224 | return result;
225 | }
226 | }
227 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/utils/LockUtils.java:
--------------------------------------------------------------------------------
1 | package com.immqy.utils;
2 |
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.math.BigInteger;
6 | import java.security.MessageDigest;
7 |
8 | /**
9 | * 开关锁
10 | * @author KARL-Dujinyang
11 | * @author https://github.com/sheep0704
12 | */
13 | public class LockUtils {
14 | private int time;
15 | private String key;
16 |
17 | public LockUtils() {
18 | time = 0;
19 | }
20 |
21 | public void createKey(String path) {
22 | File file = new File(path);
23 | int len;
24 | byte[] keyByte = new byte[128];
25 | MessageDigest digest = null;
26 | try {
27 | digest = MessageDigest.getInstance("MD5");
28 | FileInputStream inputStream = new FileInputStream(file);
29 | while ((len = inputStream.read(keyByte, 0, 64)) != -1) {
30 | digest.update(keyByte, 0, len);
31 | }
32 | inputStream.close();
33 | } catch (Exception e) {
34 | e.printStackTrace();
35 | }
36 | BigInteger bigInteger = new BigInteger(1, digest.digest());
37 | key = bigInteger.toString(32);
38 | while (key.getBytes().length != 64) {
39 | key += '0';
40 | }
41 | }
42 |
43 | public void sendKey() {
44 | //TODO Send key to PasswordLock
45 |
46 | }
47 |
48 | public void sendKey(int time) {
49 | //TODO Send key to PasswordLock after time
50 |
51 | }
52 |
53 | public String getKey() {
54 | return this.key;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Bluetooth/src/com/immqy/widget/SwitchButton.java:
--------------------------------------------------------------------------------
1 | package com.immqy.widget;
2 |
3 |
4 | import android.annotation.SuppressLint;
5 | import android.content.Context;
6 | import android.content.res.ColorStateList;
7 | import android.content.res.Resources;
8 | import android.content.res.TypedArray;
9 | import android.graphics.Canvas;
10 | import android.graphics.Paint;
11 | import android.graphics.Rect;
12 | import android.graphics.Typeface;
13 | import android.graphics.drawable.Drawable;
14 | import android.text.Layout;
15 | import android.text.StaticLayout;
16 | import android.text.TextPaint;
17 | import android.text.TextUtils;
18 | import android.util.AttributeSet;
19 | import android.view.Gravity;
20 | import android.view.MotionEvent;
21 | import android.view.VelocityTracker;
22 | import android.view.ViewConfiguration;
23 | import android.widget.CompoundButton;
24 |
25 | import com.immqy.R;
26 |
27 | /**
28 | * 切换的开关
29 | * @author KARL-Dujinyang
30 | * @author https://github.com/sheep0704
31 | */
32 | public class SwitchButton extends CompoundButton {
33 | private static final int TOUCH_MODE_IDLE = 0;
34 | private static final int TOUCH_MODE_DOWN = 1;
35 | private static final int TOUCH_MODE_DRAGGING = 2;
36 |
37 | // Enum for the "typeface" XML parameter.
38 | private static final int SANS = 1;
39 | private static final int SERIF = 2;
40 | private static final int MONOSPACE = 3;
41 |
42 | private Drawable mThumbDrawable;
43 | private Drawable mTrackDrawable;
44 | private int mThumbTextPadding;
45 | private int mSwitchMinWidth;
46 | private int mSwitchPadding;
47 | private CharSequence mTextOn;
48 | private CharSequence mTextOff;
49 |
50 | private int mTouchMode;
51 | private int mTouchSlop;
52 | private float mTouchX;
53 | private float mTouchY;
54 | private VelocityTracker mVelocityTracker = VelocityTracker.obtain();
55 | private int mMinFlingVelocity;
56 |
57 | private float mThumbPosition;
58 | private int mSwitchWidth;
59 | private int mSwitchHeight;
60 | private int mThumbWidth; // Does not include padding
61 |
62 | private int mSwitchLeft;
63 | private int mSwitchTop;
64 | private int mSwitchRight;
65 | private int mSwitchBottom;
66 |
67 | private TextPaint mTextPaint;
68 | private ColorStateList mTextColors;
69 | private Layout mOnLayout;
70 | private Layout mOffLayout;
71 |
72 | @SuppressWarnings("hiding")
73 | private final Rect mTempRect = new Rect();
74 |
75 | private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
76 |
77 | /**
78 | * Construct a new Switch with default styling.
79 | *
80 | * @param context The Context that will determine this widget's theming.
81 | */
82 | public SwitchButton(Context context) {
83 | this(context, null);
84 | }
85 |
86 | /**
87 | * Construct a new Switch with default styling, overriding specific style
88 | * attributes as requested.
89 | *
90 | * @param context The Context that will determine this widget's theming.
91 | * @param attrs Specification of attributes that should deviate from default
92 | * styling.
93 | */
94 | public SwitchButton(Context context, AttributeSet attrs) {
95 | this(context, attrs, R.attr.switchStyle); // XXXXX
96 | }
97 |
98 | public SwitchButton(Context context, AttributeSet attrs, int defStyle) {
99 | super(context, attrs, defStyle);
100 |
101 | mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
102 | Resources res = getResources();
103 | mTextPaint.density = res.getDisplayMetrics().density;
104 | // mTextPaint.setCompatibilityScaling(res.getCompatibilityInfo().applicationScale);
105 | // //XXXXXXXXXX
106 |
107 | TypedArray a = context.obtainStyledAttributes(attrs,// 传入属性集合 及style
108 | R.styleable.Switch, defStyle, 0); // XXXXXX
109 | // 获取switch属性集合中定义的每个属性的值
110 | mThumbDrawable = a.getDrawable(R.styleable.Switch_thumb);
111 | mTrackDrawable = a.getDrawable(R.styleable.Switch_track);
112 | mTextOn = a.getText(R.styleable.Switch_textOn);
113 | mTextOff = a.getText(R.styleable.Switch_textOff);
114 | mThumbTextPadding = a.getDimensionPixelSize(
115 | R.styleable.Switch_thumbTextPadding, 0);
116 | mSwitchMinWidth = a.getDimensionPixelSize(
117 | R.styleable.Switch_switchMinWidth, 0);
118 | mSwitchPadding = a.getDimensionPixelSize(
119 | R.styleable.Switch_switchPadding, 0);
120 |
121 | int appearance = a.getResourceId(
122 | R.styleable.Switch_switchTextAppearance, 0);
123 | if (appearance != 0) {
124 | setSwitchTextAppearance(context, appearance);
125 | }
126 | a.recycle();
127 |
128 | ViewConfiguration config = ViewConfiguration.get(context);
129 | mTouchSlop = config.getScaledTouchSlop();
130 | mMinFlingVelocity = config.getScaledMinimumFlingVelocity();
131 |
132 | // Refresh display with current params
133 | refreshDrawableState();
134 | setChecked(isChecked());
135 | }
136 |
137 | /**
138 | * Sets the switch text color, size, style, hint color, and highlight color
139 | * from the specified TextAppearance resource.
140 | */
141 | public void setSwitchTextAppearance(Context context, int resid) {
142 | TypedArray appearance = context.obtainStyledAttributes(resid,
143 | R.styleable.TextAppearance);
144 |
145 | ColorStateList colors;
146 | int ts;
147 | // 获取TextAppearance属性集合中定义的属性的值
148 | colors = appearance
149 | .getColorStateList(R.styleable.TextAppearance_android_textColor);
150 | if (colors != null) {
151 | mTextColors = colors;
152 | } else {
153 | // If no color set in TextAppearance, default to the view's
154 | // textColor
155 | mTextColors = getTextColors();
156 | }
157 |
158 | ts = appearance.getDimensionPixelSize(
159 | R.styleable.TextAppearance_android_textSize, 0);
160 | if (ts != 0) {
161 | if (ts != mTextPaint.getTextSize()) {
162 | mTextPaint.setTextSize(ts);
163 | requestLayout();
164 | }
165 | }
166 |
167 | int typefaceIndex, styleIndex;
168 |
169 | typefaceIndex = appearance.getInt(
170 | R.styleable.TextAppearance_android_typeface, -1);
171 | styleIndex = appearance.getInt(
172 | R.styleable.TextAppearance_android_textStyle, -1);
173 |
174 | setSwitchTypefaceByIndex(typefaceIndex, styleIndex);
175 |
176 | appearance.recycle();
177 | }
178 |
179 | private void setSwitchTypefaceByIndex(int typefaceIndex, int styleIndex) {
180 | Typeface tf = null;
181 | switch (typefaceIndex) {
182 | case SANS:
183 | tf = Typeface.SANS_SERIF;
184 | break;
185 |
186 | case SERIF:
187 | tf = Typeface.SERIF;
188 | break;
189 |
190 | case MONOSPACE:
191 | tf = Typeface.MONOSPACE;
192 | break;
193 | }
194 |
195 | setSwitchTypeface(tf, styleIndex);
196 | }
197 |
198 | /**
199 | * Sets the typeface and style in which the text should be displayed on the
200 | * switch, and turns on the fake bold and italic bits in the Paint if the
201 | * Typeface that you provided does not have all the bits in the style that
202 | * you specified.
203 | */
204 | public void setSwitchTypeface(Typeface tf, int style) {
205 | if (style > 0) {
206 | if (tf == null) {
207 | tf = Typeface.defaultFromStyle(style);
208 | } else {
209 | tf = Typeface.create(tf, style);
210 | }
211 |
212 | setSwitchTypeface(tf);
213 | // now compute what (if any) algorithmic styling is needed
214 | int typefaceStyle = tf != null ? tf.getStyle() : 0;
215 | int need = style & ~typefaceStyle;
216 | mTextPaint.setFakeBoldText((need & Typeface.BOLD) != 0);
217 | mTextPaint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0);
218 | } else {
219 | mTextPaint.setFakeBoldText(false);
220 | mTextPaint.setTextSkewX(0);
221 | setSwitchTypeface(tf);
222 | }
223 | }
224 |
225 | /**
226 | * Sets the typeface in which the text should be displayed on the switch.
227 | * Note that not all Typeface families actually have bold and italic
228 | * variants, so you may need to use
229 | * {@link #setSwitchTypeface(Typeface, int)} to get the appearance that you
230 | * actually want.
231 | *
232 | * @attr ref android.R.styleable#TextView_typeface
233 | * @attr ref android.R.styleable#TextView_textStyle
234 | */
235 | public void setSwitchTypeface(Typeface tf) {
236 | if (mTextPaint.getTypeface() != tf) {
237 | mTextPaint.setTypeface(tf);
238 |
239 | requestLayout();
240 | invalidate();
241 | }
242 | }
243 |
244 | /**
245 | * Returns the text displayed when the button is in the checked state.
246 | */
247 | public CharSequence getTextOn() {
248 | return mTextOn;
249 | }
250 |
251 | /**
252 | * Sets the text displayed when the button is in the checked state.
253 | */
254 | public void setTextOn(CharSequence textOn) {
255 | mTextOn = textOn;
256 | requestLayout();
257 | }
258 |
259 | /**
260 | * Returns the text displayed when the button is not in the checked state.
261 | */
262 | public CharSequence getTextOff() {
263 | return mTextOff;
264 | }
265 |
266 | /**
267 | * Sets the text displayed when the button is not in the checked state.
268 | */
269 | public void setTextOff(CharSequence textOff) {
270 | mTextOff = textOff;
271 | requestLayout();
272 | }
273 |
274 | @Override
275 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
276 | final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
277 | final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
278 | int widthSize = MeasureSpec.getSize(widthMeasureSpec);
279 | int heightSize = MeasureSpec.getSize(heightMeasureSpec);
280 |
281 | if (mOnLayout == null) {
282 | mOnLayout = makeLayout(mTextOn);
283 | }
284 | if (mOffLayout == null) {
285 | mOffLayout = makeLayout(mTextOff);
286 | }
287 |
288 | mTrackDrawable.getPadding(mTempRect);
289 | final int maxTextWidth = Math.max(mOnLayout.getWidth(),
290 | mOffLayout.getWidth());
291 | final int switchWidth = Math.max(mSwitchMinWidth, maxTextWidth * 2
292 | + mThumbTextPadding * 4 + mTempRect.left + mTempRect.right);
293 | final int switchHeight = mTrackDrawable.getIntrinsicHeight();
294 |
295 | mThumbWidth = maxTextWidth + mThumbTextPadding * 2;
296 |
297 | switch (widthMode) {
298 | case MeasureSpec.AT_MOST:
299 | widthSize = Math.min(widthSize, switchWidth);
300 | break;
301 |
302 | case MeasureSpec.UNSPECIFIED:
303 | widthSize = switchWidth;
304 | break;
305 |
306 | case MeasureSpec.EXACTLY:
307 | // Just use what we were given
308 | break;
309 | }
310 |
311 | switch (heightMode) {
312 | case MeasureSpec.AT_MOST:
313 | heightSize = Math.min(heightSize, switchHeight);
314 | break;
315 |
316 | case MeasureSpec.UNSPECIFIED:
317 | heightSize = switchHeight;
318 | break;
319 |
320 | case MeasureSpec.EXACTLY:
321 | // Just use what we were given
322 | break;
323 | }
324 |
325 | mSwitchWidth = switchWidth;
326 | mSwitchHeight = switchHeight;
327 |
328 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
329 | final int measuredHeight = getMeasuredHeight();
330 | if (measuredHeight < switchHeight) {
331 | setMeasuredDimension(getMeasuredWidth(), switchHeight);// xxxxxxxxxxxxxxx
332 | }
333 | }
334 |
335 | // public void onPopulateAccessibilityEvent(View host, AccessibilityEvent
336 | // event) {
337 | // host.onPopulateAccessibilityEventInternal(event);
338 | // }
339 |
340 | // @Override
341 | // public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
342 | // super.onPopulateAccessibilityEvent(event);
343 | // final boolean isPassword = hasPasswordTransformationMethod();
344 | // if (!isPassword) {
345 | // CharSequence text = getTextForAccessibility();
346 | // if (!TextUtils.isEmpty(text)) {
347 | // event.getText().add(text);
348 | // }
349 | // if (isChecked()) {
350 | // CharSequence text = mOnLayout.getText();
351 | // if (TextUtils.isEmpty(text)) {
352 | // text = mContext.getString(R.string.switch_on);
353 | // }
354 | // event.getText().add(text);
355 | // } else {
356 | // CharSequence text = mOffLayout.getText();
357 | // if (TextUtils.isEmpty(text)) {
358 | // text = mContext.getString(R.string.switch_off);
359 | // }
360 | // event.getText().add(text);
361 | // }
362 | // }
363 |
364 | private Layout makeLayout(CharSequence text) {
365 | return new StaticLayout(text, mTextPaint, (int) Math.ceil(Layout
366 | .getDesiredWidth(text, mTextPaint)),
367 | Layout.Alignment.ALIGN_NORMAL, 1.f, 0, true);
368 | }
369 |
370 | /**
371 | * @return true if (x, y) is within the target area of the switch thumb
372 | */
373 | private boolean hitThumb(float x, float y) {
374 | mThumbDrawable.getPadding(mTempRect);
375 | final int thumbTop = mSwitchTop - mTouchSlop;
376 | final int thumbLeft = mSwitchLeft + (int) (mThumbPosition + 0.5f)
377 | - mTouchSlop;
378 | final int thumbRight = thumbLeft + mThumbWidth + mTempRect.left
379 | + mTempRect.right + mTouchSlop;
380 | final int thumbBottom = mSwitchBottom + mTouchSlop;
381 | return x > thumbLeft && x < thumbRight && y > thumbTop
382 | && y < thumbBottom;
383 | }
384 |
385 | @SuppressLint("NewApi")
386 | @Override
387 | public boolean onTouchEvent(MotionEvent ev) {
388 | mVelocityTracker.addMovement(ev);
389 | System.out.println("onTouch");
390 | final int action = ev.getActionMasked();
391 | switch (action) {
392 | case MotionEvent.ACTION_DOWN: {
393 | System.out.println("ACTION_DOWN");
394 | final float x = ev.getX();
395 | final float y = ev.getY();
396 | // 根据点击的坐标判断是否点到了thumb
397 | if (isEnabled() && hitThumb(x, y)) {
398 | System.out.println("TOUCH_MODE_DOWN");
399 | mTouchMode = TOUCH_MODE_DOWN;
400 | mTouchX = x;
401 | mTouchY = y;
402 | }
403 | break;
404 | }
405 |
406 | case MotionEvent.ACTION_MOVE: {
407 | System.out.println("ACTION_MOVE");
408 | switch (mTouchMode) {
409 | case TOUCH_MODE_IDLE:
410 | // Didn't target the thumb, treat normally.
411 | break;
412 |
413 | case TOUCH_MODE_DOWN: {
414 | final float x = ev.getX();
415 | final float y = ev.getY();
416 | if (Math.abs(x - mTouchX) > mTouchSlop
417 | || Math.abs(y - mTouchY) > mTouchSlop) {
418 | mTouchMode = TOUCH_MODE_DRAGGING;
419 | getParent().requestDisallowInterceptTouchEvent(true);
420 | mTouchX = x;
421 | mTouchY = y;
422 | return true;
423 | }
424 | break;
425 | }
426 |
427 | case TOUCH_MODE_DRAGGING: {
428 | final float x = ev.getX();
429 | final float dx = x - mTouchX;
430 | float newPos = Math.max(0,
431 | Math.min(mThumbPosition + dx, getThumbScrollRange()));
432 | if (newPos != mThumbPosition) {
433 | mThumbPosition = newPos;
434 | mTouchX = x;
435 | invalidate();
436 | }
437 | return true;
438 | }
439 | }
440 | break;
441 | }
442 |
443 | case MotionEvent.ACTION_UP:
444 | case MotionEvent.ACTION_CANCEL: {
445 | if (mTouchMode == TOUCH_MODE_DRAGGING) {
446 | stopDrag(ev);
447 | return true;
448 | }
449 | mTouchMode = TOUCH_MODE_IDLE;
450 | mVelocityTracker.clear();
451 | break;
452 | }
453 | }
454 |
455 | return super.onTouchEvent(ev);
456 | }
457 |
458 | private void cancelSuperTouch(MotionEvent ev) {
459 | MotionEvent cancel = MotionEvent.obtain(ev);
460 | cancel.setAction(MotionEvent.ACTION_CANCEL);
461 | super.onTouchEvent(cancel);
462 | cancel.recycle();
463 | }
464 |
465 | /**
466 | * Called from onTouchEvent to end a drag operation.
467 | *
468 | * @param ev Event that triggered the end of drag mode - ACTION_UP or
469 | * ACTION_CANCEL
470 | */
471 | private void stopDrag(MotionEvent ev) {
472 | mTouchMode = TOUCH_MODE_IDLE;
473 | // Up and not canceled, also checks the switch has not been disabled
474 | // during the drag
475 | boolean commitChange = ev.getAction() == MotionEvent.ACTION_UP
476 | && isEnabled();
477 |
478 | cancelSuperTouch(ev);
479 |
480 | if (commitChange) {
481 | boolean newState;
482 | mVelocityTracker.computeCurrentVelocity(1000);
483 | float xvel = mVelocityTracker.getXVelocity();
484 | if (Math.abs(xvel) > mMinFlingVelocity) {
485 | newState = xvel > 0;
486 | } else {
487 | newState = getTargetCheckedState();
488 | }
489 | animateThumbToCheckedState(newState);
490 | } else {
491 | animateThumbToCheckedState(isChecked());
492 | }
493 | }
494 |
495 | private void animateThumbToCheckedState(boolean newCheckedState) {
496 | // TODO animate!
497 | // float targetPos = newCheckedState ? 0 : getThumbScrollRange();
498 | // mThumbPosition = targetPos;
499 | setChecked(newCheckedState);
500 | }
501 |
502 | private boolean getTargetCheckedState() {
503 | return mThumbPosition >= getThumbScrollRange() / 2;
504 | }
505 |
506 | @Override
507 | public void setChecked(boolean checked) {
508 | super.setChecked(checked);
509 | mThumbPosition = checked ? getThumbScrollRange() : 0;
510 | invalidate();
511 | }
512 |
513 | @Override
514 | protected void onLayout(boolean changed, int left, int top, int right,
515 | int bottom) {
516 | super.onLayout(changed, left, top, right, bottom);
517 |
518 | mThumbPosition = isChecked() ? getThumbScrollRange() : 0;
519 |
520 | int switchRight = getWidth() - getPaddingRight();
521 | int switchLeft = switchRight - mSwitchWidth;
522 | int switchTop = 0;
523 | int switchBottom = 0;
524 | switch (getGravity() & Gravity.VERTICAL_GRAVITY_MASK) {
525 | default:
526 | case Gravity.TOP:
527 | switchTop = getPaddingTop();
528 | switchBottom = switchTop + mSwitchHeight;
529 | break;
530 |
531 | case Gravity.CENTER_VERTICAL:
532 | switchTop = (getPaddingTop() + getHeight() - getPaddingBottom())
533 | / 2 - mSwitchHeight / 2;
534 | switchBottom = switchTop + mSwitchHeight;
535 | break;
536 |
537 | case Gravity.BOTTOM:
538 | switchBottom = getHeight() - getPaddingBottom();
539 | switchTop = switchBottom - mSwitchHeight;
540 | break;
541 | }
542 |
543 | mSwitchLeft = switchLeft;
544 | mSwitchTop = switchTop;
545 | mSwitchBottom = switchBottom;
546 | mSwitchRight = switchRight;
547 | }
548 |
549 | @Override
550 | protected void onDraw(Canvas canvas) {
551 | super.onDraw(canvas);
552 |
553 | // Draw the switch
554 | int switchLeft = mSwitchLeft;
555 | int switchTop = mSwitchTop;
556 | int switchRight = mSwitchRight;
557 | int switchBottom = mSwitchBottom;
558 |
559 | mTrackDrawable.setBounds(switchLeft, switchTop, switchRight,
560 | switchBottom);
561 | mTrackDrawable.draw(canvas);
562 |
563 | canvas.save();
564 |
565 | mTrackDrawable.getPadding(mTempRect);
566 | int switchInnerLeft = switchLeft + mTempRect.left;
567 | int switchInnerTop = switchTop + mTempRect.top;
568 | int switchInnerRight = switchRight - mTempRect.right;
569 | int switchInnerBottom = switchBottom - mTempRect.bottom;
570 | canvas.clipRect(switchInnerLeft, switchTop, switchInnerRight,
571 | switchBottom);
572 |
573 | mThumbDrawable.getPadding(mTempRect);
574 | final int thumbPos = (int) (mThumbPosition + 0.5f);
575 | int thumbLeft = switchInnerLeft - mTempRect.left + thumbPos;
576 | int thumbRight = switchInnerLeft + thumbPos + mThumbWidth
577 | + mTempRect.right;
578 |
579 | mThumbDrawable
580 | .setBounds(thumbLeft, switchTop, thumbRight, switchBottom);
581 | mThumbDrawable.draw(canvas);
582 |
583 | // mTextColors should not be null, but just in case
584 | if (mTextColors != null) {
585 | mTextPaint.setColor(mTextColors.getColorForState(
586 | getDrawableState(), mTextColors.getDefaultColor()));
587 | }
588 | mTextPaint.drawableState = getDrawableState();
589 |
590 | Layout switchText = getTargetCheckedState() ? mOnLayout : mOffLayout;
591 |
592 | canvas.translate(
593 | (thumbLeft + thumbRight) / 2 - switchText.getWidth() / 2,
594 | (switchInnerTop + switchInnerBottom) / 2
595 | - switchText.getHeight() / 2);
596 | switchText.draw(canvas);
597 |
598 | canvas.restore();
599 | }
600 |
601 | @Override
602 | public int getCompoundPaddingRight() {
603 | int padding = super.getCompoundPaddingRight() + mSwitchWidth;
604 | if (!TextUtils.isEmpty(getText())) {
605 | padding += mSwitchPadding;
606 | }
607 | return padding;
608 | }
609 |
610 | private int getThumbScrollRange() {
611 | if (mTrackDrawable == null) {
612 | return 0;
613 | }
614 | mTrackDrawable.getPadding(mTempRect);
615 | return mSwitchWidth - mThumbWidth - mTempRect.left - mTempRect.right;
616 | }
617 |
618 | @Override
619 | protected int[] onCreateDrawableState(int extraSpace) {
620 | final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
621 | if (isChecked()) {
622 | mergeDrawableStates(drawableState, CHECKED_STATE_SET);
623 | }
624 | return drawableState;
625 | }
626 |
627 | @Override
628 | protected void drawableStateChanged() {
629 | super.drawableStateChanged();
630 |
631 | int[] myDrawableState = getDrawableState();
632 |
633 | // Set the state of the Drawable
634 | // Drawable may be null when checked state is set from XML, from super
635 | // constructor
636 | if (mThumbDrawable != null)
637 | mThumbDrawable.setState(myDrawableState);
638 | if (mTrackDrawable != null)
639 | mTrackDrawable.setState(myDrawableState);
640 | invalidate();
641 | }
642 |
643 | @Override
644 | protected boolean verifyDrawable(Drawable who) {
645 | return super.verifyDrawable(who) || who == mThumbDrawable
646 | || who == mTrackDrawable;
647 | }
648 | }
649 |
--------------------------------------------------------------------------------
/Pratice/1.txt:
--------------------------------------------------------------------------------
1 | hello
--------------------------------------------------------------------------------
/Pratice/2.txt:
--------------------------------------------------------------------------------
1 | W
--------------------------------------------------------------------------------
/Pratice/3.txt:
--------------------------------------------------------------------------------
1 | dujinyang
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 有兴趣的可以关注【Python2048】 公众号
5 | 分享技术、灰色产业、职业规划、赚钱之道、逆向破解等趣事……
6 |
7 |
8 |
9 |
10 |
11 |
12 | # DuBluetooth
13 |
14 | ## Descript
15 |
16 | Please see -- If you have any other questions, please check here. Android 蓝牙开发(整理大全)
17 |
18 | ## Version
19 |
20 | - V1.0.0
21 |
22 | -- 根据别人修改的一个版本 -- 给大家作为参考学习使用
23 |
24 | - V0.0.9
25 |
26 | -- 代码测试使用
27 |
28 | ## Code
29 |
30 | Please see
31 | * MainActivity
32 | * SettingActivity
33 | * SearchActivity
34 | * ComminuteActivity
35 |
36 | MainActivity -> onActivityResult .
37 | ```java
38 | //返回消息处理
39 | @Override
40 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
41 | if (resultCode == RESULT_OK) {
42 | Uri uri = data.getData();
43 | try {
44 | bluetooth.comminute(openLockBytes, 1);
45 | Thread.sleep(100);
46 | String path = BluetoothUtils.getPath(uri, MainActivity.this);
47 | bluetooth.sendKey((BluetoothUtils.createKey(path)).getBytes());
48 | Thread.sleep(100);
49 | lockBt.setImageDrawable(getResources().getDrawable(R.drawable.open_lock));
50 | } catch (Exception e) {
51 | Log.e("openKey", e.toString());
52 | }
53 | }
54 | super.onActivityResult(requestCode, resultCode, data);
55 | }
56 | ```
57 |
58 | MainActivity -> BluetoothDevice.
59 | ```java
60 | if (BluetoothDevice.ACTION_FOUND.equals(action)) {
61 | BluetoothDevice receiverDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
62 | if (isLock(receiverDevice)) {
63 | device = receiverDevice;
64 | }
65 | }
66 | bluetooth = new Bluetooth(device, BluetoothUtils.readState());
67 |
68 | bluetooth.connect();
69 | Thread thread = new Thread(new Runnable() {
70 |
71 | @Override
72 | public void run() {
73 | while (true) {
74 | if (BluetoothUtils.isConnect) {
75 | try {
76 | if (isAutomatic) {
77 | startService(new Intent(MainActivity.this, OpenService.class));
78 | break;
79 | }
80 | } catch (Exception e) {
81 | break;
82 | }
83 | }
84 | }
85 | }
86 | });
87 | thread.start();
88 | }
89 | ```
90 |
91 | MainActivity -> receiveDevice.
92 |
93 | ```java
94 | //查看
95 | private void receiveDevice() {
96 | bluetoothAdapter.startDiscovery();
97 | IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
98 | receiver = new BluetoothReceiver();
99 | registerReceiver(receiver, filter);
100 | }
101 | ```
102 |
103 |
104 |
105 | ## Bugs and Feedback
106 | ### For bugs, questions and discussions please use the Github Issues.
107 | ### Home: https://github.com/sheep0704
108 |
109 |
110 | ## LICENSE
111 | Copyright (c) 2016-present, DuBluetooth Contributors. Author Immqy.com .
112 |
113 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
114 |
115 | http://www.apache.org/licenses/LICENSE-2.0
116 |
117 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
118 |
--------------------------------------------------------------------------------