Skip to content

Commit

Permalink
Merge pull request #12711 from brave/ntp_si_imagecredit_cutoff_fixes_…
Browse files Browse the repository at this point in the history
…android

Android Fix NTP SI, imagecredit cutoff
  • Loading branch information
tapanmodh authored Mar 25, 2022
2 parents fa19817 + c2337d5 commit 2a502c5
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 2a502c5

Please sign in to comment.