Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import com.google.android.material.internal.ThemeEnforcement;
import com.google.android.material.internal.ViewUtils;
import com.google.android.material.internal.VisibilityAwareImageButton;
import com.google.android.material.resources.MaterialAttributes;
import com.google.android.material.resources.MaterialResources;
import com.google.android.material.shadow.ShadowViewDelegate;
import com.google.android.material.shape.ShapeAppearanceModel;
Expand Down Expand Up @@ -237,8 +238,6 @@ public FloatingActionButton(
final float pressedTranslationZ =
a.getDimension(R.styleable.FloatingActionButton_pressedTranslationZ, 0f);
compatPadding = a.getBoolean(R.styleable.FloatingActionButton_useCompatPadding, false);
int minTouchTargetSize =
getResources().getDimensionPixelSize(R.dimen.mtrl_fab_min_touch_target);

setMaxImageSize(a.getDimensionPixelSize(R.styleable.FloatingActionButton_maxImageSize, 0));

Expand All @@ -254,6 +253,11 @@ public FloatingActionButton(
boolean ensureMinTouchTargetSize =
a.getBoolean(R.styleable.FloatingActionButton_ensureMinTouchTargetSize, false);

int minTouchTargetSize =
a.getDimensionPixelSize(
R.styleable.FloatingActionButton_minTouchTargetSize,
MaterialAttributes.resolveMinimumAccessibleTouchTarget(context));

setEnabled(a.getBoolean(R.styleable.FloatingActionButton_android_enabled, true));

a.recycle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
<attr name="fabCustomSize" format="dimension"/>
<!-- Elevation value for the FAB -->
<attr name="elevation"/>
<!-- Whether to extend the bounds of the FloatingActionButton to meet
@dimen/mtrl_fab_min_touch_target. -->
<!-- Whether to extend the bounds of the FAB to meet minTouchTargetSize. -->
<attr name="ensureMinTouchTargetSize"/>
<!-- The minimum size of the FAB's touch target. -->
<attr name="minTouchTargetSize"/>
<!-- TranslationZ value for the FAB when hovered, focused, or hovered and focused. -->
<attr name="hoveredFocusedTranslationZ" format="dimension"/>
<!-- TranslationZ value for the FAB when pressed-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@
<item name="android:background">@null</item>
<item name="enforceMaterialTheme">true</item>
<item name="ensureMinTouchTargetSize">true</item>
<item name="minTouchTargetSize">@dimen/mtrl_fab_min_touch_target</item>
<item name="elevation">@dimen/mtrl_fab_elevation</item>
<item name="backgroundTint">@color/mtrl_fab_bg_color_selector</item>
<item name="tint">@color/mtrl_fab_icon_text_color_selector</item>
Expand Down