summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViewHolder.java35
-rw-r--r--src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java19
-rw-r--r--src/com/android/dialer/filterednumber/BlockedNumberFragment.java2
3 files changed, 28 insertions, 28 deletions
diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
index 7fc62a222..8b2eb6081 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
@@ -291,25 +291,22 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
.setOnMenuItemClickListener(this);
}
- try {
- mFilteredNumberAsyncQueryHandler.isBlocked(
- new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() {
- @Override
- public void onCheckComplete(Integer id) {
- blockId = id;
- int blockTitleId = blockId == null ? R.string.call_log_block_number
- : R.string.call_log_unblock_number;
- final MenuItem blockItem = menu.add(
- ContextMenu.NONE,
- R.id.context_menu_block_number,
- ContextMenu.NONE,
- blockTitleId);
- blockItem.setOnMenuItemClickListener(
- CallLogListItemViewHolder.this);
- }
- }, info.normalizedNumber, number, countryIso);
- } catch (IllegalArgumentException e) {
- }
+ mFilteredNumberAsyncQueryHandler.startBlockedQuery(
+ new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() {
+ @Override
+ public void onCheckComplete(Integer id) {
+ blockId = id;
+ int blockTitleId = blockId == null ? R.string.call_log_block_number
+ : R.string.call_log_unblock_number;
+ final MenuItem blockItem = menu.add(
+ ContextMenu.NONE,
+ R.id.context_menu_block_number,
+ ContextMenu.NONE,
+ blockTitleId);
+ blockItem.setOnMenuItemClickListener(
+ CallLogListItemViewHolder.this);
+ }
+ }, info.normalizedNumber, number, countryIso);
}
@Override
diff --git a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java
index 061d62883..0f33aa21c 100644
--- a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java
+++ b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java
@@ -109,16 +109,19 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
/**
* Check if the number + country iso given has been blocked.
* This method normalizes the number for the lookup if normalizedNumber is null.
+ * @return {@code true} if the number was invalid and couldn't be checked,
+ * {@code false} otherwise,
*/
- public final void isBlocked(final OnCheckBlockedListener listener,
- String normalizedNumber, String number, String countryIso) {
+ public final boolean startBlockedQuery(final OnCheckBlockedListener listener,
+ String normalizedNumber, String number, String countryIso) {
if (normalizedNumber == null) {
normalizedNumber = getNormalizedNumber(number, countryIso);
if (normalizedNumber == null) {
- throw new IllegalArgumentException("Invalid phone number");
+ return true;
}
}
- isBlocked(listener, normalizedNumber);
+ startBlockedQuery(listener, normalizedNumber);
+ return false;
}
public static String getNormalizedNumber(String number, String countryIso) {
@@ -132,8 +135,8 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
/**
* Check if the normalized number given has been blocked.
*/
- public final void isBlocked(final OnCheckBlockedListener listener,
- String normalizedNumber) {
+ public final void startBlockedQuery(final OnCheckBlockedListener listener,
+ String normalizedNumber) {
startQuery(NO_TOKEN,
new Listener() {
@Override
@@ -192,8 +195,8 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
/**
* Removes row from database.
- * Caller should call {@link FilteredNumberAsyncQueryHandler#isBlocked} first.
- * @param id The ID of row to remove, from {@link FilteredNumberAsyncQueryHandler#isBlocked}.
+ * Caller should call {@link FilteredNumberAsyncQueryHandler#startBlockedQuery} first.
+ * @param id The ID of row to remove, from {@link FilteredNumberAsyncQueryHandler#startBlockedQuery}.
*/
public final void unblock(final OnUnblockNumberListener listener, Integer id) {
if (id == null) {
diff --git a/src/com/android/dialer/filterednumber/BlockedNumberFragment.java b/src/com/android/dialer/filterednumber/BlockedNumberFragment.java
index a65013ac6..69fba34d4 100644
--- a/src/com/android/dialer/filterednumber/BlockedNumberFragment.java
+++ b/src/com/android/dialer/filterednumber/BlockedNumberFragment.java
@@ -139,7 +139,7 @@ public class BlockedNumberFragment extends ListFragment implements
}
}
};
- mFilteredNumberAsyncQueryHandler.isBlocked(
+ mFilteredNumberAsyncQueryHandler.startBlockedQuery(
onCheckListener, normalizedNumber, number, countryIso);
}
}