Skip to content

Commit 131ab06

Browse files
committed
Started rewriting the Gatt Screen UI
1 parent cf48721 commit 131ab06

5 files changed

Lines changed: 602 additions & 588 deletions

File tree

sample_app/res/layout/activity_gatt_services.xml

Lines changed: 73 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,86 +14,112 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
17-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
17+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
1818
android:layout_width="match_parent"
19-
android:layout_height="wrap_content"
20-
android:layout_margin="10dp"
21-
android:orientation="vertical" >
22-
23-
<LinearLayout
19+
android:layout_height="match_parent"
20+
android:orientation="vertical"
21+
android:paddingBottom="@dimen/activity_vertical_margin"
22+
android:paddingLeft="@dimen/activity_horizontal_margin"
23+
android:paddingRight="@dimen/activity_horizontal_margin"
24+
android:paddingTop="@dimen/activity_vertical_margin" >
25+
26+
<GridLayout
27+
android:id="@+id/deviceInformation"
2428
android:layout_width="match_parent"
2529
android:layout_height="wrap_content"
26-
android:layout_margin="10dp"
27-
android:orientation="horizontal" >
30+
android:layout_alignParentTop="true"
31+
android:columnCount="2"
32+
android:useDefaultMargins="true" >
2833

2934
<TextView
35+
style="@style/GridLayoutTitleTextView"
3036
android:layout_width="wrap_content"
3137
android:layout_height="wrap_content"
32-
android:text="@string/label_device_address"
33-
android:textSize="18sp" />
34-
35-
<Space
36-
android:layout_width="5dp"
37-
android:layout_height="wrap_content" />
38+
android:text="@string/label_device_address" />
3839

3940
<TextView
4041
android:id="@+id/device_address"
41-
android:layout_width="match_parent"
42+
style="@style/GridLayoutDataTextView" />
43+
44+
<TextView
45+
style="@style/GridLayoutTitleTextView"
46+
android:layout_width="wrap_content"
4247
android:layout_height="wrap_content"
43-
android:textSize="18sp" />
44-
</LinearLayout>
48+
android:text="@string/label_state" />
4549

46-
<LinearLayout
50+
<TextView
51+
android:id="@+id/connection_state"
52+
style="@style/GridLayoutDataTextView" />
53+
</GridLayout>
54+
55+
<View
56+
android:id="@+id/upperSepparator"
57+
android:layout_width="match_parent"
58+
android:layout_height="1dp"
59+
android:layout_below="@id/deviceInformation"
60+
android:background="@android:color/holo_blue_dark" />
61+
62+
<GridLayout
63+
android:id="@+id/gattInformation"
4764
android:layout_width="match_parent"
4865
android:layout_height="wrap_content"
49-
android:layout_margin="10dp"
50-
android:orientation="horizontal" >
66+
android:layout_alignParentBottom="true"
67+
android:columnCount="2"
68+
android:useDefaultMargins="true" >
5169

5270
<TextView
71+
style="@style/GridLayoutTitleTextView"
5372
android:layout_width="wrap_content"
5473
android:layout_height="wrap_content"
55-
android:text="@string/label_state"
56-
android:textSize="18sp" />
74+
android:text="@string/label_uuid" />
5775

58-
<Space
59-
android:layout_width="5dp"
60-
android:layout_height="wrap_content" />
76+
<TextView
77+
android:id="@+id/uuid"
78+
style="@style/GridLayoutDataTextViewMonospace" />
6179

6280
<TextView
63-
android:id="@+id/connection_state"
64-
android:layout_width="match_parent"
81+
style="@style/GridLayoutTitleTextView"
82+
android:layout_width="wrap_content"
6583
android:layout_height="wrap_content"
66-
android:text="@string/disconnected"
67-
android:textSize="18sp" />
68-
</LinearLayout>
84+
android:text="@string/label_desc" />
6985

70-
<LinearLayout
71-
android:layout_width="match_parent"
72-
android:layout_height="wrap_content"
73-
android:layout_margin="10dp"
74-
android:orientation="horizontal" >
86+
<TextView
87+
android:id="@+id/description"
88+
style="@style/GridLayoutDataTextViewMonospace" />
7589

7690
<TextView
91+
style="@style/GridLayoutTitleTextView"
7792
android:layout_width="wrap_content"
7893
android:layout_height="wrap_content"
79-
android:text="@string/label_data"
80-
android:textSize="18sp" />
94+
android:text="@string/label_as_string" />
8195

82-
<Space
83-
android:layout_width="5dp"
84-
android:layout_height="wrap_content" />
96+
<TextView
97+
android:id="@+id/data_as_string"
98+
style="@style/GridLayoutDataTextViewMonospace" />
8599

86100
<TextView
87-
android:id="@+id/data_value"
88-
android:layout_width="match_parent"
101+
style="@style/GridLayoutTitleTextView"
102+
android:layout_width="wrap_content"
89103
android:layout_height="wrap_content"
90-
android:text="@string/no_data"
91-
android:textSize="18sp" />
92-
</LinearLayout>
104+
android:text="@string/label_as_array" />
105+
106+
<TextView
107+
android:id="@+id/data_as_array"
108+
style="@style/GridLayoutDataTextViewMonospace" />
109+
</GridLayout>
110+
111+
<View
112+
android:id="@+id/lowerSepparator"
113+
android:layout_width="match_parent"
114+
android:layout_height="1dp"
115+
android:layout_above="@id/gattInformation"
116+
android:background="@android:color/holo_blue_dark" />
93117

94118
<ExpandableListView
95119
android:id="@+id/gatt_services_list"
96120
android:layout_width="match_parent"
97-
android:layout_height="wrap_content" />
121+
android:layout_height="fill_parent"
122+
android:layout_above="@id/lowerSepparator"
123+
android:layout_below="@id/upperSepparator" />
98124

99-
</LinearLayout>
125+
</RelativeLayout>

sample_app/res/layout/list_item_view_adrecord.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
style="@style/GridLayoutTitleTextView"
2424
android:layout_width="wrap_content"
2525
android:layout_height="wrap_content"
26-
android:text="As String:" />
26+
android:text="@string/label_as_string" />
2727

2828
<TextView
2929
android:id="@+id/data_as_string"
@@ -33,7 +33,7 @@
3333
style="@style/GridLayoutTitleTextView"
3434
android:layout_width="wrap_content"
3535
android:layout_height="wrap_content"
36-
android:text="As Array:" />
36+
android:text="@string/label_as_array" />
3737

3838
<TextView
3939
android:id="@+id/data_as_array"

sample_app/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@
5151
<string name="header_device_info">Device Info</string>
5252
<string name="invalid_device_data">Invalid Device Data!</string>
5353
<string name="unknown">unknown</string>
54+
<string name="label_as_string">As String:</string>
55+
<string name="label_as_array">As Array:</string>
56+
<string name="label_desc">Desc:</string>
5457

5558
</resources>

0 commit comments

Comments
 (0)