From 5bde818b309bc12843852339137ae2d617412f12 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 30 Mar 2011 10:36:22 +0200 Subject: [PATCH] Fix double initFromConf. Fix dialer without incall view. --- res/layout/dialer.xml | 2 +- res/values/custom.xml | 2 +- src/org/linphone/DialerActivity.java | 57 +++++++++++----------------- 3 files changed, 24 insertions(+), 37 deletions(-) diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml index c6fbdb473..a5b8ed433 100644 --- a/res/layout/dialer.xml +++ b/res/layout/dialer.xml @@ -43,7 +43,7 @@ - + diff --git a/res/values/custom.xml b/res/values/custom.xml index 1a2e83929..9166d84ae 100644 --- a/res/values/custom.xml +++ b/res/values/custom.xml @@ -11,7 +11,7 @@ false true true - true + false false true diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index a57bcdc8f..3edd40939 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -64,22 +64,20 @@ import android.widget.Toast; */ public class DialerActivity extends Activity implements LinphoneGuiListener, NewOutgoingCallUiListener { - private AddressText mAddress; - private TextView mDisplayNameView; - private TextView mStatus; - private CallButton mCall; - private View mDecline; private View mHangup; - + + private View mCallControlRow; + private TextView mDisplayNameView; + private AddressText mAddress; + private View mAddressLayout; + private CallButton mCall; + + private View mInCallControlRow; + private View mInCallAddressLayout; private MuteMicButton mMute; private SpeakerButton mSpeaker; - - private View mCallControlRow; - private View mInCallControlRow; - private View mAddressLayout; - private View mInCallAddressLayout; - + private static DialerActivity instance; private PowerManager.WakeLock mWakeLock; @@ -122,24 +120,23 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New mCall.setAddressWidget(mAddress); - mDecline= findViewById(R.id.Decline); - mDecline.setEnabled(false); - - mCallControlRow = findViewById(R.id.CallControlRow); mAddressLayout = findViewById(R.id.Addresslayout); + mInCallControlRow = findViewById(R.id.IncallControlRow); + mInCallControlRow.setVisibility(View.GONE); + mInCallAddressLayout = findViewById(R.id.IncallAddressLayout); + mInCallAddressLayout.setVisibility(View.GONE); + if (useIncallActivity) { mHangup = findViewById(R.id.HangUp); - - mInCallControlRow = findViewById(R.id.IncallControlRow); - mInCallControlRow.setVisibility(View.GONE); - mInCallAddressLayout = findViewById(R.id.IncallAddressLayout); - mInCallAddressLayout.setVisibility(View.GONE); + } else { + mMute = (MuteMicButton) findViewById(R.id.mic_mute_button); + mSpeaker = (SpeakerButton) findViewById(R.id.speaker_button); + mHangup = findViewById(R.id.Decline); } - mMute = (MuteMicButton) findViewById(R.id.mic_mute_button); - mSpeaker = (SpeakerButton) findViewById(R.id.speaker_button); + mStatus = (TextView) findViewById(R.id.status_label); AddressAware numpad = (AddressAware) findViewById(R.id.Dialer); @@ -275,15 +272,13 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New mInCallControlRow.setVisibility(View.GONE); mInCallAddressLayout.setVisibility(View.GONE); updateIncallVideoCallButton(); + mSpeaker.setSpeakerOn(false); } mAddressLayout.setVisibility(View.VISIBLE); mHangup.setEnabled(false); - mDecline.setEnabled(false); - mSpeaker.setSpeakerOn(false); - if (useVideoActivity && LinphoneManager.getLc().isVideoEnabled()) { finishActivity(LinphoneActivity.VIDEO_VIEW_ACTIVITY); @@ -415,16 +410,8 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New public void onGlobalStateChangedToOn(String message) { mCall.setEnabled(!LinphoneManager.getLc().isIncall()); - mHangup.setEnabled(!mCall.isEnabled()); if (!useIncallActivity) updateIncallVideoCallButton(); - - try{ - LinphoneManager.getInstance().initFromConf(this); - } catch (LinphoneConfigException e) { - Log.w(LinphoneManager.TAG, "Cannot get initial config : " + e.getMessage()); - } catch (Exception e) { - Log.e(LinphoneManager.TAG, "Cannot get initial config", e); - } + else mHangup.setEnabled(!mCall.isEnabled()); if (getIntent().getData() != null) { checkIfOutgoingCallIntentReceived();