Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Commit e1d99bd

Browse files
feat: Improvements in bottom bar layout
1 parent 6768e37 commit e1d99bd

17 files changed

+223
-97
lines changed

skunkworks_crow/src/main/java/org/odk/share/views/ui/hotspot/HpReceiverActivity.java

+6
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ private void showPasswordDialog(WifiNetworkInfo scanResult) {
319319

320320
public void startScan() {
321321
scanWifi.setEnabled(false);
322+
scanWifi.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
323+
scanWifi.setTextColor(getResources().getColor(R.color.colorPrimary));
322324
scanResultList.clear();
323325
wifiResultAdapter.notifyDataSetChanged();
324326
setEmptyViewVisibility(getString(R.string.scanning));
@@ -504,6 +506,10 @@ private void wifiListAvailable(ArrayList<WifiNetworkInfo> list) {
504506
scanResultList.addAll(list);
505507
wifiResultAdapter.notifyDataSetChanged();
506508

509+
scanWifi.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
510+
scanWifi.setTextColor(getResources().getColor(android.R.color.white));
511+
scanQRCode.setTextColor(getResources().getColor(android.R.color.white));
512+
507513
scanWifi.setEnabled(true);
508514
setEmptyViewVisibility(getString(R.string.no_wifi_available));
509515

skunkworks_crow/src/main/java/org/odk/share/views/ui/instance/fragment/ReviewedInstancesFragment.java

+7
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ private void toggleButtonLabel() {
215215
toggleButton.setText(selectedInstances.size() == transferInstanceAdapter.getItemCount() ?
216216
getString(R.string.clear_all) : getString(R.string.select_all));
217217
sendButton.setEnabled(selectedInstances.size() > 0);
218+
if (selectedInstances.size() > 0) {
219+
sendButton.setTextColor(getResources().getColor(android.R.color.white));
220+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
221+
} else {
222+
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
223+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
224+
}
218225
}
219226

220227
@OnClick(R.id.bAction)

skunkworks_crow/src/main/java/org/odk/share/views/ui/main/MainActivity.java

+4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ protected void onCreate(Bundle savedInstanceState) {
9696
createODKDirs();
9797

9898
sendForms.setEnabled(false);
99+
sendForms.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
100+
sendForms.setTextColor(getResources().getColor(R.color.colorPrimary));
99101

100102
LinearLayoutManager llm = new LinearLayoutManager(this);
101103
llm.setOrientation(RecyclerView.VERTICAL);
@@ -176,6 +178,8 @@ private void setEmptyViewVisibility(int len) {
176178
recyclerView.setVisibility(View.VISIBLE);
177179
emptyView.setVisibility(View.GONE);
178180
sendForms.setEnabled(true);
181+
sendForms.setTextColor(getResources().getColor(android.R.color.white));
182+
sendForms.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
179183
} else {
180184
recyclerView.setVisibility(View.GONE);
181185
emptyView.setVisibility(View.VISIBLE);

skunkworks_crow/src/main/java/org/odk/share/views/ui/review/ReviewFormActivity.java

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ protected void onCreate(Bundle savedInstanceState) {
9393
cursor.close();
9494
}
9595
}
96+
approveButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
97+
rejectButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
98+
reviewLaterButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
99+
viewForm.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
96100
}
97101

98102
@Override

skunkworks_crow/src/main/java/org/odk/share/views/ui/send/fragment/BlankFormsFragment.java

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
8989
llm.setOrientation(RecyclerView.VERTICAL);
9090
recyclerView.setLayoutManager(llm);
9191
addListItemDivider();
92+
93+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
94+
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
9295
return view;
9396
}
9497

@@ -197,8 +200,12 @@ private void toggleButtonLabel() {
197200
}
198201
if (selectedForms.isEmpty()) {
199202
sendButton.setText(getString(R.string.send_forms));
203+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
204+
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
200205
} else {
201206
sendButton.setText(String.format(getString(R.string.send_count), selectedForms.size()));
207+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
208+
sendButton.setTextColor(getResources().getColor(android.R.color.white));
202209
}
203210
}
204211

skunkworks_crow/src/main/java/org/odk/share/views/ui/send/fragment/FilledFormsFragment.java

+4
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,12 @@ private void toggleButtonLabel() {
191191
}
192192
if (selectedInstances.isEmpty()) {
193193
sendButton.setText(getString(R.string.send_forms));
194+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
195+
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
194196
} else {
195197
sendButton.setText(String.format(getString(R.string.send_count), selectedInstances.size()));
198+
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
199+
sendButton.setTextColor(getResources().getColor(android.R.color.white));
196200
}
197201
}
198202

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:state_pressed="true">
4+
<shape>
5+
<solid android:color="@color/colorPrimary" />
6+
<stroke android:width="1dp" android:color="@color/colorPrimary" />
7+
<corners android:radius="20dp" />
8+
</shape>
9+
</item>
10+
11+
<item>
12+
<shape>
13+
<solid android:color="@color/colorButtonDisabled" />
14+
<stroke android:width="1dp" android:color="@color/colorPrimary" />
15+
<corners android:radius="20dp" />
16+
</shape>
17+
</item>
18+
19+
</selector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:state_pressed="true">
4+
<shape>
5+
<solid android:color="@android:color/darker_gray" />
6+
<stroke
7+
android:width="1dp"
8+
android:color="@android:color/darker_gray" />
9+
<corners android:radius="20dp" />
10+
</shape>
11+
</item>
12+
<item >
13+
<shape>
14+
<solid android:color="@color/colorPrimary" />
15+
<stroke android:width="1dp"
16+
android:color="@color/colorPrimary" />
17+
<corners android:radius="20dp" />
18+
</shape>
19+
</item>
20+
</selector>

