Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 2.7 KB

File metadata and controls

61 lines (41 loc) · 2.7 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Android library providing a Floating Action Button (FAB) with an optional speed-dial menu. Originally by Mark Ormesher, forked under the OneBusAway organization. Published as uk.co.markormesher:android-fab.

Build Commands

# Build everything
./gradlew build

# Install demo app (debug)
./gradlew clean installDebug

# Build library only
./gradlew :fab:build

# Generate release artifact
./gradlew :fab:generateRelease

Architecture

Two Gradle modules defined in settings.gradle:

  • fab/ — The library module (com.android.library). Contains the reusable FAB widget.
  • app/ — Demo application (com.android.application). Depends on :fab and showcases all FAB features.

Library module (fab/) key classes

All under uk.co.markormesher.android_fab:

  • FloatingActionButton — The main widget. Extends RelativeLayout, manages positioning, animation, speed-dial menu lifecycle, state save/restore, and Snackbar-aware CoordinatorLayout.Behavior.
  • SpeedDialMenuAdapter — Abstract adapter that consumers extend to provide menu items, handle clicks, and customize appearance.
  • SpeedDialMenuItem — Data class pairing an icon (Drawable/resource) with a label (String/resource).
  • SpeedDialMenuOpenListener / SpeedDialMenuCloseListener — Callback interfaces for menu state changes.
  • extensions/RelativeLayoutLayoutParams — Kotlin extension for clearing parent alignment rules across SDK versions.

Key design details

  • Uses kotlinx.android.synthetic view binding (Kotlin Android Extensions).
  • SDK-conditional code paths throughout: CardView on API 21+, LinearLayout/GradientDrawable fallbacks for API 14-20.
  • Layout variants: layout-v21/ provides separate FAB and menu item icon layouts for API 21+ (elevation/CardView support).
  • FAB position uses bitwise flags (POSITION_TOP, POSITION_BOTTOM, POSITION_START, POSITION_END, POSITION_LEFT, POSITION_RIGHT).
  • RTL support via resource boolean (R.bool.is_right_to_left) and setPaddingRelative.
  • State preservation through onSaveInstanceState/onRestoreInstanceState with Bundle.

Tech Stack

  • Language: Kotlin (1.3.21)
  • Build: Gradle with Android Gradle Plugin 3.2.1
  • Min SDK: 14 / Target SDK: 28
  • AndroidX: Uses androidx.cardview, androidx.annotation, com.google.android.material
  • Publishing: Maven plugin, artifacts deployed to local release directory then zipped

Signing

Release builds require a secrets.properties file at the project root with keystore config. Without it, only debug builds work.