Commit 8e01e324 authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Commit Bot

Cleanup HyperlinkPreference

HyperlinkPreference's imitateWebLink styleable attribute is not
currently used.

Change-Id: I03acc2edbc9c0f42ae4471148918711a99f7263d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1807436Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Theresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697353}
parent d288ddba
......@@ -7,8 +7,6 @@
<declare-styleable name="HyperlinkPreference">
<!-- The URL to load when the preference is clicked -->
<attr name="url" format="string" />
<!-- True if the hyperlink should look like an <a> element. Default is false. -->
<attr name="imitateWebLink" format="boolean" />
</declare-styleable>
<declare-styleable name="LearnMorePreference">
......
......@@ -7,13 +7,8 @@ package org.chromium.chrome.browser.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.ui.base.LocalizationUtils;
......@@ -25,18 +20,14 @@ import org.chromium.ui.base.WindowAndroid;
public class HyperlinkPreference extends Preference {
private final int mUrlResId;
private final int mColor;
private final boolean mImitateWebLink;
public HyperlinkPreference(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.HyperlinkPreference, 0, 0);
mUrlResId = a.getResourceId(R.styleable.HyperlinkPreference_url, 0);
mImitateWebLink = a.getBoolean(R.styleable.HyperlinkPreference_imitateWebLink, false);
a.recycle();
mColor = ApiCompatibilityUtils.getColor(
context.getResources(), R.color.default_text_color_link);
setSingleLineTitle(false);
}
@Override
......@@ -44,24 +35,4 @@ public class HyperlinkPreference extends Preference {
CustomTabActivity.showInfoPage(WindowAndroid.activityFromContext(getContext()),
LocalizationUtils.substituteLocalePlaceholder(getContext().getString(mUrlResId)));
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView titleView = (TextView) holder.findViewById(android.R.id.title);
titleView.setSingleLine(false);
if (mImitateWebLink) {
setSelectable(false);
titleView.setClickable(true);
titleView.setTextColor(mColor);
titleView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HyperlinkPreference.this.onClick();
}
});
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment