summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2015-01-28 18:13:41 +0800
committerkaiyiz <kaiyiz@codeaurora.org>2015-01-28 18:15:12 +0800
commit49472836ddf1fc0ea47d017e941bcbc438daa5f7 (patch)
tree5533b5e712116d991fb750362acbc375698b72de
parent6f59bd6b445f7a812e3945190ac06b6c654cc9a5 (diff)
downloadandroid_packages_apps_InCallUI-49472836ddf1fc0ea47d017e941bcbc438daa5f7.tar.gz
android_packages_apps_InCallUI-49472836ddf1fc0ea47d017e941bcbc438daa5f7.tar.bz2
android_packages_apps_InCallUI-49472836ddf1fc0ea47d017e941bcbc438daa5f7.zip
InCallUI: Fix "Speaker and add call" icons not displayed completely
Since the Mute button is also always shown in Call UI, initialize the buttonCount to 3 and remove the judgment of mute options. Add judgment of record option and show start/stop record button in logical condition. Since the CDMA phone doesn't support hold, set the max buttonCount to 4. Change-Id: Iaedeb5e4be13b95e48500d0a0646d49cebdfc442 CRs-Fixed: 750937
-rw-r--r--src/com/android/incallui/CallButtonFragment.java15
-rw-r--r--src/com/android/incallui/CallButtonPresenter.java21
2 files changed, 29 insertions, 7 deletions
diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java
index ad3efe2b..45948410 100644
--- a/src/com/android/incallui/CallButtonFragment.java
+++ b/src/com/android/incallui/CallButtonFragment.java
@@ -504,7 +504,6 @@ public class CallButtonFragment
menu.findItem(R.id.overflow_resume_menu_item).setVisible(
showHoldMenuOption && mHoldButton.isSelected());
menu.findItem(R.id.overflow_swap_menu_item).setVisible(showSwapMenuOption);
- menu.findItem(R.id.menu_start_record).setVisible(true);
menu.findItem(R.id.overflow_add_participant_menu_item).setVisible(showAddParticipantOption);
menu.findItem(R.id.overflow_manage_conference_menu_item).setVisible(
showManageConferenceVideoCallOption);
@@ -837,6 +836,20 @@ public class CallButtonFragment
@Override
public void show() {
+ final Menu menu = getMenu();
+ final MenuItem startRecord = menu.findItem(R.id.menu_start_record);
+ final MenuItem stopRecord = menu.findItem(R.id.menu_stop_record);
+
+ boolean isRecording = ((InCallActivity)getActivity()).isCallRecording();
+ boolean isRecordEnabled = ((InCallActivity)getActivity()).isCallRecorderEnabled();
+ boolean startEnabled = !isRecording && isRecordEnabled;
+ boolean stopEnabled = isRecording && isRecordEnabled;
+
+ startRecord.setVisible(startEnabled);
+ startRecord.setEnabled(startEnabled);
+ stopRecord.setVisible(stopEnabled);
+ stopRecord.setEnabled(stopEnabled);
+
super.show();
}
}
diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java
index 27b2c375..536bb7ba 100644
--- a/src/com/android/incallui/CallButtonPresenter.java
+++ b/src/com/android/incallui/CallButtonPresenter.java
@@ -33,6 +33,7 @@ import com.android.incallui.InCallPresenter.InCallDetailsListener;
import android.content.DialogInterface;
import android.telephony.PhoneNumberUtils;
+import android.telephony.TelephonyManager;
import com.android.internal.telephony.util.BlacklistUtils;
import java.util.Objects;
@@ -426,26 +427,34 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
final boolean showSwapOption = call.can(PhoneCapabilities.SWAP_CONFERENCE);
final boolean showHoldOption = !showSwapOption && (enableHoldOption || supportHold);
+ boolean showRecordOption =
+ ((InCallActivity)((CallButtonFragment)ui).getActivity()).isCallRecorderEnabled();
+
ui.setHold(call.getState() == Call.State.ONHOLD);
- //Initialize buttonCount = 2. Because speaker and dialpad these two always show in Call UI.
- int buttonCount = 2;
+ // Initialize buttonCount = 3.
+ // Because speaker and dialpad and mute these three always show in Call UI.
+ int buttonCount = 3;
buttonCount += toInteger(canVideoCall);
buttonCount += toInteger(showAddCallOption);
buttonCount += toInteger(showMergeOption);
buttonCount += toInteger(showAddParticipantOption);
buttonCount += toInteger(showHoldOption);
buttonCount += toInteger(showSwapOption);
- buttonCount += toInteger(call.can(PhoneCapabilities.MUTE));
buttonCount += toInteger(showManageVideoCallConferenceOption);
+ buttonCount += toInteger(showRecordOption);
Log.v(this, "show AddParticipant: " + showAddParticipantOption +
" show ManageVideoCallConference: " + showManageVideoCallConferenceOption);
Log.v(this, "No of InCall buttons: " + buttonCount + " canVideoCall: " + canVideoCall);
- // Show overflow menu if number of buttons is greater than 5.
- final boolean showOverflowMenu =
- buttonCount > BUTTON_THRESOLD_TO_DISPLAY_OVERFLOW_MENU;
+ int phoneType = TelephonyManager.getDefault().getCurrentPhoneType(call.getSubId());
+ int maxButtonCount = (TelephonyManager.PHONE_TYPE_CDMA != phoneType) ?
+ BUTTON_THRESOLD_TO_DISPLAY_OVERFLOW_MENU :
+ BUTTON_THRESOLD_TO_DISPLAY_OVERFLOW_MENU - 1;
+
+ // Show overflow menu if number of buttons is greater than 5(4 in CDMA type).
+ final boolean showOverflowMenu = buttonCount > maxButtonCount;
final boolean isVideoOverflowScenario = canVideoCall && showOverflowMenu;
final boolean isOverflowScenario = !canVideoCall && showOverflowMenu;