OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 mCardEditor.setEditorDialog(mUI.getCardEditorDialog()); | 539 mCardEditor.setEditorDialog(mUI.getCardEditorDialog()); |
540 if (mContactEditor != null) mContactEditor.setEditorDialog(mUI.getEditor Dialog()); | 540 if (mContactEditor != null) mContactEditor.setEditorDialog(mUI.getEditor Dialog()); |
541 } | 541 } |
542 | 542 |
543 private void createShippingSection( | 543 private void createShippingSection( |
544 Context context, List<AutofillProfile> unmodifiableProfiles) { | 544 Context context, List<AutofillProfile> unmodifiableProfiles) { |
545 List<AutofillAddress> addresses = new ArrayList<>(); | 545 List<AutofillAddress> addresses = new ArrayList<>(); |
546 | 546 |
547 for (int i = 0; i < unmodifiableProfiles.size(); i++) { | 547 for (int i = 0; i < unmodifiableProfiles.size(); i++) { |
548 AutofillProfile profile = unmodifiableProfiles.get(i); | 548 AutofillProfile profile = unmodifiableProfiles.get(i); |
549 mAddressEditor.addPhoneNumberIfValid(profile.getPhoneNumber()); | 549 mAddressEditor.addPhoneNumberIfValid( |
550 profile.getPhoneNumber(), profile.getCountryCode()); | |
gogerald1
2017/06/15 17:41:35
We should consider whether this is what we want an
wuandy1
2017/06/19 15:11:14
as discussed offline, country based validation is
| |
550 | 551 |
551 // Only suggest addresses that have a street address. | 552 // Only suggest addresses that have a street address. |
552 if (!TextUtils.isEmpty(profile.getStreetAddress())) { | 553 if (!TextUtils.isEmpty(profile.getStreetAddress())) { |
553 addresses.add(new AutofillAddress(context, profile)); | 554 addresses.add(new AutofillAddress(context, profile)); |
554 } | 555 } |
555 } | 556 } |
556 | 557 |
557 // Suggest complete addresses first. | 558 // Suggest complete addresses first. |
558 Collections.sort(addresses, COMPLETENESS_COMPARATOR); | 559 Collections.sort(addresses, COMPLETENESS_COMPARATOR); |
559 | 560 |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1823 | 1824 |
1824 /** | 1825 /** |
1825 * The frecency score is calculated according to use count and last use date . The formula is | 1826 * The frecency score is calculated according to use count and last use date . The formula is |
1826 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. | 1827 * the same as the one used in GetFrecencyScore in autofill_data_model.cc. |
1827 */ | 1828 */ |
1828 private static final double getFrecencyScore(int count, long date) { | 1829 private static final double getFrecencyScore(int count, long date) { |
1829 long currentTime = System.currentTimeMillis(); | 1830 long currentTime = System.currentTimeMillis(); |
1830 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); | 1831 return -Math.log((currentTime - date) / (24 * 60 * 60 * 1000) + 2) / Mat h.log(count + 2); |
1831 } | 1832 } |
1832 } | 1833 } |
OLD | NEW |