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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java

Issue 2062083002: Implements the Lightweight First Run Experience (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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/firstrun/LightweightFirstRunActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..50eac1584f9a91e3060a2904a4782f342189c3c7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.firstrun;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.method.LinkMovementMethod;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.EmbedContentViewActivity;
+import org.chromium.ui.text.NoUnderlineClickableSpan;
+import org.chromium.ui.text.SpanApplier;
+import org.chromium.ui.text.SpanApplier.SpanInfo;
+
+/**
+* Lightweight FirstRunActivity. It shows ToS dialog only.
+*/
+public class LightweightFirstRunActivity extends FirstRunActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(LayoutInflater.from(LightweightFirstRunActivity.this)
+ .inflate(R.layout.lightweight_fre_tos, null));
+
+ NoUnderlineClickableSpan clickableTermsSpan = new NoUnderlineClickableSpan() {
+ @Override
+ public void onClick(View widget) {
+ EmbedContentViewActivity.show(LightweightFirstRunActivity.this,
+ R.string.terms_of_service_title, R.string.chrome_terms_of_service_url);
+ }
+ };
+ NoUnderlineClickableSpan clickablePrivacySpan = new NoUnderlineClickableSpan() {
+ @Override
+ public void onClick(View widget) {
+ EmbedContentViewActivity.show(LightweightFirstRunActivity.this,
+ R.string.privacy_notice_title, R.string.chrome_privacy_notice_url);
+ }
+ };
+ ((TextView) findViewById(R.id.lightweight_fre_tos_and_privacy))
+ .setText(SpanApplier.applySpans(getString(R.string.lightweight_fre_tos_and_privacy),
+ new SpanInfo("<LINK1>", "</LINK1>", clickableTermsSpan),
+ new SpanInfo("<LINK2>", "</LINK2>", clickablePrivacySpan)));
+ ((TextView) findViewById(R.id.lightweight_fre_tos_and_privacy))
+ .setMovementMethod(LinkMovementMethod.getInstance());
+
+ ((Button) findViewById(R.id.lightweight_fre_terms_accept))
+ .setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ sGlue.acceptTermsOfService(LightweightFirstRunActivity.this, false);
+ FirstRunStatus.setLightweightFirstRunFlowComplete(
+ LightweightFirstRunActivity.this, true);
+ Intent intent = new Intent();
+ finishAllFREActivities(Activity.RESULT_OK, intent);
+ }
+ });
+
+ ((Button) findViewById(R.id.lightweight_fre_cancel))
+ .setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ abortFirstRunExperience();
+ }
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698