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

Improvements in bottom bar layout #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ private void showPasswordDialog(WifiNetworkInfo scanResult) {

public void startScan() {
scanWifi.setEnabled(false);
scanWifi.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
scanWifi.setTextColor(getResources().getColor(R.color.colorPrimary));
scanResultList.clear();
wifiResultAdapter.notifyDataSetChanged();
setEmptyViewVisibility(getString(R.string.scanning));
Expand Down Expand Up @@ -504,6 +506,10 @@ private void wifiListAvailable(ArrayList<WifiNetworkInfo> list) {
scanResultList.addAll(list);
wifiResultAdapter.notifyDataSetChanged();

scanWifi.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
scanWifi.setTextColor(getResources().getColor(android.R.color.white));
scanQRCode.setTextColor(getResources().getColor(android.R.color.white));

scanWifi.setEnabled(true);
setEmptyViewVisibility(getString(R.string.no_wifi_available));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ private void toggleButtonLabel() {
toggleButton.setText(selectedInstances.size() == transferInstanceAdapter.getItemCount() ?
getString(R.string.clear_all) : getString(R.string.select_all));
sendButton.setEnabled(selectedInstances.size() > 0);
if (selectedInstances.size() > 0) {
sendButton.setTextColor(getResources().getColor(android.R.color.white));
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
} else {
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
}
}

@OnClick(R.id.bAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ protected void onCreate(Bundle savedInstanceState) {
createODKDirs();

sendForms.setEnabled(false);
sendForms.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
sendForms.setTextColor(getResources().getColor(R.color.colorPrimary));

LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(RecyclerView.VERTICAL);
Expand Down Expand Up @@ -176,6 +178,8 @@ private void setEmptyViewVisibility(int len) {
recyclerView.setVisibility(View.VISIBLE);
emptyView.setVisibility(View.GONE);
sendForms.setEnabled(true);
sendForms.setTextColor(getResources().getColor(android.R.color.white));
sendForms.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
} else {
recyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ protected void onCreate(Bundle savedInstanceState) {
cursor.close();
}
}
approveButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
rejectButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
reviewLaterButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
viewForm.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
llm.setOrientation(RecyclerView.VERTICAL);
recyclerView.setLayoutManager(llm);
addListItemDivider();

sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
return view;
}

Expand Down Expand Up @@ -197,8 +200,12 @@ private void toggleButtonLabel() {
}
if (selectedForms.isEmpty()) {
sendButton.setText(getString(R.string.send_forms));
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
} else {
sendButton.setText(String.format(getString(R.string.send_count), selectedForms.size()));
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
sendButton.setTextColor(getResources().getColor(android.R.color.white));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,12 @@ private void toggleButtonLabel() {
}
if (selectedInstances.isEmpty()) {
sendButton.setText(getString(R.string.send_forms));
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_light));
sendButton.setTextColor(getResources().getColor(R.color.colorPrimary));
} else {
sendButton.setText(String.format(getString(R.string.send_count), selectedInstances.size()));
sendButton.setBackground(getResources().getDrawable(R.drawable.button_bottom_primary));
sendButton.setTextColor(getResources().getColor(android.R.color.white));
}
}

Expand Down
19 changes: 19 additions & 0 deletions skunkworks_crow/src/main/res/drawable/button_bottom_light.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="@color/colorPrimary" />
<stroke android:width="1dp" android:color="@color/colorPrimary" />
<corners android:radius="20dp" />
</shape>
</item>

<item>
<shape>
<solid android:color="@color/colorButtonDisabled" />
<stroke android:width="1dp" android:color="@color/colorPrimary" />
<corners android:radius="20dp" />
</shape>
</item>

</selector>
20 changes: 20 additions & 0 deletions skunkworks_crow/src/main/res/drawable/button_bottom_primary.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="@android:color/darker_gray" />
<stroke
android:width="1dp"
android:color="@android:color/darker_gray" />
<corners android:radius="20dp" />
</shape>
</item>
<item >
<shape>
<solid android:color="@color/colorPrimary" />
<stroke android:width="1dp"
android:color="@color/colorPrimary" />
<corners android:radius="20dp" />
</shape>
</item>
</selector>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<Button
android:id="@+id/btn_refresh"
style="@style/MatchParentWidth"
style="@style/bottom_button"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/button_margin"
android:text="@string/btn_refresh"
Expand Down
36 changes: 20 additions & 16 deletions skunkworks_crow/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,26 @@

<LinearLayout
android:id="@+id/buttonholder"
style="@style/MatchParentWidth"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="2">

<Button
android:id="@+id/bSendForms"
style="@style/MatchParentWidth"
android:layout_weight="1"
android:text="@string/send_forms" />

<Button
android:id="@+id/bReceiveForms"
style="@style/MatchParentWidth"
android:layout_weight="1"
android:text="@string/receive_forms" />
style="@style/main_layout_button_bottom">

<LinearLayout style="@style/layout_bottom_button">

<Button
android:id="@+id/bSendForms"
style="@style/bottom_button"
android:text="@string/send_forms" />

</LinearLayout>

<LinearLayout style="@style/layout_bottom_button">

<Button
android:id="@+id/bReceiveForms"
style="@style/bottom_button"
android:text="@string/receive_forms" />

</LinearLayout>

</LinearLayout>

</RelativeLayout>
25 changes: 21 additions & 4 deletions skunkworks_crow/src/main/res/layout/activity_review_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,44 @@
<Button
android:id="@+id/bApprove"
style="@style/MatchParentWidth"
android:layout_marginEnd="3dp"
android:layout_marginRight="3dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:text="@string/approve" />
android:background="@drawable/button_bottom_primary"
android:text="@string/approve"
android:textColor="@android:color/white" />

<Button
android:id="@+id/bReject"
style="@style/MatchParentWidth"
android:layout_marginStart="3dp"
android:layout_marginLeft="3dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:text="@string/Reject" />
android:background="@drawable/button_bottom_primary"
android:text="@string/Reject"
android:textColor="@android:color/white" />

</LinearLayout>


<Button
android:id="@+id/bViewAgain"
style="@style/MatchParentWidth"
android:layout_gravity="center_horizontal"
android:text="@string/view_form_in_collect" />
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:background="@drawable/button_bottom_primary"
android:text="@string/view_form_in_collect"
android:textColor="@android:color/white" />

<Button
android:id="@+id/bReviewLater"
style="@style/MatchParentWidth"
android:text="@string/review_later" />
android:background="@drawable/button_bottom_primary"
android:text="@string/review_later"
android:textColor="@android:color/white" />

<View
style="@style/MatchParentWidth"
Expand Down
37 changes: 21 additions & 16 deletions skunkworks_crow/src/main/res/layout/activity_wifi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,26 @@

<LinearLayout
android:id="@+id/buttonholder"
style="@style/MatchParentWidth"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="2">

<Button
android:id="@+id/bScan"
style="@style/MatchParentWidth"
android:layout_weight="1"
android:text="@string/scan" />

<Button
android:id="@+id/bScanQRCode"
style="@style/MatchParentWidth"
android:layout_weight="1"
android:text="@string/scan_qr_code" />
style="@style/main_layout_button_bottom">

<LinearLayout
style="@style/layout_bottom_button" >

<Button
android:id="@+id/bScan"
style="@style/bottom_button"
android:text="@string/scan" />
</LinearLayout>

<LinearLayout
style="@style/layout_bottom_button" >

<Button
android:id="@+id/bScanQRCode"
style="@style/bottom_button"
android:text="@string/scan_qr_code" />
</LinearLayout>

</LinearLayout>

</RelativeLayout>
52 changes: 27 additions & 25 deletions skunkworks_crow/src/main/res/layout/fragment_forms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,35 @@
style="@style/MatchParent"
android:layout_above="@id/buttonholder" />


<LinearLayout
android:id="@+id/buttonholder"
style="@style/MatchParentWidth"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="2">

<Button
android:id="@+id/toggle_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="@dimen/button_padding"
android:text="@string/select_all"
android:textAllCaps="false"
android:textSize="@dimen/button_text_size" />

<Button
android:id="@+id/send_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:enabled="false"
android:padding="@dimen/button_padding"
android:text="@string/send_selected"
android:textAllCaps="false"
android:textSize="@dimen/button_text_size" />
style="@style/main_layout_button_bottom">

<LinearLayout style="@style/layout_bottom_button">

<Button
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggle_button has so many attrs the same as send_button , consider extract them into style.xml.

android:id="@+id/toggle_button"
style="@style/bottom_button" />

</LinearLayout>

<LinearLayout style="@style/layout_bottom_button">

<Button
android:id="@+id/send_button"
android:layout_width="match_parent"
android:layout_height="@dimen/button_bottom_height"
android:background="@drawable/button_bottom_light"
android:enabled="false"
android:gravity="center"
android:text="@string/send_selected"
android:textAllCaps="false"
android:textColor="@color/colorPrimary"
android:textSize="@dimen/button_bottom_text_size" />

</LinearLayout>

</LinearLayout>

</RelativeLayout>
33 changes: 18 additions & 15 deletions skunkworks_crow/src/main/res/layout/fragment_instances.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@

<LinearLayout
android:id="@+id/buttonholder"
style="@style/MatchParentWidth"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="2">

<Button
android:id="@+id/bToggle"
style="@style/MatchParentWidth"
android:layout_weight="1"
android:text="@string/select_all" />

<Button
android:id="@+id/bAction"
style="@style/MatchParentWidth"
android:layout_weight="1" />
style="@style/main_layout_button_bottom">

<LinearLayout style="@style/layout_bottom_button">


<Button
android:id="@+id/bToggle"
style="@style/bottom_button" />

</LinearLayout>

<LinearLayout style="@style/layout_bottom_button">

<Button
android:id="@+id/bAction"
style="@style/bottom_button" />
</LinearLayout>

</LinearLayout>
</RelativeLayout>
1 change: 1 addition & 0 deletions skunkworks_crow/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<color name="colorAccent">#00796B</color>
<color name="colorTabInactive">#CFD8DC</color>
<color name="colorTabActive">#FFFFFF</color>
<color name="colorButtonDisabled">#D3D3D3</color>
</resources>
Loading