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

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

Issue 2679073004: Physical Web: Remove extraneous file (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.physicalweb;
6
7 import android.content.Intent;
8 import android.net.Uri;
9 import android.os.Bundle;
10 import android.support.v7.app.AppCompatActivity;
11 import android.text.SpannableString;
12 import android.text.TextPaint;
13 import android.text.method.LinkMovementMethod;
14 import android.text.style.ClickableSpan;
15 import android.view.View;
16 import android.widget.Button;
17 import android.widget.TextView;
18
19 import org.chromium.chrome.R;
20 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ;
21 import org.chromium.ui.text.SpanApplier;
22 import org.chromium.ui.text.SpanApplier.SpanInfo;
23
24 /**
25 * This activity invites the user to opt-in to the Physical Web feature.
26 */
27 public class PhysicalWebOptInActivity extends AppCompatActivity {
28 private static final String EXTRA_CUSTOM_TABS_SESSION =
29 "android.support.customtabs.extra.SESSION";
30 private static final String PHYSICAL_WEB_LEARN_MORE_URL =
31 "https://support.google.com/chrome/answer/6239299/";
32
33 @Override
34 protected void onCreate(Bundle savedInstanceState) {
35 super.onCreate(savedInstanceState);
36 setContentView(R.layout.physical_web_optin);
37
38 TextView description = (TextView) findViewById(R.id.physical_web_optin_d escription);
39 description.setMovementMethod(LinkMovementMethod.getInstance());
40 description.setText(getDescriptionText());
41
42 Button declineButton = (Button) findViewById(R.id.physical_web_decline);
43 declineButton.setOnClickListener(new View.OnClickListener() {
44 @Override
45 public void onClick(View v) {
46 PhysicalWebUma.onOptInDeclineButtonPressed();
47 PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(fa lse);
48 finish();
49 }
50 });
51
52 Button enableButton = (Button) findViewById(R.id.physical_web_enable);
53 enableButton.setOnClickListener(new View.OnClickListener() {
54 @Override
55 public void onClick(View v) {
56 PhysicalWebUma.onOptInEnableButtonPressed();
57 PrivacyPreferencesManager.getInstance().setPhysicalWebEnabled(tr ue);
58 finish();
59 }
60 });
61 }
62
63 private SpannableString getDescriptionText() {
64 return SpanApplier.applySpans(
65 getString(R.string.physical_web_optin_description),
66 new SpanInfo("<learnmore>", "</learnmore>", new ClickableSpan() {
67 @Override
68 public void onClick(View v) {
69 Intent intent = new Intent(Intent.ACTION_VIEW,
70 Uri.parse(PHYSICAL_WEB_LEARN_MORE_URL));
71 // Add the SESSION extra to indicate we want a Chrome cu stom tab. This
72 // allows the help page to open in the same task as the opt-in activity so
73 // they can share a back stack.
74 String session = null;
75 intent.putExtra(EXTRA_CUSTOM_TABS_SESSION, session);
76 PhysicalWebOptInActivity.this.startActivity(intent);
77 }
78
79 @Override
80 public void updateDrawState(TextPaint ds) {
81 // Color links but do not underline them.
82 ds.setColor(ds.linkColor);
83 }
84 }));
85 }
86 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698