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

Commit 393d1df3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Ieae92b5a,I0b22eb9b

* changes:
  Convert @AutoValue CoalescedRow to a proto
  Show spam blocking promo after block spam dialog
parents b8edcd26 64b57780
Loading
Loading
Loading
Loading
+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);
+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">
+0 −134
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.
 */

package com.android.dialer.calllog.model;

import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import com.android.dialer.CoalescedIds;
import com.android.dialer.DialerPhoneNumber;
import com.android.dialer.NumberAttributes;
import com.google.auto.value.AutoValue;

/** Data class containing the contents of a row from the CoalescedAnnotatedCallLog. */
@AutoValue
public abstract class CoalescedRow {

  public static Builder builder() {
    return new AutoValue_CoalescedRow.Builder()
        .setId(0)
        .setTimestamp(0)
        .setNumber(DialerPhoneNumber.getDefaultInstance())
        .setNumberPresentation(0)
        .setIsRead(false)
        .setIsNew(false)
        .setPhoneAccountColor(0)
        .setFeatures(0)
        .setCallType(0)
        .setNumberAttributes(NumberAttributes.getDefaultInstance())
        .setIsVoicemailCall(false)
        .setCoalescedIds(CoalescedIds.getDefaultInstance());
  }

  public abstract Builder toBuilder();

  public abstract int id();

  public abstract long timestamp();

  public abstract DialerPhoneNumber number();

  @Nullable
  public abstract String formattedNumber();

  public abstract int numberPresentation();

  public abstract boolean isRead();

  public abstract boolean isNew();

  @Nullable
  public abstract String geocodedLocation();

  @Nullable
  public abstract String phoneAccountComponentName();

  @Nullable
  public abstract String phoneAccountId();

  @Nullable
  public abstract String phoneAccountLabel();

  @ColorInt
  public abstract int phoneAccountColor();

  public abstract int features();

  public abstract int callType();

  public abstract NumberAttributes numberAttributes();

  public abstract boolean isVoicemailCall();

  @Nullable
  public abstract String voicemailCallTag();

  public abstract CoalescedIds coalescedIds();

  /** Builder for {@link CoalescedRow}. */
  @AutoValue.Builder
  public abstract static class Builder {

    public abstract Builder setId(int id);

    public abstract Builder setTimestamp(long timestamp);

    public abstract Builder setNumber(DialerPhoneNumber number);

    public abstract Builder setFormattedNumber(@Nullable String formattedNumber);

    public abstract Builder setNumberPresentation(int presentation);

    public abstract Builder setIsRead(boolean isRead);

    public abstract Builder setIsNew(boolean isNew);

    public abstract Builder setGeocodedLocation(@Nullable String geocodedLocation);

    public abstract Builder setPhoneAccountComponentName(
        @Nullable String phoneAccountComponentName);

    public abstract Builder setPhoneAccountId(@Nullable String phoneAccountId);

    public abstract Builder setPhoneAccountLabel(@Nullable String phoneAccountLabel);

    public abstract Builder setPhoneAccountColor(@ColorInt int phoneAccountColor);

    public abstract Builder setFeatures(int features);

    public abstract Builder setCallType(int callType);

    public abstract Builder setNumberAttributes(NumberAttributes numberAttributes);

    public abstract Builder setIsVoicemailCall(boolean isVoicemail);

    public abstract Builder setVoicemailCallTag(@Nullable String tag);

    public abstract Builder setCoalescedIds(CoalescedIds coalescedIds);

    public abstract CoalescedRow build();
  }
}
+70 −0
Original line number Diff line number Diff line
syntax = "proto2";

option java_package = "com.android.dialer.calllog.model";
option java_multiple_files = true;
option optimize_for = LITE_RUNTIME;


package com.android.dialer.calllog.model;

import "java/com/android/dialer/calllog/database/contract/coalesced_ids.proto";
import "java/com/android/dialer/calllog/database/contract/number_attributes.proto";
import "java/com/android/dialer/phonenumberproto/dialer_phone_number.proto";

// Contains the contents of a row from the CoalescedAnnotatedCallLog.
// Next ID: 19
message CoalescedRow {
  // Value in column CoalescedAnnotatedCallLog._ID
  optional int64 id = 1;

  // Value in column CoalescedAnnotatedCallLog.TIMESTAMP
  optional int64 timestamp = 2;

  // Value in column CoalescedAnnotatedCallLog.NUMBER
  optional com.android.dialer.DialerPhoneNumber number = 3;

  // Value in column CoalescedAnnotatedCallLog.FORMATTED_NUMBER
  optional string formatted_number = 4;

  // Value in column CoalescedAnnotatedCallLog.NUMBER_PRESENTATION
  optional int32 number_presentation = 5;

  // Value in column CoalescedAnnotatedCallLog.IS_READ
  optional bool is_read = 6;

  // Value in column CoalescedAnnotatedCallLog.NEW
  optional bool is_new = 7;

  // Value in column CoalescedAnnotatedCallLog.GEOCODED_LOCATION
  optional string geocoded_location = 8;

  // Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME
  optional string phone_account_component_name = 9;

  // Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_ID
  optional string phone_account_id = 10;

  // Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_LABEL
  optional string phone_account_label = 11;

  // Value in column CoalescedAnnotatedCallLog.PHONE_ACCOUNT_COLOR
  optional int32 phone_account_color = 12;

  // Value in column CoalescedAnnotatedCallLog.FEATURES
  optional int32 features = 13;

  // Value in column CoalescedAnnotatedCallLog.CALL_TYPE
  optional int32 call_type = 14;

  // Value in column CoalescedAnnotatedCallLog.NUMBER_ATTRIBUTES
  optional com.android.dialer.NumberAttributes number_attributes = 15;

  // Value in column CoalescedAnnotatedCallLog.IS_VOICEMAIL_CALL
  optional bool is_voicemail_call = 16;

  // Value in column CoalescedAnnotatedCallLog.VOICEMAIL_CALL_TAG
  optional string voicemail_call_tag = 17;

  // Value in column CoalescedAnnotatedCallLog.COALESCED_IDS
  optional com.android.dialer.CoalescedIds coalesced_ids = 18;
}
Loading