Skip to content

Commit c42284c

Browse files
committed
Merge branch 'develop' of https://github.com/eson-yunfei/AndroidBle into develop
# Conflicts: # app/src/main/java/org/eson/liteble/common/DeviceState.kt # app/src/main/java/org/eson/liteble/detail/DeviceActivity.kt # app/src/main/java/org/eson/liteble/detail/adapter/CharacterItem.kt # app/src/main/java/org/eson/liteble/detail/adapter/DataItem.kt # app/src/main/java/org/eson/liteble/detail/viewmodel/ConnectViewModel.java # app/src/main/java/org/eson/liteble/detail/viewmodel/DeviceControlViewModel.kt # app/src/main/java/org/eson/liteble/main/MainActivity.kt # app/src/main/java/org/eson/liteble/main/ScannerLiveData.kt # app/src/main/java/org/eson/liteble/main/ScannerViewModel.kt # app/src/main/java/org/eson/liteble/main/fragment/BondedFragment.java # app/src/main/java/org/eson/liteble/main/fragment/ScanFragment.kt # bluetooth/src/main/java/com/shon/bluetooth/ConnectDispatcher.kt
2 parents 152a6dd + d28a77c commit c42284c

File tree

13 files changed

+99
-53
lines changed

13 files changed

+99
-53
lines changed

app/src/main/java/org/eson/liteble/utils/ByteUtil.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ public static void printHex(byte[] buffer) {
8484
for (byte b : buffer) {
8585
String intS = Integer.toHexString(b & 0xff);
8686
if (intS.length() == 1) {
87-
sb.append(" ").append("0").append(intS);
87+
sb.append(" ").append("0").append(intS);
8888
} else {
89-
sb.append(" ").append(intS);
89+
sb.append(" ").append(intS);
9090
}
9191
}
92-
sb.append(" ]");
92+
sb.append(" ]");
9393
// LogUtil.e(sb.toString());
9494
}
9595

@@ -100,9 +100,9 @@ public static void print(byte[] buffer) {
100100
StringBuilder sb = new StringBuilder();
101101
sb.append("[");
102102
for (byte b : buffer) {
103-
sb.append(" ").append(b & 0xff);
103+
sb.append(" ").append(b & 0xff);
104104
}
105-
sb.append(" ]");
105+
sb.append(" ]");
106106
// LogUtil.e(sb.toString());
107107
}
108108

@@ -115,12 +115,12 @@ public static String getFormatHexString(byte[] buffer) {
115115
for (byte b : buffer) {
116116
String intS = Integer.toHexString(b & 0xff);
117117
if (intS.length() == 1) {
118-
sb.append(" ").append("0").append(intS);
118+
sb.append(" ").append("0").append(intS);
119119
} else {
120-
sb.append(" ").append(intS);
120+
sb.append(" ").append(intS);
121121
}
122122
}
123-
sb.append(" ]");
123+
sb.append(" ]");
124124
return sb.toString();
125125
}
126126
}

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
app:tabIndicatorHeight="2dp"
2020
app:tabIndicatorFullWidth="false"
2121
app:tabSelectedTextColor="@color/colorPrimaryDark"
22-
app:tabTextColor="#999999">
22+
app:tabTextColor="#999999"
23+
android:visibility="gone">
2324
<com.google.android.material.tabs.TabItem
2425
android:layout_width="match_parent"
2526
android:layout_height="wrap_content"

app/src/main/res/layout/activity_setting.xml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010

1111
<TextView
1212
android:id="@+id/scan_time_title"
13+
style="@style/ItemTitle"
1314
android:layout_width="wrap_content"
14-
android:layout_height="wrap_content"
15-
android:layout_marginTop="10dp"
15+
android:layout_marginTop="15dp"
1616
android:text="搜索设备搜索时长:"
17-
android:textColor="#666666"
1817
android:textSize="@dimen/text_size"
1918
app:layout_constraintStart_toStartOf="parent"
2019
app:layout_constraintTop_toTopOf="parent"
@@ -24,8 +23,8 @@
2423
android:id="@+id/scan_time_spinner"
2524
android:layout_width="wrap_content"
2625
android:layout_height="wrap_content"
27-
android:spinnerMode="dropdown"
2826
android:entries="@array/scanner_time"
27+
android:spinnerMode="dropdown"
2928
app:layout_constraintBottom_toBottomOf="@id/scan_time_title"
3029
app:layout_constraintEnd_toEndOf="parent"
3130
app:layout_constraintTop_toTopOf="@id/scan_time_title" />
@@ -34,7 +33,7 @@
3433
android:id="@+id/line1"
3534
android:layout_width="match_parent"
3635
android:layout_height="0.3dp"
37-
android:layout_marginTop="15dp"
36+
android:layout_marginTop="20dp"
3837
android:background="#cccccc"
3938
app:layout_constraintEnd_toEndOf="parent"
4039
app:layout_constraintStart_toStartOf="parent"
@@ -44,10 +43,10 @@
4443
<TextView
4544
android:id="@+id/filter_empty_title"
4645
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
4846
android:layout_centerVertical="true"
49-
android:layout_marginTop="15dp"
47+
android:layout_marginTop="20dp"
5048
android:text="过滤无名称设备"
49+
style="@style/ItemTitle"
5150
android:textSize="@dimen/text_size"
5251
app:layout_constraintStart_toStartOf="parent"
5352
app:layout_constraintTop_toBottomOf="@id/line1"
@@ -66,7 +65,7 @@
6665
android:id="@+id/line2"
6766
android:layout_width="match_parent"
6867
android:layout_height="0.3dp"
69-
android:layout_marginTop="15dp"
68+
android:layout_marginTop="20dp"
7069
android:background="#cccccc"
7170
app:layout_constraintTop_toBottomOf="@id/filter_no_name" />
7271

