-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fingerprint dialog behaviour after rotation
- Loading branch information
Denis Zakharov
committed
Oct 11, 2019
1 parent
95fe0a2
commit a49d8b2
Showing
4 changed files
with
76 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
android-biometric-compat/src/main/java/com/exxbrain/android/biometric/LifecycleEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.exxbrain.android.biometric; | ||
|
||
import android.app.Fragment; | ||
import android.arch.lifecycle.Lifecycle; | ||
import android.arch.lifecycle.LifecycleObserver; | ||
import android.arch.lifecycle.OnLifecycleEvent; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
class LifecycleEvents { | ||
LifecycleObserver observer; | ||
LifecycleEvents(LifecycleObserver observer) { | ||
this.observer = observer; | ||
} | ||
|
||
void raise(Lifecycle.Event event, Fragment fragment) { | ||
Method[] methods = observer.getClass().getDeclaredMethods(); | ||
for(Method mt : methods) { | ||
if (mt.isAnnotationPresent(OnLifecycleEvent.class)) { | ||
OnLifecycleEvent annotation = mt.getAnnotation(OnLifecycleEvent.class); | ||
if (annotation.value() == event) { | ||
try { | ||
mt.invoke(observer, fragment); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |