mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-24 08:21:15 +01:00
Bangle.js:actTrk: simplify timeout
This commit is contained in:
parent
c250a70196
commit
f97dda37c7
@ -4,7 +4,6 @@ import static java.lang.Math.cos;
|
|||||||
import static java.lang.Math.sqrt;
|
import static java.lang.Math.sqrt;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@ -63,7 +62,6 @@ class BangleJSActivityTrack extends BangleJSDeviceSupport {
|
|||||||
static TimerTask timeoutTask;
|
static TimerTask timeoutTask;
|
||||||
|
|
||||||
//we are going to use a handler to be able
|
//we are going to use a handler to be able
|
||||||
static final Handler handler = new Handler();
|
|
||||||
|
|
||||||
private static void startTimeout(GBDevice device, Context context) {
|
private static void startTimeout(GBDevice device, Context context) {
|
||||||
//set a new Timer
|
//set a new Timer
|
||||||
@ -87,17 +85,11 @@ class BangleJSActivityTrack extends BangleJSDeviceSupport {
|
|||||||
private static void initializeTimeoutTask(GBDevice device, Context context) {
|
private static void initializeTimeoutTask(GBDevice device, Context context) {
|
||||||
|
|
||||||
timeoutTask = new TimerTask() {
|
timeoutTask = new TimerTask() {
|
||||||
public void run() {
|
|
||||||
|
|
||||||
//use a handler to run a toast that shows the current timestamp
|
|
||||||
handler.post(new Runnable() {
|
|
||||||
public void run() {
|
public void run() {
|
||||||
signalFetchingEnded(device, context);
|
signalFetchingEnded(device, context);
|
||||||
LOG.warn(context.getString(R.string.busy_task_fetch_sports_details_interrupted));
|
LOG.warn(context.getString(R.string.busy_task_fetch_sports_details_interrupted));
|
||||||
GB.toast(context.getString(R.string.busy_task_fetch_sports_details_interrupted), Toast.LENGTH_LONG, GB.INFO);
|
GB.toast(context.getString(R.string.busy_task_fetch_sports_details_interrupted), Toast.LENGTH_LONG, GB.INFO);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user