mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-17 02:58:48 +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() {
|
btnMinus.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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());
|
int curQauntity = Integer.parseInt(etQuantity.getText().toString());
|
||||||
if (curQauntity > 0) {
|
if (curQauntity > 1) {
|
||||||
curQauntity--;
|
curQauntity--;
|
||||||
etQuantity.setText(String.format("%d", curQauntity));
|
etQuantity.setText(String.format("%d", curQauntity));
|
||||||
}
|
}
|
||||||
@ -102,6 +107,11 @@ public class ListPickerDialogFragment extends DialogFragment {
|
|||||||
btnPlus.setOnClickListener(new View.OnClickListener() {
|
btnPlus.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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());
|
int curQauntity = Integer.parseInt(etQuantity.getText().toString());
|
||||||
curQauntity++;
|
curQauntity++;
|
||||||
etQuantity.setText(String.format("%d", 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);
|
TextView itemStore = (TextView) convertView.findViewById(R.id.item_store);
|
||||||
|
|
||||||
Product product = productList.get(position);
|
Product product = productList.get(position);
|
||||||
// TODO: If image url is broken, display @drawable/ic_baseline_broken_image_600.xml
|
|
||||||
Glide.with(activity)
|
Glide.with(activity)
|
||||||
.applyDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.ic_baseline_image_600).error(R.drawable.ic_baseline_broken_image_600))
|
.applyDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.ic_baseline_image_600).error(R.drawable.ic_baseline_broken_image_600))
|
||||||
.load(product.getImageUrl())
|
.load(product.getImageUrl())
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
android:layout_width="60dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="@string/_1"
|
android:text="@string/_1"
|
||||||
|
android:digits="0123456789"
|
||||||
android:inputType="number"/>
|
android:inputType="number"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user