summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2014-10-05 19:42:29 +0000
committerEthan Chen <intervigil@gmail.com>2015-01-19 22:08:18 +0000
commit13d358600b5821190eb417b201d650663ce14a30 (patch)
tree1dc2035e62b5fa7962f78a1673faa964e5ebdafb
parent81e7b2448d80d0c519baf285b328200d86586702 (diff)
downloadandroid_packages_apps_Dialer-13d358600b5821190eb417b201d650663ce14a30.tar.gz
android_packages_apps_Dialer-13d358600b5821190eb417b201d650663ce14a30.tar.bz2
android_packages_apps_Dialer-13d358600b5821190eb417b201d650663ce14a30.zip
Revert "Add reverse lookup provider "PagineBianche" (IT)."
This reverts commit 2491d19f178f2b78a00cce00bce5dc8ec0d60231. Change-Id: I96c3da9dbc430233528359eb6abcaef3eeb3d4b2
-rw-r--r--src/com/android/dialer/lookup/LookupSettings.java1
-rw-r--r--src/com/android/dialer/lookup/ReverseLookup.java6
-rw-r--r--src/com/android/dialer/lookup/paginebianche/PagineBiancheApi.java82
-rw-r--r--src/com/android/dialer/lookup/paginebianche/PagineBiancheReverseLookup.java70
4 files changed, 0 insertions, 159 deletions
diff --git a/src/com/android/dialer/lookup/LookupSettings.java b/src/com/android/dialer/lookup/LookupSettings.java
index b52bff7ef..3d969a32d 100644
--- a/src/com/android/dialer/lookup/LookupSettings.java
+++ b/src/com/android/dialer/lookup/LookupSettings.java
@@ -45,7 +45,6 @@ public final class LookupSettings {
public static final String RLP_ZABASEARCH = "ZabaSearch";
public static final String RLP_CYNGN_CHINESE = "CyngnChinese";
public static final String RLP_DASTELEFONBUCH = "DasTelefonbuch";
- public static final String RLP_PAGINEBIANCHE = "PagineBianche";
public static final String RLP_DEFAULT = RLP_OPENCNAM;
private LookupSettings() {
diff --git a/src/com/android/dialer/lookup/ReverseLookup.java b/src/com/android/dialer/lookup/ReverseLookup.java
index 041b6ffba..79ee96ebd 100644
--- a/src/com/android/dialer/lookup/ReverseLookup.java
+++ b/src/com/android/dialer/lookup/ReverseLookup.java
@@ -19,7 +19,6 @@ package com.android.dialer.lookup;
import com.android.dialer.calllog.ContactInfo;
import com.android.dialer.lookup.cyngn.CyngnChineseReverseLookup;
import com.android.dialer.lookup.dastelefonbuch.TelefonbuchReverseLookup;
-import com.android.dialer.lookup.paginebianche.PagineBiancheReverseLookup;
import com.android.dialer.lookup.opencnam.OpenCnamReverseLookup;
import com.android.dialer.lookup.whitepages.WhitePagesReverseLookup;
import com.android.dialer.lookup.yellowpages.YellowPagesReverseLookup;
@@ -57,8 +56,6 @@ public abstract class ReverseLookup {
INSTANCE = new CyngnChineseReverseLookup(context);
} else if (provider.equals(LookupSettings.RLP_DASTELEFONBUCH)) {
INSTANCE = new TelefonbuchReverseLookup(context);
- } else if (provider.equals(LookupSettings.RLP_PAGINEBIANCHE)) {
- INSTANCE = new PagineBiancheReverseLookup(context);
}
}
@@ -86,9 +83,6 @@ public abstract class ReverseLookup {
} else if (provider.equals(LookupSettings.RLP_DASTELEFONBUCH)
&& INSTANCE instanceof TelefonbuchReverseLookup) {
return true;
- } else if (provider.equals(LookupSettings.RLP_PAGINEBIANCHE)
- && INSTANCE instanceof PagineBiancheReverseLookup) {
- return true;
} else {
return false;
}
diff --git a/src/com/android/dialer/lookup/paginebianche/PagineBiancheApi.java b/src/com/android/dialer/lookup/paginebianche/PagineBiancheApi.java
deleted file mode 100644
index cace3b56c..000000000
--- a/src/com/android/dialer/lookup/paginebianche/PagineBiancheApi.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2014 The CyanogenMod 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.lookup.paginebianche;
-
-import android.content.Context;
-import android.net.Uri;
-
-import com.android.dialer.lookup.LookupUtils;
-
-import org.apache.http.client.methods.HttpGet;
-
-import java.io.IOException;
-
-public class PagineBiancheApi {
- private static final String TAG = PagineBiancheApi.class.getSimpleName();
-
- private static final String REVERSE_LOOKUP_URL =
- "http://www.paginebianche.it/ricerca-da-numero?";
-
- private static final String NAME_REGEX = "\\stitle=\"(.*?)\"";
- private static final String NUMBER_REGEX = "class=\"tel\".*?class=\"value\">(.*?)<";
- private static final String ADDRESS_REGEX = "class=\"street-address\">(.*?)</div>";
-
- private PagineBiancheApi() {
- }
-
- public static ContactInfo reverseLookup(Context context, String number)
- throws IOException {
- Uri uri = Uri.parse(REVERSE_LOOKUP_URL)
- .buildUpon()
- .appendQueryParameter("qs", number)
- .build();
-
- // Cut out everything we're not interested in (scripts etc.) to
- // speed up the subsequent matching.
- String output = LookupUtils.firstRegexResult(
- LookupUtils.httpGet(new HttpGet(uri.toString())),
- "class=\"org fn\"(.*?)class=\"link_social", true);
-
- String name = LookupUtils.firstRegexResult(output, NAME_REGEX, false);
- if (name == null) {
- return null;
- }
-
- String phoneNumber = LookupUtils.firstRegexResult(output, NUMBER_REGEX, false);
- String address = parseAddress(output);
-
- ContactInfo info = new ContactInfo();
- info.name = name;
- info.address = address;
- info.formattedNumber = phoneNumber != null ? phoneNumber : number;
- info.website = uri.toString();
-
- return info;
- }
-
- private static String parseAddress(String output) {
- String address = LookupUtils.firstRegexResult(output, ADDRESS_REGEX, false);
- return address != null ? address.replaceAll("</?span.*?>", "") : null;
- }
-
- public static class ContactInfo {
- String name;
- String address;
- String formattedNumber;
- String website;
- }
-}
diff --git a/src/com/android/dialer/lookup/paginebianche/PagineBiancheReverseLookup.java b/src/com/android/dialer/lookup/paginebianche/PagineBiancheReverseLookup.java
deleted file mode 100644
index 212663828..000000000
--- a/src/com/android/dialer/lookup/paginebianche/PagineBiancheReverseLookup.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2014 The CyanogenMod 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.lookup.paginebianche;
-
-import android.content.Context;
-import android.net.Uri;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
-import android.provider.ContactsContract.CommonDataKinds.Website;
-
-import com.android.dialer.calllog.ContactInfo;
-import com.android.dialer.lookup.ContactBuilder;
-import com.android.dialer.lookup.ReverseLookup;
-
-import java.io.IOException;
-
-public class PagineBiancheReverseLookup extends ReverseLookup {
- private static final String TAG = PagineBiancheReverseLookup.class.getSimpleName();
-
- public PagineBiancheReverseLookup(Context context) {
- }
-
- /**
- * Perform phone number lookup.
- *
- * @param context The application context
- * @param normalizedNumber The normalized phone number
- * @param formattedNumber The formatted phone number
- * @return The phone number info object
- */
- public ContactInfo lookupNumber(Context context,
- String normalizedNumber, String formattedNumber) throws IOException {
- if (normalizedNumber.startsWith("+") && !normalizedNumber.startsWith("+39")) {
- // PagineBianche only supports Italian numbers
- return null;
- }
-
- PagineBiancheApi.ContactInfo info =
- PagineBiancheApi.reverseLookup(context, normalizedNumber.replace("+39",""));
- if (info == null) {
- return null;
- }
-
- ContactBuilder builder = new ContactBuilder(
- ContactBuilder.REVERSE_LOOKUP,
- normalizedNumber, formattedNumber);
-
- builder.setName(ContactBuilder.Name.createDisplayName(info.name));
- builder.addPhoneNumber(ContactBuilder.PhoneNumber.createMainNumber(info.formattedNumber));
- if (info.address != null) {
- builder.addAddress(ContactBuilder.Address.createFormattedHome(info.address));
- }
-
- return builder.build();
- }
-}