Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 2d484b2

Browse files
kunall17niftynei
authored andcommitted
Setup interval in AsyncGetEvents
1 parent bf8c90f commit 2d484b2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/src/main/java/com/zulip/android/networking/AsyncGetEvents.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class AsyncGetEvents extends Thread {
4141
private static final String POINTER = "pointer";
4242
private ZulipActivity activity;
4343
private ZulipApp app;
44+
private static int interval = 1000;
45+
private boolean calledFromWidget = false;
4446

4547
private boolean keepThisRunning = true;
4648
private HTTPRequest request;
@@ -56,6 +58,15 @@ public AsyncGetEvents(ZulipActivity zulipActivity) {
5658
request = new HTTPRequest(app);
5759
}
5860

61+
public AsyncGetEvents(ZulipApp zulipApp, int interval) {
62+
super();
63+
app = zulipApp;
64+
activity = null;
65+
request = new HTTPRequest(app);
66+
calledFromWidget = true;
67+
this.interval = interval;
68+
}
69+
5970
public void start() {
6071
registeredOrGotEventsThisRun = false;
6172
super.start();
@@ -174,7 +185,7 @@ public void run() {
174185
} catch (JSONException e) {
175186
backoff(e);
176187
}
177-
Thread.sleep(1000);
188+
Thread.sleep(interval);
178189
}
179190
} catch (Exception e) {
180191
ZLog.logException(e);

0 commit comments

Comments
 (0)