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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java

Issue 2808403008: [Home] Bottom page info (Closed)
Patch Set: update spec Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java
index 62579757d84c16c28ede6a3effa5b8846a52fe1a..cf3cc435f18e4eb901ad3ce700d80adb0490891e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/page_info/PageInfoPopup.java
@@ -141,6 +141,9 @@ public class PageInfoPopup implements OnClickListener {
// The maximum number of lines currently shown in the view
private int mCurrentMaxLines = Integer.MAX_VALUE;
+ // Whether or not the full URL should always be shown.
+ private boolean mAlwaysShowFullUrl;
+
/** Constructor for inflating from XML. */
public ElidedUrlTextView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -202,6 +205,13 @@ public class PageInfoPopup implements OnClickListener {
}
/**
+ * @param show Whether or not the full URL should always be shown on the page info dialog.
+ */
+ public void setAlwaysShowFullUrl(boolean show) {
+ mAlwaysShowFullUrl = show;
+ }
+
+ /**
* Sets the profile to use when calculating the end index of the origin.
* Must be called before layout.
*
@@ -222,7 +232,9 @@ public class PageInfoPopup implements OnClickListener {
private boolean updateMaxLines() {
int maxLines = mFullLinesToDisplay;
- if (mIsShowingTruncatedText) maxLines = mTruncatedUrlLinesToDisplay;
+ if (mIsShowingTruncatedText && !mAlwaysShowFullUrl) {
+ maxLines = mTruncatedUrlLinesToDisplay;
+ }
if (maxLines != mCurrentMaxLines) {
setMaxLines(maxLines);
return true;
@@ -262,6 +274,9 @@ public class PageInfoPopup implements OnClickListener {
// The dialog the container is placed in.
private final Dialog mDialog;
+ // Whether or not the popup should appear at the bottom of the screen.
+ private final boolean mIsBottomPopup;
+
// Animation which is currently running, if there is one.
private AnimatorSet mCurrentAnimation;
@@ -306,6 +321,8 @@ public class PageInfoPopup implements OnClickListener {
String publisher) {
mContext = activity;
mTab = tab;
+ mIsBottomPopup = mTab.getActivity().getBottomSheet() != null;
+
if (offlinePageCreationDate != null) {
mOfflinePageCreationDate = offlinePageCreationDate;
}
@@ -330,6 +347,7 @@ public class PageInfoPopup implements OnClickListener {
mUrlTitle = (ElidedUrlTextView) mContainer.findViewById(R.id.page_info_url);
mUrlTitle.setProfile(mTab.getProfile());
+ mUrlTitle.setAlwaysShowFullUrl(mIsBottomPopup);
mUrlTitle.setOnClickListener(this);
// Long press the url text to copy it to the clipboard.
mUrlTitle.setOnLongClickListener(new OnLongClickListener() {
@@ -485,6 +503,10 @@ public class PageInfoPopup implements OnClickListener {
}
});
+ if (mIsBottomPopup) {
+ mDialog.getWindow().getAttributes().gravity = Gravity.BOTTOM | Gravity.END;
+ }
+
showDialog();
}
@@ -684,7 +706,22 @@ public class PageInfoPopup implements OnClickListener {
private void showDialog() {
if (!DeviceFormFactor.isTablet(mContext)) {
// On smaller screens, make the dialog fill the width of the screen.
- ScrollView scrollView = new ScrollView(mContext);
+ ScrollView scrollView = new ScrollView(mContext) {
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ int dialogMaxHeight = mTab.getHeight();
+ if (mIsBottomPopup) {
+ // In Chrome Home, the full URL is showing at all times; give the scroll
+ // view a max height so long URLs don't consume the entire screen.
+ dialogMaxHeight -=
+ mContext.getResources().getDimension(R.dimen.min_touch_target_size);
+ }
+
+ heightMeasureSpec =
+ MeasureSpec.makeMeasureSpec(dialogMaxHeight, MeasureSpec.AT_MOST);
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+ };
scrollView.addView(mContainer);
mDialog.addContentView(scrollView, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
@@ -869,7 +906,7 @@ public class PageInfoPopup implements OnClickListener {
* Create an animator to slide in the entire dialog from the top of the screen.
*/
private Animator createDialogSlideAnimator(boolean isEnter) {
- final float animHeight = -1f * mContainer.getHeight();
+ final float animHeight = (mIsBottomPopup ? 1f : -1f) * mContainer.getHeight();
ObjectAnimator translateAnim;
if (isEnter) {
mContainer.setTranslationY(animHeight);
« 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