Skip to content

Commit

Permalink
1. order product bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
softsolutionzonein committed Feb 1, 2024
1 parent c93aa03 commit 1a37e8e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,21 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
double price = modal.getAgentPrice();
int qty = 0;
if (count>0){
if(modal!=null && modal.getAgentPrice()>0) {
double price = modal.getAgentPrice();
int qty = 0;
//if (count>0){
String ss = s.toString().trim();
if (!ss.isEmpty())
qty = Integer.parseInt(ss);
qty = Integer.parseInt(ss);
//}
modal.setPrice(price * qty);
modal.setQty(qty);
et_price.setText("" + modal.getPrice());
listener.onUpdate(modal, position);
}else{

}
modal.setPrice(price*qty);
modal.setQty(qty);
et_price.setText(""+modal.getPrice());
listener.onUpdate(modal,position);
}

@Override
Expand All @@ -89,6 +93,7 @@ public void afterTextChanged(Editable s) {
});
rl_select.setOnClickListener(v -> {
listener.onSelectProduct(modal,position);

});
tv_delete.setOnClickListener(v -> {
listener.onDelete(modal,position);
Expand Down
18 changes: 10 additions & 8 deletions app/src/main/res/layout/order_product_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
<TextView
android:id="@+id/tv_product"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/_20sdp"
android:paddingStart="@dimen/_5sdp"
android:text="Select Product"
android:gravity="start"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/down_aro"
android:textSize="@dimen/_10ssp"/>
android:textSize="@dimen/_12ssp"/>

<ImageView
android:id="@+id/down_aro"
Expand Down Expand Up @@ -80,17 +80,18 @@
android:paddingStart="@dimen/_5sdp"
android:text="Quantity : "
android:textStyle="bold"
android:textSize="@dimen/_10ssp"/>
android:textSize="@dimen/_12ssp"/>

<EditText
android:id="@+id/et_qty"
android:layout_width="match_parent"
android:layout_height="@dimen/_20sdp"
android:layout_height="@dimen/_25sdp"
android:background="@drawable/aa_rect_et_bg_grey"
android:hint="0"
android:inputType="number"
android:minWidth="@dimen/_40sdp"
android:maxLines="1"
android:textSize="@dimen/_10ssp"
android:textSize="@dimen/_12ssp"
android:paddingStart="@dimen/_5sdp"
android:paddingTop="@dimen/_2sdp"
android:paddingEnd="@dimen/_5sdp"
Expand All @@ -108,19 +109,20 @@
android:paddingStart="@dimen/_5sdp"
android:text="Price : "
android:textStyle="bold"
android:textSize="@dimen/_10ssp" />
android:textSize="@dimen/_12ssp" />

<EditText
android:id="@+id/et_price"
android:layout_width="match_parent"
android:layout_height="@dimen/_20sdp"
android:layout_height="@dimen/_25sdp"
android:background="@drawable/aa_rect_et_bg_grey"
android:focusable="false"
android:focusableInTouchMode="false"
android:hint="0"
android:inputType="number"
android:minWidth="@dimen/_50sdp"
android:maxLines="1"
android:textSize="@dimen/_10ssp"
android:textSize="@dimen/_12ssp"
android:paddingStart="@dimen/_5sdp"
android:paddingTop="@dimen/_2sdp"
android:paddingEnd="@dimen/_5sdp"
Expand Down

0 comments on commit 1a37e8e

Please sign in to comment.