[Android][cr148] Fix for VPN callout card when Settings Containment is on (#35982)

Resolves https://github.com/brave/brave-browser/issues/55041
This commit is contained in:
AlexeyBarabash
2026-04-29 11:36:42 +03:00
committed by GitHub
parent e41017405f
commit cfde1fbed4
@@ -20,6 +20,7 @@ import androidx.preference.PreferenceViewHolder;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.InternetConnection;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.util.ConfigurationUtils;
import org.chromium.chrome.browser.vpn.utils.BraveVpnPrefUtils;
import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils;
@@ -40,9 +41,16 @@ public class VpnCalloutPreference extends Preference {
boolean isTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(getContext());
int width = (int) (getContext().getResources().getDisplayMetrics().widthPixels * 1.00);
if (isTablet || ConfigurationUtils.isLandscape(getContext())) {
width = (int) dpToPx(getContext(), 390);
int width;
if (ChromeFeatureList.sAndroidSettingsContainment.isEnabled()) {
// With containment the card lives inside a padded rounded container — let it
// fill the available width rather than forcing the raw screen pixel width.
width = CardView.LayoutParams.MATCH_PARENT;
} else {
width = (int) (getContext().getResources().getDisplayMetrics().widthPixels * 1.00);
if (isTablet || ConfigurationUtils.isLandscape(getContext())) {
width = (int) dpToPx(getContext(), 390);
}
}
int height = CardView.LayoutParams.WRAP_CONTENT;
ViewGroup.LayoutParams params = mainView.getLayoutParams();