Fixed go to chat from call & add call / transfer call
This commit is contained in:
parent
6e80a6a9bb
commit
b88faccc62
3 changed files with 22 additions and 30 deletions
|
@ -154,7 +154,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
private RelativeLayout sideMenuContent, quitLayout, defaultAccount;
|
private RelativeLayout sideMenuContent, quitLayout, defaultAccount;
|
||||||
private ListView accountsList, sideMenuItemList;
|
private ListView accountsList, sideMenuItemList;
|
||||||
private ImageView menu;
|
private ImageView menu;
|
||||||
private boolean doNotGoToCallActivity = false;
|
|
||||||
private List<String> sideMenuItems;
|
private List<String> sideMenuItems;
|
||||||
private boolean callTransfer = false;
|
private boolean callTransfer = false;
|
||||||
private boolean isOnBackground = false;
|
private boolean isOnBackground = false;
|
||||||
|
@ -300,10 +299,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
}
|
}
|
||||||
mAlwaysChangingPhoneAngle = rotation;
|
mAlwaysChangingPhoneAngle = rotation;
|
||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
onNewIntent(getIntent());
|
||||||
if (extras != null && extras.getBoolean("GoToChat", false)) {
|
|
||||||
onNewIntent(getIntent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initButtons() {
|
private void initButtons() {
|
||||||
|
@ -1153,10 +1149,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
} 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);
|
||||||
callTransfer = data != null && data.getBooleanExtra("Transfer", false);
|
callTransfer = data != null && data.getBooleanExtra("Transfer", false);
|
||||||
boolean chat = data != null && data.getBooleanExtra("chat", false);
|
|
||||||
if (chat) {
|
|
||||||
pendingFragmentTransaction = FragmentsAvailable.CHAT_LIST;
|
|
||||||
}
|
|
||||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
initInCallMenuLayout(callTransfer);
|
initInCallMenuLayout(callTransfer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1173,8 +1165,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
getIntent().putExtra("PreviousActivity", 0);
|
|
||||||
|
|
||||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
lc.removeListener(mListener);
|
lc.removeListener(mListener);
|
||||||
|
@ -1366,10 +1356,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
super.onRestoreInstanceState(savedInstanceState);
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableGoToCall() {
|
|
||||||
doNotGoToCallActivity = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -1407,7 +1393,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
|
|
||||||
LinphoneManager.getInstance().changeStatusToOnline();
|
LinphoneManager.getInstance().changeStatusToOnline();
|
||||||
|
|
||||||
if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY && !doNotGoToCallActivity) {
|
if (!getIntent().getBooleanExtra("DoNotGoToCallActivity", false)) {
|
||||||
if (LinphoneManager.getLc().getCalls().length > 0) {
|
if (LinphoneManager.getLc().getCalls().length > 0) {
|
||||||
Call call = LinphoneManager.getLc().getCalls()[0];
|
Call call = LinphoneManager.getLc().getCalls()[0];
|
||||||
Call.State onCallStateChanged = call.getState();
|
Call.State onCallStateChanged = call.getState();
|
||||||
|
@ -1432,7 +1418,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
displayChat(null, null, intent.getStringExtra("fileShared"));
|
displayChat(null, null, intent.getStringExtra("fileShared"));
|
||||||
intent.putExtra("fileShared", "");
|
intent.putExtra("fileShared", "");
|
||||||
}
|
}
|
||||||
doNotGoToCallActivity = false;
|
|
||||||
isOnBackground = false;
|
isOnBackground = false;
|
||||||
|
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
@ -1482,13 +1467,17 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
if (extras != null && extras.getBoolean("GoToChat", false)) {
|
if (extras != null && extras.getBoolean("GoToChat", false)) {
|
||||||
String sipUri = extras.getString("ChatContactSipUri");
|
String sipUri = extras.getString("ChatContactSipUri");
|
||||||
doNotGoToCallActivity = true;
|
intent.putExtra("DoNotGoToCallActivity", true);
|
||||||
displayChat(sipUri, null, null);
|
if (sipUri == null) {
|
||||||
|
goToChatList();
|
||||||
|
} else {
|
||||||
|
displayChat(sipUri, null, null);
|
||||||
|
}
|
||||||
} else if (extras != null && extras.getBoolean("GoToHistory", false)) {
|
} else if (extras != null && extras.getBoolean("GoToHistory", false)) {
|
||||||
doNotGoToCallActivity = true;
|
intent.putExtra("DoNotGoToCallActivity", true);
|
||||||
changeCurrentFragment(FragmentsAvailable.HISTORY_LIST, null);
|
changeCurrentFragment(FragmentsAvailable.HISTORY_LIST, null);
|
||||||
} else if (extras != null && extras.getBoolean("GoToInapp", false)) {
|
} else if (extras != null && extras.getBoolean("GoToInapp", false)) {
|
||||||
doNotGoToCallActivity = true;
|
intent.putExtra("DoNotGoToCallActivity", true);
|
||||||
displayInapp();
|
displayInapp();
|
||||||
} else if (extras != null && extras.getBoolean("Notification", false)) {
|
} else if (extras != null && extras.getBoolean("Notification", false)) {
|
||||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||||
|
@ -1496,7 +1485,6 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
startIncallActivity(call);
|
startIncallActivity(call);
|
||||||
}
|
}
|
||||||
} else if (extras != null && extras.getBoolean("StartCall", false)) {
|
} else if (extras != null && extras.getBoolean("StartCall", false)) {
|
||||||
boolean extraBool = extras.getBoolean("StartCall", false);
|
|
||||||
if (CallActivity.isInstanciated()) {
|
if (CallActivity.isInstanciated()) {
|
||||||
CallActivity.instance().startIncomingCallActivity();
|
CallActivity.instance().startIncomingCallActivity();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1504,17 +1492,19 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
goToDialerFragment();
|
goToDialerFragment();
|
||||||
//startActivity(new Intent(this, CallIncomingActivity.class));
|
//startActivity(new Intent(this, CallIncomingActivity.class));
|
||||||
}
|
}
|
||||||
|
} else if (extras != null && extras.getBoolean("Transfer", false)) {
|
||||||
|
intent.putExtra("DoNotGoToCallActivity", true);
|
||||||
} else {
|
} else {
|
||||||
DialerFragment dialerFragment = DialerFragment.instance();
|
DialerFragment dialerFragment = DialerFragment.instance();
|
||||||
if (dialerFragment != null) {
|
if (dialerFragment != null) {
|
||||||
if (extras != null && extras.containsKey("SipUriOrNumber")) {
|
if (extras != null && extras.containsKey("SipUriOrNumber")) {
|
||||||
if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
|
if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
|
||||||
((DialerFragment) dialerFragment).newOutgoingCall(extras.getString("SipUriOrNumber"));
|
dialerFragment.newOutgoingCall(extras.getString("SipUriOrNumber"));
|
||||||
} else {
|
} else {
|
||||||
((DialerFragment) dialerFragment).displayTextInAddressBar(extras.getString("SipUriOrNumber"));
|
dialerFragment.displayTextInAddressBar(extras.getString("SipUriOrNumber"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
((DialerFragment) dialerFragment).newOutgoingCall(intent);
|
dialerFragment.newOutgoingCall(intent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (extras != null && extras.containsKey("SipUriOrNumber")) {
|
if (extras != null && extras.containsKey("SipUriOrNumber")) {
|
||||||
|
@ -1524,7 +1514,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
}
|
}
|
||||||
if (LinphoneManager.getLc().getCalls().length > 0) {
|
if (LinphoneManager.getLc().getCalls().length > 0) {
|
||||||
// If a call is ringing, start incomingcallactivity
|
// If a call is ringing, start incomingcallactivity
|
||||||
Collection<Call.State> incoming = new ArrayList<Call.State>();
|
Collection<Call.State> incoming = new ArrayList<>();
|
||||||
incoming.add(Call.State.IncomingReceived);
|
incoming.add(Call.State.IncomingReceived);
|
||||||
if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
|
if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
|
||||||
if (CallActivity.isInstanciated()) {
|
if (CallActivity.isInstanciated()) {
|
||||||
|
@ -1535,6 +1525,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnBackground() {
|
public boolean isOnBackground() {
|
||||||
|
|
|
@ -1065,15 +1065,17 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
|
|
||||||
private void goBackToDialerAndDisplayTransferButton() {
|
private void goBackToDialerAndDisplayTransferButton() {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
|
intent.setClass(this, LinphoneActivity.class);
|
||||||
intent.putExtra("Transfer", true);
|
intent.putExtra("Transfer", true);
|
||||||
setResult(Activity.RESULT_FIRST_USER, intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goToChatList() {
|
private void goToChatList() {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra("chat", true);
|
intent.setClass(this, LinphoneActivity.class);
|
||||||
setResult(Activity.RESULT_FIRST_USER, intent);
|
intent.putExtra("GoToChat", true);
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -682,7 +682,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.image_picker_title));
|
Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.image_picker_title));
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));
|
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));
|
||||||
|
|
||||||
LinphoneActivity.instance().disableGoToCall();
|
|
||||||
startActivityForResult(chooserIntent, ADD_PHOTO);
|
startActivityForResult(chooserIntent, ADD_PHOTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue