Modify icon size for fill and save dialogs

Bug: 274942082
Test: Tested on phone, foldable, tablet
Change-Id: I40da6b0b67dae523b6afb903f65bc4842630c308
This commit is contained in:
skxu
2023-05-05 06:35:52 +00:00
parent ff9f72716d
commit 1ec5701a09
5 changed files with 13 additions and 36 deletions

View File

@@ -35,10 +35,10 @@
<ImageView
android:id="@+id/autofill_service_icon"
android:scaleType="fitStart"
android:scaleType="fitCenter"
android:visibility="gone"
android:layout_width="@dimen/autofill_dialog_icon_size"
android:layout_height="@dimen/autofill_dialog_icon_size"/>
android:layout_height="@dimen/autofill_dialog_icon_max_height"
android:layout_width="fill_parent"/>
<LinearLayout
android:id="@+id/autofill_dialog_header"

View File

@@ -40,10 +40,10 @@
<ImageView
android:id="@+id/autofill_save_icon"
android:scaleType="fitStart"
android:scaleType="fitCenter"
android:layout_gravity="center"
android:layout_width="@dimen/autofill_save_icon_size"
android:layout_height="@dimen/autofill_save_icon_size"/>
android:layout_height="@dimen/autofill_save_icon_max_height"
android:layout_width="fill_parent"/>
<TextView
android:id="@+id/autofill_save_title"
@@ -60,7 +60,6 @@
android:id="@+id/autofill_save_custom_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/autofill_save_scroll_view_top_margin"
android:visibility="gone"/>
</LinearLayout>

View File

@@ -874,6 +874,7 @@
<dimen name="autofill_elevation">32dp</dimen>
<dimen name="autofill_save_inner_padding">16dp</dimen>
<dimen name="autofill_save_icon_size">32dp</dimen>
<dimen name="autofill_save_icon_max_height">56dp</dimen>
<dimen name="autofill_save_title_start_padding">8dp</dimen>
<dimen name="autofill_save_scroll_view_top_margin">16dp</dimen>
<dimen name="autofill_save_button_bar_padding">16dp</dimen>
@@ -882,19 +883,15 @@
<!-- Max height of the the autofill save custom subtitle as a fraction of the screen width/height -->
<dimen name="autofill_save_custom_subtitle_max_height">20%</dimen>
<!-- Max (absolute) dimensions (both width and height) of autofill service icon on autofill save affordance.
NOTE: the actual displayed size might is actually smaller than this and is hardcoded in the
autofill_save.xml layout; this dimension is just used to avoid a crash in the UI (if the icon provided
by the autofill service metadata is bigger than these dimentionsit will not be displayed).
-->
<dimen name="autofill_save_icon_max_size">300dp</dimen>
<!-- Maximum number of datasets that are visible in the UX picker without scrolling -->
<integer name="autofill_max_visible_datasets">3</integer>
<!-- Size of an icon in the Autolfill fill dialog -->
<!-- Size of an icon in the Autofill fill dialog -->
<dimen name="autofill_dialog_icon_size">32dp</dimen>
<!-- The max height of an icon in the Autofill fill dialog. -->
<dimen name="autofill_dialog_icon_max_height">56dp</dimen>
<!-- Size of a slice shortcut view -->
<dimen name="slice_shortcut_size">56dp</dimen>
<!-- Size of action icons in a slice -->

View File

@@ -3654,7 +3654,6 @@
<java-symbol type="dimen" name="autofill_dataset_picker_max_width"/>
<java-symbol type="dimen" name="autofill_dataset_picker_max_height"/>
<java-symbol type="dimen" name="autofill_save_custom_subtitle_max_height"/>
<java-symbol type="dimen" name="autofill_save_icon_max_size"/>
<java-symbol type="integer" name="autofill_max_visible_datasets" />
<java-symbol type="style" name="Theme.DeviceDefault.Autofill" />
@@ -5011,7 +5010,7 @@
<java-symbol type="bool" name="config_batteryStatsResetOnUnplugHighBatteryLevel" />
<java-symbol type="bool" name="config_batteryStatsResetOnUnplugAfterSignificantCharge" />
<java-symbol name="materialColorOnSecondaryFixedVariant" type="attr"/>
<java-symbol name="materialColorOnTertiaryFixedVariant" type="attr"/>
<java-symbol name="materialColorSurfaceContainerLowest" type="attr"/>

View File

@@ -563,25 +563,7 @@ final class SaveUi {
private void setServiceIcon(Context context, View view, Drawable serviceIcon) {
final ImageView iconView = view.findViewById(R.id.autofill_save_icon);
final Resources res = context.getResources();
final int maxWidth = res.getDimensionPixelSize(R.dimen.autofill_save_icon_max_size);
final int maxHeight = maxWidth;
final int actualWidth = serviceIcon.getMinimumWidth();
final int actualHeight = serviceIcon.getMinimumHeight();
if (actualWidth <= maxWidth && actualHeight <= maxHeight) {
if (sDebug) {
Slog.d(TAG, "Adding service icon "
+ "(" + actualWidth + "x" + actualHeight + ") as it's less than maximum "
+ "(" + maxWidth + "x" + maxHeight + ").");
}
iconView.setImageDrawable(serviceIcon);
} else {
Slog.w(TAG, "Not adding service icon of size "
+ "(" + actualWidth + "x" + actualHeight + ") because maximum is "
+ "(" + maxWidth + "x" + maxHeight + ").");
((ViewGroup)iconView.getParent()).removeView(iconView);
}
iconView.setImageDrawable(serviceIcon);
}
private static boolean isValidLink(PendingIntent pendingIntent, Intent intent) {