From 183cb71663320f16149d83eeebaff7795a4b55f2 Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 27 Dec 2017 17:02:37 -0800 Subject: Remove field prefixes. Test: Existing tests PiperOrigin-RevId: 180230450 Change-Id: I0b2589cfeeaef81e42a04efa48af24b4e4d0e95f --- .../smartdial/util/SmartDialNameMatcher.java | 26 +++++++------- .../dialer/smartdial/util/SmartDialPrefix.java | 42 +++++++++++----------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'java/com/android/dialer/smartdial/util') diff --git a/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java b/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java index 725c88c57..601962292 100644 --- a/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java +++ b/java/com/android/dialer/smartdial/util/SmartDialNameMatcher.java @@ -38,14 +38,14 @@ public class SmartDialNameMatcher { // positives private static final int INITIAL_LENGTH_LIMIT = 1; - private final ArrayList mMatchPositions = new ArrayList<>(); - private String mQuery; + private final ArrayList matchPositions = new ArrayList<>(); + private String query; // Controls whether to treat an empty query as a match (with anything). - private boolean mShouldMatchEmptyQuery = false; + private boolean shouldMatchEmptyQuery = false; public SmartDialNameMatcher(String query) { - mQuery = query; + this.query = query; } /** @@ -112,7 +112,7 @@ public class SmartDialNameMatcher { @Nullable public SmartDialMatchPosition matchesNumber(Context context, String phoneNumber, String query) { if (TextUtils.isEmpty(phoneNumber)) { - return mShouldMatchEmptyQuery ? new SmartDialMatchPosition(0, 0) : null; + return shouldMatchEmptyQuery ? new SmartDialMatchPosition(0, 0) : null; } StringBuilder builder = new StringBuilder(); constructEmptyMask(builder, phoneNumber.length()); @@ -148,7 +148,7 @@ public class SmartDialNameMatcher { * with the matching positions otherwise */ public SmartDialMatchPosition matchesNumber(Context context, String phoneNumber) { - return matchesNumber(context, phoneNumber, mQuery); + return matchesNumber(context, phoneNumber, query); } /** @@ -164,7 +164,7 @@ public class SmartDialNameMatcher { private SmartDialMatchPosition matchesNumberWithOffset( Context context, String phoneNumber, String query, int offset) { if (TextUtils.isEmpty(phoneNumber) || TextUtils.isEmpty(query)) { - return mShouldMatchEmptyQuery ? new SmartDialMatchPosition(offset, offset) : null; + return shouldMatchEmptyQuery ? new SmartDialMatchPosition(offset, offset) : null; } int queryAt = 0; int numberAt = offset; @@ -406,25 +406,25 @@ public class SmartDialNameMatcher { * match positions (multiple matches correspond to initial matches). */ public boolean matches(Context context, String displayName) { - mMatchPositions.clear(); - return matchesCombination(context, displayName, mQuery, mMatchPositions); + matchPositions.clear(); + return matchesCombination(context, displayName, query, matchPositions); } public ArrayList getMatchPositions() { // Return a clone of mMatchPositions so that the caller can use it without // worrying about it changing - return new ArrayList<>(mMatchPositions); + return new ArrayList<>(matchPositions); } public String getQuery() { - return mQuery; + return query; } public void setQuery(String query) { - mQuery = query; + this.query = query; } public void setShouldMatchEmptyQuery(boolean matches) { - mShouldMatchEmptyQuery = matches; + shouldMatchEmptyQuery = matches; } } diff --git a/java/com/android/dialer/smartdial/util/SmartDialPrefix.java b/java/com/android/dialer/smartdial/util/SmartDialPrefix.java index 9af411913..7fef8814c 100644 --- a/java/com/android/dialer/smartdial/util/SmartDialPrefix.java +++ b/java/com/android/dialer/smartdial/util/SmartDialPrefix.java @@ -54,38 +54,38 @@ public class SmartDialPrefix { private static final String PREF_USER_SIM_COUNTRY_CODE_DEFAULT = null; - private static String sUserSimCountryCode = PREF_USER_SIM_COUNTRY_CODE_DEFAULT; + private static String userSimCountryCode = PREF_USER_SIM_COUNTRY_CODE_DEFAULT; /** Indicates whether user is in NANP regions. */ - private static boolean sUserInNanpRegion = false; + private static boolean userInNanpRegion = false; /** Set of country names that use NANP code. */ - private static Set sNanpCountries = null; + private static Set nanpCountries = null; /** Set of supported country codes in front of the phone number. */ - private static Set sCountryCodes = null; + private static Set countryCodes = null; - private static boolean sNanpInitialized = false; + private static boolean nanpInitialized = false; /** Initializes the Nanp settings, and finds out whether user is in a NANP region. */ public static void initializeNanpSettings(Context context) { final TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (manager != null) { - sUserSimCountryCode = manager.getSimCountryIso(); + userSimCountryCode = manager.getSimCountryIso(); } final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); - if (sUserSimCountryCode != null) { + if (userSimCountryCode != null) { /** Updates shared preferences with the latest country obtained from getSimCountryIso. */ - prefs.edit().putString(PREF_USER_SIM_COUNTRY_CODE, sUserSimCountryCode).apply(); + prefs.edit().putString(PREF_USER_SIM_COUNTRY_CODE, userSimCountryCode).apply(); } else { /** Uses previously stored country code if loading fails. */ - sUserSimCountryCode = + userSimCountryCode = prefs.getString(PREF_USER_SIM_COUNTRY_CODE, PREF_USER_SIM_COUNTRY_CODE_DEFAULT); } /** Queries the NANP country list to find out whether user is in a NANP region. */ - sUserInNanpRegion = isCountryNanp(sUserSimCountryCode); - sNanpInitialized = true; + userInNanpRegion = isCountryNanp(userSimCountryCode); + nanpInitialized = true; } /** @@ -255,7 +255,7 @@ public class SmartDialPrefix { */ if ((normalizedNumber.length() == 11) && (normalizedNumber.charAt(0) == '1') - && (sUserInNanpRegion)) { + && (userInNanpRegion)) { countryCode = "1"; countryCodeOffset = number.indexOf(normalizedNumber.charAt(1)); if (countryCodeOffset == -1) { @@ -265,7 +265,7 @@ public class SmartDialPrefix { } /** If user is in NANP region, finds out whether a number is in NANP format. */ - if (sUserInNanpRegion) { + if (userInNanpRegion) { String areaCode = ""; if (countryCode.equals("") && normalizedNumber.length() == 10) { /** @@ -292,10 +292,10 @@ public class SmartDialPrefix { /** Checkes whether a country code is valid. */ private static boolean isValidCountryCode(String countryCode) { - if (sCountryCodes == null) { - sCountryCodes = initCountryCodes(); + if (countryCodes == null) { + countryCodes = initCountryCodes(); } - return sCountryCodes.contains(countryCode); + return countryCodes.contains(countryCode); } private static Set initCountryCodes() { @@ -531,10 +531,10 @@ public class SmartDialPrefix { if (TextUtils.isEmpty(country)) { return false; } - if (sNanpCountries == null) { - sNanpCountries = initNanpCountries(); + if (nanpCountries == null) { + nanpCountries = initNanpCountries(); } - return sNanpCountries.contains(country.toUpperCase()); + return nanpCountries.contains(country.toUpperCase()); } private static Set initNanpCountries() { @@ -572,13 +572,13 @@ public class SmartDialPrefix { * @return Whether user is in Nanp region. */ public static boolean getUserInNanpRegion() { - return sUserInNanpRegion; + return userInNanpRegion; } /** Explicitly setting the user Nanp to the given boolean */ @VisibleForTesting public static void setUserInNanpRegion(boolean userInNanpRegion) { - sUserInNanpRegion = userInNanpRegion; + SmartDialPrefix.userInNanpRegion = userInNanpRegion; } /** Class to record phone number parsing information. */ -- cgit v1.2.3