Move merge and transfer bar on top of other controls.

This commit is contained in:
Guillaume Beraudo 2011-11-22 14:06:26 +01:00
parent 886bdcd28a
commit e82587ae94
2 changed files with 23 additions and 29 deletions

View file

@ -7,18 +7,7 @@
android:paddingRight="8dp"> android:paddingRight="8dp">
<LinearLayout android:id="@+id/conf_control_buttons" <LinearLayout android:id="@+id/conf_header" android:layout_alignParentTop="true"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<Button android:id="@+id/conf_simple_merge" style="@style/conf_icon_text_button"
android:drawableTop="@drawable/conf_merge"
android:text="@string/conf_simple_merge_bt_txt"/>
<Button android:id="@+id/conf_simple_transfer" style="@style/conf_icon_text_button"
android:drawableTop="@drawable/conf_transfer"
android:text="@string/conf_simple_transfer_bt_txt" />
</LinearLayout>
<LinearLayout android:id="@+id/conf_header" android:layout_below="@id/conf_control_buttons"
android:orientation="vertical" android:layout_marginBottom="10dip" android:orientation="vertical" android:layout_marginBottom="10dip"
android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
@ -60,6 +49,19 @@
android:text="@string/show_send_dtmfs_button" android:drawableTop="@drawable/numpad_big" /> android:text="@string/show_send_dtmfs_button" android:drawableTop="@drawable/numpad_big" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/conf_advanced_buttons"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_above="@id/conf_terminate_row">
<Button android:id="@+id/conf_simple_merge" style="@style/conf_icon_text_button"
android:drawableTop="@drawable/conf_merge"
android:text="@string/conf_simple_merge_bt_txt"/>
<Button android:id="@+id/conf_simple_transfer" style="@style/conf_icon_text_button"
android:drawableTop="@drawable/conf_transfer"
android:text="@string/conf_simple_transfer_bt_txt" />
</LinearLayout>
<ImageView android:id="@+id/incall_picture" android:visibility="gone" <ImageView android:id="@+id/incall_picture" android:visibility="gone"
android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
@ -74,7 +76,7 @@
android:dividerHeight="10dip" android:dividerHeight="10dip"
android:divider="@android:color/transparent" android:divider="@android:color/transparent"
android:layout_below="@id/conf_header" android:layout_below="@id/conf_header"
android:layout_above="@id/conf_terminate_row" android:layout_above="@id/conf_advanced_buttons"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
android:fadeScrollbars="false" android:fadeScrollbars="false"
/> />

View file

@ -146,10 +146,7 @@ public class IncallActivity extends ListActivity implements
if (mMultipleCallsLimit > 0) { if (mMultipleCallsLimit > 0) {
limitReached = lc().getCallsNb() >= mMultipleCallsLimit; limitReached = lc().getCallsNb() >= mMultipleCallsLimit;
} }
findViewById(R.id.addCall).setVisibility(limitReached? View.INVISIBLE : VISIBLE);
int establishedCallsNb = LinphoneUtils.getRunningOrPausedCalls(lc()).size();
boolean hideButton = limitReached || establishedCallsNb == 0;
findViewById(R.id.addCall).setVisibility(hideButton? GONE : VISIBLE);
} }
private void updateDtmfButton() { private void updateDtmfButton() {
@ -304,11 +301,9 @@ public class IncallActivity extends ListActivity implements
showDialog(numpad_dialog_id); showDialog(numpad_dialog_id);
break; break;
case R.id.conf_simple_merge: case R.id.conf_simple_merge:
findViewById(R.id.conf_control_buttons).setVisibility(GONE);
lc().addAllToConference(); lc().addAllToConference();
break; break;
case R.id.conf_simple_transfer: case R.id.conf_simple_transfer:
findViewById(R.id.conf_control_buttons).setVisibility(GONE);
LinphoneCall tCall = lc().getCurrentCall(); LinphoneCall tCall = lc().getCurrentCall();
if (tCall != null) { if (tCall != null) {
prepareForTransferingExistingOrNewCall(tCall); prepareForTransferingExistingOrNewCall(tCall);
@ -617,22 +612,19 @@ public class IncallActivity extends ListActivity implements
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private void updateSimpleControlButtons() { private void updateAdvancedButtons() {
LinphoneCall activeCall = lc().getCurrentCall(); LinphoneCall activeCall = lc().getCurrentCall();
View control = findViewById(R.id.conf_control_buttons); View bar = findViewById(R.id.conf_advanced_buttons);
int nonConfCallsNb = LinphoneUtils.countNonConferenceCalls(lc()); int nonConfCallsNb = LinphoneUtils.countNonConferenceCalls(lc());
View merge = control.findViewById(R.id.conf_simple_merge); View merge = bar.findViewById(R.id.conf_simple_merge);
boolean showMerge = nonConfCallsNb >=2 boolean showMerge = nonConfCallsNb >=2
|| (lc().getConferenceSize() > 0 && nonConfCallsNb > 0); || (lc().getConferenceSize() > 0 && nonConfCallsNb > 0);
merge.setVisibility(showMerge ? VISIBLE : GONE); merge.setEnabled(showMerge);
View transfer = control.findViewById(R.id.conf_simple_transfer); View transfer = bar.findViewById(R.id.conf_simple_transfer);
boolean showTransfer = mAllowTransfers && activeCall != null; boolean showTransfer = mAllowTransfers && activeCall != null;
transfer.setVisibility(showTransfer ? VISIBLE : GONE); transfer.setEnabled(showTransfer);
boolean showControl = showMerge || showTransfer;
control.setVisibility(showControl ? VISIBLE : GONE);
} }
public void onCallStateChanged(final LinphoneCall c, final State s, String m) { public void onCallStateChanged(final LinphoneCall c, final State s, String m) {
@ -659,7 +651,7 @@ public class IncallActivity extends ListActivity implements
} }
private void recreateActivity() { private void recreateActivity() {
updateSimpleControlButtons(); updateAdvancedButtons();
updateCalleeImage(); updateCalleeImage();
updateSoundLock(); updateSoundLock();
updateAddCallButton(); updateAddCallButton();