Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(941)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java

Issue 1947693002: Add a Learn More link to the Physical Web opt-in activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java
index 58e7c9643de2d9928bfe9f58941fb32000cfd4d7..6b84a518c067403dbc43932f5bb718117a9b0c4e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java
@@ -6,24 +6,41 @@ package org.chromium.chrome.browser.physicalweb;
import android.content.Context;
import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
+import android.text.SpannableString;
+import android.text.TextPaint;
+import android.text.method.LinkMovementMethod;
+import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.Button;
+import android.widget.TextView;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager;
+import org.chromium.ui.text.SpanApplier;
+import org.chromium.ui.text.SpanApplier.SpanInfo;
/**
* This activity invites the user to opt-in to the Physical Web feature.
*/
public class PhysicalWebOptInActivity extends AppCompatActivity {
+ private static final String EXTRA_CUSTOM_TABS_SESSION =
+ "android.support.customtabs.extra.SESSION";
+ private static final String PHYSICAL_WEB_LEARN_MORE_URL =
+ "https://support.google.com/chrome/answer/6239299/";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.physical_web_optin);
PhysicalWebUma.onOptInNotificationPressed(this);
+ TextView description = (TextView) findViewById(R.id.physical_web_optin_description);
+ description.setMovementMethod(LinkMovementMethod.getInstance());
+ description.setText(getDescriptionText());
+
Button declineButton = (Button) findViewById(R.id.physical_web_decline);
declineButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -56,4 +73,28 @@ public class PhysicalWebOptInActivity extends AppCompatActivity {
ListUrlsActivity.OPTIN_REFERER);
return intent;
}
+
+ private SpannableString getDescriptionText() {
+ return SpanApplier.applySpans(
+ getString(R.string.physical_web_optin_description),
+ new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse(PHYSICAL_WEB_LEARN_MORE_URL));
+ // Add the SESSION extra to indicate we want a Chrome custom tab. This
+ // allows the help page to open in the same task as the opt-in activity so
+ // they can share a back stack.
+ String session = null;
+ intent.putExtra(EXTRA_CUSTOM_TABS_SESSION, session);
+ PhysicalWebOptInActivity.this.startActivity(intent);
+ }
+
+ @Override
+ public void updateDrawState(TextPaint ds) {
+ // Color links but do not underline them.
+ ds.setColor(ds.linkColor);
+ }
+ }));
+ }
}
« no previous file with comments | « chrome/android/java/res/layout/physical_web_optin.xml ('k') | chrome/android/java/strings/android_chrome_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698