Fix double initFromConf. Fix dialer without incall view.

This commit is contained in:
Guillaume Beraudo 2011-03-30 10:36:22 +02:00
parent 5d762a8c61
commit 5bde818b30
3 changed files with 24 additions and 37 deletions

View file

@ -43,7 +43,7 @@
<org.linphone.ui.HangCallButton android:id="@+id/Decline" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/> <org.linphone.ui.HangCallButton android:id="@+id/Decline" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/IncallControlRow" android:layout_height="fill_parent" android:layout_width="fill_parent"> <LinearLayout android:id="@+id/IncallControlRow" android:layout_height="fill_parent" android:layout_width="fill_parent" android:visibility="gone">
<org.linphone.ui.AddVideoButton android:id="@+id/AddVideo" android:src="@drawable/startvideo_green" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg"/> <org.linphone.ui.AddVideoButton android:id="@+id/AddVideo" android:src="@drawable/startvideo_green" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg"/>
<org.linphone.ui.HangCallButton android:id="@+id/HangUp" android:src="@drawable/stopcall_red" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg"/> <org.linphone.ui.HangCallButton android:id="@+id/HangUp" android:src="@drawable/stopcall_red" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg"/>
</LinearLayout> </LinearLayout>

View file

@ -11,7 +11,7 @@
<bool name="useFirstLoginActivity">false</bool> <bool name="useFirstLoginActivity">false</bool>
<bool name="useMenuSettings">true</bool> <bool name="useMenuSettings">true</bool>
<bool name="useMenuAbout">true</bool> <bool name="useMenuAbout">true</bool>
<bool name="use_incall_activity">true</bool> <bool name="use_incall_activity">false</bool>
<bool name="use_video_activity">false</bool> <bool name="use_video_activity">false</bool>
<bool name="show_full_remote_address_on_incoming_call">true</bool> <bool name="show_full_remote_address_on_incoming_call">true</bool>

View file

@ -64,22 +64,20 @@ import android.widget.Toast;
*/ */
public class DialerActivity extends Activity implements LinphoneGuiListener, NewOutgoingCallUiListener { public class DialerActivity extends Activity implements LinphoneGuiListener, NewOutgoingCallUiListener {
private AddressText mAddress;
private TextView mDisplayNameView;
private TextView mStatus; private TextView mStatus;
private CallButton mCall;
private View mDecline;
private View mHangup; 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 MuteMicButton mMute;
private SpeakerButton mSpeaker; private SpeakerButton mSpeaker;
private View mCallControlRow;
private View mInCallControlRow;
private View mAddressLayout;
private View mInCallAddressLayout;
private static DialerActivity instance; private static DialerActivity instance;
private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock;
@ -122,24 +120,23 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
mCall.setAddressWidget(mAddress); mCall.setAddressWidget(mAddress);
mDecline= findViewById(R.id.Decline);
mDecline.setEnabled(false);
mCallControlRow = findViewById(R.id.CallControlRow); mCallControlRow = findViewById(R.id.CallControlRow);
mAddressLayout = findViewById(R.id.Addresslayout); 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) { if (useIncallActivity) {
mHangup = findViewById(R.id.HangUp); mHangup = findViewById(R.id.HangUp);
} else {
mInCallControlRow = findViewById(R.id.IncallControlRow); mMute = (MuteMicButton) findViewById(R.id.mic_mute_button);
mInCallControlRow.setVisibility(View.GONE); mSpeaker = (SpeakerButton) findViewById(R.id.speaker_button);
mInCallAddressLayout = findViewById(R.id.IncallAddressLayout); mHangup = findViewById(R.id.Decline);
mInCallAddressLayout.setVisibility(View.GONE);
} }
mMute = (MuteMicButton) findViewById(R.id.mic_mute_button);
mSpeaker = (SpeakerButton) findViewById(R.id.speaker_button);
mStatus = (TextView) findViewById(R.id.status_label); mStatus = (TextView) findViewById(R.id.status_label);
AddressAware numpad = (AddressAware) findViewById(R.id.Dialer); AddressAware numpad = (AddressAware) findViewById(R.id.Dialer);
@ -275,15 +272,13 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
mInCallControlRow.setVisibility(View.GONE); mInCallControlRow.setVisibility(View.GONE);
mInCallAddressLayout.setVisibility(View.GONE); mInCallAddressLayout.setVisibility(View.GONE);
updateIncallVideoCallButton(); updateIncallVideoCallButton();
mSpeaker.setSpeakerOn(false);
} }
mAddressLayout.setVisibility(View.VISIBLE); mAddressLayout.setVisibility(View.VISIBLE);
mHangup.setEnabled(false); mHangup.setEnabled(false);
mDecline.setEnabled(false);
mSpeaker.setSpeakerOn(false);
if (useVideoActivity && LinphoneManager.getLc().isVideoEnabled()) { if (useVideoActivity && LinphoneManager.getLc().isVideoEnabled()) {
finishActivity(LinphoneActivity.VIDEO_VIEW_ACTIVITY); finishActivity(LinphoneActivity.VIDEO_VIEW_ACTIVITY);
@ -415,16 +410,8 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
public void onGlobalStateChangedToOn(String message) { public void onGlobalStateChangedToOn(String message) {
mCall.setEnabled(!LinphoneManager.getLc().isIncall()); mCall.setEnabled(!LinphoneManager.getLc().isIncall());
mHangup.setEnabled(!mCall.isEnabled());
if (!useIncallActivity) updateIncallVideoCallButton(); if (!useIncallActivity) updateIncallVideoCallButton();
else mHangup.setEnabled(!mCall.isEnabled());
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);
}
if (getIntent().getData() != null) { if (getIntent().getData() != null) {
checkIfOutgoingCallIntentReceived(); checkIfOutgoingCallIntentReceived();