Skip to content

Commit

Permalink
Add BottomSheet theming options
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Scherzinger <[email protected]>
  • Loading branch information
AndyScherzinger committed Dec 19, 2023
1 parent 0e2c55f commit 6205dcc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ enum class ColorRole(internal val select: (DynamicScheme) -> Int) {
SURFACE_VARIANT({ dynamiccolor.MaterialDynamicColors().surfaceVariant().getArgb(it) }),
ON_SURFACE_VARIANT({ dynamiccolor.MaterialDynamicColors().onSurfaceVariant().getArgb(it) }),
OUTLINE({ dynamiccolor.MaterialDynamicColors().outline().getArgb(it) }),
OUTLINE_VARIANT({ dynamiccolor.MaterialDynamicColors().outlineVariant().getArgb(it) })
OUTLINE_VARIANT({ dynamiccolor.MaterialDynamicColors().outlineVariant().getArgb(it) }),
SURFACE_CONTAINER_LOW({ dynamiccolor.MaterialDynamicColors().surfaceContainerLow().getArgb(it) })
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.view.View
import androidx.annotation.ColorInt
import androidx.core.content.ContextCompat
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import com.google.android.material.appbar.MaterialToolbar
import com.google.android.material.bottomsheet.BottomSheetDragHandleView
import com.google.android.material.button.MaterialButton
import com.google.android.material.card.MaterialCardView
import com.google.android.material.chip.Chip
Expand Down Expand Up @@ -418,6 +420,24 @@ class MaterialViewThemeUtils
}
}

fun colorBottomSheetBackground(
bottomSheet: View,
colorRole: ColorRole = ColorRole.SURFACE_CONTAINER_LOW
) {
withScheme(bottomSheet) { scheme ->
bottomSheet.setBackgroundColor(colorRole.select(scheme))
}
}

fun colorBottomSheetDragHandle(
bottomSheetDragHandleView: BottomSheetDragHandleView,
colorRole: ColorRole = ColorRole.SURFACE_CONTAINER_LOW
) {
withScheme(bottomSheetDragHandleView) { scheme ->
bottomSheetDragHandleView.setColorFilter(colorRole.select(scheme))
}
}

fun colorTabLayout(
tabLayout: TabLayout,
scheme: DynamicScheme
Expand Down

0 comments on commit 6205dcc

Please sign in to comment.