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

Commit ef366bad authored by kaiyiz's avatar kaiyiz
Browse files

Fix operator name not displayed in call log

Get the operator name and display it in call log list item and
Dialpadfragment, show the SIM name when operator name is not available.

CRs-Fixed: 775267

Change-Id: Ibf007f7968749689d2ccf2d3c84fb7b11c5fe5dc
parent 6d904c46
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -121,7 +121,18 @@
                        android:layout_gravity="center_vertical"
                        android:tint="?attr/call_log_secondary_text_color"
                        android:scaleType="centerInside"
                        android:visibility="gone"
                        />
                    <TextView
                        android:id="@+id/operator"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="@dimen/call_log_icon_margin"
                        android:layout_gravity="center_vertical"
                        android:textColor="?attr/call_log_secondary_text_color"
                        android:textSize="12sp"
                        android:singleLine="true"
                        android:visibility="gone" />
                    <TextView
                        android:id="@+id/call_location_and_date"
                        android:layout_width="wrap_content"
+10 −0
Original line number Diff line number Diff line
@@ -73,4 +73,14 @@

    </FrameLayout>

    <TextView
        android:id="@+id/dialpad_floating_operator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/dialpad_floating_action_button_container"
        android:layout_centerHorizontal="true"
        android:textColor="?attr/call_log_secondary_text_color"
        android:textSize="12sp"
        android:singleLine="true"
        android:visibility="gone" />
</view>
+21 −2
Original line number Diff line number Diff line
@@ -95,6 +95,10 @@ public class PhoneCallDetails implements CallDetailHeader.Data {
     * Duration type for this call.
     */
    public final int durationType;
    /**
     * The operator for this call.
     */
    public final String operator;
    /**
     * Default phone Id
     */
@@ -127,10 +131,11 @@ public class PhoneCallDetails implements CallDetailHeader.Data {
    public PhoneCallDetails(CharSequence number, int numberPresentation,
            CharSequence formattedNumber, String countryIso, String geocode,
            int[] callTypes, long date, long duration, String accountLabel, Drawable accountIcon,
            int features, Long dataUsage, String transcription, long accountId) {
            int features, Long dataUsage, String transcription, long accountId, String operator) {
        this(number, numberPresentation, formattedNumber, countryIso, geocode,
                callTypes, date, duration, "", 0, "", null, null, 0, accountLabel, accountIcon,
                features, dataUsage, transcription, Calls.DURATION_TYPE_ACTIVE, accountId);
                features, dataUsage, transcription, Calls.DURATION_TYPE_ACTIVE, accountId,
                operator);
    }

    public PhoneCallDetails(CharSequence number, int numberPresentation,
@@ -152,6 +157,19 @@ public class PhoneCallDetails implements CallDetailHeader.Data {
            int numberType, CharSequence numberLabel, Uri contactUri,
            Uri photoUri, int sourceType, String accountLabel, Drawable accountIcon, int features,
            Long dataUsage, String transcription, int durationType, long accountId) {
        this(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date,
                duration, name, numberType, numberLabel, contactUri, photoUri, sourceType,
                accountLabel, accountIcon, features, dataUsage, transcription, durationType,
                accountId, null);
    }

    /** Create the details for a call with a number associated with a contact. */
    public PhoneCallDetails(CharSequence number, int numberPresentation,
            CharSequence formattedNumber, String countryIso, String geocode,
            int[] callTypes, long date, long duration, CharSequence name,
            int numberType, CharSequence numberLabel, Uri contactUri, Uri photoUri, int sourceType,
            String accountLabel, Drawable accountIcon, int features, Long dataUsage,
            String transcription, int durationType, long accountId, String operator) {
        this.number = number;
        this.numberPresentation = numberPresentation;
        this.formattedNumber = formattedNumber;
@@ -173,6 +191,7 @@ public class PhoneCallDetails implements CallDetailHeader.Data {
        this.transcription = transcription;
        this.durationType = durationType;
        this.accountId = accountId;
        this.operator = operator;
    }

    @Override
+10 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.view.View;
import android.widget.TextView;

import com.android.contacts.common.CallUtil;
import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.dialer.calllog.CallTypeHelper;
@@ -115,8 +116,15 @@ public class PhoneCallDetailsHelper {

        // set the account icon if it exists
        if (details.accountIcon != null) {
            if (MoreContactUtils.shouldShowOperator(mResources)) {
                views.operator.setVisibility(View.VISIBLE);
                views.operator.setText(details.operator);
                views.callAccountIcon.setVisibility(View.GONE);
            } else {
                views.operator.setVisibility(View.GONE);
                views.callAccountIcon.setVisibility(View.VISIBLE);
                views.callAccountIcon.setImageDrawable(details.accountIcon);
            }
        } else {
            views.callAccountIcon.setVisibility(View.GONE);
        }
+5 −1
Original line number Diff line number Diff line
@@ -31,16 +31,18 @@ public final class PhoneCallDetailsViews {
    public final View callTypeView;
    public final CallTypeIconsView callTypeIcons;
    public final ImageView callAccountIcon;
    public final TextView operator;
    public final TextView callLocationAndDate;
    public final TextView voicemailTranscriptionView;

    private PhoneCallDetailsViews(TextView nameView, View callTypeView,
            CallTypeIconsView callTypeIcons, ImageView callAccountIcon,
            CallTypeIconsView callTypeIcons, ImageView callAccountIcon, TextView operator,
            TextView callLocationAndDate, TextView voicemailTranscriptionView) {
        this.nameView = nameView;
        this.callTypeView = callTypeView;
        this.callTypeIcons = callTypeIcons;
        this.callAccountIcon = callAccountIcon;
        this.operator = operator;
        this.callLocationAndDate = callLocationAndDate;
        this.voicemailTranscriptionView = voicemailTranscriptionView;
    }
@@ -57,6 +59,7 @@ public final class PhoneCallDetailsViews {
                view.findViewById(R.id.call_type),
                (CallTypeIconsView) view.findViewById(R.id.call_type_icons),
                (ImageView) view.findViewById(R.id.call_account_icon),
                (TextView) view.findViewById(R.id.operator),
                (TextView) view.findViewById(R.id.call_location_and_date),
                (TextView) view.findViewById(R.id.voicemail_transcription));
    }
@@ -68,6 +71,7 @@ public final class PhoneCallDetailsViews {
                new CallTypeIconsView(context),
                new ImageView(context),
                new TextView(context),
                new TextView(context),
                new TextView(context));
    }
}
Loading