diff --git a/android/examples/PubnubExample/res/layout/usage.xml b/android/examples/PubnubExample/res/layout/usage.xml index a5a8f6754..867516d04 100644 --- a/android/examples/PubnubExample/res/layout/usage.xml +++ b/android/examples/PubnubExample/res/layout/usage.xml @@ -120,6 +120,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/option15" /> + \ No newline at end of file diff --git a/android/examples/PubnubExample/res/menu/activity_main.xml b/android/examples/PubnubExample/res/menu/activity_main.xml index 41be348fa..8a1c582d2 100644 --- a/android/examples/PubnubExample/res/menu/activity_main.xml +++ b/android/examples/PubnubExample/res/menu/activity_main.xml @@ -14,5 +14,5 @@ - + \ No newline at end of file diff --git a/android/examples/PubnubExample/res/values/strings.xml b/android/examples/PubnubExample/res/values/strings.xml index 356a8ab1c..a870ddeca 100644 --- a/android/examples/PubnubExample/res/values/strings.xml +++ b/android/examples/PubnubExample/res/values/strings.xml @@ -34,6 +34,7 @@ Set Retry Interval Set Subscribe Timeout Set Non Subscribe Timeout + Set Window Interval \ No newline at end of file diff --git a/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java b/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java index 2f3e4c096..6a25f8856 100644 --- a/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java +++ b/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java @@ -163,6 +163,10 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.option15: setNonSubscribeTimeout(); return true; + + case R.id.option16: + setWindowInterval(); + return true; default: return super.onOptionsItemSelected(item); } @@ -564,6 +568,26 @@ public void onClick(DialogInterface dialog, int which) { AlertDialog alert = builder.create(); alert.show(); } + private void setWindowInterval() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Set Window Interval"); + builder.setMessage("Enter Window interval in milliseconds"); + final EditText edInterval = new EditText(this); + edInterval.setInputType(InputType.TYPE_CLASS_NUMBER); + builder.setView(edInterval); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.setWindowInterval(Integer.parseInt(edInterval + .getText().toString())); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } private void toggleResumeOnReconnect() { pubnub.setResumeOnReconnect(pubnub.isResumeOnReconnect() ? false : true); diff --git a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java index 256612f9e..7a66204e3 100644 --- a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java +++ b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java @@ -504,7 +504,7 @@ private void setMaxRetries(int maxRetries) { private void setRetryInterval(int retryInterval) { pubnub.setRetryInterval(retryInterval); } - + private void setWindowInterval(int windowInterval) { pubnub.setWindowInterval(windowInterval); } diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java index 33f36f9c4..7a7f44569 100644 --- a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java +++ b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java @@ -84,9 +84,9 @@ public boolean isResumeOnReconnect() { public void setRetryInterval(int retryInterval) { subscribeManager.setRetryInterval(retryInterval); } - + /** - * This method sets window interval for subscribe. + * This method sets window interval for subscribe. * * @param windowInterval * Window Interval in milliseconds @@ -102,7 +102,7 @@ public void setWindowInterval(int windowInterval) { public int getRetryInterval() { return subscribeManager.retryInterval; } - + /** * Returns current window interval for subscribe * @return Current Window Interval in milliseconds diff --git a/java/srcPubnubApi/com/pubnub/api/RequestManager.java b/java/srcPubnubApi/com/pubnub/api/RequestManager.java index 005010e15..251297fd4 100644 --- a/java/srcPubnubApi/com/pubnub/api/RequestManager.java +++ b/java/srcPubnubApi/com/pubnub/api/RequestManager.java @@ -263,7 +263,7 @@ public void setRetryInterval(int retryInterval) { ((SubscribeWorker) _workers[i]).setRetryInterval(retryInterval); } } - + public void setWindowInterval(int windowInterval) { this.windowInterval = windowInterval; for (int i = 0; i < _workers.length; i++) { @@ -325,14 +325,14 @@ abstract class AbstractSubscribeWorker extends Worker { this.maxRetries = maxRetries; this.retryInterval= retryInterval; } - + AbstractSubscribeWorker(Vector _requestQueue, int connectionTimeout, int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { - super(_requestQueue, connectionTimeout, requestTimeout, headers); - this.maxRetries = maxRetries; - this.retryInterval= retryInterval; - this.windowInterval = windowInterval; - } + super(_requestQueue, connectionTimeout, requestTimeout, headers); + this.maxRetries = maxRetries; + this.retryInterval= retryInterval; + this.windowInterval = windowInterval; + } public void setMaxRetries(int maxRetries) { this.maxRetries = maxRetries; @@ -341,7 +341,7 @@ public void setMaxRetries(int maxRetries) { public void setRetryInterval(int retryInterval) { this.retryInterval = retryInterval; } - + public void setWindowInterval(int windowInterval) { this.windowInterval = windowInterval; }