Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class PFLockScreenFragment extends Fragment {
private final PFPinCodeViewModel mPFPinCodeViewModel = new PFPinCodeViewModel();

private View.OnClickListener mOnLeftButtonClickListener = null;
private OnEncryptionInProgressListener mOnEncryptionInProgressListener = null;

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
Expand Down Expand Up @@ -351,11 +352,17 @@ public void onCodeNotCompleted(String code) {
private final View.OnClickListener mOnNextButtonClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnEncryptionInProgressListener != null) {
mOnEncryptionInProgressListener.onEncryptionInProgress(true);
}
mPFPinCodeViewModel.encodePin(getContext(), mCode).observe(
PFLockScreenFragment.this,
new Observer<PFResult<String>>() {
@Override
public void onChanged(@Nullable PFResult<String> result) {
if (mOnEncryptionInProgressListener != null) {
mOnEncryptionInProgressListener.onEncryptionInProgress(false);
}
if (result == null) {
return;
}
Expand Down Expand Up @@ -412,6 +419,10 @@ public void setOnLeftButtonClickListener(View.OnClickListener onLeftButtonClickL
this.mOnLeftButtonClickListener = onLeftButtonClickListener;
}

public void setOnEncryptionInProgressListener(OnEncryptionInProgressListener onEncryptionInProgressListener) {
this.mOnEncryptionInProgressListener = onEncryptionInProgressListener;
}

/*private void showFingerprintAlertDialog(Context context) {
new AlertDialog.Builder(context).setTitle("Fingerprint").setMessage(
"Would you like to use fingerprint for future login?")
Expand Down Expand Up @@ -502,6 +513,20 @@ public interface OnPFLockScreenLoginListener {
}


/**
* Callback interface to track when encryption is in progress. You can use this to show a
* progress bar or other loading indicators.
*/
public interface OnEncryptionInProgressListener {

/**
* Callback method for when encryption has started, i.e. when user taps "Next" button
* @param inProgress true if encryption is in progress, false if it has finished
*/
void onEncryptionInProgress(boolean inProgress);
}


}


Expand Down