diff options
7 files changed, 15 insertions, 74 deletions
diff --git a/chrome/android/java/res/values/colors.xml b/chrome/android/java/res/values/colors.xml index b69c03d..da7d2eb 100644 --- a/chrome/android/java/res/values/colors.xml +++ b/chrome/android/java/res/values/colors.xml @@ -15,7 +15,6 @@ <color name="text_highlight_color">#C6DAFC</color> <color name="dark_action_bar_color">#263238</color> <color name="descriptive_text_color">#646464</color> - <color name="ui_link_text_color">#3367D6</color> <!-- Infobar colors --> <color name="infobar_accent_blue">#4285f4</color> @@ -61,7 +60,6 @@ <!-- Password generation popup colors --> <color name="password_generation_divider_color">#e5e5e5</color> - <color name="password_generation_link_text_color">#5595e3</color> <!-- Preferences Colors --> <color name="pref_accent_color">@color/light_active_color</color> diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationAdapter.java index 1dd73e3..1aed0d4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationAdapter.java @@ -7,9 +7,7 @@ package org.chromium.chrome.browser.autofill; import android.content.Context; import android.text.SpannableString; import android.text.Spanned; -import android.text.TextPaint; import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; import android.view.LayoutInflater; import android.view.View; import android.view.View.MeasureSpec; @@ -18,8 +16,8 @@ import android.widget.BaseAdapter; import android.widget.RelativeLayout.LayoutParams; import android.widget.TextView; -import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; +import org.chromium.ui.text.NoUnderlineClickableSpan; import java.util.Arrays; import java.util.List; @@ -144,20 +142,13 @@ public class PasswordGenerationAdapter extends BaseAdapter { .findViewById(R.id.password_generation_explanation); SpannableString explanationSpan = new SpannableString(mExplanationText); explanationSpan.setSpan( - new ClickableSpan() { + new NoUnderlineClickableSpan() { @Override public void onClick(View view) { mDelegate.onSavedPasswordsLinkClicked(); } - - @Override - public void updateDrawState(TextPaint textPaint) { - textPaint.setUnderlineText(false); - textPaint.setColor(ApiCompatibilityUtils.getColor( - mContext.getResources(), - R.color.password_generation_link_text_color)); - } - }, mExplanationTextLinkRangeStart, mExplanationTextLinkRangeEnd, + }, + mExplanationTextLinkRangeStart, mExplanationTextLinkRangeEnd, Spanned.SPAN_INCLUSIVE_INCLUSIVE); explanation.setText(explanationSpan); explanation.setMovementMethod(LinkMovementMethod.getInstance()); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchOptOutPromo.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchOptOutPromo.java index b662db8..3accd6da 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchOptOutPromo.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchOptOutPromo.java @@ -6,7 +6,6 @@ package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; import android.content.Context; import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; import android.util.AttributeSet; import android.view.View; import android.widget.Button; @@ -15,6 +14,7 @@ import android.widget.TextView; import org.chromium.chrome.R; import org.chromium.ui.resources.dynamics.ViewResourceAdapter; +import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier.SpanInfo; @@ -85,18 +85,11 @@ public class ContextualSearchOptOutPromo extends RelativeLayout { // Fill in text with link to Settings. TextView optOutText = (TextView) findViewById(R.id.contextual_search_opt_out_text); - ClickableSpan settingsLink = new ClickableSpan() { + NoUnderlineClickableSpan settingsLink = new NoUnderlineClickableSpan() { @Override public void onClick(View view) { mHost.onPromoPreferenceClick(); } - - // Disable underline on the link text. - @Override - public void updateDrawState(android.text.TextPaint textPaint) { - super.updateDrawState(textPaint); - textPaint.setUnderlineText(false); - } }; optOutText.setText(SpanApplier.applySpans( diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java index 5d847f0..31b8e65 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java @@ -6,9 +6,7 @@ package org.chromium.chrome.browser.firstrun; import android.content.Context; import android.os.Bundle; -import android.text.TextPaint; import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -21,6 +19,7 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeVersionInfo; import org.chromium.chrome.browser.preferences.PrefServiceBridge; +import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier.SpanInfo; @@ -71,8 +70,7 @@ public class ToSAndUMAFirstRunFragment extends FirstRunPage { mTosAndPrivacy.setMovementMethod(LinkMovementMethod.getInstance()); - int linkColor = getResources().getColor(R.color.ui_link_text_color); - ClickableSpan clickableTermsSpan = new FreClickableSpan(linkColor) { + NoUnderlineClickableSpan clickableTermsSpan = new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { if (!isAdded()) return; @@ -81,7 +79,7 @@ public class ToSAndUMAFirstRunFragment extends FirstRunPage { } }; - ClickableSpan clickablePrivacySpan = new FreClickableSpan(linkColor) { + NoUnderlineClickableSpan clickablePrivacySpan = new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { if (!isAdded()) return; @@ -94,24 +92,6 @@ public class ToSAndUMAFirstRunFragment extends FirstRunPage { new SpanInfo("<LINK2>", "</LINK2>", clickablePrivacySpan))); } - // TODO(peconn): Move this out into a more general class. - private abstract static class FreClickableSpan extends ClickableSpan { - private final int mColor; - - /** - * Creates a clickable span that styles without an underline and uses the given color. - */ - public FreClickableSpan(int color) { - mColor = color; - } - - @Override - public void updateDrawState(TextPaint textPaint) { - textPaint.setColor(mColor); - textPaint.setUnderlineText(false); - } - } - @Override public boolean shouldSkipPageOnCreate(Context appContext) { return PrefServiceBridge.getInstance().isFirstRunEulaAccepted(); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java index 988e128..25cb5f9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java @@ -23,7 +23,6 @@ import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -55,6 +54,7 @@ import org.chromium.chrome.browser.profiles.MostVisitedSites.MostVisitedURLsObse import org.chromium.chrome.browser.profiles.MostVisitedSites.ThumbnailCallback; import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.widget.RoundedIconGenerator; +import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier.SpanInfo; @@ -395,18 +395,11 @@ public class NewTabPageView extends FrameLayout // Fill in opt-out text with Settings link TextView optOutText = (TextView) mOptOutView.findViewById(R.id.opt_out_text); - ClickableSpan settingsLink = new ClickableSpan() { + NoUnderlineClickableSpan settingsLink = new NoUnderlineClickableSpan() { @Override public void onClick(View view) { mManager.optOutPromoClicked(true); } - - // Disable underline on the link text. - @Override - public void updateDrawState(android.text.TextPaint textPaint) { - super.updateDrawState(textPaint); - textPaint.setUnderlineText(false); - } }; optOutText.setText(SpanApplier.applySpans( diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java index 5182d2a..4cd73c3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java @@ -9,10 +9,8 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.text.TextPaint; import android.text.TextUtils; import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; import android.util.AttributeSet; import android.view.View; import android.widget.AdapterView; @@ -37,6 +35,7 @@ import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog; import org.chromium.chrome.browser.sync.ui.ConfirmImportSyncDataDialog.ImportSyncType; import org.chromium.signin.InvestigatedScenario; import org.chromium.sync.signin.AccountManagerHelper; +import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier.SpanInfo; @@ -494,17 +493,11 @@ public class AccountSigninView extends FirstRunView setUpUndoButton(); if (mShowSettingsSpan) { - ClickableSpan settingsSpan = new ClickableSpan() { + NoUnderlineClickableSpan settingsSpan = new NoUnderlineClickableSpan() { @Override public void onClick(View widget) { mListener.onAccountSelected(mAccountName, true); } - - @Override - public void updateDrawState(TextPaint textPaint) { - textPaint.setColor(getResources().getColor(R.color.ui_link_text_color)); - textPaint.setUnderlineText(false); - } }; mDescriptionText.setText(SpanApplier.applySpans(getSignedInDescription(mIsChildAccount), new SpanInfo(SETTINGS_LINK_OPEN, SETTINGS_LINK_CLOSE, settingsSpan))); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/SadTabViewFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/SadTabViewFactory.java index 43bc84f..704b8e18 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/SadTabViewFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/SadTabViewFactory.java @@ -6,7 +6,6 @@ package org.chromium.chrome.browser.tab; import android.content.Context; import android.text.method.LinkMovementMethod; -import android.text.style.ClickableSpan; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -14,6 +13,7 @@ import android.widget.Button; import android.widget.TextView; import org.chromium.chrome.R; +import org.chromium.ui.text.NoUnderlineClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier.SpanInfo; @@ -56,18 +56,11 @@ public class SadTabViewFactory { Context context, final OnClickListener suggestionAction) { String helpMessage = context.getString(R.string.sad_tab_message) + "\n\n" + context.getString(R.string.sad_tab_suggestions); - ClickableSpan span = new ClickableSpan() { + NoUnderlineClickableSpan span = new NoUnderlineClickableSpan() { @Override public void onClick(View view) { suggestionAction.onClick(view); } - - // Disable underline on the link text. - @Override - public void updateDrawState(android.text.TextPaint textPaint) { - super.updateDrawState(textPaint); - textPaint.setUnderlineText(false); - } }; return SpanApplier.applySpans(helpMessage, new SpanInfo("<link>", "</link>", span)); } |