Skip to content

Commit db84259

Browse files
fix: generate config file layout and modify item checkbox margin (#2124)
* fix generate config file layout and modify item checkbox margin. * remove hard-coding value from create_config file and put into dimens.xml
1 parent 47ef0da commit db84259

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,61 +14,67 @@
1414

1515
<LinearLayout
1616
android:layout_width="match_parent"
17-
android:layout_height="wrap_content"
17+
android:layout_height="@dimen/height_zero"
1818
android:orientation="vertical"
1919
android:padding="@dimen/config_activity_padding">
2020

2121
<LinearLayout
2222
android:id="@+id/select_instrument"
2323
android:layout_width="match_parent"
24-
android:layout_height="wrap_content"
24+
android:layout_height="@dimen/height_zero"
25+
android:layout_weight="@dimen/weight_one"
2526
android:orientation="horizontal">
2627

2728
<TextView
2829
android:id="@+id/select_instrument_title"
2930
style="@style/Base.TextAppearance.AppCompat.Title"
30-
android:layout_width="wrap_content"
31+
android:layout_width="@dimen/width_zero"
32+
android:layout_weight="@dimen/weight_one"
33+
android:textSize="@dimen/text_size_of_label"
3134
android:layout_height="wrap_content"
3235
android:layout_gravity="center"
3336
android:text="@string/select_instrument_title" />
3437

3538
<android.support.v7.widget.AppCompatSpinner
3639
android:id="@+id/select_instrument_spinner"
37-
android:layout_width="match_parent"
40+
android:layout_width="@dimen/width_zero"
41+
android:layout_weight="@dimen/weight_two"
3842
android:layout_height="wrap_content"
3943
android:layout_gravity="center"
4044
android:textAlignment="center" />
41-
4245
</LinearLayout>
4346

4447
<LinearLayout
4548
android:layout_width="match_parent"
46-
android:layout_height="wrap_content"
49+
android:layout_height="@dimen/height_zero"
50+
android:layout_weight="@dimen/weight_one"
4751
android:layout_marginTop="@dimen/create_config_margin1"
4852
android:orientation="horizontal">
4953

5054
<TextView
5155
android:id="@+id/time_interval_title"
5256
style="@style/Base.TextAppearance.AppCompat.Title"
5357
android:layout_width="wrap_content"
58+
android:textSize="@dimen/text_size_of_label"
5459
android:layout_height="wrap_content"
5560
android:layout_gravity="center"
5661
android:text="@string/time_interval_title" />
5762

5863
<EditText
5964
android:id="@+id/interval_edit_text"
60-
android:layout_width="0dp"
65+
android:layout_width="@dimen/width_zero"
66+
android:layout_weight="@dimen/weight_three"
6167
android:layout_height="wrap_content"
6268
android:hint="@string/time_interval_hint"
6369
android:imeOptions="actionDone"
6470
android:inputType="number"
6571
android:textAlignment="center"
66-
android:layout_gravity="center"
67-
android:layout_weight="1"/>
72+
android:layout_gravity="center"/>
6873

6974
<android.support.v7.widget.AppCompatSpinner
7075
android:id="@+id/interval_unit_spinner"
71-
android:layout_width="wrap_content"
76+
android:layout_width="@dimen/width_zero"
77+
android:layout_weight="@dimen/weight_one"
7278
android:layout_height="wrap_content"
7379
android:layout_gravity="center"/>
7480
</LinearLayout>
@@ -79,13 +85,16 @@
7985
android:layout_width="wrap_content"
8086
android:layout_height="wrap_content"
8187
android:layout_gravity="center"
88+
android:textAlignment="center"
89+
android:textSize="@dimen/text_size_of_heading"
8290
android:layout_marginTop="@dimen/create_config_margin2"
8391
android:text="@string/select_params_title" />
8492

8593
<android.support.v7.widget.RecyclerView
8694
android:id="@+id/params_list_container"
8795
android:layout_width="match_parent"
88-
android:layout_height="@dimen/create_config_recycler_view"
96+
android:layout_height="@dimen/height_zero"
97+
android:layout_weight="@dimen/weight_four"
8998
android:layout_marginTop="@dimen/create_config_margin1" />
9099

91100
<Button

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:layout_width="match_parent"
55
android:layout_height="wrap_content"
6-
android:layout_marginTop="@dimen/check_box_magin"
7-
android:layout_marginBottom="@dimen/check_box_magin"
6+
android:layout_margin="@dimen/check_box_magin"
87
app:cardCornerRadius="@dimen/check_box_corner">
98

109
<LinearLayout

app/src/main/res/values/dimens.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@
8181
<dimen name="device_status_height">80dp</dimen>
8282
<dimen name="device_status_textsize">20sp</dimen>
8383
<dimen name="config_activity_padding">9dp</dimen>
84+
<dimen name="height_zero">0dp</dimen>
85+
<dimen name="width_zero">0dp</dimen>
86+
<dimen name="weight_one">1</dimen>
87+
<dimen name="weight_two">2</dimen>
88+
<dimen name="weight_three">3</dimen>
89+
<dimen name="weight_four">4</dimen>
90+
<dimen name="text_size_of_label">17sp</dimen>
91+
<dimen name="text_size_of_heading">20sp</dimen>
8492

8593
<dimen name="multimeter_layout_margin">20dp</dimen>
8694
<dimen name="multimeter_line_width">1dp</dimen>
@@ -359,7 +367,7 @@
359367
<dimen name="create_config_margin4">12dp</dimen>
360368
<dimen name="create_config_recycler_view">280dp</dimen>
361369
<dimen name="check_box_width">0dp</dimen>
362-
<dimen name="check_box_magin">4dp</dimen>
370+
<dimen name="check_box_magin">5dp</dimen>
363371
<dimen name="check_box_corner">5dp</dimen>
364372
<dimen name="sensor_sht21_margin">5dp</dimen>
365373
<dimen name="sht21_height">40dp</dimen>

0 commit comments

Comments
 (0)