From 95bdc725c082388813f025557a98ccd7c02418ea Mon Sep 17 00:00:00 2001 From: dtvv Date: Wed, 17 Oct 2018 00:31:36 -0500 Subject: [PATCH] -When try to change to none pattern either pin it should ask for confirmation -When the security mode is changed to none show toast of it -When the security mode is set to none and you change to pattern that erase the visible fake password --- .../fragments/NoneSecurityFragment.java | 49 ++++++++++++++++++- .../fragments/PinSecurityFragment.java | 9 ++++ .../res/layout/fragment_none_security.xml | 23 ++++++--- app/src/main/res/values/strings.xml | 2 + 4 files changed, 74 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/NoneSecurityFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/NoneSecurityFragment.java index 090cfe2..bee1286 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/NoneSecurityFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/NoneSecurityFragment.java @@ -3,18 +3,30 @@ package cy.agorise.crystalwallet.fragments; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; +import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; +import android.widget.Toast; + +import org.jetbrains.annotations.NotNull; import java.util.List; +import butterknife.BindView; import butterknife.ButterKnife; +import butterknife.OnClick; import cy.agorise.crystalwallet.R; +import cy.agorise.crystalwallet.activities.BoardActivity; import cy.agorise.crystalwallet.application.CrystalSecurityMonitor; +import cy.agorise.crystalwallet.dialogs.material.DialogMaterial; +import cy.agorise.crystalwallet.dialogs.material.NegativeResponse; +import cy.agorise.crystalwallet.dialogs.material.PositiveResponse; +import cy.agorise.crystalwallet.dialogs.material.QuestionDialog; import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.validators.PinSecurityValidator; @@ -25,6 +37,12 @@ import cy.agorise.crystalwallet.viewmodels.validators.PinSecurityValidator; public class NoneSecurityFragment extends Fragment { + @BindView(R.id.btnOK) + Button btnOK; + + + + public NoneSecurityFragment() { // Required empty public constructor } @@ -43,14 +61,41 @@ public class NoneSecurityFragment extends Fragment { View v = inflater.inflate(R.layout.fragment_none_security, container, false); ButterKnife.bind(this, v); + + return v; } - @Override + @OnClick(R.id.btnOK) + public void btnOKClic(){ + + /* + * Question if user is sure to remove the security + * */ + final QuestionDialog questionDialog = new QuestionDialog(getActivity()); + questionDialog.setText(getActivity().getString(R.string.question_continue)); + questionDialog.setOnNegative(new NegativeResponse() { + @Override + public void onNegative(@NotNull DialogMaterial dialogMaterial) { + } + }); + questionDialog.setOnPositive(new PositiveResponse() { + @Override + public void onPositive() { + CrystalSecurityMonitor.getInstance(null).clearSecurity(); + + Toast.makeText(getActivity().getBaseContext(),getActivity().getString(R.string.Security_mode_changed_to_none), + Toast.LENGTH_SHORT).show(); + } + }); + questionDialog.show(); + } + + /*@Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser) { CrystalSecurityMonitor.getInstance(null).clearSecurity(); } - } + }*/ } diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/PinSecurityFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/PinSecurityFragment.java index 98c32dc..1a76695 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/PinSecurityFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/PinSecurityFragment.java @@ -117,6 +117,11 @@ public class PinSecurityFragment extends Fragment implements UIValidatorListener default: + if(etNewPin!=null && etConfirmPin!=null) { + etNewPin.setText(""); + etConfirmPin.setText(""); + } + } /* @@ -152,6 +157,10 @@ public class PinSecurityFragment extends Fragment implements UIValidatorListener default: + if(etNewPin!=null && etConfirmPin!=null) { + etNewPin.setText(""); + etConfirmPin.setText(""); + } } /* diff --git a/app/src/main/res/layout/fragment_none_security.xml b/app/src/main/res/layout/fragment_none_security.xml index 3c4da4e..05386f8 100644 --- a/app/src/main/res/layout/fragment_none_security.xml +++ b/app/src/main/res/layout/fragment_none_security.xml @@ -1,20 +1,29 @@ - + android:layout_centerInParent="true"/> - \ No newline at end of file +