Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final UI changes #122

Merged
merged 11 commits into from
Dec 4, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testDateFilterWithOneDateFilled() {
*/
public void navigateToDateRangeFilter() {
onView(withId(R.id.filter_dropdown_button)).perform(click());
onView(withText("Date Range")).perform(click());
onView(withText("Date")).perform(click());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
setDateTextView(contentView, R.id.start_date_filter, R.id.start_date_layout);
setDateTextView(contentView, R.id.end_date_filter, R.id.end_date_layout);

Dialog dialog = createBuilder().setTitle("Modify Date Filter").setView(contentView).create();
Dialog dialog = createBuilder().setTitle("Filter by Date").setView(contentView).create();

filterCallback = getArguments().getSerializable("callback", FilterCallback.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
contentView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_filter_by_keywords, null);
AlertDialog.Builder builder = createBuilder();

Dialog dialog = builder.setTitle("Modify Keyword Filter").setView(contentView).create();
Dialog dialog = builder.setTitle("Filter by Keywords").setView(contentView).create();

chipGroup = contentView.findViewById(R.id.chip_group_labels);
addButton = contentView.findViewById(R.id.add_keyword_button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class MakeFilterFragment extends FilterFragment {
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
contentView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_filter_by_make, null);

Dialog dialog = createBuilder().setTitle("Modify Make Filter").setView(contentView).create();
Dialog dialog = createBuilder().setTitle("Filter by Make").setView(contentView).create();

filterCallback = getArguments().getSerializable("callback", FilterCallback.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class TagFilterFragment extends FilterFragment {
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
contentView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_filter_by_tags, null);
AlertDialog.Builder builder = createBuilder();
Dialog dialog = builder.setTitle("Modify Tag Filter").setView(contentView).create();
Dialog dialog = builder.setTitle("Filter by Tags").setView(contentView).create();

if (getArguments() != null) {
this.filterCallback = getArguments().getSerializable("callback", FilterCallback.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -44,15 +45,18 @@ public DeleteItemsFragment(DeleteCallBack deleteCallBack, ArrayList<Item> select
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
View view = getLayoutInflater().inflate(R.layout.fragment_delete_items, null);
TextView dialogMessage = view.findViewById(R.id.dialogMessage);
dialogMessage.setText("This will permanently remove the selected items from your inventory.");
Copy link
Contributor

Choose a reason for hiding this comment

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

😨

AlertDialog.Builder builder = new AlertDialog.Builder(getContext());

return builder
.setView(view)
.setNeutralButton("Cancel", null)
.setTitle(listener.DialogTitle(selectedItems))
.setNegativeButton("Cancel",null)
.setPositiveButton("OK",(dialog,which)->{
.setPositiveButton("OK", (dialog, which) -> {
listener.onOKPressed(selectedItems);
}).create();
})
.create();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void onOKPressed(ArrayList<Item> selectedItems){
*/
@Override
public String DialogTitle(ArrayList<Item> selectedItems) {
return "Confirm deletion of "+selectedItems.size()+" item(s)?";
return "Delete "+selectedItems.size()+" item(s)?";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -67,6 +68,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

// Initialize TextViews
TextView title = rootView.findViewById(R.id.view_item_title);
TextView date = rootView.findViewById(R.id.view_item_date);
TextView make = rootView.findViewById(R.id.view_item_make);
TextView model = rootView.findViewById(R.id.view_item_model);
TextView serialNumber = rootView.findViewById(R.id.view_item_serial_number);
Expand All @@ -82,12 +84,18 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
.ifPresent(item -> {
this.item = item;
title.setText(item.getDescription());
date.setText((new SimpleDateFormat("yyyy-MM-dd")).format(item.getAcquisitionDate()));
make.setText(item.getMake());
model.setText(item.getModel());
serialNumber.setText(item.getSerialNumber());
cost.setText(item.getCost().toString());
addTagsToChipGroup();
comment.setText(item.getComment());
if (item.getComment() != null && !item.getComment().isEmpty()) {
comment.setText(item.getComment());
} else {
rootView.findViewById(R.id.view_item_comment_section).setVisibility(View.GONE);
}
});

// On edit button click, pass item to EditItemFragment
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/barcode.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="16dp"
android:viewportWidth="24"
android:viewportHeight="16">
<path
android:pathData="M0,15.636V0.364H2.182V15.636H0ZM3.273,15.636V0.364H5.455V15.636H3.273ZM6.545,15.636V0.364H7.636V15.636H6.545ZM9.818,15.636V0.364H12V15.636H9.818ZM13.091,15.636V0.364H16.364V15.636H13.091ZM17.455,15.636V0.364H18.545V15.636H17.455ZM20.727,15.636V0.364H24V15.636H20.727Z"
android:fillColor="#E2E2E2"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/serial_number.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="10dp"
android:viewportWidth="24"
android:viewportHeight="10">
<path
android:pathData="M2.323,9.645V2.677H0V0.355H4.645V9.645H2.323ZM7.742,9.645V5.774C7.742,5.335 7.89,4.968 8.187,4.671C8.484,4.374 8.852,4.226 9.29,4.226H12.387V2.677H7.742V0.355H13.161C13.6,0.355 13.968,0.503 14.264,0.8C14.561,1.097 14.71,1.465 14.71,1.903V4.226C14.71,4.665 14.561,5.032 14.264,5.329C13.968,5.626 13.6,5.774 13.161,5.774H10.064V7.323H14.71V9.645H7.742ZM17.032,9.645V7.323H21.677V5.774H18.581V4.226H21.677V2.677H17.032V0.355H22.452C22.89,0.355 23.258,0.503 23.555,0.8C23.852,1.097 24,1.465 24,1.903V8.097C24,8.535 23.852,8.903 23.555,9.2C23.258,9.497 22.89,9.645 22.452,9.645H17.032Z"
android:fillColor="#ffffff"/>
</vector>
18 changes: 9 additions & 9 deletions app/src/main/res/layout/base_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/select_items_button"
android:layout_width="80dp"
android:layout_height="34dp"
android:layout_height="36dp"
android:text="@string/select"
android:layout_marginStart="4dp"
android:padding="0dp"
Expand All @@ -26,30 +26,30 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/filter_dropdown_button"
style="?android:attr/borderlessButtonStyle"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_width="36dp"
android:layout_height="36dp"
app:icon="@drawable/baseline_tune_24"
app:iconSize="22dp"
app:iconSize="26dp"
app:iconGravity="textEnd"
app:iconTint="@color/black"
android:contentDescription="@string/filter_dropdown_description"/>

<com.google.android.material.button.MaterialButton
android:id="@+id/sort_by_alpha_button"
style="?android:attr/borderlessButtonStyle"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_width="36dp"
android:layout_height="36dp"
app:icon="@drawable/baseline_sort_by_alpha_24"
app:iconSize="22dp"
app:iconSize="26dp"
app:iconTint="@color/black"
app:iconGravity="textEnd"
android:contentDescription="@string/sort_button_description"/>

<androidx.appcompat.widget.AppCompatToggleButton
android:id="@+id/sort_order_toggle"
android:layout_width="32dp"
android:layout_width="36dp"
style="?android:attr/borderlessButtonStyle"
android:layout_height="32dp"
android:layout_height="36dp"
app:iconGravity="textStart|start"
android:textOn=""
android:textOff=""
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/res/layout/dialog_scanning_choices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="24dp"
android:text="Scan Serial Number"
android:text=" Scan Serial Number"
android:textAlignment="textStart"
android:textColor="@color/white"
app:icon="@drawable/number_sign_icon"
app:icon="@drawable/serial_number"
android:textSize="18sp"
app:iconGravity="textStart"
app:iconSize="24dp"
app:iconTint="@color/white" />

<com.google.android.material.divider.MaterialDivider
Expand All @@ -31,13 +30,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="24dp"
android:text="Scan Barcode"
android:text=" Scan Barcode"
android:textAlignment="textStart"
android:textColor="@color/white"
app:icon="@drawable/baseline_barcode_scanner_24"
app:icon="@drawable/barcode"
app:iconGravity="textStart"
android:textSize="18sp"
app:iconSize="24dp"
app:iconTint="@color/white" />

</LinearLayout>
10 changes: 7 additions & 3 deletions app/src/main/res/layout/fragment_delete_items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/num_delete_items"
android:id="@+id/dialogMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"/>
android:paddingTop="16dp"
android:paddingHorizontal="24dp"
android:text="This will permanently remove the selected items from your inventory."
android:textSize="16sp"/>

</LinearLayout>
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</androidx.cardview.widget.CardView>

<Space
android:layout_width="12dp"
android:layout_width="10dp"
android:layout_height="match_parent" />

<androidx.cardview.widget.CardView
Expand Down Expand Up @@ -143,6 +143,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="1.0sp"
android:padding="4dp"/>
android:paddingHorizontal="4dp"
android:paddingTop="4dp" />
</LinearLayout>
Loading