skunkworks_crow/src/main/res/layout/activity_bt_receive.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
<Button
4141
android:id="@+id/btn_refresh"
42-
style="@style/MatchParentWidth"
42+
style="@style/bottom_button"
4343
android:layout_alignParentBottom="true"
4444
android:layout_margin="@dimen/button_margin"
4545
android:text="@string/btn_refresh"

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

+20-16
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,26 @@
2929

3030
<LinearLayout
3131
android:id="@+id/buttonholder"
32-
style="@style/MatchParentWidth"
33-
android:layout_alignParentBottom="true"
34-
android:orientation="horizontal"
35-
android:weightSum="2">
36-
37-
<Button
38-
android:id="@+id/bSendForms"
39-
style="@style/MatchParentWidth"
40-
android:layout_weight="1"
41-
android:text="@string/send_forms" />
42-
43-
<Button
44-
android:id="@+id/bReceiveForms"
45-
style="@style/MatchParentWidth"
46-
android:layout_weight="1"
47-
android:text="@string/receive_forms" />
32+
style="@style/main_layout_button_bottom">
33+
34+
<LinearLayout style="@style/layout_bottom_button">
35+
36+
<Button
37+
android:id="@+id/bSendForms"
38+
style="@style/bottom_button"
39+
android:text="@string/send_forms" />
40+
41+
</LinearLayout>
42+
43+
<LinearLayout style="@style/layout_bottom_button">
44+
45+
<Button
46+
android:id="@+id/bReceiveForms"
47+
style="@style/bottom_button"
48+
android:text="@string/receive_forms" />
49+
50+
</LinearLayout>
51+
4852
</LinearLayout>
4953

5054
</RelativeLayout>

skunkworks_crow/src/main/res/layout/activity_review_form.xml

+21-4
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,44 @@
5555
<Button
5656
android:id="@+id/bApprove"
5757
style="@style/MatchParentWidth"
58+
android:layout_marginEnd="3dp"
59+
android:layout_marginRight="3dp"
60+
android:layout_marginBottom="5dp"
5861
android:layout_weight="1"
59-
android:text="@string/approve" />
62+
android:background="@drawable/button_bottom_primary"
63+
android:text="@string/approve"
64+
android:textColor="@android:color/white" />
6065

6166
<Button
6267
android:id="@+id/bReject"
6368
style="@style/MatchParentWidth"
69+
android:layout_marginStart="3dp"
70+
android:layout_marginLeft="3dp"
71+
android:layout_marginBottom="5dp"
6472
android:layout_weight="1"
65-
android:text="@string/Reject" />
73+
android:background="@drawable/button_bottom_primary"
74+
android:text="@string/Reject"
75+
android:textColor="@android:color/white" />
6676

6777
</LinearLayout>
6878

79+
6980
<Button
7081
android:id="@+id/bViewAgain"
7182
style="@style/MatchParentWidth"
7283
android:layout_gravity="center_horizontal"
73-
android:text="@string/view_form_in_collect" />
84+
android:layout_marginTop="5dp"
85+
android:layout_marginBottom="10dp"
86+
android:background="@drawable/button_bottom_primary"
87+
android:text="@string/view_form_in_collect"
88+
android:textColor="@android:color/white" />
7489

7590
<Button
7691
android:id="@+id/bReviewLater"
7792
style="@style/MatchParentWidth"
78-
android:text="@string/review_later" />
93+
android:background="@drawable/button_bottom_primary"
94+
android:text="@string/review_later"
95+
android:textColor="@android:color/white" />
7996

8097
<View
8198
style="@style/MatchParentWidth"

skunkworks_crow/src/main/res/layout/activity_wifi.xml

+21-16
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,26 @@
3737

