bug fixes
This commit is contained in:
@@ -54,7 +54,8 @@ public class LoginActivity extends BaseActivity {
|
||||
//initViews();
|
||||
}
|
||||
|
||||
@OnClick({R.id.loginButton, R.id.forgotPasswordTextView, R.id.registerButton})
|
||||
@OnClick({R.id.loginButton, R.id.forgotPasswordTextView,
|
||||
R.id.registerButton, R.id.loginAsGuestTextView})
|
||||
protected void onClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.loginButton:
|
||||
@@ -68,6 +69,9 @@ public class LoginActivity extends BaseActivity {
|
||||
case R.id.registerButton:
|
||||
startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
|
||||
break;
|
||||
case R.id.loginAsGuestTextView:
|
||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@ import ch.pizzalink.android.fragment.StoreInfoFragment;
|
||||
import ch.pizzalink.android.fragment.MenuFragment;
|
||||
import ch.pizzalink.android.fragment.ProductFragment;
|
||||
import ch.pizzalink.android.fragment.ProfileFragment;
|
||||
import ch.pizzalink.android.helper.DialogHelper;
|
||||
import ch.pizzalink.android.helper.PriceHelper;
|
||||
import ch.pizzalink.android.helper.SessionHelper;
|
||||
import ch.pizzalink.android.helper.SharedPrefsHelper;
|
||||
import ch.pizzalink.android.model.CategoryModel;
|
||||
import ch.pizzalink.android.view.PizzalinkToolbar;
|
||||
@@ -130,6 +132,10 @@ public class MainActivity extends BaseActivity {
|
||||
shoppingCartButtonLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(!SessionHelper.isCustomerLoggedIn()){
|
||||
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
|
||||
return;
|
||||
}
|
||||
bottomNavigationView.setCurrentItem(2);
|
||||
}
|
||||
});
|
||||
@@ -186,6 +192,10 @@ public class MainActivity extends BaseActivity {
|
||||
return true;
|
||||
|
||||
case R.id.action_empty:
|
||||
if(!SessionHelper.isCustomerLoggedIn()){
|
||||
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
|
||||
return false;
|
||||
}
|
||||
if (currentFragmentName.equals(CartFragment.FRAGMENT_NAME))
|
||||
return true;
|
||||
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, CartFragment.newInstance()).commit();
|
||||
@@ -200,6 +210,10 @@ public class MainActivity extends BaseActivity {
|
||||
return true;
|
||||
|
||||
case R.id.action_history:
|
||||
if(!SessionHelper.isCustomerLoggedIn()){
|
||||
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
|
||||
return false;
|
||||
}
|
||||
if (currentFragmentName.equals(OrderHistoryFragment.FRAGMENT_NAME))
|
||||
return true;
|
||||
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, OrderHistoryFragment.newInstance()).commit();
|
||||
@@ -214,6 +228,10 @@ public class MainActivity extends BaseActivity {
|
||||
return true;
|
||||
|
||||
case R.id.action_profile:
|
||||
if(!SessionHelper.isCustomerLoggedIn()){
|
||||
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
|
||||
return false;
|
||||
}
|
||||
if (currentFragmentName.equals(ProfileFragment.FRAGMENT_NAME))
|
||||
return true;
|
||||
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, ProfileFragment.newInstance()).commit();
|
||||
|
||||
@@ -28,7 +28,7 @@ import retrofit2.Response;
|
||||
public class OrderHistoryDetailsActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.orderDatePizzalinkInfoLayout) PizzalinkInfoView orderDatePizzalinkInfoLayout;
|
||||
@BindView(R.id.orderStatusPizzalinkInfoLayout) PizzalinkInfoView orderStatusPizzalinkInfoLayout;
|
||||
//@BindView(R.id.orderStatusPizzalinkInfoLayout) PizzalinkInfoView orderStatusPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderShippingTimePizzalinkInfoLayout) PizzalinkInfoView orderShippingTimePizzalinkInfoLayout;
|
||||
@BindView(R.id.orderTotalPizzalinkInfoLayout) PizzalinkInfoView orderTotalPizzalinkInfoLayout;
|
||||
@BindView(R.id.orderPaymentMethodPizzalinkInfoLayout) PizzalinkInfoView orderPaymentMethodPizzalinkInfoLayout;
|
||||
@@ -57,7 +57,7 @@ public class OrderHistoryDetailsActivity extends BaseActivity {
|
||||
|
||||
private void initViews(){
|
||||
orderDatePizzalinkInfoLayout.setText(orderHistoryModel.getFormattedCreateDate());
|
||||
orderStatusPizzalinkInfoLayout.setText(orderHistoryModel.getStatus());
|
||||
//orderStatusPizzalinkInfoLayout.setText(orderHistoryModel.getStatus());
|
||||
if(orderHistoryModel.getShippingTime().isEmpty()){
|
||||
orderShippingTimePizzalinkInfoLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -120,8 +120,14 @@ public class ProductPropertiesActivity extends BaseActivity {
|
||||
productPriceTextView.getText().toString(), productCount + 1, productCount));
|
||||
break;
|
||||
case R.id.addToCartButton:
|
||||
if(checkFields())
|
||||
addProductToCart();
|
||||
if(checkFields()){
|
||||
if(SessionHelper.isCustomerLoggedIn()){
|
||||
addProductToCart();
|
||||
}
|
||||
else {
|
||||
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_shopping);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
|
||||
@BindView(R.id.orderDateTextView) TextView orderDateTextView;
|
||||
@BindView(R.id.orderTotalTextView) TextView orderTotalTextView;
|
||||
@BindView(R.id.orderStatusTextView) TextView orderStatusTextView;
|
||||
//@BindView(R.id.orderStatusTextView) TextView orderStatusTextView;
|
||||
|
||||
public OrderViewHolder(final View view, final RecyclerItemClickListener recyclerItemClickListener) {
|
||||
super(view);
|
||||
@@ -105,7 +105,7 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
|
||||
OrderViewHolder orderViewHolder = (OrderViewHolder) holder;
|
||||
orderViewHolder.orderDateTextView.setText(orderHistoryList.get(position).getFormattedCreateDate());
|
||||
orderViewHolder.orderTotalTextView.setText(PriceHelper.roundFractions(orderHistoryList.get(position).getTotalString()));
|
||||
orderViewHolder.orderStatusTextView.setText(orderHistoryList.get(position).getStatus());
|
||||
//orderViewHolder.orderStatusTextView.setText(orderHistoryList.get(position).getStatus());
|
||||
break;
|
||||
|
||||
case HOLDER_SPACE :
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.ArrayList;
|
||||
import ch.pizzalink.android.R;
|
||||
import ch.pizzalink.android.activity.BaseActivity;
|
||||
import ch.pizzalink.android.activity.LoginActivity;
|
||||
import ch.pizzalink.android.activity.RegisterActivity;
|
||||
|
||||
public class DialogHelper {
|
||||
|
||||
@@ -132,6 +133,39 @@ public class DialogHelper {
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void showNeedToLoginDialog(int messageResourceId){
|
||||
|
||||
MaterialDialog dialog = new MaterialDialog.Builder(BaseActivity.currentActivity)
|
||||
.title(R.string.alert)
|
||||
.content(BaseActivity.currentActivity.getString(messageResourceId))
|
||||
.titleColorRes(R.color.red)
|
||||
.contentColorRes(R.color.navy)
|
||||
.positiveText(R.string.button_login)
|
||||
.onPositive(new MaterialDialog.SingleButtonCallback() {
|
||||
@Override
|
||||
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||
BaseActivity.currentActivity.startActivity(new Intent(BaseActivity.currentActivity, LoginActivity.class));
|
||||
}
|
||||
})
|
||||
.negativeText(R.string.register_text)
|
||||
.onNegative(new MaterialDialog.SingleButtonCallback() {
|
||||
@Override
|
||||
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||
BaseActivity.currentActivity.startActivity(new Intent(BaseActivity.currentActivity, RegisterActivity.class));
|
||||
}
|
||||
})
|
||||
.neutralText(R.string.cancel_all_caps)
|
||||
//.onNeutral()
|
||||
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
|
||||
.build();
|
||||
|
||||
dialog.getActionButton(DialogAction.POSITIVE).setTextSize(12);
|
||||
dialog.getActionButton(DialogAction.NEGATIVE).setTextSize(12);
|
||||
dialog.getActionButton(DialogAction.NEUTRAL).setTextSize(12);
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showUpdateAppDialog(Context context) {
|
||||
|
||||
new MaterialDialog.Builder(context)
|
||||
|
||||
Reference in New Issue
Block a user