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

Commit d56eb125 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4674419 from 4b0bc050 to qt-release

Change-Id: Idbea0514fcc1232e2ade0703e00a052fd649eb0a
parents 6da379f6 4b0bc050
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2018 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="36dp"
    android:height="36dp"
    android:viewportWidth="36.0"
    android:viewportHeight="36.0"
    android:tint="?attr/colorControlNormal">
  <group
      android:pivotX="12"
      android:pivotY="12"
      android:scaleX="1.5"
      android:scaleY="1.5"
      android:translateX="6"
      android:translateY="6">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
  </group>
</vector>
 No newline at end of file
+13 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.FragmentManager;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler;
import com.android.dialer.blockreportspam.BlockReportSpamDialogs;
import com.android.dialer.blockreportspam.BlockReportSpamDialogs.DialogFragmentForReportingNotSpam;
@@ -31,26 +32,32 @@ import com.android.dialer.logging.Logger;
import com.android.dialer.logging.ReportingLocation;
import com.android.dialer.spam.Spam;
import com.android.dialer.spam.SpamComponent;
import com.android.dialer.spam.promo.SpamBlockingPromoHelper;

/** Listener to show dialogs for block and report spam actions. */
public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClickListener {

  private final Context context;
  private final View rootView;
  private final FragmentManager fragmentManager;
  private final RecyclerView.Adapter adapter;
  private final FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler;
  private final Spam spam;
  private final SpamBlockingPromoHelper spamBlockingPromoHelper;

  public BlockReportSpamListener(
      Context context,
      View rootView,
      FragmentManager fragmentManager,
      RecyclerView.Adapter adapter,
      FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler) {
    this.context = context;
    this.rootView = rootView;
    this.fragmentManager = fragmentManager;
    this.adapter = adapter;
    this.filteredNumberAsyncQueryHandler = filteredNumberAsyncQueryHandler;
    spam = SpamComponent.get(context).spam();
    spamBlockingPromoHelper = new SpamBlockingPromoHelper(context, spam);
  }

  @Override
@@ -85,6 +92,10 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
                  },
                  number,
                  countryIso);

              if (isSpamChecked) {
                spamBlockingPromoHelper.showSpamBlockingPromoDialog(rootView, fragmentManager);
              }
            },
            null)
        .show(fragmentManager, BlockReportSpamDialogs.BLOCK_REPORT_SPAM_DIALOG_TAG);
@@ -122,6 +133,8 @@ public class BlockReportSpamListener implements CallLogListItemViewHolder.OnClic
                  },
                  number,
                  countryIso);

              spamBlockingPromoHelper.showSpamBlockingPromoDialog(rootView, fragmentManager);
            },
            null)
        .show(fragmentManager, BlockReportSpamDialogs.BLOCK_DIALOG_TAG);
+1 −0
Original line number Diff line number Diff line
@@ -564,6 +564,7 @@ public class CallLogAdapter extends GroupingListAdapter
    blockReportSpamListener =
        new BlockReportSpamListener(
            this.activity,
            this.activity.findViewById(R.id.call_log_fragment_root),
            ((Activity) this.activity).getFragmentManager(),
            this,
            this.filteredNumberAsyncQueryHandler);
+22 −32
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.support.v4.content.ContextCompat;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneNumberUtils;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.DateUtils;
@@ -199,20 +200,7 @@ public class PhoneCallDetailsHelper
      views.callAccountLabel.setVisibility(View.GONE);
    }

    final CharSequence nameText;
    final CharSequence displayNumber = details.displayNumber;
    if (TextUtils.isEmpty(details.getPreferredName())) {
      nameText = displayNumber;
      // We have a real phone number as "nameView" so make it always LTR
      views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR);
    } else {
      nameText = details.getPreferredName();
      // "nameView" is updated from phone number to contact name after number matching.
      // Since TextDirection remains at View.TEXT_DIRECTION_LTR, initialize it.
      views.nameView.setTextDirection(View.TEXT_DIRECTION_INHERIT);
    }

    views.nameView.setText(nameText);
    setNameView(views, details);

    if (isVoicemail) {
      int relevantLinkTypes = Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS | Linkify.WEB_URLS;
@@ -282,6 +270,26 @@ public class PhoneCallDetailsHelper
            details.isRead ? R.color.call_log_detail_color : R.color.call_log_unread_text_color));
  }

  private void setNameView(PhoneCallDetailsViews views, PhoneCallDetails details) {
    if (!TextUtils.isEmpty(details.getPreferredName())) {
      views.nameView.setText(details.getPreferredName());
      // "nameView" is updated from phone number to contact name after number matching.
      // Since TextDirection remains at View.TEXT_DIRECTION_LTR, initialize it.
      views.nameView.setTextDirection(View.TEXT_DIRECTION_INHERIT);
      return;
    }

    if (PhoneNumberUtils.isEmergencyNumber(details.number.toString())) {
      views.nameView.setText(R.string.emergency_number);
      views.nameView.setTextDirection(View.TEXT_DIRECTION_INHERIT);
      return;
    }

    views.nameView.setText(details.displayNumber);
    // We have a real phone number as "nameView" so make it always LTR
    views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR);
  }

  private boolean shouldShowTranscriptionRating(
      int transcriptionState, PhoneAccountHandle account) {
    if (transcriptionState != VoicemailCompat.TRANSCRIPTION_AVAILABLE) {
@@ -548,24 +556,6 @@ public class PhoneCallDetailsHelper
    return currentYear != calendar.get(Calendar.YEAR);
  }

  /** 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;
    if (!TextUtils.isEmpty(details.namePrimary)) {
      nameText = details.namePrimary;
    } else if (!TextUtils.isEmpty(details.displayNumber)) {
      nameText = details.displayNumber;
    } else {
      nameText = resources.getString(R.string.unknown);
    }

    nameView.setText(nameText);
  }

  public void setCurrentTimeForTest(long currentTimeMillis) {
    currentTimeMillisForTest = currentTimeMillis;
  }

  /**
   * Returns the current time in milliseconds since the epoch.
   *
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

<!-- Layout parameters are set programmatically. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/call_log_fragment_root"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">
Loading