Fix issue with incall dialer view
This commit is contained in:
parent
6db9cffc82
commit
427ed76520
4 changed files with 21 additions and 18 deletions
|
@ -69,7 +69,7 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
|
|||
|
||||
newContact = (ImageView) view.findViewById(R.id.newContact);
|
||||
newContact.setOnClickListener(this);
|
||||
newContact.setEnabled(!LinphoneActivity.instance().isInCallLayout());
|
||||
newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0);
|
||||
|
||||
allContacts.setEnabled(onlyDisplayLinphoneContacts);
|
||||
linphoneContacts.setEnabled(!allContacts.isEnabled());
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.linphone.ui.AddressText;
|
|||
import org.linphone.ui.CallButton;
|
||||
import org.linphone.ui.EraseButton;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -57,7 +58,7 @@ public class DialerFragment extends Fragment {
|
|||
|
||||
mCall = (CallButton) view.findViewById(R.id.Call);
|
||||
mCall.setAddressWidget(mAddress);
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().isInCallLayout()) {
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0) {
|
||||
mCall.setImageResource(R.drawable.plus);
|
||||
} else {
|
||||
mCall.setImageResource(R.drawable.call);
|
||||
|
@ -81,7 +82,7 @@ public class DialerFragment extends Fragment {
|
|||
LinphoneActivity.instance().resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
|
||||
}
|
||||
};
|
||||
mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneActivity.instance().isInCallLayout()));
|
||||
mAddContact.setEnabled(!(LinphoneActivity.isInstanciated() && LinphoneManager.getLc().getCallsNb() > 0));
|
||||
resetLayout();
|
||||
|
||||
if (getArguments() != null) {
|
||||
|
@ -107,6 +108,12 @@ public class DialerFragment extends Fragment {
|
|||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
LinphoneActivity.instance().updateDialerFragment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -114,10 +121,11 @@ public class DialerFragment extends Fragment {
|
|||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.DIALER);
|
||||
LinphoneActivity.instance().updateDialerFragment(this);
|
||||
}
|
||||
resetLayout();
|
||||
}
|
||||
|
||||
public void resetLayout() {
|
||||
if (LinphoneActivity.instance().isInCallLayout()) {
|
||||
if (LinphoneManager.getLc().getCallsNb() > 0) {
|
||||
mCall.setImageResource(R.drawable.plus);
|
||||
mAddress.setText("");
|
||||
mAddContact.setImageResource(R.drawable.cancel);
|
||||
|
|
|
@ -84,7 +84,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
private SavedState dialerSavedState;
|
||||
private ChatStorage chatStorage;
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean isInCallLayout = false;
|
||||
private List<Contact> contactList, sipContactList;
|
||||
private Cursor contactCursor, sipContactCursor;
|
||||
|
||||
|
@ -606,16 +605,16 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
}
|
||||
|
||||
private void initInCallMenuLayout() {
|
||||
isInCallLayout = true;
|
||||
selectMenu(FragmentsAvailable.DIALER);
|
||||
((DialerFragment) dialerFragment).resetLayout();
|
||||
if (dialerFragment != null) {
|
||||
((DialerFragment) dialerFragment).resetLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void resetClassicMenuLayoutAndGoBackToCallIfStillRunning() {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
isInCallLayout = false;
|
||||
if (dialerFragment != null) {
|
||||
((DialerFragment) dialerFragment).resetLayout();
|
||||
}
|
||||
|
@ -632,10 +631,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
|||
});
|
||||
}
|
||||
|
||||
public boolean isInCallLayout() {
|
||||
return isInCallLayout;
|
||||
}
|
||||
|
||||
public FragmentsAvailable getCurrentFragment() {
|
||||
return currentFragment;
|
||||
}
|
||||
|
|
|
@ -77,11 +77,11 @@ public class Digit extends Button implements AddressAware {
|
|||
}
|
||||
|
||||
private class DialKeyListener implements OnClickListener, OnTouchListener, OnLongClickListener {
|
||||
final CharSequence mKeyCode;
|
||||
final char mKeyCode;
|
||||
boolean mIsDtmfStarted;
|
||||
|
||||
DialKeyListener() {
|
||||
mKeyCode = Digit.this.getText().subSequence(0, 1);
|
||||
mKeyCode = Digit.this.getText().subSequence(0, 1).charAt(0);
|
||||
}
|
||||
|
||||
private boolean linphoneServiceReady() {
|
||||
|
@ -100,7 +100,7 @@ public class Digit extends Button implements AddressAware {
|
|||
lc.stopDtmf();
|
||||
mIsDtmfStarted =false;
|
||||
if (lc.isIncall()) {
|
||||
lc.sendDtmf(mKeyCode.charAt(0));
|
||||
lc.sendDtmf(mKeyCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class Digit extends Button implements AddressAware {
|
|||
lBegin = mAddress.length();
|
||||
}
|
||||
if (lBegin >=0) {
|
||||
mAddress.getEditableText().insert(lBegin,mKeyCode);
|
||||
mAddress.getEditableText().insert(lBegin,String.valueOf(mKeyCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class Digit extends Button implements AddressAware {
|
|||
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN && !mIsDtmfStarted) {
|
||||
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode.charAt(0));
|
||||
LinphoneManager.getInstance().playDtmf(getContext().getContentResolver(), mKeyCode);
|
||||
mIsDtmfStarted=true;
|
||||
} else {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
|
|
Loading…
Reference in a new issue