Skip to content

Instantly share code, notes, and snippets.

View anitaa1990's full-sized avatar
🎯
Focusing

Anitaa Murthy anitaa1990

🎯
Focusing
  • Chennai
View GitHub Profile
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:name=".SampleApplication"
android:allowBackup="true"
tools:targetApi="31">
</application>
</manifest>
@anitaa1990
anitaa1990 / RecyclerViewPaginator.java
Created December 24, 2018 04:25
An alternate to Android Paging Library - to enable Pagination in RecyclerView
public abstract class RecyclerViewPaginator extends RecyclerView.OnScrollListener {
/*
* This is the Page Limit for each request
* i.e. every request will fetch 19 transactions
* */
private Long batchSize = 19l;
/*
* Variable to keep track of the current page
@Composable
fun SlideToBookButton(
btnText: String, // The text label shown on the button (e.g., "Book Ride ₹199")
btnTextStyle: TextStyle, // The style for the button text (font, weight, size, etc.)
outerBtnBackgroundColor: Color, // Background color for the outer track (entire button)
sliderBtnBackgroundColor: Color, // Background color for the draggable thumb
@DrawableRes sliderBtnIcon: Int, // Icon to show inside the draggable thumb
onBtnSwipe: () -> Unit // Callback triggered when swipe is completed
)
// Inside my app/build.gradle.kts
dependencies {
// Google Maps
implementation(libs.google.maps.compose)
}
[versions]
googleMapsCompose = "6.5.2"
[libraries]
## Google Maps Compose: simplifies the integration of Google Maps into Jetpack Compose by providing
## composable functions that wrap the Maps SDK
google-maps-compose = { group = "com.google.maps.android", name = "maps-compose", version.ref = "googleMapsCompose" }
@Composable
fun SlideToBookButton(
btnText: String,
btnTextStyle: TextStyle,
outerBtnBackgroundColor: Color,
sliderBtnBackgroundColor: Color,
@DrawableRes sliderBtnIcon: Int,
onBtnSwipe: () -> Unit
) {
// Slider button width
@Composable
fun SlideToBookButton(
btnText: String,
btnTextStyle: TextStyle,
outerBtnBackgroundColor: Color,
sliderBtnBackgroundColor: Color,
@DrawableRes sliderBtnIcon: Int,
onBtnSwipe: () -> Unit
) {
// Slider button width
@Composable
fun SlideToBookButton(
btnText: String,
btnTextStyle: TextStyle,
outerBtnBackgroundColor: Color,
sliderBtnBackgroundColor: Color,
@DrawableRes sliderBtnIcon: Int,
onBtnSwipe: () -> Unit
) {
// Slider button width
/**
*
* This composable creates a custom, swipeable button that resembles a "slide to book" interaction.
* It is composed of two main parts:
* - The outer track (the full-width button background) which displays the label.
* - The inner slider thumb, which can be dragged from left to right.
*
*
* @param btnText Text to display on the outer button track (e.g., "Book Ride ₹199")
* @param btnTextStyle Text style for the button label (e.g., font weight, color)
/**
*
* This composable creates a custom, swipeable button that resembles a "slide to book" interaction.
* It is composed of two main parts:
* - The outer track (the full-width button background) which displays the label.
* - The inner slider thumb, which can be dragged from left to right.
*
*
* @param btnText Text to display on the outer button track (e.g., "Book Ride ₹199")
* @param btnTextStyle Text style for the button label (e.g., font weight, color)