Commit 34c9b093 authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

[PwdCheckAndroid] Crop illustration in leak and seafety check dialog

The dialog now contains banners which should not extend to the borders
of the dialog since they don't user a lot of whitespace. Instead, they
should use the same padding that is used for texts, too.

The change applies to all users of the dialog but depends on the
password check feature being enabled. Once the check is launched (which
seems the most-likely scenario), we can inline the layout params into
the layout file.

Mocks and screenshots in the linked bug.

Bug: 1121959, 1092444
Change-Id: Ifef5352c08a159e4e6bc01e024e42fe9e82f7960
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377728Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Commit-Queue: Friedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801748}
parent 77df4489
...@@ -77,6 +77,17 @@ public class PasswordManagerDialogView extends ScrollView { ...@@ -77,6 +77,17 @@ public class PasswordManagerDialogView extends ScrollView {
mInlineHelpButtonView.setVisibility(usesInlineIcon ? VISIBLE : GONE); mInlineHelpButtonView.setVisibility(usesInlineIcon ? VISIBLE : GONE);
} }
void cropImageToText() {
LinearLayout.LayoutParams marginParams =
new LinearLayout.LayoutParams(mIllustrationView.getLayoutParams());
marginParams.setMarginStart(getContext().getResources().getDimensionPixelSize(
R.dimen.password_manager_dialog_text_margin));
marginParams.setMarginEnd(getContext().getResources().getDimensionPixelSize(
R.dimen.password_manager_dialog_text_margin));
mIllustrationView.setLayoutParams(marginParams);
mIllustrationView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
void setTitle(String title) { void setTitle(String title) {
mTitleView.setText(title); mTitleView.setText(title);
} }
......
...@@ -12,6 +12,7 @@ import static org.chromium.chrome.browser.password_manager.PasswordManagerDialog ...@@ -12,6 +12,7 @@ import static org.chromium.chrome.browser.password_manager.PasswordManagerDialog
import android.view.View; import android.view.View;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyKey;
import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModel;
...@@ -28,6 +29,11 @@ class PasswordManagerDialogViewBinder { ...@@ -28,6 +29,11 @@ class PasswordManagerDialogViewBinder {
} else if (ILLUSTRATION_VISIBLE == propertyKey) { } else if (ILLUSTRATION_VISIBLE == propertyKey) {
dialogView.updateIllustrationVisibility(model.get(ILLUSTRATION_VISIBLE)); dialogView.updateIllustrationVisibility(model.get(ILLUSTRATION_VISIBLE));
dialogView.updateHelpIcon(!model.get(ILLUSTRATION_VISIBLE)); dialogView.updateHelpIcon(!model.get(ILLUSTRATION_VISIBLE));
// TODO(crbug.com/1092444): Depending on feature status, remove this or inline the
// cropping into password_manager_dialog_with_help_button.xml.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.PASSWORD_CHECK)) {
dialogView.cropImageToText();
}
} else if (TITLE == propertyKey) { } else if (TITLE == propertyKey) {
dialogView.setTitle(model.get(TITLE)); dialogView.setTitle(model.get(TITLE));
} else if (DETAILS == propertyKey) { } else if (DETAILS == propertyKey) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment