Skip to content

Commit cf8a235

Browse files
author
Antonis Tsakiridis
committed
Fixed #400: Olympus messages Activity not updated on connectivity change
1 parent 2a4f06d commit cf8a235

File tree

10 files changed

+82
-36
lines changed

10 files changed

+82
-36
lines changed

Examples/restcomm-olympus/app/app.iml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@
6464
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
6565
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
6666
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
67-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
68-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
69-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
70-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
71-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
72-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
73-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
74-
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
7567
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
7668
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
7769
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
@@ -80,6 +72,14 @@
8072
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
8173
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
8274
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
75+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
76+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
77+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
78+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
79+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
80+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
81+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
82+
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
8383
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
8484
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
8585
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Thu Sep 22 12:46:15 EEST 2016
2-
VERSION_CODE=1467
1+
#Thu Sep 22 15:59:34 EEST 2016
2+
VERSION_CODE=1479

Examples/restcomm-olympus/app/src/main/java/org/restcomm/android/olympus/MainActivity.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,8 @@ public void handleConnectivityUpdate(RCConnectivityStatus connectivityStatus, St
418418
handleExternalCall();
419419
}
420420

421-
//if (connectivityStatus != this.previousConnectivityStatus) {
422-
//showOkAlert("RCDevice connectivity change", text);
423-
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
424-
this.previousConnectivityStatus = connectivityStatus;
425-
//}
421+
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
422+
this.previousConnectivityStatus = connectivityStatus;
426423
}
427424

428425
// Handle call issued by external App via CALL intent

Examples/restcomm-olympus/app/src/main/java/org/restcomm/android/olympus/MessageActivity.java

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ public void onServiceConnected(ComponentName className, IBinder service)
189189
RCDevice.RCDeviceBinder binder = (RCDevice.RCDeviceBinder) service;
190190
device = binder.getService();
191191

192+
// needed if we are returning from Message screen that becomes the Device listener
193+
device.setDeviceListener(this);
194+
192195
// We have the device reference, let's handle the call
193196
handleMessage(getIntent());
194197

@@ -270,43 +273,39 @@ public void onClick(View view)
270273
*/
271274
public void onInitialized(RCDevice device, RCDeviceListener.RCConnectivityStatus connectivityStatus, int statusCode, String statusText)
272275
{
273-
276+
Log.i(TAG, "%% onInitialized");
274277
}
275278

276279
public void onInitializationError(int errorCode, String errorText)
277280
{
278-
281+
Log.i(TAG, "%% onInitializationError");
279282
}
280283

281284
public void onStartListening(RCDevice device, RCConnectivityStatus connectivityStatus)
282285
{
283-
286+
Log.i(TAG, "%% onStartListening");
284287
}
285288

286289
public void onStopListening(RCDevice device)
287290
{
288-
291+
Log.i(TAG, "%% onStopListening");
289292
}
290293

291294
public void onStopListening(RCDevice device, int errorCode, String errorText)
292295
{
293-
showOkAlert("RCDevice Error", errorText);
294-
/*
295-
if (errorCode == RCClient.ErrorCodes.NO_CONNECTIVITY.ordinal()) {
296-
showOkAlert("No Wifi Connectivity", errorText);
297-
}
298-
else if (errorCode == RCClient.ErrorCodes.GENERIC_ERROR.ordinal()) {
299-
showOkAlert("Generic Error", errorText);
300-
}
301-
else {
302-
showOkAlert("Unknown Error", "Unknown Restcomm Client error");
303-
}
304-
*/
296+
if (errorCode == RCClient.ErrorCodes.SUCCESS.ordinal()) {
297+
handleConnectivityUpdate(RCConnectivityStatus.RCConnectivityStatusNone, "RCDevice: " + errorText);
298+
}
299+
else {
300+
handleConnectivityUpdate(RCConnectivityStatus.RCConnectivityStatusNone, "RCDevice Error: " + errorText);
301+
}
305302
}
306303

307304
public void onConnectivityUpdate(RCDevice device, RCConnectivityStatus connectivityStatus)
308305
{
306+
Log.i(TAG, "%% onConnectivityUpdate");
309307

308+
handleConnectivityUpdate(connectivityStatus, null);
310309
}
311310

312311
public void onMessageSent(RCDevice device, int statusCode, String statusText)
@@ -391,4 +390,28 @@ public boolean onOptionsItemSelected(MenuItem item)
391390
return super.onOptionsItemSelected(item);
392391
}
393392

393+
public void handleConnectivityUpdate(RCConnectivityStatus connectivityStatus, String text)
394+
{
395+
if (text == null) {
396+
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusNone) {
397+
text = "RCDevice connectivity change: Lost connectivity";
398+
}
399+
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusWiFi) {
400+
text = "RCDevice connectivity change: Reestablished connectivity (Wifi)";
401+
}
402+
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusCellular) {
403+
text = "RCDevice connectivity change: Reestablished connectivity (Cellular)";
404+
}
405+
}
406+
407+
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusNone) {
408+
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorTextSecondary)));
409+
}
410+
else {
411+
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
412+
}
413+
414+
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
415+
}
416+
394417
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="#FF000000"
8+
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
9+
</vector>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24.0"
5+
android:viewportHeight="24.0">
6+
<path
7+
android:fillColor="#FF000000"
8+
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
9+
</vector>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto">
4+
5+
<item android:id="@+id/action_save_settings"
6+
android:icon="@drawable/ic_done_24dp"
7+
android:title="@string/action_video_call"
8+
app:showAsAction="ifRoom"/>
9+
10+
</menu>

Examples/restcomm-olympus/app/src/main/res/values/styles.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
<item name="windowActionBar">false</item>
1414
<item name="windowNoTitle">true</item>
15-
<item name="android:switchPreferenceStyle">@android:style/Preference.DeviceDefault.SwitchPreference</item>
16-
<item name="android:switchStyle">@android:style/Widget.Material.Light.CompoundButton.Switch</item>
1715
</style>
1816

1917
<!-- Styling for Alert Dialogs -->
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Thu Sep 22 12:46:15 EEST 2016
2-
VERSION_CODE=1487
1+
#Thu Sep 22 15:59:34 EEST 2016
2+
VERSION_CODE=1499

restcomm.android.sdk/src/main/java/org/restcomm/android/sdk/RCDevice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public static class ParameterKeys {
250250
// is an incoming call ringing, triggered by the Notification subsystem?
251251
private boolean activeCallNotification = false;
252252
// Numbers here refer to: delay duration, on duration 1, off duration 1, on duration 2, off duration2, ...
253-
long[] notificationVibrationPattern = { 0, 100, 200, 100, 200 };
253+
long[] notificationVibrationPattern = { 0, 100, 100, 100, 1000 };
254254
int notificationColor = Color.parseColor("#3c5866");
255255
int[] notificationColorPattern = { 2000, 2000 };
256256
private boolean foregroundNoticationActive = false;

0 commit comments

Comments
 (0)