-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
This commit is contained in:
dtvv 2018-10-17 00:31:36 -05:00
parent 91bc799310
commit 95bdc725c0
4 changed files with 74 additions and 9 deletions

View file

@ -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;
}
@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();
}
}
}*/
}

View file

@ -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("");
}
}
/*

View file

@ -1,20 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="0dp"
android:id="@+id/txtFirst"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="It is recommended to use some kind of security."
android:textAlignment="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_centerInParent="true"/>
</android.support.constraint.ConstraintLayout>
<Button
android:id="@+id/btnOK"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/txtFirst"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/WhiteButton"
android:textColor="@color/black"
android:text="@string/ok"/>
</RelativeLayout>

View file

@ -371,6 +371,8 @@
<string name="question_continue">¿Are you sure to continue?</string>
<string name="Security_mode_changed_to_none">Security mode changed to none</string>
<string name="select">"Select</string>
<string name="are_you_sure">"Are you sure?</string>
<string name="is_already_added">is already added</string>