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

Commit 6ecb732e authored by Daniel Lehmann's avatar Daniel Lehmann
Browse files

Replace the list of call symbols by a single custom view to paint them.

Saves about 7-21 views per screen and should be more efficient to recycle

Bug:5099652
Change-Id: I10a1b1d188c5c58329de4ba063d41f8c116c3497
parent f513860e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@
    android:background="?attr/call_log_secondary_background_color"
    android:padding="@dimen/call_log_indent_margin"
>
    <FrameLayout
    <view
        class="com.android.contacts.calllog.CallTypeIconsView"
        android:id="@+id/call_type_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
+2 −2
Original line number Diff line number Diff line
@@ -45,13 +45,13 @@
            android:layout_height="wrap_content"
            android:orientation="horizontal"
        >
            <LinearLayout
            <view
                class="com.android.contacts.calllog.CallTypeIconsView"
                android:id="@+id/call_type_icons"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/call_log_icon_margin"
                android:layout_gravity="center_vertical"
                android:orientation="horizontal"
            />
            <TextView
                android:id="@+id/call_type_name"
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ public class CallDetailActivity extends ListActivity implements
        mResources = getResources();

        mPhoneCallDetailsViews = PhoneCallDetailsViews.fromView(getWindow().getDecorView());
        mCallTypeHelper = new CallTypeHelper(getResources(), mInflater);
        mCallTypeHelper = new CallTypeHelper(getResources());
        mPhoneNumberHelper = new PhoneNumberHelper(mResources, getVoicemailNumber());
        mPhoneCallDetailsHelper = new PhoneCallDetailsHelper(mResources, mCallTypeHelper,
                mPhoneNumberHelper);
+3 −4
Original line number Diff line number Diff line
@@ -61,10 +61,10 @@ public class PhoneCallDetailsHelper {
    public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details,
            boolean useIcons, boolean isHighlighted, boolean nameOnly) {
        if (useIcons) {
            views.callTypeIcons.removeAllViews();
            views.callTypeIcons.clear();
            int count = details.callTypes.length;
            for (int index = 0; index < count && index < MAX_CALL_TYPE_ICONS; ++index) {
                mCallTypeHelper.inflateCallTypeIcon(details.callTypes[index], views.callTypeIcons);
                views.callTypeIcons.add(details.callTypes[index]);
            }
            views.callTypeIcons.setVisibility(View.VISIBLE);
            if (count > MAX_CALL_TYPE_ICONS) {
@@ -77,14 +77,13 @@ public class PhoneCallDetailsHelper {
                views.callTypeSeparator.setVisibility(View.GONE);
            }
        } else {
            String callTypeName;
            // Use the name of the first call type.
            // TODO: We should update this to handle the text for multiple calls as well.
            int callType = details.callTypes[0];
            views.callTypeText.setText(
                    isHighlighted ? mCallTypeHelper.getHighlightedCallTypeText(callType)
                            : mCallTypeHelper.getCallTypeText(callType));
            views.callTypeIcons.removeAllViews();
            views.callTypeIcons.clear();

            views.callTypeText.setVisibility(View.VISIBLE);
            views.callTypeSeparator.setVisibility(View.VISIBLE);
+8 −6
Original line number Diff line number Diff line
@@ -16,9 +16,10 @@

package com.android.contacts;

import com.android.contacts.calllog.CallTypeIconsView;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
@@ -27,14 +28,15 @@ import android.widget.TextView;
public final class PhoneCallDetailsViews {
    public final TextView nameView;
    public final View callTypeView;
    public final LinearLayout callTypeIcons;
    public final CallTypeIconsView callTypeIcons;
    public final TextView callTypeText;
    public final View callTypeSeparator;
    public final TextView dateView;
    public final TextView numberView;

    private PhoneCallDetailsViews(TextView nameView, View callTypeView, LinearLayout callTypeIcons,
            TextView callTypeText, View callTypeSeparator, TextView dateView, TextView numberView) {
    private PhoneCallDetailsViews(TextView nameView, View callTypeView,
            CallTypeIconsView callTypeIcons, TextView callTypeText, View callTypeSeparator,
            TextView dateView, TextView numberView) {
        this.nameView = nameView;
        this.callTypeView = callTypeView;
        this.callTypeIcons = callTypeIcons;
@@ -54,7 +56,7 @@ public final class PhoneCallDetailsViews {
    public static PhoneCallDetailsViews fromView(View view) {
        return new PhoneCallDetailsViews((TextView) view.findViewById(R.id.name),
                view.findViewById(R.id.call_type),
                (LinearLayout) view.findViewById(R.id.call_type_icons),
                (CallTypeIconsView) view.findViewById(R.id.call_type_icons),
                (TextView) view.findViewById(R.id.call_type_name),
                view.findViewById(R.id.call_type_separator),
                (TextView) view.findViewById(R.id.date),
@@ -65,7 +67,7 @@ public final class PhoneCallDetailsViews {
        return new PhoneCallDetailsViews(
                new TextView(context),
                new View(context),
                new LinearLayout(context),
                new CallTypeIconsView(context),
                new TextView(context),
                new View(context),
                new TextView(context),
Loading