mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-15 18:28:47 +00:00
Restrict quantities when adding item to a list
This commit is contained in:
parent
757ac20fe6
commit
0934965306
@ -90,8 +90,13 @@ public class ListPickerDialogFragment extends DialogFragment {
|
||||
btnMinus.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Set to 1 if it is empty
|
||||
if (etQuantity.getText().toString().equals("")) {
|
||||
etQuantity.setText("1");
|
||||
}
|
||||
|
||||
int curQauntity = Integer.parseInt(etQuantity.getText().toString());
|
||||
if (curQauntity > 0) {
|
||||
if (curQauntity > 1) {
|
||||
curQauntity--;
|
||||
etQuantity.setText(String.format("%d", curQauntity));
|
||||
}
|
||||
@ -102,6 +107,11 @@ public class ListPickerDialogFragment extends DialogFragment {
|
||||
btnPlus.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Set to 1 if it is empty
|
||||
if (etQuantity.getText().toString().equals("")) {
|
||||
etQuantity.setText("1");
|
||||
}
|
||||
|
||||
int curQauntity = Integer.parseInt(etQuantity.getText().toString());
|
||||
curQauntity++;
|
||||
etQuantity.setText(String.format("%d", curQauntity));
|
||||
|
||||
@ -56,7 +56,7 @@ public class SearchResultsListAdapter extends BaseAdapter {
|
||||
TextView itemStore = (TextView) convertView.findViewById(R.id.item_store);
|
||||
|
||||
Product product = productList.get(position);
|
||||
// TODO: If image url is broken, display @drawable/ic_baseline_broken_image_600.xml
|
||||
|
||||
Glide.with(activity)
|
||||
.applyDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.ic_baseline_image_600).error(R.drawable.ic_baseline_broken_image_600))
|
||||
.load(product.getImageUrl())
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/_1"
|
||||
android:digits="0123456789"
|
||||
android:inputType="number"/>
|
||||
|
||||
<Button
|
||||
|
||||
Loading…
Reference in New Issue
Block a user