Open sooorajjj opened 8 years ago
@NileshJarad
lol, why am I tagged in this? Anyway, why not (in XML) set the views that you want hidden "gone". android:visibility="gone" and in code when something changes or refreshes, .....View.VISIBLE.
@creativetrendsapps thanks ill try that
@creativetrendsapps tried this
` if (currentCartCount == 0){ btnSendToKitchen.setVisibility(View.GONE);
}else { btnSendToKitchen.setVisibility(View.VISIBLE); }`
but the visibility always remains gone :cry:
Finally fixed the Visibility of view
` tvTotalCartAmt.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (currentCartCount == 0) {
btnSendToKitchen.setVisibility(View.GONE);
etKitchenNote.setVisibility(View.GONE);
btnType.setVisibility(View.GONE);
tvType.setVisibility(View.GONE);
rvShoppingCart.setVisibility(View.GONE);
tvTotalCartAmt.setVisibility(View.GONE);
tvNoCartItems.setVisibility(View.VISIBLE);
} else {
btnSendToKitchen.setVisibility(View.VISIBLE);
etKitchenNote.setVisibility(View.VISIBLE);
btnType.setVisibility(View.VISIBLE);
tvType.setVisibility(View.VISIBLE);
rvShoppingCart.setVisibility(View.VISIBLE);
tvTotalCartAmt.setVisibility(View.VISIBLE);
tvNoCartItems.setVisibility(View.GONE);
}
}`
had to add addTextChangedListener for it to work fix commit dd4388d5171ea4edd2c79f6a1a7a456f2c240d31
This should be closed.
@creativetrendsapps the other half of the question isn't answered . About creating a Badge on Cart tab title so that it would update when there is a change in CartFragment .
@creativetrendsapps Awesome , thanks m8 :)
At the moment the tablayout-> Fragment looks like this
https://github.com/sooorajjj/KOT/blob/master/app/src/main/java/online/klok/kot/shopping_cart/CartFragment.java
what i am trying to do is set all this views to gone unless there is an update in cart fragment
Also trying to create a Badge on Cart tab title so that it would update when there is a change in CartFragment
would look same just with Text instead of icon there
@pocheshire @martinwithaar @eneim @creativetrendsapps