android/views-widgets-samples
Multiple samples showing the best practices in views-widgets on Android.
Healthy across all four use cases
weakest axisPermissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit 10mo ago
- ✓15 active contributors
- ✓Distributed ownership (top contributor 35% of recent commits)
Show all 7 evidence items →Show less
- ✓Apache-2.0 licensed
- ✓CI configured
- ✓Tests present
- ⚠Slowing — last commit 10mo ago
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/android/views-widgets-samples)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/android/views-widgets-samples on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: android/views-widgets-samples
Generated by RepoPilot · 2026-05-09 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/android/views-widgets-samples shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across all four use cases
- Last commit 10mo ago
- 15 active contributors
- Distributed ownership (top contributor 35% of recent commits)
- Apache-2.0 licensed
- CI configured
- Tests present
- ⚠ Slowing — last commit 10mo ago
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live android/views-widgets-samples
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/android/views-widgets-samples.
What it runs against: a local clone of android/views-widgets-samples — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in android/views-widgets-samples | Confirms the artifact applies here, not a fork |
| 2 | License is still Apache-2.0 | Catches relicense before you depend on it |
| 3 | Default branch main exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 331 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of android/views-widgets-samples. If you don't
# have one yet, run these first:
#
# git clone https://github.com/android/views-widgets-samples.git
# cd views-widgets-samples
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of android/views-widgets-samples and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "android/views-widgets-samples(\\.git)?\\b" \\
&& ok "origin remote is android/views-widgets-samples" \\
|| miss "origin remote is not android/views-widgets-samples (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
&& ok "license is Apache-2.0" \\
|| miss "license drift — was Apache-2.0 at generation time"
# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
&& ok "default branch main exists" \\
|| miss "default branch main no longer exists"
# 4. Critical files exist
test -f "AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java" \\
&& ok "AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java" \\
|| miss "missing critical file: AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java"
test -f "AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/CurveVisualizer.java" \\
&& ok "AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/CurveVisualizer.java" \\
|| miss "missing critical file: AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/CurveVisualizer.java"
test -f "AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/TimingVisualizer.java" \\
&& ok "AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/TimingVisualizer.java" \\
|| miss "missing critical file: AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/TimingVisualizer.java"
test -f "AnimationsInterpolatorPlayground/app/build.gradle" \\
&& ok "AnimationsInterpolatorPlayground/app/build.gradle" \\
|| miss "missing critical file: AnimationsInterpolatorPlayground/app/build.gradle"
test -f "CardView/Application/src/main/java/com/example/android/cardview/CardViewActivity.java" \\
&& ok "CardView/Application/src/main/java/com/example/android/cardview/CardViewActivity.java" \\
|| miss "missing critical file: CardView/Application/src/main/java/com/example/android/cardview/CardViewActivity.java"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 331 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~301d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/android/views-widgets-samples"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
A curated collection of Android Studio sample projects demonstrating best practices for implementing Views and Widgets on Android. The repo contains standalone sample apps like AnimationsInterpolatorPlayground (which lets developers visualize and experiment with custom interpolators for animations) and CardView, each showcasing idiomatic patterns for specific UI components. It serves as a reference implementation archive for Android framework features. Multi-sample monorepo structure: each major sample (AnimationsInterpolatorPlayground, CardView, etc.) is a standalone Android Studio project with its own app/ module containing src/main/java/ for source code, src/main/res/ for layouts and resources, and build.gradle for dependencies. No shared library or common code layer is visible; samples are independent reference implementations.
👥Who it's for
Android developers learning to implement custom animations, widgets, and view components; engineers integrating Material Design widgets; and developers studying Google's official best-practice patterns for views/widgets implementation.
🌱Maturity & risk
The repository is deprecated and in maintenance mode: the README explicitly states migration to the new android/platform-samples repository is underway, with no further updates planned. Based on the file timestamps and structure, this appears to be 5+ years old with minimal recent activity. The codebase uses compileSdkVersion 29 (Android 10, released 2019), indicating it is not actively maintained for current Android standards.
High risk for production use: the repository is explicitly being deprecated in favor of android/platform-samples. It targets API 29 (minSdkVersion 21) which is well below current Android support requirements. There is no visible CI pipeline beyond a basic copy-branch workflow, no test suite present in the file list, and no commit activity visible. Starting new projects here would require significant modernization.
Active areas of work
The repository is in migration phase: active development has moved to android/platform-samples. The only visible CI workflow is .github/workflows/copy-branch.yml, suggesting basic maintenance. No pull requests, active issues, or recent commits are indicated in the provided data. This is a legacy archive being phased out.
🚀Get running
Clone and open a specific sample: ```bash git clone https://github.com/android/views-widgets-samples.git cd views-widgets-samples/AnimationsInterpolatorPlayground open -a 'Android Studio' .
Then sync Gradle and run on an emulator or device targeting API 21+.
**Daily commands:**
For AnimationsInterpolatorPlayground: ```bash
cd AnimationsInterpolatorPlayground
./gradlew build
./gradlew installDebug
Then launch on an Android device/emulator. Individual samples are self-contained; there is no shared build process.
🗺️Map of the codebase
AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java— Entry point for the Animations Interpolator Playground sample; demonstrates the primary use case of animation interpolators in Android views.AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/CurveVisualizer.java— Core custom view that visualizes interpolator curves; essential to understanding how this sample demonstrates view drawing and animation concepts.AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/TimingVisualizer.java— Companion visualizer showing timing behavior of interpolators; demonstrates animation lifecycle and frame-by-frame rendering in views.AnimationsInterpolatorPlayground/app/build.gradle— Defines minSdkVersion 21 and androidx.appcompat dependency; critical for understanding compatibility constraints and build configuration for all samples.CardView/Application/src/main/java/com/example/android/cardview/CardViewActivity.java— Activity demonstrating CardView widget usage; key example of a material design widget sample pattern used across the repository.CardView/Application/src/main/res/layout/activity_card_view.xml— Layout file showing CardView XML configuration; illustrates declarative UI best practices for views and widgets in Android.
🧩Components & responsibilities
- MainActivity / Activity classes (Android Activity, Fragment, layout inflation) — Entry point; inflates layout, initializes views, binds callbacks
- Failure mode: Null pointer if views not found in layout; app crashes if onCreate throws exception
- CurveVisualizer / Custom Views (Android Canvas, Paint, Path, custom View subclass) — Renders interpolator curve visualization via onDraw() canvas operations
- Failure mode: Dropped frames if onDraw() is too expensive; ANR if blocking the main thread
- ControlPointCallback — Interface for interactive control point updates;
🛠️How to make changes
Add a New Animation Interpolator Visualization
- Create a new custom View class extending Android View in the same package as CurveVisualizer.java (
AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/) - Implement onDraw() method to visualize your interpolator curve using Canvas operations, referencing CurveVisualizer.java for pattern (
AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/CurveVisualizer.java) - Add your custom view to the main activity layout file (
AnimationsInterpolatorPlayground/app/src/main/res/layout/activity_main.xml) - Reference your view in MainActivity.java and add initialization logic following the existing pattern (
AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java)
Add a New Widget Sample (e.g., new view type)
- Create a new Activity class in CardView/Application/src/main/java/com/example/android/cardview/ (
CardView/Application/src/main/java/com/example/android/cardview/CardViewActivity.java) - Create a corresponding layout XML file in CardView/Application/src/main/res/layout/ (
CardView/Application/src/main/res/layout/activity_card_view.xml) - Register the new Activity in AndroidManifest.xml (
CardView/Application/src/main/AndroidManifest.xml) - Add string resources for your widget in values/strings.xml (
CardView/Application/src/main/res/values/base-strings.xml)
Update SDK Version Across All Samples
- Update compileSdkVersion and targetSdkVersion in AnimationsInterpolatorPlayground/app/build.gradle (
AnimationsInterpolatorPlayground/app/build.gradle) - Update compileSdkVersion and targetSdkVersion in CardView/Application/build.gradle (
CardView/Application/build.gradle) - Update minSdkVersion if required based on new features, ensuring backward compatibility requirements (
AnimationsInterpolatorPlayground/app/build.gradle)
🔧Why these technologies
- Android Views (Canvas-based custom views) — Core framework for demonstrating interpolator curves and animation visualization with low-level drawing control
- androidx.appcompat:appcompat:1.1.0 — Provides backward compatibility and material design support across API 21+ devices
- Android Animation Framework (TimeInterpolator) — Native interpolator API for demonstrating animation timing curves and control point manipulation
- Material Design CardView — Demonstrates modern Android material widget patterns and elevation-based UI design
- Android Instrumentation Testing (androidx.test.runner) — Framework for validating view behavior and animation rendering on actual devices
⚖️Trade-offs already made
-
minSdkVersion 21 (instead of lower)
- Why: Targets modern devices and APIs; avoids complexity of supporting very old Android versions
- Consequence: Cannot run on Android 4.x devices; reduces addressable device pool but simplifies codebase
-
Custom View drawing with Canvas (vs. animated layouts)
- Why: Provides fine-grained control for visualizing interpolator curves and smooth animations
- Consequence: Higher CPU usage than simple property animations; requires manual invalidation and frame rendering
-
Sample-per-feature architecture (separate projects)
- Why: Each sample is self-contained and demonstrates a single widget/feature clearly
- Consequence: Code duplication across samples; harder to maintain consistency and shared utilities
🚫Non-goals (don't propose these)
- Does not provide production-ready reusable libraries—each sample is for educational purposes only
- Does not include complex data persistence or networking—focuses on view/widget rendering
- Does not cover enterprise-scale state management (e.g., no MVVM/MVI architecture patterns)
- Does not target pre-API 21 devices
🪤Traps & gotchas
- Deprecated API target: All samples compile for API 29 (Android 10, 2019). Running on modern emulators (API 33+) may reveal permission/behavior changes not addressed in sample code. 2. No migration guide: The README warns of migration to android/platform-samples but does not specify which samples map to which new locations or how to update code. 3. Missing gradle.properties defaults: Some samples may expect local.properties with SDK paths; Gradle wrapper is present but Android Studio may prompt for SDK setup. 4. Java version ambiguity: No explicit sourceCompatibility/targetCompatibility in provided build.gradle snippet; JDK 8+ is implied but not enforced. 5. Resource naming conventions: Uses pre-AndroidX appcompat (though AndroidX dependency is present); lint warnings about deprecated resource prefixes may appear.
🏗️Architecture
💡Concepts to learn
- Bezier Interpolation Curves — CurveVisualizer renders cubic Bezier curves to represent animation timing functions; understanding control points and curve evaluation is essential to implementing custom interpolators in Android.
- Custom View Subclassing & onDraw() — CurveVisualizer and TimingVisualizer extend View and override onDraw(Canvas) to render custom graphics; this is the foundational pattern for any non-standard UI component in Android.
- TimeInterpolator Interface — Android's animation system uses TimeInterpolator to map elapsed time (0–1) to progress values, enabling easing curves; the playground lets developers visualize and test interpolator implementations.
- Touch Event Handling & Gesture Detection — ControlPointCallback interface suggests the playground allows interactive dragging of Bezier control points; implementing onTouchEvent() and hit testing are core to responsive custom Views.
- Android Resource System (XML Layouts & Themes) — All samples use res/layout/, res/values/ (colors, dimens, strings, styles) to separate UI from code; understanding resource qualifiers and theme application is essential for maintainable Android apps.
- Material Design CardView — One of the primary samples; CardView is a foundational Material Design component providing elevation, corner radius, and content inset patterns replicated across modern Android apps.
- ViewGroup Layout & Measurement — Custom Views must implement onMeasure() and onLayout() to participate in the Android layout system; understanding measurement specs and child layout is needed for complex custom components.
🔗Related repos
android/platform-samples— Official successor repository; active development has migrated here for all Views/Widgets samples and modern Kotlin/Compose examples.android/architecture-samples— Companion repo showing architectural patterns (MVVM, Repository) that pair with Views/Widgets to build complete apps; essential for understanding state management alongside UI components.android/compose-samples— Modern alternative using Jetpack Compose (declarative UI) rather than traditional Views; relevant for developers migrating from this repo to contemporary Android UI patterns.material-components/material-components-android— Official Material Design component library; provides updated, production-ready implementations of widgets referenced in these samples (CardView, buttons, dialogs).androidx/androidx— Source of truth for AndroidX libraries (appcompat, constraintlayout, etc.) that underpin all samples; useful for tracking breaking changes and new API behavior.
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add AndroidJUnit4 instrumentation tests for AnimationsInterpolatorPlayground sample
The AnimationsInterpolatorPlayground app has custom visualization classes (CurveVisualizer.java, TimingVisualizer.java, ControlPointCallback.java) but no instrumentation tests. Since this is a samples repo meant to demonstrate best practices, adding UI tests would show proper testing patterns for animation-heavy views. The build.gradle already has testInstrumentationRunner configured but no test files exist under src/androidTest.
- [ ] Create AnimationsInterpolatorPlayground/app/src/androidTest/java/com/example/android/interpolatorplayground/ directory
- [ ] Add CurveVisualizerTest.java to verify curve rendering and touch interactions
- [ ] Add TimingVisualizerTest.java to verify animation timing visualization
- [ ] Update AnimationsInterpolatorPlayground/app/build.gradle to include androidx.test:rules and espresso dependencies if missing
Update deprecated compileSdkVersion and targetSdkVersion across all samples
The AnimationsInterpolatorPlayground and other samples have compileSdkVersion=29 and targetSdkVersion=29, which is outdated (current is 34+). As a best practices repository, samples should target current API levels. This requires updating build.gradle files across multiple sample projects and verifying compatibility with newer Android APIs.
- [ ] Audit all sample projects' build.gradle files for compileSdkVersion and targetSdkVersion values
- [ ] Create a master build.gradle update script or update each sample's compileSdkVersion to 34 and targetSdkVersion to 34
- [ ] Verify AndroidManifest.xml files don't use deprecated permissions (e.g., check for READ_EXTERNAL_STORAGE without WRITE_EXTERNAL_STORAGE on API 30+)
- [ ] Test each sample builds and runs without deprecation warnings
Add GitHub Actions workflow to build and lint all samples on PR
The repo has .github/workflows/copy-branch.yml but no build verification workflow. With multiple sample projects, new contributors could submit PRs that break builds. A CI workflow would validate that all samples compile and pass lint checks, ensuring code quality standards across the repository.
- [ ] Create .github/workflows/build-samples.yml that runs on push and pull_request
- [ ] Add matrix build step to compile all sample projects (AnimationsInterpolatorPlayground, CardView, etc.) using ./gradlew build
- [ ] Add Android Lint step using ./gradlew lint to check for API issues and best practice violations
- [ ] Configure workflow to fail if any sample fails to build or has critical lint issues
🌿Good first issues
- Modernize AnimationsInterpolatorPlayground to API 33+: Update compileSdkVersion from 29 to 33 or 34, targetSdkVersion accordingly, and test for breaking changes in custom View rendering or animation APIs. Update androidx.appcompat to 1.6+ and verify backward compatibility with minSdkVersion 21.
- Add unit tests for CurveVisualizer and TimingVisualizer: Create src/test/java and src/androidTest/java test suites exercising the custom View drawing logic, interpolation calculations, and touch event handling. Currently no test files exist in the provided structure.
- Document migration path from views-widgets-samples to platform-samples: Add MIGRATION.md with explicit mappings of each sample (AnimationsInterpolatorPlayground, CardView, etc.) to their equivalents in android/platform-samples, plus code diff examples showing how to update deprecated patterns.
⭐Top contributors
Click to expand
Top contributors
- @grcoleman — 35 commits
- @objcode — 19 commits
- @nic0lette — 13 commits
- @MagicalMeghan — 12 commits
- @thagikura — 4 commits
📝Recent commits
Click to expand
Recent commits
2238cc8— Deprecate views-widgets-samples (yrezgui)8c7b24b— Merge pull request #269 from cartland/workflow_dispatch (cartland)b2ef1b6— Add workflow_dispatch trigger to workflows from GitHub (cartland)64bd334— Merge pull request #256 from android/yaraki/readme (yaraki)410c68d— Update readme (yaraki)f22069a— Merge pull request #215 from android/update-agp-4-2-1 (ggfan)3b323cb— Update build script to AGP 4.2.1 (ggfan)f9cb520— Merge pull request #208 from android/codingjeremy-patch-1 (codingjeremy)1ae444b— Update packaging.yaml (codingjeremy)bdfa3ce— Merge pull request #203 from nfischer/update-branchname-webview (nic0lette)
🔒Security observations
This sample repository demonstrates standard Android UI patterns but has moderate security concerns. The primary issues are outdated dependencies (AppCompat 1.1.0), disabled code minification in release builds, and outdated SDK versions (compileSdkVersion 29, targetSdkVersion 29). The repository is no longer actively maintained, which is a significant consideration for using it as a reference. No hardcoded credentials, injection vulnerabilities, or infrastructure misconfigurations were detected. Recommendations include updating all dependencies to current versions, enabling ProGuard/R8 minification, and targeting newer Android API levels for compatibility with modern security standards and Google Play requirements.
- High · Outdated AppCompat Dependency —
AnimationsInterpolatorPlayground/app/build.gradle. The dependency 'androidx.appcompat:appcompat:1.1.0' is outdated and may contain known security vulnerabilities. This version was released in 2019 and is no longer receiving security updates. Fix: Update androidx.appcompat to the latest stable version (1.6.1 or higher). Run 'gradle dependencyUpdates' to identify all outdated dependencies and update them accordingly. - Medium · Minify Disabled in Release Build —
AnimationsInterpolatorPlayground/app/build.gradle. ProGuard/R8 minification is disabled in the release build configuration (minifyEnabled false). This exposes the app code to reverse engineering and makes it easier for attackers to understand the application logic. Fix: Set 'minifyEnabled true' in the release build type and ensure proper ProGuard rules are configured in proguard-rules.pro to protect sensitive code while maintaining functionality. - Medium · Outdated Compile SDK Version —
AnimationsInterpolatorPlayground/app/build.gradle. The compileSdkVersion is set to 29, which is outdated. Current Android development targets much newer API levels (34+). Using older SDK versions may miss important security features and API hardening. Fix: Update compileSdkVersion to 34 or the latest available Android API level. Also consider updating targetSdkVersion to match. - Low · Low Target SDK Version —
AnimationsInterpolatorPlayground/app/build.gradle. targetSdkVersion is set to 29. Google Play requires apps to target API level 33 or higher as of August 2023. This may prevent app distribution and misses important security features available in newer API levels. Fix: Update targetSdkVersion to at least 33, preferably to the latest stable API level (34+). Ensure app testing is performed on these newer API levels. - Low · Repository Status - Unmaintained —
README.md. The README explicitly states the repository is no longer being updated and samples are being migrated. This means security updates and vulnerability patches are unlikely to be applied to existing samples. Fix: Monitor the migrated samples in the platform-samples repository instead. Use this repository only for reference and educational purposes, not as a basis for production applications.
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.