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:
Alexander Bakker 2018-06-06 16:15:31 +02:00
parent 9859011a6d
commit 4a4ab1a82c
47 changed files with 1230 additions and 861 deletions

View 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();
}
}