Skip to content

Commit

Permalink
clean exit from specc and eco app
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Monni committed Feb 13, 2015
1 parent 6add109 commit 98bb1a5
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
9 changes: 9 additions & 0 deletions eco_app/res/layout/actionbar_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,14 @@

/>

<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/butExit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_close_clear_cancel"

/>


</LinearLayout>
40 changes: 40 additions & 0 deletions eco_app/src/most/demo/ecoapp/EcoTeleconsultationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class EcoTeleconsultationActivity extends ActionBarActivity implements Ha
private boolean remoteHold = false;

private boolean accountRegistered = false;
private boolean exitFromAppRequest = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -167,6 +168,22 @@ else if (this.tcState==TeleconsultationState.REMOTE_HOLDING)

}

private void exitFromApp() {

Log.d(TAG,"Called exitFromApp()");

this.exitFromAppRequest = true;

if (this.myVoip!=null)
{
this.myVoip.destroyLib();
}
else
{
Log.d(TAG, "Voip Library deinitialized. Exiting the app");
this.finish();
}
}
private void setupStreamLib()
{
String streamName = "Teleconsultation Stream";
Expand Down Expand Up @@ -221,6 +238,16 @@ public void onClick(View v) {

}
});

ImageButton butExit = (ImageButton) actionBar.getCustomView().findViewById(R.id.butExit);
butExit.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
exitFromApp();

}});

actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
| ActionBar.DISPLAY_SHOW_HOME);

Expand Down Expand Up @@ -443,6 +470,11 @@ else if(myEventBundle.getEvent()==VoipEvent.BUDDY_HOLDING)
if (myVoip.getCall().getState()== CallState.ACTIVE || myVoip.getCall().getState()== CallState.HOLDING)
setTeleconsultationState(TeleconsultationState.REMOTE_HOLDING);
}
else if(myEventBundle.getEvent()==VoipEvent.BUDDY_DISCONNECTED)
{
setTeleconsultationState(TeleconsultationState.IDLE);
}


}

Expand All @@ -467,6 +499,14 @@ else if (myEventBundle.getEvent()==VoipEvent.BUDDY_HOLDING) {
else if (myEventBundle.getEvent()==VoipEvent.CALL_HOLDING) {
this.app.setTeleconsultationState(TeleconsultationState.HOLDING);
}
else if (myEventBundle.getEvent()==VoipEvent.LIB_DEINITIALIZED)
{
if (exitFromAppRequest)
{
Log.d(TAG, "Voip Lib successfully deinitialized. Exit from app...");
finish();
}
}



Expand Down
2 changes: 1 addition & 1 deletion external_libs/most-voip
Submodule most-voip updated from 101874 to 47c26f
14 changes: 12 additions & 2 deletions spec_app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@
android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
Expand Down
4 changes: 2 additions & 2 deletions spec_app/res/layout/login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="" />
android:text="most" />


<TextView
Expand All @@ -35,7 +35,7 @@
android:ems="10"
android:maxLength="4"
android:inputType="textPassword"
android:text="" />
android:text="most" />

<Button android:id="@+id/butLogin"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,10 @@ else if(myEventBundle.getEvent()==VoipEvent.BUDDY_HOLDING)
if (myVoip.getCall().getState()== CallState.ACTIVE || myVoip.getCall().getState()== CallState.HOLDING)
setTeleconsultationState(TeleconsultationState.REMOTE_HOLDING);
}
else if(myEventBundle.getEvent()==VoipEvent.BUDDY_DISCONNECTED)
{
setTeleconsultationState(TeleconsultationState.IDLE);
}

}

Expand Down

0 comments on commit 98bb1a5

Please sign in to comment.