Skip to content

Commit

Permalink
Merge pull request #12752 from brave/pr12711_ntp_si_imagecredit_cutof…
Browse files Browse the repository at this point in the history
…f_fixes_android_1.37.x

Android Fix NTP SI, imagecredit cutoff (uplift to 1.37.x)
  • Loading branch information
kjozwiak committed Mar 28, 2022
2 parents 9ef50de + 0b80d42 commit 2e48a02
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 2e48a02

Please sign in to comment.