3838
<LinearLayout
3939
android:id="@+id/buttonholder"
40-
style="@style/MatchParentWidth"
41-
android:layout_alignParentBottom="true"
42-
android:orientation="horizontal"
43-
android:weightSum="2">
44-
45-
<Button
46-
android:id="@+id/bScan"
47-
style="@style/MatchParentWidth"
48-
android:layout_weight="1"
49-
android:text="@string/scan" />
50-
51-
<Button
52-
android:id="@+id/bScanQRCode"
53-
style="@style/MatchParentWidth"
54-
android:layout_weight="1"
55-
android:text="@string/scan_qr_code" />
40+
style="@style/main_layout_button_bottom">
41+
42+
<LinearLayout
43+
style="@style/layout_bottom_button" >
44+
45+
<Button
46+
android:id="@+id/bScan"
47+
style="@style/bottom_button"
48+
android:text="@string/scan" />
49+
</LinearLayout>
50+
51+
<LinearLayout
52+
style="@style/layout_bottom_button" >
53+
54+
<Button
55+
android:id="@+id/bScanQRCode"
56+
style="@style/bottom_button"
57+
android:text="@string/scan_qr_code" />
58+
</LinearLayout>
59+
5660
</LinearLayout>
61+
5762
</RelativeLayout>

skunkworks_crow/src/main/res/layout/fragment_forms.xml

+27-25
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,35 @@
1717
style="@style/MatchParent"
1818
android:layout_above="@id/buttonholder" />
1919

20+
2021
<LinearLayout
2122
android:id="@+id/buttonholder"
22-
style="@style/MatchParentWidth"
23-
android:layout_alignParentBottom="true"
24-
android:orientation="horizontal"
25-
android:weightSum="2">
26-
27-
<Button
28-
android:id="@+id/toggle_button"
29-
android:layout_width="0dp"
30-
android:layout_height="match_parent"
31-
android:layout_weight="1"
32-
android:padding="@dimen/button_padding"
33-
android:text="@string/select_all"
34-
android:textAllCaps="false"
35-
android:textSize="@dimen/button_text_size" />
36-
37-
<Button
38-
android:id="@+id/send_button"
39-
android:layout_width="0dp"
40-
android:layout_height="match_parent"
41-
android:layout_weight="1"
42-
android:enabled="false"
43-
android:padding="@dimen/button_padding"
44-
android:text="@string/send_selected"
45-
android:textAllCaps="false"
46-
android:textSize="@dimen/button_text_size" />
23+
style="@style/main_layout_button_bottom">
24+
25+
<LinearLayout style="@style/layout_bottom_button">
26+
27+
<Button
28+
android:id="@+id/toggle_button"
29+
style="@style/bottom_button" />
30+
31+
</LinearLayout>
32+
33+
<LinearLayout style="@style/layout_bottom_button">
34+
35+
<Button
36+
android:id="@+id/send_button"
37+
android:layout_width="match_parent"
38+
android:layout_height="@dimen/button_bottom_height"
39+
android:background="@drawable/button_bottom_light"
40+
android:enabled="false"
41+
android:gravity="center"
42+
android:text="@string/send_selected"
43+
android:textAllCaps="false"
44+
android:textColor="@color/colorPrimary"
45+
android:textSize="@dimen/button_bottom_text_size" />
46+
47+
</LinearLayout>
48+
4749
</LinearLayout>
4850

4951
</RelativeLayout>

skunkworks_crow/src/main/res/layout/fragment_instances.xml

+18-15
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,23 @@
1919

2020
<LinearLayout
2121
android:id="@+id/buttonholder"
22-
style="@style/MatchParentWidth"
23-
android:layout_alignParentBottom="true"
24-
android:orientation="horizontal"
25-
android:weightSum="2">
26-
27-
<Button
28-
android:id="@+id/bToggle"
29-
style="@style/MatchParentWidth"
30-
android:layout_weight="1"
31-
android:text="@string/select_all" />
32-
33-
<Button
34-
android:id="@+id/bAction"
35-
style="@style/MatchParentWidth"
36-
android:layout_weight="1" />
22+
style="@style/main_layout_button_bottom">
23+
24+
<LinearLayout style="@style/layout_bottom_button">
25+
26+
27+
<Button
28+
android:id="@+id/bToggle"
29+
style="@style/bottom_button" />
30+
31+
</LinearLayout>
32+
33+
<LinearLayout style="@style/layout_bottom_button">
34+
35+
<Button
36+
android:id="@+id/bAction"
37+
style="@style/bottom_button" />
38+
</LinearLayout>
39+
3740
</LinearLayout>
3841
</RelativeLayout>

skunkworks_crow/src/main/res/values/colors.xml

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<color name="colorAccent">#00796B</color>
66
<color name="colorTabInactive">#CFD8DC</color>
77
<color name="colorTabActive">#FFFFFF</color>
8+
<color name="colorButtonDisabled">#D3D3D3</color>
89
</resources>

0 commit comments

Comments
 (0)