Fix call transfer

This commit is contained in:
Margaux Clerc 2016-09-13 14:19:19 +02:00
parent 36e361dc8d
commit 83c32db784
2 changed files with 14 additions and 5 deletions

View file

@ -122,13 +122,15 @@ public class DialerFragment extends Fragment {
} }
} }
instance = this;
return view; return view;
} }
/** /**
* @return null if not ready yet * @return null if not ready yet
*/ */
public static DialerFragment instance() { public static DialerFragment instance() {
return instance; return instance;
} }
@ -166,7 +168,7 @@ public class DialerFragment extends Fragment {
} }
public void resetLayout(boolean callTransfer) { public void resetLayout(boolean callTransfer) {
isCallTransferOngoing = callTransfer; isCallTransferOngoing = LinphoneActivity.instance().isCallTransfer();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null) { if (lc == null) {
return; return;

View file

@ -133,6 +133,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private ImageView menu; private ImageView menu;
private boolean fetchedContactsOnce = false; private boolean fetchedContactsOnce = false;
private boolean doNotGoToCallActivity = false; private boolean doNotGoToCallActivity = false;
private boolean callTransfer = false;
static final boolean isInstanciated() { static final boolean isInstanciated() {
return instance != null; return instance != null;
@ -998,7 +999,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
private void initInCallMenuLayout(boolean callTransfer) { public Boolean isCallTransfer(){
return callTransfer;
}
private void initInCallMenuLayout(final boolean callTransfer) {
selectMenu(FragmentsAvailable.DIALER); selectMenu(FragmentsAvailable.DIALER);
DialerFragment dialerFragment = DialerFragment.instance(); DialerFragment dialerFragment = DialerFragment.instance();
if (dialerFragment != null) { if (dialerFragment != null) {
@ -1009,7 +1014,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() { public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() {
DialerFragment dialerFragment = DialerFragment.instance(); DialerFragment dialerFragment = DialerFragment.instance();
if (dialerFragment != null) { if (dialerFragment != null) {
((DialerFragment) dialerFragment).resetLayout(false); ((DialerFragment) dialerFragment).resetLayout(true);
} }
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) { if (LinphoneManager.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
@ -1073,7 +1078,7 @@ 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); callTransfer = data == null ? false : data.getBooleanExtra("Transfer", false);
boolean chat = data == null ? false : data.getBooleanExtra("chat", false); boolean chat = data == null ? false : data.getBooleanExtra("chat", false);
if(chat){ if(chat){
pendingFragmentTransaction = FragmentsAvailable.CHAT_LIST; pendingFragmentTransaction = FragmentsAvailable.CHAT_LIST;
@ -1103,6 +1108,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
callTransfer = false;
super.onPause(); super.onPause();
} }