Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9d687cc authored by Tyler Gunn's avatar Tyler Gunn Committed by Android Git Automerger
Browse files

am 27c57f5e: Call History Affordances Swap

* commit '27c57f5e':
  Call History Affordances Swap
parents cfe34de3 27c57f5e
Loading
Loading
Loading
Loading
+31 −11
Original line number Diff line number Diff line
@@ -114,6 +114,25 @@
                    />
                </LinearLayout>
            </LinearLayout>
            <!-- Linear layout to house a vertical separator line and the
                 secondary action button.  Used as a convenience to hide both
                 the separator and action button at the same time. -->
            <LinearLayout
                android:id="@+id/secondary_action_view"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:gravity="center_vertical"
                >
                <!-- Thin vertical divider to visually separate the secondary action button -->
                <View
                    android:id="@+id/vertical_divider"
                    android:layout_width="@dimen/call_log_list_item_vertical_divider_width"
                    android:layout_height="match_parent"
                    android:layout_marginTop="@dimen/call_log_list_item_vertical_divider_margin"
                    android:layout_marginBottom="@dimen/call_log_list_item_vertical_divider_margin"
                    android:background="?android:attr/dividerVertical"/>
                <!-- The secondary action button; either play voicemail or call details. -->
                <ImageButton
                    android:id="@+id/secondary_action_icon"
                    android:layout_width="@dimen/call_log_call_action_width"
@@ -127,6 +146,7 @@
                    android:nextFocusLeft="@id/primary_action_view"
                />
            </LinearLayout>
        </LinearLayout>

    <TextView
        android:id="@+id/call_log_header"
+7 −0
Original line number Diff line number Diff line
@@ -43,6 +43,13 @@
    <dimen name="call_log_list_contact_photo_size">64dip</dimen>
    <dimen name="call_detail_contact_name_margin">24dip</dimen>
    <dimen name="call_detail_button_spacing">2dip</dimen>
    <!-- Defines the vertical margin for the vertical separator between
         the main area of a call log entry and the secondary action button. -->
    <dimen name="call_log_list_item_vertical_divider_margin">8dp</dimen>

    <!-- Defines the width of the vertical separator between
         the main area of a call log entry and the secondary action button. -->
    <dimen name="call_log_list_item_vertical_divider_width">1dp</dimen>

    <!-- Layout weight values for dialpad screen. These layouts will be used in one
         LinearLayout (dialpad_fragment.xml), configuring dialpad screen's vertical
+80 −0
Original line number Diff line number Diff line
@@ -435,6 +435,86 @@
    -->
    <string name="description_call">Call <xliff:g id="name">%1$s</xliff:g></string>

    <!-- String describing the button to access the contact details for a name or number.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_contact_details">Contact details for <xliff:g id="nameOrNumber">%1$s</xliff:g></string>

    <!-- String describing the button to access call details in the call log.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_call_details">Call details</string>

    <!-- String indicating a call log entry has an associated voicemail.

    Note: AccessibilityServices use this attribute to announce what the view represents.
          This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_new_voicemail">New voicemail.</string>

    <!-- String indicating the number of calls to/from a caller in the call log.

    Note: AccessibilityServices use this attribute to announce what the view represents.
          This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_num_calls"><xliff:g id="numberOfCalls">%1$s</xliff:g> calls.</string>


    <!-- Call history description for a missed call from a caller.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_return_missed_call">Return missed call from <xliff:g id="nameOrNumber">%1$s</xliff:g> <xliff:g id="typeOrLocation">%2$s</xliff:g> <xliff:g id="timeOfCall">%3$s</xliff:g></string>


    <!-- Call history description for an answered call for a caller.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_return_answered_call">Return answered call from <xliff:g id="nameOrNumber">%1$s</xliff:g> <xliff:g id="typeOrLocation">%2$s</xliff:g> <xliff:g id="timeOfCall">%3$s</xliff:g></string>

    <!-- Call history description for a missed call from an unknown caller.
         Drops the "return" part of description_return_missed_call since it is not
         possible to actually call an unknown number.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_unknown_missed_call">Missed call from <xliff:g id="nameOrNumber">%1$s</xliff:g> <xliff:g id="typeOrLocation">%2$s</xliff:g> <xliff:g id="timeOfCall">%3$s</xliff:g></string>


    <!-- Call history description for an answered call from an unknown caller.
        Drops the "return" part of description_return_answered_call since it is not
         possible to actually call an unknown number.
        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_unknown_answered_call">Answered call from <xliff:g id="nameOrNumber">%1$s</xliff:g> <xliff:g id="typeOrLocation">%2$s</xliff:g> <xliff:g id="timeOfCall">%3$s</xliff:g></string>

    <!-- String describing an outgoing call entry in the call log.  Used to indicate that
         a call will be made to the specified caller.  Used when there are multiple calls to/from
         the caller.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_call_last_multiple">Call <xliff:g id="nameOrNumber">%1$s</xliff:g> <xliff:g id="typeOrLocation">%2$s</xliff:g>.  Last called <xliff:g id="timeOfCall">%3$s</xliff:g>.</string>

    <!-- String describing an outgoing call entry in the call log.  Used to indicate that
         a call will be made to the specified caller.  Used when there is only a single call
         related to/from the caller.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_call_last">Call <xliff:g id="nameOrNumber">%1$s</xliff:g> <xliff:g id="typeOrLocation">%2$s</xliff:g>.  Called <xliff:g id="timeOfCall">%3$s</xliff:g>.</string>


    <!-- String describing the button to SMS a number or contact.

