Styling your snackbar easily and quickly. This library can be used in both Java and Kotlin.
maven { url 'https://jitpack.io' }
implementation 'com.github.eriffanani:Snacking2:1.1.3'
<CoordinatorLayout
android:id="@+id/parentView"/>
<ChildView/>
<ExtendedFloatingActionButton
android:id="@+id/fab"
android:layout_gravity="bottom|end"/>
</CoordinatorLayout>
val parentView: CoordinatorLayout = findViewById(R.id.parentView)
val fab: ExtendedFloatingActionButton = findViewById(R.id.fab)
Snacking.Builder(parentView, "Hello! this is basic message")
.build().show()
.icon(R.drawable.ic_info, R.color.teal_200)
.action("Dismiss", R.color.teal_200) { snackBar ->
// TODO ACTION
}
.useMargin(true)
.cornerRadius(R.dimen.snack_bar_corner_radius)
// Top Left, Top Right, Bottom Left, Bottom Right
.cornerRadius(R.dimen.snack_bar_corner_radius, 0, 0, R.dimen.snack_bar_corner_radius)
.border(R.dimen.snack_bar_border_size, R.color.teal_700)
.backgroundColor(R.color.purple_200)
.background(R.mipmap.img_gradient)
.textColor("#ffca28") / R.color.colorYellow
.fontFamily(R.font.montserrat)
.anchorView(fab)
Snacking.State(parentView!!, Snacking.State.INFO)
.message("This message is using state")
.show()
.position(Snacking.TOP)
.messageMaxLines(2)
.landscapeStyle(Snacking.CENTER)
Copyright 2022 Mukhammad Erif Fanani
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.















