diff options
Diffstat (limited to 'src/com/android/dialer')
6 files changed, 51 insertions, 14 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 3c9b870dd..5e6f03597 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -229,6 +229,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private int mActionBarHeight; + /** + * The text returned from a voice search query. Set in {@link #onActivityResult} and used in + * {@link #onResume()} to populate the search box. + */ + private String mVoiceSearchQuery; + private class OptionsPopupMenu extends PopupMenu { public OptionsPopupMenu(Context context, View anchor) { super(context, anchor, Gravity.END); @@ -477,6 +483,16 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O showDialpadFragment(false); mShowDialpadOnResume = false; } + + // If there was a voice query result returned in the {@link #onActivityResult} callback, it + // will have been stashed in mVoiceSearchQuery since the search results fragment cannot be + // shown until onResume has completed. Active the search UI and set the search term now. + if (!TextUtils.isEmpty(mVoiceSearchQuery)) { + mActionBarController.onSearchBoxTapped(); + mSearchView.setText(mVoiceSearchQuery); + mVoiceSearchQuery = null; + } + mFirstLaunch = false; if (mIsRestarting) { @@ -618,7 +634,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O RecognizerIntent.EXTRA_RESULTS); if (matches.size() > 0) { final String match = matches.get(0); - mSearchView.setText(match); + mVoiceSearchQuery = match; } else { Log.e(TAG, "Voice search - nothing heard"); } diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java index 2e1651a70..b4e817174 100644 --- a/src/com/android/dialer/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/PhoneCallDetailsHelper.java @@ -115,7 +115,7 @@ public class PhoneCallDetailsHelper { views.callAccountLabel.setVisibility(View.VISIBLE); views.callAccountLabel.setText(accountLabel); int color = PhoneAccountUtils.getAccountColor(mContext, details.accountHandle); - if (color == PhoneAccount.NO_COLOR) { + if (color == PhoneAccount.NO_HIGHLIGHT_COLOR) { int defaultColor = R.color.dialtacts_secondary_text_color; views.callAccountLabel.setTextColor(mContext.getResources().getColor(defaultColor)); } else { diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 99bf38615..9528e4507 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -982,7 +982,8 @@ public class CallLogAdapter extends GroupingListAdapter } /*** - * Binds click handlers and intents to the voicemail, details and callback action buttons. + * Binds text titles, click handlers and intents to the voicemail, details and callback action + * buttons. * * @param views The call log item views. */ @@ -1005,6 +1006,14 @@ public class CallLogAdapter extends GroupingListAdapter } views.callBackButtonView.setVisibility(View.VISIBLE); views.callBackButtonView.setOnClickListener(mActionListener); + + final int titleId; + if (views.callType == Calls.VOICEMAIL_TYPE || views.callType == Calls.OUTGOING_TYPE) { + titleId = R.string.call_log_action_redial; + } else { + titleId = R.string.call_log_action_call_back; + } + views.callBackButtonView.setText(mContext.getString(titleId)); } else { // Number is not callable, so hide button. views.callBackButtonView.setTag(null); diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java index 1eb25fbfa..4ebfb4b88 100644 --- a/src/com/android/dialer/calllog/CallLogListItemHelper.java +++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java @@ -105,7 +105,7 @@ import com.android.dialer.R; * Returns the accessibility description of the "return call/call" action for a call log * entry. * Accessibility text is a combination of: - * {Voicemail Prefix}. {Number of Calls}. {Caller information}. + * {Voicemail Prefix}. {Number of Calls}. {Caller information} {Phone Account}. * If most recent call is a voicemail, {Voicemail Prefix} is "New Voicemail.", otherwise "". * * If more than one call for the caller, {Number of Calls} is: @@ -124,9 +124,13 @@ import com.android.dialer.R; * {Call type} is the contact phone number type (eg mobile) or location. * {Call Time} is the time since the last call for the contact occurred. * + * The {Phone Account} refers to the account/SIM through which the call was placed or received + * in multi-SIM devices. + * * Examples: - * 3 calls. New Voicemail. Missed call from Joe Smith mobile 2 hours ago. - * 2 calls. Answered call from John Doe mobile. Last called 1 hour ago. + * 3 calls. New Voicemail. Missed call from Joe Smith mobile 2 hours ago on SIM 1. + * + * 2 calls. Answered call from John Doe mobile 1 hour ago. * * @param context The application context. * @param details Details of call. @@ -165,13 +169,16 @@ import com.android.dialer.R; } int stringID = getCallDescriptionStringID(details); + String accountLabel = PhoneAccountUtils.getAccountLabel(context, details.accountHandle); // Use chosen string resource to build up the message. callDescription.append(mResources.getString(stringID, nameOrNumber, // If no type or location can be determined, sub in empty string. typeOrLocation == null ? "" : typeOrLocation, - timeOfCall)); + timeOfCall, + accountLabel == null ? "" : + mResources.getString(R.string.description_phone_account, accountLabel))); return callDescription; } @@ -187,13 +194,15 @@ import com.android.dialer.R; int stringID; if (lastCallType == Calls.VOICEMAIL_TYPE || lastCallType == Calls.MISSED_TYPE) { - //Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>. + //Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, + //<PhoneAccount>. stringID = R.string.description_incoming_missed_call; } else if (lastCallType == Calls.INCOMING_TYPE) { - //Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>. + //Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, + //<PhoneAccount>. stringID = R.string.description_incoming_answered_call; } else { - //Message: Call to <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>. + //Message: Call to <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, <PhoneAccount>. stringID = R.string.description_outgoing_call; } return stringID; diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java index 2eaf94937..adeec0f2b 100644 --- a/src/com/android/dialer/calllog/PhoneAccountUtils.java +++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java @@ -18,7 +18,6 @@ package com.android.dialer.calllog; import android.content.ComponentName; import android.content.Context; -import android.graphics.drawable.Drawable; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -65,7 +64,10 @@ public class PhoneAccountUtils { */ public static String getAccountLabel(Context context, PhoneAccountHandle accountHandle) { PhoneAccount account = getAccountOrNull(context, accountHandle); - return account == null ? null : account.getLabel().toString(); + if (account != null && account.getLabel() != null) { + return account.getLabel().toString(); + } + return null; } /** @@ -73,7 +75,7 @@ public class PhoneAccountUtils { */ public static int getAccountColor(Context context, PhoneAccountHandle accountHandle) { PhoneAccount account = getAccountOrNull(context, accountHandle); - return account == null ? PhoneAccount.NO_COLOR : account.getHighlightColor(); + return account == null ? PhoneAccount.NO_HIGHLIGHT_COLOR : account.getHighlightColor(); } /** diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index 382e42e56..3f670127f 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -441,7 +441,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements * @param itemIndex Position of the contact in {@link #mContactEntries}. */ private void markDropArea(int itemIndex) { - if (isIndexInBound(mDragEnteredEntryIndex) && isIndexInBound(itemIndex)) { + if (mDraggedEntry != null && isIndexInBound(mDragEnteredEntryIndex) && + isIndexInBound(itemIndex)) { mDataSetChangedListener.cacheOffsetsForDatasetChange(); // Remove the old placeholder item and place the new placeholder item. final int oldIndex = mDragEnteredEntryIndex; |