use of com.google.android.material.shape.MaterialShapeDrawable in project Carbon by ZieIony.
the class Toolbar method setShapeModel.
@Override
public void setShapeModel(@NotNull ShapeAppearanceModel model) {
this.shapeModel = model;
shadowDrawable = new MaterialShapeDrawable(shapeModel);
if (getWidth() > 0 && getHeight() > 0)
updateCorners();
if (!Carbon.IS_LOLLIPOP_OR_HIGHER)
postInvalidate();
}
use of com.google.android.material.shape.MaterialShapeDrawable in project Signal-Android by WhisperSystems.
the class ReactWithAnyEmojiBottomSheetDialogFragment method onCreateDialog.
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
dialog.getBehavior().setPeekHeight((int) (getResources().getDisplayMetrics().heightPixels * 0.50));
ShapeAppearanceModel shapeAppearanceModel = ShapeAppearanceModel.builder().setTopLeftCorner(CornerFamily.ROUNDED, ViewUtil.dpToPx(requireContext(), 18)).setTopRightCorner(CornerFamily.ROUNDED, ViewUtil.dpToPx(requireContext(), 18)).build();
MaterialShapeDrawable dialogBackground = new MaterialShapeDrawable(shapeAppearanceModel);
dialogBackground.setTint(ContextCompat.getColor(requireContext(), R.color.react_with_any_background));
dialog.getBehavior().addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if (bottomSheet.getBackground() != dialogBackground) {
ViewCompat.setBackground(bottomSheet, dialogBackground);
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
}
});
boolean shadows = requireArguments().getBoolean(ARG_SHADOWS, true);
if (!shadows) {
Window window = dialog.getWindow();
if (window != null) {
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
}
return dialog;
}
use of com.google.android.material.shape.MaterialShapeDrawable in project ForPDA by RadiationX.
the class BottomSheetBehaviorFixed method createMaterialShapeDrawable.
private void createMaterialShapeDrawable(@NonNull Context context, AttributeSet attrs, boolean hasBackgroundTint, @Nullable ColorStateList bottomSheetColor) {
if (this.shapeThemingEnabled) {
this.shapeAppearanceModelDefault = ShapeAppearanceModel.builder(context, attrs, R.attr.bottomSheetStyle, DEF_STYLE_RES).build();
this.materialShapeDrawable = new MaterialShapeDrawable(shapeAppearanceModelDefault);
this.materialShapeDrawable.initializeElevationOverlay(context);
if (hasBackgroundTint && bottomSheetColor != null) {
materialShapeDrawable.setFillColor(bottomSheetColor);
} else {
// If the tint isn't set, use the theme default background color.
TypedValue defaultColor = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.colorBackground, defaultColor, true);
materialShapeDrawable.setTint(defaultColor.data);
}
}
}
use of com.google.android.material.shape.MaterialShapeDrawable in project Carbon by ZieIony.
the class CollapsingToolbarLayout method setShapeModel.
@Override
public void setShapeModel(@NotNull ShapeAppearanceModel model) {
this.shapeModel = model;
shadowDrawable = new MaterialShapeDrawable(shapeModel);
if (getWidth() > 0 && getHeight() > 0)
updateCorners();
if (!Carbon.IS_LOLLIPOP_OR_HIGHER)
postInvalidate();
}
use of com.google.android.material.shape.MaterialShapeDrawable in project Carbon by ZieIony.
the class MotionLayout method setShapeModel.
@Override
public void setShapeModel(@NotNull ShapeAppearanceModel model) {
this.shapeModel = model;
shadowDrawable = new MaterialShapeDrawable(shapeModel);
if (getWidth() > 0 && getHeight() > 0)
updateCorners();
if (!Carbon.IS_LOLLIPOP_OR_HIGHER)
postInvalidate();
}
Aggregations