OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.signin; | 5 package org.chromium.chrome.browser.signin; |
6 | 6 |
7 import android.app.FragmentManager; | 7 import android.app.FragmentManager; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.drawable.Drawable; | 10 import android.graphics.drawable.Drawable; |
11 import android.os.Bundle; | 11 import android.os.Bundle; |
12 import android.text.TextPaint; | |
13 import android.text.TextUtils; | 12 import android.text.TextUtils; |
14 import android.text.method.LinkMovementMethod; | 13 import android.text.method.LinkMovementMethod; |
15 import android.text.style.ClickableSpan; | |
16 import android.util.AttributeSet; | 14 import android.util.AttributeSet; |
17 import android.view.View; | 15 import android.view.View; |
18 import android.widget.AdapterView; | 16 import android.widget.AdapterView; |
19 import android.widget.ArrayAdapter; | 17 import android.widget.ArrayAdapter; |
20 import android.widget.Button; | 18 import android.widget.Button; |
21 import android.widget.ImageView; | 19 import android.widget.ImageView; |
22 import android.widget.LinearLayout; | 20 import android.widget.LinearLayout; |
23 import android.widget.Spinner; | 21 import android.widget.Spinner; |
24 import android.widget.TextView; | 22 import android.widget.TextView; |
25 | 23 |
26 import org.chromium.base.ApiCompatibilityUtils; | 24 import org.chromium.base.ApiCompatibilityUtils; |
27 import org.chromium.base.metrics.RecordUserAction; | 25 import org.chromium.base.metrics.RecordUserAction; |
28 import org.chromium.chrome.R; | 26 import org.chromium.chrome.R; |
29 import org.chromium.chrome.browser.firstrun.FirstRunView; | 27 import org.chromium.chrome.browser.firstrun.FirstRunView; |
30 import org.chromium.chrome.browser.firstrun.ImageCarousel; | 28 import org.chromium.chrome.browser.firstrun.ImageCarousel; |
31 import org.chromium.chrome.browser.firstrun.ImageCarousel.ImageCarouselPositionC
hangeListener; | 29 import org.chromium.chrome.browser.firstrun.ImageCarousel.ImageCarouselPositionC
hangeListener; |
32 import org.chromium.chrome.browser.firstrun.ProfileDataCache; | 30 import org.chromium.chrome.browser.firstrun.ProfileDataCache; |
33 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 31 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
34 import org.chromium.chrome.browser.profiles.ProfileDownloader; | 32 import org.chromium.chrome.browser.profiles.ProfileDownloader; |
35 import org.chromium.chrome.browser.signin.AccountTrackerService.OnSystemAccounts
SeededListener; | 33 import org.chromium.chrome.browser.signin.AccountTrackerService.OnSystemAccounts
SeededListener; |
36 import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog; | 34 import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog; |
37 import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog.ImportSyn
cType; | 35 import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog.ImportSyn
cType; |
38 import org.chromium.signin.InvestigatedScenario; | 36 import org.chromium.signin.InvestigatedScenario; |
39 import org.chromium.sync.signin.AccountManagerHelper; | 37 import org.chromium.sync.signin.AccountManagerHelper; |
| 38 import org.chromium.ui.text.NoUnderlineClickableSpan; |
40 import org.chromium.ui.text.SpanApplier; | 39 import org.chromium.ui.text.SpanApplier; |
41 import org.chromium.ui.text.SpanApplier.SpanInfo; | 40 import org.chromium.ui.text.SpanApplier.SpanInfo; |
42 | 41 |
43 import java.util.List; | 42 import java.util.List; |
44 | 43 |
45 /** | 44 /** |
46 * This view allows the user to select an account to log in to, add an account, | 45 * This view allows the user to select an account to log in to, add an account, |
47 * cancel account selection, etc. Users of this class should | 46 * cancel account selection, etc. Users of this class should |
48 * {@link AccountSigninView#setListener(Listener)} and | 47 * {@link AccountSigninView#setListener(Listener)} and |
49 * {@link AccountSigninView#setDelegate(Delegate)} after the view has been infla
ted. | 48 * {@link AccountSigninView#setDelegate(Delegate)} after the view has been infla
ted. |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 486 |
488 private void showConfirmSigninPage() { | 487 private void showConfirmSigninPage() { |
489 mSignedIn = true; | 488 mSignedIn = true; |
490 updateProfileName(); | 489 updateProfileName(); |
491 | 490 |
492 configureSpinner(false); | 491 configureSpinner(false); |
493 setUpConfirmButton(); | 492 setUpConfirmButton(); |
494 setUpUndoButton(); | 493 setUpUndoButton(); |
495 | 494 |
496 if (mShowSettingsSpan) { | 495 if (mShowSettingsSpan) { |
497 ClickableSpan settingsSpan = new ClickableSpan() { | 496 NoUnderlineClickableSpan settingsSpan = new NoUnderlineClickableSpan
() { |
498 @Override | 497 @Override |
499 public void onClick(View widget) { | 498 public void onClick(View widget) { |
500 mListener.onAccountSelected(mAccountName, true); | 499 mListener.onAccountSelected(mAccountName, true); |
501 } | 500 } |
502 | |
503 @Override | |
504 public void updateDrawState(TextPaint textPaint) { | |
505 textPaint.setColor(getResources().getColor(R.color.ui_link_t
ext_color)); | |
506 textPaint.setUnderlineText(false); | |
507 } | |
508 }; | 501 }; |
509 mDescriptionText.setText(SpanApplier.applySpans(getSignedInDescripti
on(mIsChildAccount), | 502 mDescriptionText.setText(SpanApplier.applySpans(getSignedInDescripti
on(mIsChildAccount), |
510 new SpanInfo(SETTINGS_LINK_OPEN, SETTINGS_LINK_CLOSE, settin
gsSpan))); | 503 new SpanInfo(SETTINGS_LINK_OPEN, SETTINGS_LINK_CLOSE, settin
gsSpan))); |
511 } else { | 504 } else { |
512 // If we aren't showing the span, get rid of the LINK1 annotations. | 505 // If we aren't showing the span, get rid of the LINK1 annotations. |
513 mDescriptionText.setText(getSignedInDescription(mIsChildAccount) | 506 mDescriptionText.setText(getSignedInDescription(mIsChildAccount) |
514 .replace(SETTINGS_LINK_OPEN, "") | 507 .replace(SETTINGS_LINK_OPEN, "") |
515 .replace(SETTINGS_LINK_CLOSE, "")); | 508 .replace(SETTINGS_LINK_CLOSE, "")); |
516 } | 509 } |
517 | 510 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 public boolean isInForcedAccountMode() { | 661 public boolean isInForcedAccountMode() { |
669 return mForcedAccountName != null; | 662 return mForcedAccountName != null; |
670 } | 663 } |
671 | 664 |
672 @Override | 665 @Override |
673 public void onPositionChanged(int i) { | 666 public void onPositionChanged(int i) { |
674 mPositionSetProgrammatically = true; | 667 mPositionSetProgrammatically = true; |
675 mSpinner.setSelection(i); | 668 mSpinner.setSelection(i); |
676 } | 669 } |
677 } | 670 } |
OLD | NEW |