+38 −16
Original line number Diff line number Diff line
@@ -90,26 +90,13 @@ public class PhoneCallDetailsHelper {
                isHighlighted ? mCallTypeHelper.getHighlightedColor(details.callTypes[0]) : null;

        // The date of this call, relative to the current time.
        CharSequence dateText =
            DateUtils.getRelativeTimeSpanString(details.date,
                    getCurrentTimeMillis(),
                    DateUtils.MINUTE_IN_MILLIS,
                    DateUtils.FORMAT_ABBREV_RELATIVE);
        CharSequence dateText = getCallDate(details);

        // Set the call count and date.
        setCallCountAndDate(views, callCount, dateText, highlightColor);

        CharSequence numberFormattedLabel = null;
        // Only show a label if the number is shown and it is not a SIP address.
        if (!TextUtils.isEmpty(details.number)
                && !PhoneNumberUtils.isUriNumber(details.number.toString())) {
            if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
                numberFormattedLabel = details.geocode;
            } else {
                numberFormattedLabel = Phone.getTypeLabel(mResources, details.numberType,
                        details.numberLabel);
            }
        }
        // Get type of call (ie mobile, home, etc) if known, or the caller's
        CharSequence numberFormattedLabel = getCallTypeOrLocation(details);

        final CharSequence nameText;
        final CharSequence numberText;
