auto close feature of "product added to cart" dialog disabled on product details
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package ch.pizzaleu.android.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
@@ -8,6 +9,9 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -325,8 +329,7 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
if(response.isSuccessful() && response.body().getData() != null){
|
||||
if(response.body().isSuccess()){
|
||||
DialogHelper.showDialogWithPositiveButton(BaseActivity.currentActivity, response.body().getData().getSuccessMessage());
|
||||
getCartItemCount();
|
||||
getCartItemCount(response.body().getData().getSuccessMessage());
|
||||
}
|
||||
else
|
||||
DialogHelper.showDialogWithPositiveButton(BaseActivity.currentActivity, response.body().getData().getErrorMessage());
|
||||
@@ -375,7 +378,7 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
private void getCartItemCount(){
|
||||
private void getCartItemCount(final String dialogMessage){
|
||||
|
||||
|
||||
/*
|
||||
@@ -403,14 +406,16 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
SharedPrefsHelper.setCartItemCount(response.body().getData().getProducts().size());
|
||||
SharedPrefsHelper.setCartTotalPrice(PriceHelper.removeCurrencyFromPrice(response.body().getData().getCartTotalModel().getText()));
|
||||
|
||||
/*
|
||||
MainActivity mainActivity = (MainActivity) BaseActivity.currentActivity;
|
||||
mainActivity.setCartItemCount();
|
||||
*/
|
||||
setResult(RESULT_OK);
|
||||
|
||||
finish();
|
||||
|
||||
DialogHelper.showOneButtonDialogWithCallback(
|
||||
dialogMessage,
|
||||
new MaterialDialog.SingleButtonCallback() {
|
||||
@Override
|
||||
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.pizzaleu.android.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
@@ -8,6 +9,9 @@ import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -326,8 +330,7 @@ public class ProductDetailsActivity extends BaseActivity {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
if(response.isSuccessful() && response.body().getData() != null){
|
||||
if(response.body().isSuccess()){
|
||||
DialogHelper.showDialogWithPositiveButton(BaseActivity.currentActivity, response.body().getData().getSuccessMessage());
|
||||
getCartItemCount();
|
||||
getCartItemCount(response.body().getData().getSuccessMessage());
|
||||
}
|
||||
else
|
||||
DialogHelper.showDialogWithPositiveButton(BaseActivity.currentActivity, response.body().getData().getErrorMessage());
|
||||
@@ -376,7 +379,7 @@ public class ProductDetailsActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
private void getCartItemCount(){
|
||||
private void getCartItemCount(final String dialogMessage){
|
||||
/*
|
||||
Call<ResponseObject<CartInfoModel>> call = ApiService.apiInterface.getCartProducts(
|
||||
"/" + SessionHelper.getSelectedStore().getStoreName() + ApiEndPoints.API_GET_CART_PRODUCTS + SessionHelper.getCustomerToken().getToken());
|
||||
@@ -401,14 +404,16 @@ public class ProductDetailsActivity extends BaseActivity {
|
||||
SharedPrefsHelper.setCartItemCount(response.body().getData().getProducts().size());
|
||||
SharedPrefsHelper.setCartTotalPrice(PriceHelper.removeCurrencyFromPrice(response.body().getData().getCartTotalModel().getText()));
|
||||
|
||||
/*
|
||||
MainActivity mainActivity = (MainActivity) BaseActivity.currentActivity;
|
||||
mainActivity.setCartItemCount();
|
||||
*/
|
||||
setResult(RESULT_OK);
|
||||
|
||||
finish();
|
||||
|
||||
DialogHelper.showOneButtonDialogWithCallback(
|
||||
dialogMessage,
|
||||
new MaterialDialog.SingleButtonCallback() {
|
||||
@Override
|
||||
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -247,6 +247,13 @@ public class DialogHelper {
|
||||
|
||||
public static void showOneButtonDialogWithCallback(String message,
|
||||
MaterialDialog.SingleButtonCallback singleButtonCallback){
|
||||
showOneButtonDialogWithCallback(message, singleButtonCallback, true);
|
||||
}
|
||||
|
||||
|
||||
public static void showOneButtonDialogWithCallback(String message,
|
||||
MaterialDialog.SingleButtonCallback singleButtonCallback,
|
||||
boolean cancelable){
|
||||
new MaterialDialog.Builder(BaseActivity.currentActivity)
|
||||
.title(R.string.app_name)
|
||||
.content(message)
|
||||
@@ -254,6 +261,7 @@ public class DialogHelper {
|
||||
.contentColorRes(R.color.black)
|
||||
.positiveText(R.string.ok)
|
||||
.onPositive(singleButtonCallback)
|
||||
.cancelable(cancelable)
|
||||
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
|
||||
.show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user