Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‚οΈ File Organizer AI

An AI-powered Android file organization app β€” scan your storage, chat with Gemini AI, queue smart commands, preview every operation before it runs, and undo anything.


✨ Features at a Glance

Category What it does
🧠 AI Chat Full multi-turn Gemini chat β€” ask in English or Swahili, get smart answers, code snippets, and queued command suggestions
πŸ—‚οΈ 40+ Commands Organize by type/date, move media by source, delete duplicates, clean APKs, caches, WhatsApp junk, dev build outputs, and more
πŸ‘οΈ Preview (Dry Run) Every command builds an ActionPlan first β€” see exactly which files will move or be deleted, uncheck anything you want to skip
↩️ Undo A persistent UndoLedger records every operation β€” tap Undo to reverse moves and restores from the in-app trash
πŸ—‘οΈ Soft Delete Nothing is hard-deleted immediately β€” files go to Organized/.trash/ and are auto-purged after 30 days via WorkManager
πŸŒ™ Dark Mode Full dark/light theme β€” all colors are semantic tokens in ThemeManager, zero hardcoded hex values in layout code
πŸ›’ Action Cart Quick-action chips, AI suggestions, and the command browser all add to the same queue β€” one unified "Confirm" flow
πŸ“Š Storage Stats Live usage bar with used/free/total labels; color shifts orange β†’ red as storage fills
πŸ’€ Skeleton Loading Shimmer placeholder cards replace the old "scanning…" text while indexing runs in the background

πŸ“± Screenshots

(Coming soon β€” build and run on a physical device or emulator to see the UI)

Home / Dashboard AI Chat Command Browser
Storage stats + Quick actions Multi-turn Gemini chat Searchable 40+ commands
Preview Execution Results + Undo
Per-file checkbox review Live progress per command Freed/moved summary + ↩ Undo

πŸ—οΈ Architecture

app/src/main/java/com/willykez/fileorganizer/
β”‚
β”œβ”€β”€ AppState.java          β†’ State machine: EMPTY Β· SCANNING Β· IDLE Β· STAGING Β· EXECUTING Β· RESULTS
β”œβ”€β”€ ThemeManager.java      β†’ Dark/light semantic color tokens + typography scale
β”œβ”€β”€ UIFactory.java         β†’ Unified component factory (3 button styles, chips, cards, skeleton shimmer)
β”‚
β”œβ”€β”€ FileModel.java         β†’ File metadata + category classification (merged FileMetadata + FileCategoryDetector)
β”œβ”€β”€ StorageManager.java    β†’ Recursive scan, delta load, device StorageStats (merged StorageScanner + MetadataManager)
β”‚
β”œβ”€β”€ ActionPlan.java        β†’ Dry-run model: list of PlannedOp (MOVE / SOFT_DELETE) with per-item toggle
β”œβ”€β”€ CommandEngine.java     β†’ Parse commands (offline regex + Gemini AI), buildPlan(), executePlan(), multi-turn chat
β”œβ”€β”€ CommandType.java       β†’ Enum of 40+ commands with emoji, description, category, cost, requiresRoot flag
β”‚
β”œβ”€β”€ FileSystemRouter.java  β†’ Safety layer: move(), trash() β†’ .trash/, restore(), purgeExpiredTrash()
β”œβ”€β”€ UndoLedger.java        β†’ Persistent undo stack (SharedPreferences JSON), push/pop snapshots
β”‚
β”œβ”€β”€ AppUtil.java           β†’ IO helpers, SHA-256 hashing, formatSize, permissions (merged FileUtil + SketchwareUtil + PermissionsHelper)
β”œβ”€β”€ FileOrganizerApp.java  β†’ Application class, shared Gson instance
β”‚
└── MainActivity.java      β†’ State-driven UI: empty state Β· skeleton Β· dashboard Β· 5 bottom sheets

Data Flow