@@ -140,6 +127,41 @@ public class PhoneCallDetailsHelper {
        views.labelView.setVisibility(TextUtils.isEmpty(labelText) ? View.GONE : View.VISIBLE);
    }

    /**
     * For a call, if there is an associated contact for the caller, return the known call type
     * (e.g. mobile, home, work).  If there is no associated contact, attempt to use the caller's
     * location if known.
     * @param details Call details to use.
     * @return Type of call (mobile/home) if known, or the location of the caller (if known).
     */
    public CharSequence getCallTypeOrLocation(PhoneCallDetails details) {
        CharSequence numberFormattedLabel = null;
        // Only show a label if the number is shown and it is not a SIP address.
        if (!TextUtils.isEmpty(details.number)
                && !PhoneNumberUtils.isUriNumber(details.number.toString())) {
            if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
                numberFormattedLabel = details.geocode;
            } else {
                numberFormattedLabel = Phone.getTypeLabel(mResources, details.numberType,
                        details.numberLabel);
            }
        }
        return numberFormattedLabel;
    }

    /**
     * Get the call date/time of the call, relative to the current time.
     * e.g. 3 minutes ago
     * @param details Call details to use.
     * @return String representing when the call occurred.
     */
    public CharSequence getCallDate(PhoneCallDetails details) {
        return DateUtils.getRelativeTimeSpanString(details.date,
                getCurrentTimeMillis(),
                DateUtils.MINUTE_IN_MILLIS,
                DateUtils.FORMAT_ABBREV_RELATIVE);
    }

    /** Sets the text of the header view for the details page of a phone call. */
    public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) {
        final CharSequence nameText;
+25 −27
Original line number Diff line number Diff line
@@ -183,9 +183,11 @@ public class CallLogAdapter extends GroupingListAdapter
    /** Can be set to true by tests to disable processing of requests. */
    private volatile boolean mRequestProcessingDisabled = false;

    /** True if CallLogAdapter is created from the PhoneFavoriteFragment, where the primary
     * action should be set to call a number instead of opening the detail page. */
    private boolean mUseCallAsPrimaryAction = false;
    /**
     * Whether to show the secondary action button used to play voicemail or show call details.
     * True if created from a CallLogFragment.
     * False if created from the PhoneFavoriteFragment. */
    private boolean mShowSecondaryActionButton = true;

    private boolean mIsCallLog = true;
    private int mNumMissedCalls = 0;
@@ -246,14 +248,14 @@ public class CallLogAdapter extends GroupingListAdapter
    };

    public CallLogAdapter(Context context, CallFetcher callFetcher,
            ContactInfoHelper contactInfoHelper, boolean useCallAsPrimaryAction,
            ContactInfoHelper contactInfoHelper, boolean showSecondaryActionButton,
            boolean isCallLog) {
        super(context);

        mContext = context;
        mCallFetcher = callFetcher;
        mContactInfoHelper = contactInfoHelper;
        mUseCallAsPrimaryAction = useCallAsPrimaryAction;
        mShowSecondaryActionButton = showSecondaryActionButton;
        mIsCallLog = isCallLog;

        mContactInfoCache = ExpirableCache.create(CONTACT_INFO_CACHE_SIZE);
@@ -508,7 +510,7 @@ public class CallLogAdapter extends GroupingListAdapter
        // Get the views to bind to.
        CallLogListItemViews views = CallLogListItemViews.fromView(view);
        views.primaryActionView.setOnClickListener(mActionListener);
        views.secondaryActionView.setOnClickListener(mActionListener);
        views.secondaryActionButtonView.setOnClickListener(mActionListener);
        view.setTag(views);
    }

@@ -535,31 +537,30 @@ public class CallLogAdapter extends GroupingListAdapter

        final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c);

        if (!mUseCallAsPrimaryAction) {
            // Sets the primary action to open call detail page.
            views.primaryActionView.setTag(
                    IntentProvider.getCallDetailIntentProvider(
                            getCursor(), c.getPosition(), c.getLong(CallLogQuery.ID), count));
        } else if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
        // Primary action is always to call, if possible.
        if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
            // Sets the primary action to call the number.
            views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number));
        } else {
            views.primaryActionView.setTag(null);
        }

        if ( mShowSecondaryActionButton ) {
            // Store away the voicemail information so we can play it directly.
            if (callType == Calls.VOICEMAIL_TYPE) {
                String voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
                final long rowId = c.getLong(CallLogQuery.ID);
            views.secondaryActionView.setTag(
                views.secondaryActionButtonView.setTag(
                        IntentProvider.getPlayVoicemailIntentProvider(rowId, voicemailUri));
        } else if (!TextUtils.isEmpty(number)) {
            // Store away the number so we can call it directly if you click on the call icon.
            views.secondaryActionView.setTag(
                    IntentProvider.getReturnCallIntentProvider(number));
            } else {
                // Store the call details information.
                views.secondaryActionButtonView.setTag(
                        IntentProvider.getCallDetailIntentProvider(
                                getCursor(), c.getPosition(), c.getLong(CallLogQuery.ID), count));
            }
        } else {
            // No action enabled.
            views.secondaryActionView.setTag(null);
            views.secondaryActionButtonView.setTag(null);
        }

        // Lookup contacts with this number
@@ -624,7 +625,7 @@ public class CallLogAdapter extends GroupingListAdapter
        // New items also use the highlighted version of the text.
        final boolean isHighlighted = isNew;
        mCallLogViewsHelper.setPhoneCallDetails(views, details, isHighlighted,
                mUseCallAsPrimaryAction);
                mShowSecondaryActionButton);

        if (photoId == 0 && photoUri != null) {
            setPhoto(views, photoUri, lookupUri);
@@ -632,9 +633,6 @@ public class CallLogAdapter extends GroupingListAdapter
            setPhoto(views, photoId, lookupUri);
        }

        views.quickContactView.setContentDescription(views.phoneCallDetailsViews.nameView.
                getText());

        // Listen for the first draw
        if (mViewTreeObserver == null) {
            mViewTreeObserver = view.getViewTreeObserver();
Loading