@@ -76,7 +75,7 @@
7675
android:layout_width="wrap_content"
7776
android:layout_height="wrap_content"
7877
android:layout_centerVertical="true"
79-
android:layout_marginTop="15dp"
78+
android:layout_marginTop="20dp"
8079
android:text="允许连接多个设备"
8180
android:textSize="@dimen/text_size"
8281
app:layout_constraintStart_toStartOf="parent"
@@ -92,12 +91,18 @@
9291
app:layout_constraintEnd_toEndOf="parent"
9392
app:layout_constraintTop_toTopOf="@id/link_more_title" />
9493

94+
<androidx.constraintlayout.widget.Group
95+
android:id="@+id/max_link_switch_group"
96+
android:layout_width="wrap_content"
97+
android:layout_height="wrap_content"
98+
android:visibility="gone"
99+
app:constraint_referenced_ids="line2,link_more_title,switchBtn" />
95100

96101
<View
97102
android:id="@+id/line3"
98103
android:layout_width="match_parent"
99104
android:layout_height="0.3dp"
100-
android:layout_marginTop="15dp"
105+
android:layout_marginTop="20dp"
101106
android:background="#cccccc"
102107
app:layout_constraintTop_toBottomOf="@id/link_more_title" />
103108

@@ -107,7 +112,7 @@
107112
android:layout_width="wrap_content"
108113
android:layout_height="wrap_content"
109114
android:layout_centerVertical="true"
110-
android:layout_marginTop="15dp"
115+
android:layout_marginTop="20dp"
111116
android:text="最大连接设备个数:"
112117
android:textSize="@dimen/text_size"
113118
app:layout_constraintStart_toStartOf="parent"
@@ -117,8 +122,8 @@
117122
<androidx.appcompat.widget.AppCompatSpinner
118123
android:id="@+id/maxNumber"
119124
android:layout_width="wrap_content"
120-
android:entries="@array/max_connect_size"
121125
android:layout_height="wrap_content"
126+
android:entries="@array/max_connect_size"
122127
app:layout_constraintBottom_toBottomOf="@id/max_link_title"
123128
app:layout_constraintEnd_toEndOf="parent"
124129
app:layout_constraintTop_toTopOf="@id/max_link_title" />

app/src/main/res/layout/fragment_bonded_device.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!--
1+
<?xml version="1.0" encoding="utf-8"?><!--
32
~ Copyright (c) 2017. xiaoyunfei
43
~
54
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,12 +15,12 @@
1615
-->
1716

1817
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
19-
android:layout_width="match_parent"
20-
android:layout_height="match_parent"
21-
android:orientation="vertical">
18+
android:layout_width="match_parent"
19+
android:layout_height="match_parent"
20+
android:orientation="vertical">
2221

2322
<ListView
2423
android:id="@+id/bondedDeviceList"
2524
android:layout_width="match_parent"
26-
android:layout_height="wrap_content"/>
25+
android:layout_height="wrap_content" />
2726
</LinearLayout>

app/src/main/res/layout/fragment_device_log.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,26 @@
55
xmlns:tools="http://schemas.android.com/tools"
66
xmlns:app="http://schemas.android.com/apk/res-auto">
77

8+
<TextView
9+
android:id="@+id/log_title"
10+
android:layout_width="330dp"
11+
app:layout_constraintStart_toStartOf="parent"
12+
app:layout_constraintEnd_toEndOf="parent"
13+
app:layout_constraintTop_toTopOf="parent"
14+
android:text="数据日志"
15+
android:textSize="18sp"
16+
style="@style/ItemTitle"
17+
android:gravity="center"
18+
android:paddingTop="16dp"
19+
android:paddingBottom="16dp" />
820
<androidx.recyclerview.widget.RecyclerView
921
android:id="@+id/data_List"
1022
app:layout_constraintBottom_toBottomOf="parent"
11-
app:layout_constraintTop_toTopOf="parent"
23+
app:layout_constraintTop_toBottomOf="@id/log_title"
1224
app:layout_constraintStart_toStartOf="parent"
1325
app:layout_constraintEnd_toEndOf="parent"
1426
android:layout_width="match_parent"
15-
android:layout_height="400dp"
27+
android:layout_height="350dp"
1628
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
1729
tools:listitem="@layout/item_data"/>
1830
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/fragment_scan_device.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
<androidx.recyclerview.widget.RecyclerView
2626
android:id="@+id/listview"
2727
android:layout_width="match_parent"
28-
android:layout_height="wrap_content"
28+
android:layout_height="0dp"
2929
android:layout_marginTop="6dp"
30+
app:layout_constraintBottom_toBottomOf="parent"
31+
android:layout_marginBottom="5dp"
3032
app:layout_constraintEnd_toEndOf="parent"
3133
app:layout_constraintStart_toStartOf="parent"
3234
app:layout_constraintTop_toTopOf="parent"
@@ -41,6 +43,7 @@
4143
app:layout_constraintBottom_toBottomOf="parent"
4244
app:layout_constraintStart_toStartOf="parent"
4345
app:layout_constraintEnd_toEndOf="parent"
46+
android:layout_marginBottom="150dp"
4447
app:cardCornerRadius="8dp">
4548