User Input (Quick Action / AI Chat / Command Browser)
        ↓
  addToCart(CommandType)           ← Action Cart (unified queue)
        ↓
  commandEngine.buildPlan()        ← Dry-run on background thread
        ↓
  Preview Sheet (user reviews)     ← Per-op checkboxes
        ↓
  commandEngine.executePlan()      ← FileSystemRouter (soft-delete safe)
        ↓
  undoLedger.push(reverseOps)      ← Persistent undo
        ↓
  Results Sheet + Snackbar

πŸ€– AI Chat Features

The ✨ AI FAB opens a full-screen Gemini-powered chat:

  • Multi-turn context β€” full conversation history sent with every request
  • [SUGGEST:COMMAND_NAME] protocol β€” AI embeds a tag; app strips it from display and renders a tappable "AI Suggests β†’ Queue" chip
  • "list all commands" β€” answered locally (instant, no API call) with categorized command list
  • Code artifacts β€” triple-backtick blocks render with dark background, language label, monospace font, and a πŸ“‹ Copy button
  • Inline markdown β€” **bold**, *italic*, - bullet rendered as styled Views
  • Typing indicator β€” three animated bouncing dots while AI responds
  • Offline graceful fallback β€” replies helpfully without crashing when disconnected
  • Clear chat β€” wipes history with a confirmation dialog
  • Swahili support β€” offline keyword matcher handles Swahili commands natively

⚑ Command Categories

Category Commands (sample)
πŸ“‚ Organize By Type, By Date, Media by Source, Screen Recordings, Downloads by Date
πŸ“¦ Move Screenshots, WhatsApp Images/Videos, Telegram, Audio, Videos, Documents, Large Files (>50 MB), Old Files (>180 days)
🧹 Cleanup Delete Duplicates (SHA-256), Empty Folders, Cache, APKs, Thumbnails, Temp Files, Crash Logs
πŸ’¬ Social Clean WhatsApp Sent, TikTok Cache, Instagram Cache
πŸ’» Developer Clean Gradle Cache, Remove node_modules, Clean Build Outputs
πŸ“Š Analysis Find Largest Files (Top 25), Find Unused Files (1+ yr), Analyze Storage Breakdown
πŸ€– Automation Auto Organize Daily, Nightly Cleanup

πŸ› οΈ Setup & Build

Prerequisites

  • Android Studio Hedgehog or newer
  • JDK 8+
  • Android device / emulator (API 21+)
  • Gemini API key (included in source for demo β€” replace in production)

Clone & Build

git clone https://github.com/Willykez/FileOrganizerAI.git
cd FileOrganizerAI
# Open in Android Studio and sync Gradle

Gradle dependencies

implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.google.code.gson:gson:2.10.1'

Permissions (auto-requested)

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />  <!-- Android 11+ -->
<uses-permission android:name="android.permission.INTERNET" />

πŸ” API Key

The Gemini API key is embedded for demo purposes. For production:

  1. Get a key at aistudio.google.com
  2. Move it to local.properties:
    GEMINI_API_KEY=your_key_here
    
  3. Reference it via BuildConfig.GEMINI_API_KEY in CommandEngine.java

πŸ—ΊοΈ Roadmap

  • MediaStore API scanning β€” query OS-indexed media instead of full directory crawl (10x faster)
  • FileObserver delta updates β€” listen for changes and update cache incrementally
  • Perceptual hashing (pHash) β€” detect near-duplicate images (burst shots, lightly edited)
  • WorkManager trash purge β€” auto-purge .trash/ older than 30 days without blocking launch
  • SAF / StorageAdapter β€” full SD card support via Android's Document File API
  • Room database β€” replace Gson JSON persistence for better query performance
  • Batch AI renaming β€” send 50 files per Gemini request for smart rename suggestions
  • Root commands β€” isolated RootShellContext for Dalvik cache wipe, etc.
  • Widget β€” home-screen storage usage widget

πŸ“„ License

MIT License β€” Copyright (c) 2025 Willykez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software to use, copy, modify, merge, publish, distribute, and/or
sell copies of the Software, subject to the standard MIT terms.

Built with ❀️ for East African Android users · Swahili-first design

About

πŸ—‚οΈ AI-powered Android file organizer β€” dark mode, smart scanning, Gemini AI chat, action cart, soft-delete undo, and 40+ commands.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages