Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Fix NTP SI, imagecredit cutoff (uplift to 1.37.x) #12752

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ public static int correctImageCreditLayoutTopPosition(NTPImage ntpImage) {
// Correction defaults to tablet BackgroundImage
imageCreditCorrection = isLandscape ? (int) (pxHeight * (isCompensate ? 0.48 : 0.54))
: (int) (pxHeight * (isCompensate ? 0.60 : 0.30));

if (ntpImage instanceof BackgroundImage) {
if (!isTablet) {
imageCreditCorrection = isLandscape
? (int) (pxHeight * (isCompensate ? 0.12 : 0.88))
: (int) (pxHeight * (isCompensate ? 0.53 : 0.59));
: (int) (pxHeight - dpToPx(activity, 355));
}
if (!ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_NEWS)) {
imageCreditCorrection = (int) imageCreditCorrection - (int) (pxHeight * 0.04);
Expand All @@ -123,7 +122,7 @@ public static int correctImageCreditLayoutTopPosition(NTPImage ntpImage) {
if (!isTablet) {
imageCreditCorrection = isLandscape
? (int) (pxHeight * (isCompensate ? 0.02 : 0.98))
: (int) (pxHeight * (isCompensate ? 0.36 : 0.50));
: (int) (pxHeight - dpToPx(activity, 480));
} else {
imageCreditCorrection = isLandscape
? (int) (pxHeight * (isCompensate ? 0.28 : 0.72))
Expand Down Expand Up @@ -205,6 +204,7 @@ public static void updateOrientedUI(
layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
layoutParams.setMargins(0, 0, 0, dpToPx(context, 5));
}

parentLayout.setOrientation(LinearLayout.VERTICAL);

imageCreditLayout.setLayoutParams(imageCreditLayoutParams);
Expand Down