Skip to content

Commit

Permalink
try to fix calledfromwrongthreadexception
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyrno42 committed Oct 12, 2018
1 parent 49571c9 commit 776801e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,17 @@ private class FingerprintManagerAuthenticationCallbackImpl
public void onAuthenticationError(int errorCode, CharSequence errString) {
animateHandler.removeMessages(AnimateHandler.WHAT_RESTORE_NORMAL_STATE);
if (errString != null) {
dialog.getStatus().setText(errString);
dialog.getStatus().post(new Runnable() {
public void run () {
dialog.getStatus().setText(errString);
}
});
}
dialog.getFingerprintIcon().setState(FingerprintIconView.State.ERROR);
dialog.getFingerprintIcon().post(new Runnable() {
public void run () {
dialog.getFingerprintIcon().setState(FingerprintIconView.State.ERROR);
}
});
animateHandler.sendEmptyMessageDelayed(AnimateHandler.WHAT_RESTORE_NORMAL_STATE, 2000);
callback.onAuthenticationError(errorCode, errString);
}
Expand All @@ -249,8 +257,16 @@ public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult re
@Override
public void onAuthenticationFailed() {
animateHandler.removeMessages(AnimateHandler.WHAT_RESTORE_NORMAL_STATE);
dialog.getFingerprintIcon().setState(FingerprintIconView.State.ERROR);
dialog.getStatus().setText(R.string.not_recognized_fingerprint_hint);
dialog.getFingerprintIcon().post(new Runnable() {
public void run () {
dialog.getFingerprintIcon().setState(FingerprintIconView.State.ERROR);
}
});
dialog.getStatus().post(new Runnable() {
public void run () {
dialog.getStatus().setText(R.string.not_recognized_fingerprint_hint);
}
});
animateHandler.sendEmptyMessageDelayed(AnimateHandler.WHAT_RESTORE_NORMAL_STATE, 2000);
callback.onAuthenticationFailed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void setState(State state, boolean animate) {
if (icon == null) {
icon = VectorDrawableCompat.create(getResources(), resId, getContext().getTheme());
}

setImageDrawable(icon);

if (icon instanceof Animatable) {
Expand Down

0 comments on commit 776801e

Please sign in to comment.