summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/service
diff options
context:
space:
mode:
authorGilles Franck Mevaa <gillesd@google.com>2016-02-16 14:10:03 -0800
committerSailesh Nepal <sail@google.com>2016-02-17 03:45:30 -0800
commit486ee39d0791d290411290af6d2e54f37436b09f (patch)
treeb5dfb204b831d4edac19ef492ffc5ea35b230708 /src/com/android/dialer/service
parent9172c905b311816eba1d24659f02facfab95b0b3 (diff)
DO NOT MERGE: Listener of spam events
Getting rid of the Manager to have the ButtonRenderer directly communicate changes to an event listener. Implementation changes in ag/863096. Cherry picking to nyc-dev to fix build. Change-Id: I8061116f0b91e3f5a6a3a6eac09fe2171ebcbd5c
Diffstat (limited to 'src/com/android/dialer/service')
-rw-r--r--src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java64
-rw-r--r--src/com/android/dialer/service/ExtendedBlockingManager.java38
2 files changed, 57 insertions, 45 deletions
diff --git a/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java b/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java
index 9ce844776..5ff373288 100644
--- a/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java
+++ b/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java
@@ -1,6 +1,24 @@
+/*
+ * Copyright (C) 2016 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.service;
+import android.support.annotation.Nullable;
import android.view.View;
+import android.view.ViewStub;
import java.util.List;
@@ -9,15 +27,47 @@ import java.util.List;
*/
public interface ExtendedBlockingButtonRenderer {
- /**
- * Renders buttons for a phone number.
- */
- void render(String number, String countryIso);
+ final class ViewHolderInfo {
- void setCompleteListItemViews(List<View> views);
+ public final List<View> completeListItemViews;
+ public final List<View> extendedBlockedViews;
+ public final List<View> blockedNumberViews;
+ public final String phoneNumber;
+ public final String countryIso;
+ public final String nameOrNumber;
+ public final String displayNumber;
- void setExtendedFilteredViews(List<View> views);
+ public ViewHolderInfo(
+ /* All existing views amongst the list item actions, even if invisible */
+ List<View> completeListItemViews,
+ /* Views that should be seen if the number is in the blacklist */
+ List<View> extendedBlockedViews,
+ /* Views that should be seen if the number is in the extended blacklist */
+ List<View> blockedNumberViews,
+ String phoneNumber,
+ String countryIso,
+ String nameOrNumber,
+ String displayNumber) {
- void setFilteredNumberViews(List<View> views);
+ this.completeListItemViews = completeListItemViews;
+ this.extendedBlockedViews = extendedBlockedViews;
+ this.blockedNumberViews = blockedNumberViews;
+ this.phoneNumber = phoneNumber;
+ this.countryIso = countryIso;
+ this.nameOrNumber = nameOrNumber;
+ this.displayNumber = displayNumber;
+ }
+ }
+
+ interface Listener {
+ void onBlockedNumber(String number, @Nullable String countryIso);
+ void onUnblockedNumber(String number, @Nullable String countryIso);
+ }
+
+ /**
+ * Renders buttons for a phone number.
+ */
+ void render(ViewStub viewStub);
+ void setViewHolderInfo(ViewHolderInfo info);
}
diff --git a/src/com/android/dialer/service/ExtendedBlockingManager.java b/src/com/android/dialer/service/ExtendedBlockingManager.java
deleted file mode 100644
index 3257a72c5..000000000
--- a/src/com/android/dialer/service/ExtendedBlockingManager.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2016 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.service;
-
-import android.support.annotation.Nullable;
-
-/**
- * Manager of extended blocking events. It notifies all listeners of all blocking-related events.
- */
-public interface ExtendedBlockingManager {
-
- interface ButtonRendererListener {
- void onBlockedNumber(String number, @Nullable String countryIso);
- void onUnblockedNumber(String number, @Nullable String countryIso);
- }
-
- void addButtonRendererListener(@Nullable ButtonRendererListener listener);
-
- void removeButtonRendererListener(@Nullable ButtonRendererListener listener);
-
- void notifyOnBlockedNumber(String number, @Nullable String countryIso);
-
- void notifyOnUnblockedNumber(String number, @Nullable String countryIso);
-}