cart total layout on main activity
This commit is contained in:
@@ -17,6 +17,7 @@ import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -37,6 +38,7 @@ import ch.pizzalink.android.fragment.HistoryFragment;
|
||||
import ch.pizzalink.android.fragment.MenuFragment;
|
||||
import ch.pizzalink.android.fragment.ProductFragment;
|
||||
import ch.pizzalink.android.fragment.ProfileFragment;
|
||||
import ch.pizzalink.android.helper.PriceHelper;
|
||||
import ch.pizzalink.android.helper.SharedPrefsHelper;
|
||||
import ch.pizzalink.android.model.CategoryModel;
|
||||
import ch.pizzalink.android.view.PizzalinkToolbar;
|
||||
@@ -51,6 +53,8 @@ public class MainActivity extends BaseActivity {
|
||||
@BindView(R.id.drawerLayout) DrawerLayout drawerLayout;
|
||||
@BindView(R.id.navigationMenuRecyclerView) RecyclerView navigationMenuRecyclerView;
|
||||
@BindView(R.id.pizzalinkToolbar) PizzalinkToolbar pizzalinkToolbar;
|
||||
@BindView(R.id.cartTotalRelativeLayout) RelativeLayout cartTotalRelativeLayout;
|
||||
@BindView(R.id.cartTotalTextView) TextView cartTotalTextView;
|
||||
@BindView(R.id.bottomNavigationView) BottomNavigationViewEx bottomNavigationView;
|
||||
|
||||
@BindView(R.id.badgeLayout) RelativeLayout badgeLayout;
|
||||
@@ -176,6 +180,13 @@ public class MainActivity extends BaseActivity {
|
||||
shoppingCartImageView.setImageDrawable(whiteCartDrawable);
|
||||
shoppingCartTextView.setTextColor(whiteColor);
|
||||
|
||||
if(!SharedPrefsHelper.getCartTotalPrice().equals("0") &&
|
||||
!SharedPrefsHelper.getCartTotalPrice().equals("0.0") &&
|
||||
!SharedPrefsHelper.getCartTotalPrice().equals("0.00")){
|
||||
cartTotalTextView.setText(PriceHelper.getPriceWithCurreny(SharedPrefsHelper.getCartTotalPrice()));
|
||||
cartTotalRelativeLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case R.id.action_empty:
|
||||
@@ -186,6 +197,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
currentCategoryId = -1;
|
||||
|
||||
cartTotalRelativeLayout.setVisibility(View.GONE);
|
||||
shoppingCartImageView.setImageDrawable(redCartDrawable);
|
||||
shoppingCartTextView.setTextColor(redColor);
|
||||
|
||||
@@ -199,6 +211,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
currentCategoryId = -1;
|
||||
|
||||
cartTotalRelativeLayout.setVisibility(View.GONE);
|
||||
shoppingCartImageView.setImageDrawable(whiteCartDrawable);
|
||||
shoppingCartTextView.setTextColor(whiteColor);
|
||||
|
||||
@@ -212,6 +225,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
currentCategoryId = -1;
|
||||
|
||||
cartTotalRelativeLayout.setVisibility(View.GONE);
|
||||
shoppingCartImageView.setImageDrawable(whiteCartDrawable);
|
||||
shoppingCartTextView.setTextColor(whiteColor);
|
||||
|
||||
@@ -225,6 +239,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
currentCategoryId = -1;
|
||||
|
||||
cartTotalRelativeLayout.setVisibility(View.GONE);
|
||||
shoppingCartImageView.setImageDrawable(whiteCartDrawable);
|
||||
shoppingCartTextView.setTextColor(whiteColor);
|
||||
|
||||
@@ -418,13 +433,26 @@ public class MainActivity extends BaseActivity {
|
||||
*/
|
||||
|
||||
private void addBadgeAt(int position, int number) {
|
||||
|
||||
badgeTextView.setText(String.valueOf(number));
|
||||
|
||||
if(number <= 0){
|
||||
badgeLayout.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
badgeLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(SharedPrefsHelper.getCartTotalPrice().equals("0") ||
|
||||
SharedPrefsHelper.getCartTotalPrice().equals("0.0") ||
|
||||
SharedPrefsHelper.getCartTotalPrice().equals("0.00")){
|
||||
cartTotalRelativeLayout.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
cartTotalTextView.setText(PriceHelper.getPriceWithCurreny(SharedPrefsHelper.getCartTotalPrice()));
|
||||
cartTotalRelativeLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user