mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 965038 - Styling for links. r=nalexander
This commit is contained in:
parent
fbbe589163
commit
cbb7b8036b
@ -118,7 +118,7 @@ public abstract class FxAccountAbstractActivity extends Activity {
|
||||
continue;
|
||||
}
|
||||
|
||||
ActivityUtils.linkifyTextView(textView);
|
||||
ActivityUtils.linkifyTextView(textView, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,8 @@ public class FxAccountCreateAccountActivity extends FxAccountAbstractSetupActivi
|
||||
final String linkedTOS = "<a href=\"" + linkTerms + "\">" + getString(R.string.fxaccount_policy_linktos) + "</a>";
|
||||
final String linkedPN = "<a href=\"" + linkPrivacy + "\">" + getString(R.string.fxaccount_policy_linkprivacy) + "</a>";
|
||||
policyView.setText(getString(R.string.fxaccount_policy_text, linkedTOS, linkedPN));
|
||||
ActivityUtils.linkifyTextView(policyView);
|
||||
final boolean underlineLinks = true;
|
||||
ActivityUtils.linkifyTextView(policyView, underlineLinks);
|
||||
|
||||
emailEdit = (EditText) ensureFindViewById(null, R.id.email, "email edit");
|
||||
passwordEdit = (EditText) ensureFindViewById(null, R.id.password, "password edit");
|
||||
|
@ -74,6 +74,7 @@
|
||||
<TextView
|
||||
android:id="@+id/policy"
|
||||
style="@style/FxAccountLinkifiedItem"
|
||||
android:textColorLink="@color/fxaccount_linkified_textColorLinkSubdued"
|
||||
android:text="@string/fxaccount_policy_text" />
|
||||
|
||||
<LinearLayout style="@style/FxAccountSpacer" />
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
<color name="fxaccount_linkified_textColor">#c0c9d0</color>
|
||||
<color name="fxaccount_linkified_textColorLink">#0096dd</color>
|
||||
<color name="fxaccount_linkified_textColorLinkSubdued">#c0c9d0</color>
|
||||
|
||||
<color name="fxaccount_error">#d63920</color>
|
||||
<color name="fxaccount_button_textColor">#ffffff</color>
|
||||
|
@ -17,6 +17,7 @@ import android.net.Uri;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.URLSpan;
|
||||
@ -60,9 +61,19 @@ public class ActivityUtils {
|
||||
*/
|
||||
public static class FennecClickableSpan extends ClickableSpan {
|
||||
private final String url;
|
||||
private final boolean underlining;
|
||||
|
||||
public FennecClickableSpan(final String url) {
|
||||
public FennecClickableSpan(final String url, boolean underlining) {
|
||||
this.url = url;
|
||||
this.underlining = underlining;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
if (!this.underlining) {
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,10 +90,10 @@ public class ActivityUtils {
|
||||
final Context context = view.getContext();
|
||||
final String url = context.getString(link);
|
||||
view.setText("<a href=\"" + url + "\">" + context.getString(text) + "</a>");
|
||||
ActivityUtils.linkifyTextView(view);
|
||||
linkifyTextView(view, false);
|
||||
}
|
||||
|
||||
public static void linkifyTextView(TextView textView) {
|
||||
public static void linkifyTextView(TextView textView, boolean underlining) {
|
||||
if (textView == null) {
|
||||
Logger.warn(LOG_TAG, "Could not process links for view.");
|
||||
return;
|
||||
@ -102,7 +113,7 @@ public class ActivityUtils {
|
||||
final int flags = replaced.getSpanFlags(span);
|
||||
|
||||
replaced.removeSpan(span);
|
||||
replaced.setSpan(new FennecClickableSpan(span.getURL()), start, end, flags);
|
||||
replaced.setSpan(new FennecClickableSpan(span.getURL(), underlining), start, end, flags);
|
||||
}
|
||||
|
||||
textView.setText(replaced);
|
||||
|
Loading…
Reference in New Issue
Block a user