Skip to content

Commit

Permalink
Fixed RestComm#400: Olympus messages Activity not updated on connecti…
Browse files Browse the repository at this point in the history
…vity change
  • Loading branch information
Antonis Tsakiridis committed Sep 22, 2016
1 parent 2a4f06d commit cf8a235
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 36 deletions.
16 changes: 8 additions & 8 deletions Examples/restcomm-olympus/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
Expand All @@ -80,6 +72,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
Expand Down
4 changes: 2 additions & 2 deletions Examples/restcomm-olympus/app/olympus-version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Sep 22 12:46:15 EEST 2016
VERSION_CODE=1467
#Thu Sep 22 15:59:34 EEST 2016
VERSION_CODE=1479
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,8 @@ public void handleConnectivityUpdate(RCConnectivityStatus connectivityStatus, St
handleExternalCall();
}

//if (connectivityStatus != this.previousConnectivityStatus) {
//showOkAlert("RCDevice connectivity change", text);
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
this.previousConnectivityStatus = connectivityStatus;
//}
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
this.previousConnectivityStatus = connectivityStatus;
}

// Handle call issued by external App via CALL intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ public void onServiceConnected(ComponentName className, IBinder service)
RCDevice.RCDeviceBinder binder = (RCDevice.RCDeviceBinder) service;
device = binder.getService();

// needed if we are returning from Message screen that becomes the Device listener
device.setDeviceListener(this);

// We have the device reference, let's handle the call
handleMessage(getIntent());

Expand Down Expand Up @@ -270,43 +273,39 @@ public void onClick(View view)
*/
public void onInitialized(RCDevice device, RCDeviceListener.RCConnectivityStatus connectivityStatus, int statusCode, String statusText)
{

Log.i(TAG, "%% onInitialized");
}

public void onInitializationError(int errorCode, String errorText)
{

Log.i(TAG, "%% onInitializationError");
}

public void onStartListening(RCDevice device, RCConnectivityStatus connectivityStatus)
{

Log.i(TAG, "%% onStartListening");
}

public void onStopListening(RCDevice device)
{

Log.i(TAG, "%% onStopListening");
}

public void onStopListening(RCDevice device, int errorCode, String errorText)
{
showOkAlert("RCDevice Error", errorText);
/*
if (errorCode == RCClient.ErrorCodes.NO_CONNECTIVITY.ordinal()) {
showOkAlert("No Wifi Connectivity", errorText);
}
else if (errorCode == RCClient.ErrorCodes.GENERIC_ERROR.ordinal()) {
showOkAlert("Generic Error", errorText);
}
else {
showOkAlert("Unknown Error", "Unknown Restcomm Client error");
}
*/
if (errorCode == RCClient.ErrorCodes.SUCCESS.ordinal()) {
handleConnectivityUpdate(RCConnectivityStatus.RCConnectivityStatusNone, "RCDevice: " + errorText);
}
else {
handleConnectivityUpdate(RCConnectivityStatus.RCConnectivityStatusNone, "RCDevice Error: " + errorText);
}
}

public void onConnectivityUpdate(RCDevice device, RCConnectivityStatus connectivityStatus)
{
Log.i(TAG, "%% onConnectivityUpdate");

handleConnectivityUpdate(connectivityStatus, null);
}

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

public void handleConnectivityUpdate(RCConnectivityStatus connectivityStatus, String text)
{
if (text == null) {
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusNone) {
text = "RCDevice connectivity change: Lost connectivity";
}
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusWiFi) {
text = "RCDevice connectivity change: Reestablished connectivity (Wifi)";
}
if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusCellular) {
text = "RCDevice connectivity change: Reestablished connectivity (Cellular)";
}
}

if (connectivityStatus == RCConnectivityStatus.RCConnectivityStatusNone) {
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorTextSecondary)));
}
else {
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
}

Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG).show();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
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"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>
10 changes: 10 additions & 0 deletions Examples/restcomm-olympus/app/src/main/res/menu/menu_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item android:id="@+id/action_save_settings"
android:icon="@drawable/ic_done_24dp"
android:title="@string/action_video_call"
app:showAsAction="ifRoom"/>

</menu>
2 changes: 0 additions & 2 deletions Examples/restcomm-olympus/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:switchPreferenceStyle">@android:style/Preference.DeviceDefault.SwitchPreference</item>
<item name="android:switchStyle">@android:style/Widget.Material.Light.CompoundButton.Switch</item>
</style>

<!-- Styling for Alert Dialogs -->
Expand Down
4 changes: 2 additions & 2 deletions restcomm.android.sdk/restcomm-android-sdk-version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Sep 22 12:46:15 EEST 2016
VERSION_CODE=1487
#Thu Sep 22 15:59:34 EEST 2016
VERSION_CODE=1499
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static class ParameterKeys {
// is an incoming call ringing, triggered by the Notification subsystem?
private boolean activeCallNotification = false;
// Numbers here refer to: delay duration, on duration 1, off duration 1, on duration 2, off duration2, ...
long[] notificationVibrationPattern = { 0, 100, 200, 100, 200 };
long[] notificationVibrationPattern = { 0, 100, 100, 100, 1000 };
int notificationColor = Color.parseColor("#3c5866");
int[] notificationColorPattern = { 2000, 2000 };
private boolean foregroundNoticationActive = false;
Expand Down

0 comments on commit cf8a235

Please sign in to comment.