Add chat in call

This commit is contained in:
Margaux Clerc 2015-11-05 15:40:47 +01:00
parent 5f2203fcd4
commit 92c066d239
5 changed files with 51 additions and 13 deletions

View file

@ -22,6 +22,16 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:padding="15dp"/> android:padding="15dp"/>
<ImageView
android:id="@+id/back_in_call"
android:src="@drawable/call_back"
android:background="@drawable/toolbar_button"
android:layout_width="70dp"
android:layout_height="match_parent"
android:padding="15dp"
android:visibility="gone"
android:layout_toRightOf="@+id/new_discussion"/>
<ImageView <ImageView
android:id="@+id/edit" android:id="@+id/edit"
android:src="@drawable/edit_list_button" android:src="@drawable/edit_list_button"

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- New settings --> <!-- New settings -->
<!-- TODO Migrate it in linphonerc -->
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool> <bool name="assistant_use_linphone_login_as_first_fragment">false</bool>
<bool name="hide_in_call_stats">false</bool> <bool name="hide_in_call_stats">false</bool>
<string name="default_domain">sip.linphone.org</string> <string name="default_domain">sip.linphone.org</string>

View file

@ -84,7 +84,7 @@ public class CallActivity extends Activity implements OnClickListener {
private ImageView switchCamera; private ImageView switchCamera;
private RelativeLayout mActiveCallHeader, sideMenuContent, avatar_layout; private RelativeLayout mActiveCallHeader, sideMenuContent, avatar_layout;
private ImageView pause, hangUp, dialer, video, micro, speaker, options, addCall, transfer, conference, conferenceStatus, contactPicture; private ImageView pause, hangUp, dialer, video, micro, speaker, options, addCall, transfer, conference, conferenceStatus, contactPicture;
private ImageView audioRoute, routeSpeaker, routeEarpiece, routeBluetooth, menu; private ImageView audioRoute, routeSpeaker, routeEarpiece, routeBluetooth, menu, chat;
private LinearLayout mNoCurrentCall, callInfo, mCallPaused; private LinearLayout mNoCurrentCall, callInfo, mCallPaused;
private ProgressBar videoProgress; private ProgressBar videoProgress;
private StatusFragment status; private StatusFragment status;
@ -327,6 +327,9 @@ public class CallActivity extends Activity implements OnClickListener {
numpad = (Numpad) findViewById(R.id.numpad); numpad = (Numpad) findViewById(R.id.numpad);
numpad.getBackground().setAlpha(240); numpad.getBackground().setAlpha(240);
chat = (ImageView) findViewById(R.id.chat);
chat.setOnClickListener(this);
//Others //Others
//Active Call //Active Call
@ -569,6 +572,9 @@ public class CallActivity extends Activity implements OnClickListener {
else if (id == R.id.dialer) { else if (id == R.id.dialer) {
hideOrDisplayNumpad(); hideOrDisplayNumpad();
} }
else if (id == R.id.chat) {
goToChatList();
}
else if (id == R.id.conference) { else if (id == R.id.conference) {
enterConference(); enterConference();
hideOrDisplayCallOptions(); hideOrDisplayCallOptions();
@ -653,7 +659,7 @@ public class CallActivity extends Activity implements OnClickListener {
} }
private void enabledConferenceButton(boolean enabled){ private void enabledConferenceButton(boolean enabled){
if(enabled) { if (enabled) {
conference.setEnabled(true); conference.setEnabled(true);
conference.setImageAlpha(250); conference.setImageAlpha(250);
} else { } else {
@ -1236,6 +1242,13 @@ public class CallActivity extends Activity implements OnClickListener {
finish(); finish();
} }
private void goToChatList() {
Intent intent = new Intent();
intent.putExtra("chat", true);
setResult(Activity.RESULT_FIRST_USER, intent);
finish();
}
public void acceptCallUpdate(boolean accept) { public void acceptCallUpdate(boolean accept) {
if (timer != null) { if (timer != null) {
timer.cancel(); timer.cancel();
@ -1450,7 +1463,6 @@ public class CallActivity extends Activity implements OnClickListener {
//CALL INFORMATION //CALL INFORMATION
private void displayCurrentCall(LinphoneCall call){ private void displayCurrentCall(LinphoneCall call){
//if(!isVideoEnabled(call)){ //if(!isVideoEnabled(call)){
// mActiveCallHeader.setVisibility(View.VISIBLE); // mActiveCallHeader.setVisibility(View.VISIBLE);
@ -1527,14 +1539,6 @@ public class CallActivity extends Activity implements OnClickListener {
return isCallPaused || isInConference; return isCallPaused || isInConference;
} }
private void displayOrHideContactPicture(LinearLayout callView, Uri pictureUri, Uri thumbnailUri, boolean hide) {
/*ImageView contactPicture = (ImageView) callView.findViewById(R.id.contactPicture);
if (pictureUri != null) {
}
callView.setVisibility(hide ? View.GONE : View.VISIBLE);*/
}
private void registerCallDurationTimer(View v, LinphoneCall call) { private void registerCallDurationTimer(View v, LinphoneCall call) {
int callDuration = call.getDuration(); int callDuration = call.getDuration();
if (callDuration == 0 && call.getState() != State.StreamsRunning) { if (callDuration == 0 && call.getState() != State.StreamsRunning) {

View file

@ -69,7 +69,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
private List<String> mConversations, mDrafts; private List<String> mConversations, mDrafts;
private ListView chatList; private ListView chatList;
private TextView noChatHistory; private TextView noChatHistory;
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, contactPicture, cancel; private ImageView edit, selectAll, deselectAll, delete, newDiscussion, contactPicture, cancel, backInCall;
private RelativeLayout editList, topbar; private RelativeLayout editList, topbar;
private boolean isEditMode = false; private boolean isEditMode = false;
@ -103,6 +103,9 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
deselectAll = (ImageView) view.findViewById(R.id.deselect_all); deselectAll = (ImageView) view.findViewById(R.id.deselect_all);
deselectAll.setOnClickListener(this); deselectAll.setOnClickListener(this);
backInCall = (ImageView) view.findViewById(R.id.back_in_call);
backInCall.setOnClickListener(this);
delete = (ImageView) view.findViewById(R.id.delete); delete = (ImageView) view.findViewById(R.id.delete);
delete.setOnClickListener(this); delete.setOnClickListener(this);
return view; return view;
@ -195,6 +198,12 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (LinphoneManager.getLc().getCallsNb() > 0) {
backInCall.setVisibility(View.VISIBLE);
} else {
backInCall.setVisibility(View.GONE);
}
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.instance()); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.instance());
boolean updateNeeded = prefs.getBoolean(getString(R.string.pref_first_time_linphone_chat_storage), true); boolean updateNeeded = prefs.getBoolean(getString(R.string.pref_first_time_linphone_chat_storage), true);
updateNeeded = updateNeeded && !isVersionUsingNewChatStorage(); updateNeeded = updateNeeded && !isVersionUsingNewChatStorage();
@ -265,6 +274,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
public void onClick(View v) { public void onClick(View v) {
int id = v.getId(); int id = v.getId();
if (id == R.id.back_in_call) {
LinphoneActivity.instance().resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
return;
}
if (id == R.id.select_all) { if (id == R.id.select_all) {
deselectAll.setVisibility(View.VISIBLE); deselectAll.setVisibility(View.VISIBLE);
selectAll.setVisibility(View.GONE); selectAll.setVisibility(View.GONE);

View file

@ -603,6 +603,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
preferLinphoneContacts = false; preferLinphoneContacts = false;
} }
public void displayChatList() {
Bundle extras = new Bundle();
changeCurrentFragment(FragmentsAvailable.CHATLIST, extras);
}
public void displayContactsForEdition(String sipAddress) { public void displayContactsForEdition(String sipAddress) {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putBoolean("EditOnClick", true); extras.putBoolean("EditOnClick", true);
@ -881,6 +886,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
public void displayCustomToast(final String message, final int duration) { public void displayCustomToast(final String message, final int duration) {
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot)); View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
@ -1087,6 +1094,10 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} else if (resultCode == Activity.RESULT_FIRST_USER && requestCode == CALL_ACTIVITY) { } else if (resultCode == Activity.RESULT_FIRST_USER && requestCode == CALL_ACTIVITY) {
getIntent().putExtra("PreviousActivity", CALL_ACTIVITY); getIntent().putExtra("PreviousActivity", CALL_ACTIVITY);
boolean callTransfer = data == null ? false : data.getBooleanExtra("Transfer", false); boolean callTransfer = data == null ? false : data.getBooleanExtra("Transfer", false);
boolean chat = data == null ? false : data.getBooleanExtra("chat", false);
if(chat){
displayChatList();
}
if (LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneManager.getLc().getCallsNb() > 0) {
initInCallMenuLayout(callTransfer); initInCallMenuLayout(callTransfer);
} else { } else {