Skip to content

Instantly share code, notes, and snippets.

View KvRae's full-sized avatar
👀
Focusing

Karam Mannai KvRae

👀
Focusing
View GitHub Profile
@KvRae
KvRae / cid.yml
Last active May 24, 2025 14:17
GitHub Action Android Pipeline
name: Build and Test
on:
workflow_dispatch: # Manual trigger from GitHub UI
jobs:
# -----------------------------------------------------
# 🧪 Local Unit Test Job
# -----------------------------------------------------
local_test_job:
@KvRae
KvRae / NetworkAvailabilityObserver.kt
Created August 30, 2024 16:04
Composable function that returns is network (wifi, mobile data) is available
/**
* A Composable function that provides network connectivity status.
*
* This function uses the `ConnectivityManager` to monitor changes in network connectivity.
* It returns a `Boolean` that indicates whether the network is currently available.
* The `Boolean` value will be updated automatically as the network connectivity status changes.
*
* This function is designed to be used within a Composable context and utilizes
* `remember` and `DisposableEffect` to manage the state and lifecycle of the network callback.
*
@KvRae
KvRae / RatingBar.kt
Last active July 28, 2024 14:23
Jetpack compose customizable rating bar component that displays a series of stars to represent a rating.
/**
* A customizable rating bar component that displays a series of stars.
*
* @param maxRating The maximum number of stars to display. Defaults to 5.
* @param currentRating The number of filled stars representing the current rating. Defaults to 0.
* @param onRatingChanged A lambda function that gets called with the new rating when a star is clicked.
* It is ignored if [isClickable] is set to false.
* @param isClickable Determines if the stars are clickable or not. Defaults to true.
* @param filledIcon The icon to use for filled stars. Defaults to [Icons.Filled.Star].
* @param outlinedIcon The icon to use for empty stars. Defaults to [Icons.Outlined.Star].
@KvRae
KvRae / VerticalDashedDivider.kt
Created May 24, 2024 14:04
A vertical dashed divider implementation for jetpack compose
/**
* A vertical dashed divider that can be used to separate content in a composable
* @param modifier the modifier to apply to the divider
* @param thickness the thickness of the divider
* @param color the color of the divider
* @author KvRae
*/
@Composable
fun VerticalDashedDivider(
modifier: Modifier = Modifier,
@KvRae
KvRae / Android Project with Bitbucket Pipelines and Firebase Guide.md
Last active April 9, 2025 02:24
Full guide on how to integrate bitbucket pipelines with your Android project to build and deploy your artifact (APK) to Firebase App distribution

Android Project with Bitbucket Pipelines and Firebase App Distribution

Bitbucket Firebase

Kotlin clean code and best practices

Clean Code Rules

Our main aim is to have a clean code, avoid common silly mistakes and reduce the load on engineers during PR reviews. This is a team effort and If anyone has something that’s generally applicable, let’s talk and decide whether it should be baked into our style guide— so everyone can benefit from it

The bad code creates a lot of distractions. It causes developers to waste time and energy navigating through functions, classes, and files, and pouring over code trying to understand it.

Working on a project where developers care about clean code makes it easy to understand its virtues; the developer can read the code from top to bottom in one go and clearly understand what it does. It makes code manageable and maintainable in the long term, isolating changes and increasing the efficiency of the team.