4649
<LinearLayout

app/src/main/res/layout/item_data.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
android:id="@+id/data_text"
2020
android:layout_width="350dp"
2121
android:layout_height="wrap_content"
22-
android:maxLines="3"
22+
android:maxLines="5"
2323
android:paddingTop="6dp"
2424
android:paddingBottom="6dp"
2525
android:paddingStart="10dp"
2626
android:textSize="12sp"
2727
android:typeface="serif"
2828
android:text="1111"
29+
android:textColor="@color/color_69"
2930
android:textStyle="bold"
3031
tools:ignore="HardcodedText,MissingPrefix,RtlSymmetry" />

app/src/main/res/layout/item_scan_device.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,40 @@
2020

2121
<TextView
2222
android:id="@+id/deviceName"
23+
style="@style/ItemTitle"
2324
android:layout_width="0dp"
24-
android:layout_height="wrap_content"
25-
android:minLines="1"
2625
android:text="deviceName"
27-
android:textColor="#333333"
28-
android:textSize="18sp"
29-
android:textStyle="bold"
26+
android:textSize="14sp"
3027
android:layout_marginEnd="10dp"
3128
app:layout_constraintEnd_toStartOf="@id/deviceRssi"
3229
app:layout_constraintStart_toStartOf="parent"
33-
app:layout_constraintTop_toTopOf="parent" />
30+
app:layout_constraintTop_toTopOf="parent"
31+
tools:ignore="HardcodedText" />
3432

3533

3634
<TextView
35+
style="@style/ItemContent"
3736
android:id="@+id/deviceMac"
3837
android:layout_width="0dp"
39-
android:layout_height="wrap_content"
38+
android:textSize="12sp"
4039
android:layout_marginTop="6dp"
4140
android:text="deviceMac"
4241
android:layout_marginEnd="10dp"
4342
app:layout_constraintEnd_toStartOf="@id/deviceRssi"
4443
app:layout_constraintStart_toStartOf="parent"
45-
app:layout_constraintTop_toBottomOf="@id/deviceName" />
44+
app:layout_constraintTop_toBottomOf="@id/deviceName"
45+
tools:ignore="HardcodedText" />
4646

4747

4848
<TextView
4949
android:id="@+id/scanRet"
50+
style="@style/ItemContent"
5051
android:layout_width="0dp"
51-
android:layout_height="wrap_content"
5252
android:layout_marginTop="6dp"
5353
android:visibility="invisible"
5454
android:text="[00 00 00]"
5555
android:maxLines="3"
56-
android:textSize="11sp"
56+
android:textSize="10sp"
5757
android:layout_marginEnd="10dp"
5858
app:layout_constraintEnd_toStartOf="@id/deviceRssi"
5959
app:layout_constraintStart_toStartOf="parent"

app/src/main/res/layout/item_uuid.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
app:layout_constraintBottom_toBottomOf="parent"
1818
app:layout_constraintEnd_toEndOf="parent"
1919
app:layout_constraintTop_toTopOf="parent"
20-
tools:ignore="UseAppTint" />
20+
tools:ignore="ContentDescription,UseAppTint" />
2121

2222

2323
<ImageView
@@ -31,7 +31,7 @@
3131
app:layout_constraintBottom_toBottomOf="parent"
3232
app:layout_constraintEnd_toStartOf="@id/notification_image"
3333
app:layout_constraintTop_toTopOf="parent"
34-
tools:ignore="UseAppTint" />
34+
tools:ignore="ContentDescription,UseAppTint" />
3535

3636
<ImageView
3737
android:id="@+id/send_image"
@@ -44,7 +44,7 @@
4444
app:layout_constraintBottom_toBottomOf="parent"
4545
app:layout_constraintEnd_toStartOf="@id/read_image"
4646
app:layout_constraintTop_toTopOf="parent"
47-
tools:ignore="UseAppTint" />
47+
tools:ignore="ContentDescription,UseAppTint" />
4848

4949

5050
<TextView

app/src/main/res/menu/menu_detail.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
tools:context="org.eson.liteble.detail.DeviceActivity">
55

6+
<item
7+
android:id="@+id/menu_refresh"
8+
android:checkable="false"
9+
android:orderInCategory="1"
10+
android:title=""
11+
app:showAsAction="ifRoom"/>
12+
613
<item
714
android:id="@+id/device_state"
815
android:checkable="false"

0 commit comments

Comments
 (0)