diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index ca79217b..3ee97a61 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -19,8 +19,8 @@ diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index f8f2acb7..85138e1e 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/CustomAlertDialog.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/CustomAlertDialog.java index 7b5b9cb7..59c71379 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/CustomAlertDialog.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/CustomAlertDialog.java @@ -3,6 +3,8 @@ package com.gmeremit.online.gmeremittance_native.customwidgets; import android.app.Dialog; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.graphics.drawable.AnimatedVectorDrawableCompat; +import android.support.graphics.drawable.VectorDrawableCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.view.View; @@ -26,6 +28,8 @@ public class CustomAlertDialog extends android.support.v4.app.DialogFragment { private String positiveBtnString = null; private String negativeBtnString = null; + private AnimatedVectorDrawableCompat logo; + @Override public Dialog onCreateDialog(Bundle savedInstanceState) { @@ -36,56 +40,62 @@ public class CustomAlertDialog extends android.support.v4.app.DialogFragment { TextView dialogDescriptionTxt = dialogView.findViewById(R.id.txt_dialog_message); TextView dialogOkButtonTxt = dialogView.findViewById(R.id.btn_diaog_ok); TextView dialogCancelButtonTxt = dialogView.findViewById(R.id.btn_diaog_cancel); + if (positiveBtnString != null) dialogOkButtonTxt.setText(positiveBtnString); if (negativeBtnString != null) { dialogCancelButtonTxt.setText(negativeBtnString); dialogCancelButtonTxt.setVisibility(View.VISIBLE); } + builder.setView(dialogView); setCancelable(false); dialogDescriptionTxt.setText(descriptionString); - + logo = null; switch (alertType) { case ALERT: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.alert)); dialogTitleTxt.setText(getString(R.string.important_text)); - + imgStatusImgView.setImageDrawable(VectorDrawableCompat.create(getActivity().getResources(),R.drawable.vd_alert_ico,getActivity().getTheme())); break; + case FAILED: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.error)); String walletNumber = GmeApplication.getStorage().getString(PrefKeys.USER_WALLET_NUMBER, ""); String message = getString(R.string.error_text); - if (walletNumber.length()>0) + if (walletNumber.length() > 0) message += " - (" + walletNumber + ")"; dialogTitleTxt.setText(message); - + logo=AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_success_transition); break; + case BAD_REQUEST: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.server_errror)); dialogTitleTxt.setText(getString(R.string.operation_failed_text)); + logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_fail_transition); break; + case NO_INTERNET: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.no_internet)); dialogTitleTxt.setText(getString(R.string.connection_failed_text)); + logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_fail_transition); break; case SUCCESS: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.correct)); dialogTitleTxt.setText(getString(R.string.success_text)); + logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_success_transition); break; case ALERT_RETRY: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.alert)); - dialogTitleTxt.setText(getString(R.string.important_text)); + dialogTitleTxt.setText(getString(R.string.error_text)); dialogOkButtonTxt.setText(getString(R.string.retry_text)); + logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_fail_transition); break; default: - imgStatusImgView.setImageDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.error)); dialogTitleTxt.setText(getString(R.string.error_text)); + logo = AnimatedVectorDrawableCompat.create(getActivity(), R.drawable.avd_fail_transition); break; } + + if (logo != null) + imgStatusImgView.setImageDrawable(logo); dialogOkButtonTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -121,6 +131,14 @@ public class CustomAlertDialog extends android.support.v4.app.DialogFragment { } + @Override + public void onStart() { + super.onStart(); + if (logo != null && !logo.isRunning()) { + logo.start(); + } + } + @Override public void onDestroyView() { super.onDestroyView(); diff --git a/app/src/main/res/drawable/avd_fail_transition.xml b/app/src/main/res/drawable/avd_fail_transition.xml index ca8ff5bb..93edc651 100644 --- a/app/src/main/res/drawable/avd_fail_transition.xml +++ b/app/src/main/res/drawable/avd_fail_transition.xml @@ -7,21 +7,21 @@ + + + + + + diff --git a/app/src/main/res/drawable/vd_fail_ico.xml b/app/src/main/res/drawable/vd_fail_ico.xml index 6ed17e4c..2bf2f4f5 100644 --- a/app/src/main/res/drawable/vd_fail_ico.xml +++ b/app/src/main/res/drawable/vd_fail_ico.xml @@ -1,8 +1,8 @@ + android:pathData="M 0,0 m -5,0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0"/> @@ -27,7 +27,7 @@ + android:pathData="M 0,0 m -5,0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0"/> @@ -44,14 +44,14 @@ android:strokeAlpha="1" android:trimPathEnd="0" android:strokeWidth="1" - android:strokeColor="@android:color/holo_red_dark" + android:strokeColor="@color/colorPrimary" android:pathData="M 16 16 L 8 16 "/> diff --git a/app/src/main/res/drawable/vd_success_ico.xml b/app/src/main/res/drawable/vd_success_ico.xml index 44dec89b..8eaa091f 100644 --- a/app/src/main/res/drawable/vd_success_ico.xml +++ b/app/src/main/res/drawable/vd_success_ico.xml @@ -1,8 +1,8 @@ + android:pathData="M 0,0 m -5,0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0"/> @@ -27,7 +27,7 @@ + android:pathData="M 0,0 m -5,0 a 5,5 0 1,0 10,0 a 5,5 0 1,0 -10,0"/> @@ -43,7 +43,7 @@ android:strokeAlpha="1" android:trimPathEnd="0" android:strokeWidth="1" - android:strokeColor="@android:color/holo_red_dark" + android:strokeColor="@color/colorPrimary" android:pathData="M 9 13.7 L 9 16 L 16 16"/> diff --git a/app/src/main/res/layout/dialog_common_error.xml b/app/src/main/res/layout/dialog_common_error.xml index f42a7833..019ccd5f 100644 --- a/app/src/main/res/layout/dialog_common_error.xml +++ b/app/src/main/res/layout/dialog_common_error.xml @@ -4,22 +4,22 @@ android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/dialog_round" - android:paddingTop="28dp"> + android:paddingTop="@dimen/_13sdp">