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

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

Issue 978653002: Upstream FirstRunActivity and friends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits + remove MobileFreFinishState as it is no longer relevant Created 5 years, 9 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/TosAndUmaView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaView.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaView.java
new file mode 100644
index 0000000000000000000000000000000000000000..3c8ec646ae56b446f0187c1d5c414178575bd09b
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/TosAndUmaView.java
@@ -0,0 +1,53 @@
+// Copyright 2015 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.content.Context;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+import org.chromium.base.ApiCompatibilityUtils;
+import org.chromium.chrome.R;
+
+/**
+ * View that handles orientation changes for Terms of Service and UMA first run page.
+ */
+public class TosAndUmaView extends FrameLayout {
+
+ public TosAndUmaView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ // This assumes that view's layout_width is set to match_parent.
+ assert MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY;
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ int height = MeasureSpec.getSize(heightMeasureSpec);
+ LinearLayout content = (LinearLayout) findViewById(R.id.fre_content);
+ LinearLayout wrapper = (LinearLayout) findViewById(R.id.text_wrapper);
+ MarginLayoutParams params = (MarginLayoutParams) wrapper.getLayoutParams();
+ int paddingStart = 0;
+ if (width >= 2 * getResources().getDimension(R.dimen.fre_image_carousel_width)
+ && width > height) {
+ content.setOrientation(LinearLayout.HORIZONTAL);
+ paddingStart = getResources().getDimensionPixelSize(R.dimen.fre_margin);
+ params.width = 0;
+ params.height = LayoutParams.WRAP_CONTENT;
+ } else {
+ content.setOrientation(LinearLayout.VERTICAL);
+ params.width = LayoutParams.WRAP_CONTENT;
+ params.height = 0;
+ }
+ ApiCompatibilityUtils.setPaddingRelative(content,
+ paddingStart,
+ content.getPaddingTop(),
+ ApiCompatibilityUtils.getPaddingEnd(content),
+ content.getPaddingBottom());
+ wrapper.setLayoutParams(params);
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698