mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-04 20:30:36 +00:00
Bunch of refactoring
- Get rid of KeyProfile and use DatabaseEntry directly - Don't store Google auth style urls in the db, but use separate fields - Update testdata to reflect db format changes - Lay the ground work for HOTP support - Refactor KeyInfo and split it into OtpInfo, TotpInto and HotpInfo - Surely some other stuff I forgot about
This commit is contained in:
parent
9859011a6d
commit
4a4ab1a82c
47 changed files with 1230 additions and 861 deletions
41
app/src/main/java/me/impy/aegis/helpers/UiRefresher.java
Normal file
41
app/src/main/java/me/impy/aegis/helpers/UiRefresher.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package me.impy.aegis.helpers;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
public class UiRefresher {
|
||||
private boolean _running;
|
||||
private Listener _listener;
|
||||
private Handler _handler;
|
||||
|
||||
public UiRefresher(Listener listener) {
|
||||
_listener = listener;
|
||||
_handler = new Handler();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (_running) {
|
||||
return;
|
||||
}
|
||||
_running = true;
|
||||
|
||||
_listener.onRefresh();
|
||||
_handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (_running) {
|
||||
_listener.onRefresh();
|
||||
_handler.postDelayed(this, _listener.getMillisTillNextRefresh());
|
||||
}
|
||||
}
|
||||
}, _listener.getMillisTillNextRefresh());
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
_running = false;
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onRefresh();
|
||||
long getMillisTillNextRefresh();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue