Merge "Changed Quick Contacts details Button to ImageView" into jb-mr1.1-dev
diff --git a/src/com/android/contacts/activities/DialtactsActivity.java b/src/com/android/contacts/activities/DialtactsActivity.java
index ea68407..556f0b0 100644
--- a/src/com/android/contacts/activities/DialtactsActivity.java
+++ b/src/com/android/contacts/activities/DialtactsActivity.java
@@ -833,7 +833,7 @@
if (mViewPager.getCurrentItem() == TAB_INDEX_DIALER) {
if (mDialpadFragment != null) {
- mDialpadFragment.configureScreenFromIntent(newIntent);
+ mDialpadFragment.setStartedFromNewIntent(true);
} else {
Log.e(TAG, "DialpadFragment isn't ready yet when the tab is already selected.");
}
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index a8c2f06..9d8066c 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -77,8 +77,6 @@
/** Whether there is at least one voicemail source installed. */
private boolean mVoicemailSourcesAvailable = false;
- /** Whether we are currently filtering over voicemail. */
- private boolean mShowingVoicemailOnly = false;
private VoicemailStatusHelper mVoicemailStatusHelper;
private View mStatusMessageView;
@@ -317,10 +315,6 @@
public void startCallsQuery() {
mAdapter.setLoading(true);
mCallLogQueryHandler.fetchCalls(mCallTypeFilter);
- if (mShowingVoicemailOnly) {
- mShowingVoicemailOnly = false;
- getActivity().invalidateOptionsMenu();
- }
}
private void startVoicemailStatusQuery() {
@@ -340,10 +334,49 @@
// menu items are ready if the first item is non-null.
if (itemDeleteAll != null) {
itemDeleteAll.setEnabled(mAdapter != null && !mAdapter.isEmpty());
- menu.findItem(R.id.show_voicemails_only).setVisible(mVoicemailSourcesAvailable);
+
+ showAllFilterMenuOptions(menu);
+ hideCurrentFilterMenuOption(menu);
+
+ // Only hide if not available. Let the above calls handle showing.
+ if (!mVoicemailSourcesAvailable) {
+ menu.findItem(R.id.show_voicemails_only).setVisible(false);
+ }
}
}
+ private void hideCurrentFilterMenuOption(Menu menu) {
+ MenuItem item = null;
+ switch (mCallTypeFilter) {
+ case CallLogQueryHandler.CALL_TYPE_ALL:
+ item = menu.findItem(R.id.show_all_calls);
+ break;
+ case Calls.INCOMING_TYPE:
+ item = menu.findItem(R.id.show_incoming_only);
+ break;
+ case Calls.OUTGOING_TYPE:
+ item = menu.findItem(R.id.show_outgoing_only);
+ break;
+ case Calls.MISSED_TYPE:
+ item = menu.findItem(R.id.show_missed_only);
+ break;
+ case Calls.VOICEMAIL_TYPE:
+ menu.findItem(R.id.show_voicemails_only);
+ break;
+ }
+ if (item != null) {
+ item.setVisible(false);
+ }
+ }
+
+ private void showAllFilterMenuOptions(Menu menu) {
+ menu.findItem(R.id.show_all_calls).setVisible(true);
+ menu.findItem(R.id.show_incoming_only).setVisible(true);
+ menu.findItem(R.id.show_outgoing_only).setVisible(true);
+ menu.findItem(R.id.show_missed_only).setVisible(true);
+ menu.findItem(R.id.show_voicemails_only).setVisible(true);
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
@@ -375,7 +408,6 @@
registerPhoneCallReceiver();
mCallLogQueryHandler.fetchCalls(Calls.VOICEMAIL_TYPE);
updateFilterTypeAndHeader(Calls.VOICEMAIL_TYPE);
- mShowingVoicemailOnly = true;
return true;
case R.id.show_all_calls:
@@ -383,7 +415,6 @@
unregisterPhoneCallReceiver();
mCallLogQueryHandler.fetchCalls(CallLogQueryHandler.CALL_TYPE_ALL);
updateFilterTypeAndHeader(CallLogQueryHandler.CALL_TYPE_ALL);
- mShowingVoicemailOnly = false;
return true;
default:
diff --git a/src/com/android/contacts/dialpad/DialpadFragment.java b/src/com/android/contacts/dialpad/DialpadFragment.java
index 6ba4178..a310b88 100644
--- a/src/com/android/contacts/dialpad/DialpadFragment.java
+++ b/src/com/android/contacts/dialpad/DialpadFragment.java
@@ -198,6 +198,8 @@
*/
private boolean mDigitsFilledByIntent;
+ private boolean mStartedFromNewIntent = false;
+
private static final String PREF_DIGITS_FILLED_BY_INTENT = "pref_digits_filled_by_intent";
@Override
@@ -323,8 +325,6 @@
mDialpadChooser = (ListView) fragmentView.findViewById(R.id.dialpadChooser);
mDialpadChooser.setOnItemClickListener(this);
- configureScreenFromIntent(getActivity().getIntent());
-
return fragmentView;
}
@@ -381,45 +381,11 @@
}
/**
- * @see #showDialpadChooser(boolean)
+ * Determines whether an add call operation is requested.
+ *
+ * @param intent The intent.
+ * @return {@literal true} if add call operation was requested. {@literal false} otherwise.
*/
- private static boolean needToShowDialpadChooser(Intent intent, boolean isAddCallMode) {
- final String action = intent.getAction();
-
- boolean needToShowDialpadChooser = false;
-
- if (Intent.ACTION_DIAL.equals(action) || Intent.ACTION_VIEW.equals(action)) {
- Uri uri = intent.getData();
- if (uri == null) {
- // ACTION_DIAL or ACTION_VIEW with no data.
- // This behaves basically like ACTION_MAIN: If there's
- // already an active call, bring up an intermediate UI to
- // make the user confirm what they really want to do.
- // Be sure *not* to show the dialpad chooser if this is an
- // explicit "Add call" action, though.
- if (!isAddCallMode && phoneIsInUse()) {
- needToShowDialpadChooser = true;
- }
- }
- } else if (Intent.ACTION_MAIN.equals(action)) {
- // The MAIN action means we're bringing up a blank dialer
- // (e.g. by selecting the Home shortcut, or tabbing over from
- // Contacts or Call log.)
- //
- // At this point, IF there's already an active call, there's a
- // good chance that the user got here accidentally (but really
- // wanted the in-call dialpad instead). So we bring up an
- // intermediate UI to make the user confirm what they really
- // want to do.
- if (phoneIsInUse()) {
- // Log.i(TAG, "resolveIntent(): phone is in use; showing dialpad chooser!");
- needToShowDialpadChooser = true;
- }
- }
-
- return needToShowDialpadChooser;
- }
-
private static boolean isAddCallMode(Intent intent) {
final String action = intent.getAction();
if (Intent.ACTION_DIAL.equals(action) || Intent.ACTION_VIEW.equals(action)) {
@@ -434,7 +400,7 @@
* Checks the given Intent and changes dialpad's UI state. For example, if the Intent requires
* the screen to enter "Add Call" mode, this method will show correct UI for the mode.
*/
- public void configureScreenFromIntent(Intent intent) {
+ private void configureScreenFromIntent(Intent intent) {
if (!isLayoutReady()) {
// This happens typically when parent's Activity#onNewIntent() is called while
// Fragment#onCreateView() isn't called yet, and thus we cannot configure Views at
@@ -447,16 +413,37 @@
boolean needToShowDialpadChooser = false;
+ // Be sure *not* to show the dialpad chooser if this is an
+ // explicit "Add call" action, though.
final boolean isAddCallMode = isAddCallMode(intent);
if (!isAddCallMode) {
+
+ // Don't show the chooser when called via onNewIntent() and phone number is present.
+ // i.e. User clicks a telephone link from gmail for example.
+ // In this case, we want to show the dialpad with the phone number.
final boolean digitsFilled = fillDigitsIfNecessary(intent);
- if (!digitsFilled) {
- needToShowDialpadChooser = needToShowDialpadChooser(intent, isAddCallMode);
+ if (!(mStartedFromNewIntent && digitsFilled)) {
+
+ final String action = intent.getAction();
+ if (Intent.ACTION_DIAL.equals(action) || Intent.ACTION_VIEW.equals(action)
+ || Intent.ACTION_MAIN.equals(action)) {
+ // If there's already an active call, bring up an intermediate UI to
+ // make the user confirm what they really want to do.
+ if (phoneIsInUse()) {
+ needToShowDialpadChooser = true;
+ }
+ }
+
}
}
+
showDialpadChooser(needToShowDialpadChooser);
}
+ public void setStartedFromNewIntent(boolean value) {
+ mStartedFromNewIntent = value;
+ }
+
/**
* Sets formatted digits to digits field.
*/
@@ -490,6 +477,13 @@
}
@Override
+ public void onStart() {
+ super.onStart();
+ configureScreenFromIntent(getActivity().getIntent());
+ setStartedFromNewIntent(false);
+ }
+
+ @Override
public void onResume() {
super.onResume();