Skip to content

Instantly share code, notes, and snippets.

View rahul-gill's full-sized avatar

Rahul Gill rahul-gill

View GitHub Profile
@rahul-gill
rahul-gill / ContestItem.kt
Last active March 2, 2022 06:15
ContestItem
@Composable
fun ContestItem(
contestModel: ContestModel,
onAddToCalendar: (Event) -> Unit = {}
) {
if (contestModel.name != "ProjectEuler+") Box {
Card(
modifier = Modifier.padding(bottom = 8.dp).fillMaxWidth(),
elevation = 2.dp,
@rahul-gill
rahul-gill / Color.kt
Last active April 12, 2022 08:47
Design System
/**
* creating custom design system colors
* we can also add attributes like buttonColor, headerColor, topBarColor etc.
*/
class DlsColors(
primary: Color,
onPrimary: Color,
background: Color,
onBackground: Color,

Custom lint rules

  • To avoid using style attributes in layout files see this file for example this layout file
     <Text
         android:layout_height="wrap_content"
         android:layout_width="match_parent"

android:text="Heading: Account Summary"

@Composable
private fun LoadingDot(
color: Color,
modifier: Modifier = Modifier,
){
Box(
modifier = modifier
.clip(shape = CircleShape)
.background(color = color)
)
#!/usr/bin/env bash
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
echo 'source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc
git clone https://github.com/zsh-users/zsh-completions.git ~/.zsh/zsh-completions
fpath=(~/.zsh/zsh-completions/src $fpath)
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting
echo "source ~/.zsh/zsh-syntax-highlighting" >> ~/.zshrc
@rahul-gill
rahul-gill / attrs.md
Last active September 9, 2022 09:24
UI library attributes

Typography

  • Mifos.DesignSystem.TextStyle.Heading
  • Mifos.DesignSystem.TextStyle.SubHeading
  • Mifos.DesignSystem.TextStyle.MainFocusText
  • Mifos.DesignSystem.TextStyle.BodyLarger
  • Mifos.DesignSystem.TextStyle.Body
  • Mifos.DesignSystem.TextStyle.Label
  • Mifos.DesignSystem.TextStyle.Link
  • Mifos.DesignSystem.TextStyle.PrimaryColorBody
  • Mifos.DesignSystem.TextStyle.PrimaryColorBodyLarger
@rahul-gill
rahul-gill / report.md
Last active March 7, 2023 05:15
GSoC '22 Report | The Mifos Initiative | Mifos Android UI library

Google Summer of Code 2022

Project - Mifos UI library for Android Apps

This project focused on implementing a UI library that will be consumed by Mifos Android apps(android-client, mifos-mobile, mobile-wallet) and implement new designs using it across the customer-facing apps providing a consistent and familiar look and feel.

Work Done

  • added common styles, size and padding values to the UI library
  • added lint rule in the library to enforce usage of these defined style only
package com.example
import android.content.Intent
import android.os.Build
import android.provider.Settings
import android.provider.Settings.EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED
import androidx.activity.result.ActivityResultLauncher
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat

Project Goals:

  • Develop a common UI library to ensure a consistent look and feel of UIs for all apps
  • Define a process for migrating apps to use the library
  • Develop design guidelines and standards for the apps(design document)
  • Develop base-level widgets, common UI components
  • Implement screens and workflows to test out on reference sample app
  • Document how to use the UI library and how to update the app when the library is updated.

Styles

  • So we will build styles in the library and provide them to the apps. The lint rules will report whenever style attributes are used in layout files
@rahul-gill
rahul-gill / DatePickerDialog.kt
Created April 17, 2023 21:10
Date Picker In compose(Someone add horizontal scrolling of months if they have time)
import android.annotation.SuppressLint
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height