Forumus Admin is an Android-based administration application designed for managing an internal university forum. Developed using Kotlin for the Android platform, this application provides administrators with a comprehensive suite of tools to monitor, moderate, and manage forum content and user accounts effectively.
| Category | Technology |
|---|---|
| Language | Kotlin |
| Platform | Android (minSdk 24, targetSdk 36) |
| Architecture | MVVM (Model-View-ViewModel) |
| UI | View Binding, Material Design Components |
| Backend | Firebase (Firestore, Auth, Storage) |
| Networking | Retrofit 2 + OkHttp |
| Image Loading | Glide |
| Charts | MPAndroidChart |
| Navigation | Android Jetpack Navigation Component |
| Caching | SharedPreferences + Gson |
| Other | SwipeRefreshLayout, Coroutines |
The application features are organized into two categories: Basic Features and Advanced Features.
| # | Feature | Description |
|---|---|---|
| 1 | Dashboard | Central hub displaying key statistics, interactive charts (bar and pie), and quick navigation to other modules |
| 2 | Navigation Drawer | Side navigation menu providing access to all major sections of the application |
| 3 | Total Users Management | Paginated user list with search, filter, and detailed user information viewing capabilities |
| 4 | Total Posts Management | Post listing with date range filtering, search functionality, and navigation to post details |
| 5 | Post Detail View | Comprehensive single post view displaying metadata, content, images, and engagement statistics |
| 6 | Settings | Application configuration for theme selection (Light/Dark/Auto) and language preferences (English/Vietnamese) |
| 7 | Localization | Multi-language support with English and Vietnamese translations |
| 8 | Theme Management | Dynamic theme switching with persistence across application sessions |
| # | Feature | Description |
|---|---|---|
| 1 | Reported Posts Management | Review and manage user-reported posts with dismiss and delete actions, including violation tracking |
| 2 | AI Moderation System | Review AI-analyzed posts with ability to override AI decisions (approve/reject) |
| 3 | Blacklist Management | Manage users with warning statuses (Reminded, Warned, Banned) with status escalation/de-escalation capabilities |
| 4 | User Status Escalation | Automatic status progression system (Normal → Reminded → Warned → Banned) triggered by content violations |
| 5 | Email Notification Service | Automated email notifications to users regarding account status changes via REST API |
| 6 | Push Notification Service | Real-time push notifications to user devices for post actions and status changes |
| 7 | Dashboard Caching System | Efficient data caching mechanism with 5-minute expiration to optimize Firebase calls |
| 8 | Topic Management | Administrative CRUD operations for forum topics/categories with post count tracking |
Description:
The Dashboard serves as the primary interface of the administration application, displaying key statistics, interactive charts, and navigation pathways to other functional modules. It provides administrators with a comprehensive overview of forum activity.
Key Components:
- 4 Stat Cards: Total Users, Total Posts, Blacklisted Users, Reported Posts
- Bar Chart: Posts over time (Day/Week/Month views with navigation)
- Pie Chart: Posts distribution by topic with dynamic legends
- Topic Management: Add, edit, delete topics
- Pull-to-Refresh: Manual data refresh with cache invalidation
- Dashboard Caching: 5-minute cache for efficient data loading
flowchart TD
A[Dashboard Screen] --> B{Load Data}
B -->|Cache Valid| C[Display Cached Data]
B -->|Cache Invalid| D[Fetch from Firebase]
D --> E[Update Cache]
E --> C
C --> F[Display Stat Cards]
C --> G[Display Bar Chart]
C --> H[Display Pie Chart]
F --> I{Card Clicked?}
I -->|Total Users| J[Navigate to Total Users]
I -->|Total Posts| K[Navigate to Total Posts]
I -->|Blacklisted| L[Navigate to Blacklist]
I -->|Reported| M[Navigate to Reported Posts]
G --> N[Toggle Day/Week/Month]
G --> O[Navigate Previous/Next Period]
H --> P[Click Manage Topics]
P --> Q[Show Topic Management Dialog]
Related Screens:
- Total Users Screen (on stat card click)
- Total Posts Screen (on stat card click)
- Blacklist Screen (on stat card click)
- Reported Posts Screen (on stat card click)
Screenshot Descriptions:
- Dashboard Overview (Light Mode): Full dashboard showing all 4 stat cards with numbers, bar chart displaying weekly posts, pie chart with topic distribution, and the side navigation drawer icon
- Dashboard Overview (Dark Mode): Same view in dark theme
- Bar Chart - Day View: Bar chart showing posts per day in the current week with day labels (Mon-Sun)
- Bar Chart - Week View: Bar chart showing posts per week in the current month
- Bar Chart - Month View: Bar chart showing posts per month in the current year
- Pie Chart with Legend: Topic distribution pie chart with custom legend items below
- Pie Chart Segment Selected: Pie chart with one segment expanded and percentage displayed
- Topic Management Dialog: Dialog showing list of existing topics with edit/delete buttons and add new topic input field
- Edit Topic Dialog: Dialog for editing a topic's name and description
- Delete Topic Confirmation: Confirmation dialog before deleting a topic
- Pull-to-Refresh in Progress: Dashboard with refresh spinner visible
Description:
The Navigation Drawer is a side navigation menu that provides access to all major sections of the application. It features a gradient header design consistent with the application branding.
Menu Items:
- Dashboard
- AI Moderation
- Settings
flowchart LR
A[Menu Icon] --> B[Open Drawer]
B --> C{Select Item}
C -->|Dashboard| D[Dashboard Fragment]
C -->|AI Moderation| E[AI Moderation Fragment]
C -->|Settings| F[Settings Fragment]
Screenshot Descriptions:
- Navigation Drawer Open: Side drawer showing gradient header and menu items (Dashboard, AI Moderation, Settings) with icons
Description:
This screen displays a comprehensive, paginated list of all forum users. It provides search functionality with autocomplete suggestions, filtering capabilities by status and role, and detailed user information viewing through modal dialogs.
Features:
- User list with avatar, name, ID, status badge, and role
- Search with autocomplete suggestions
- Filter by status (Normal, Reminded, Warned, Banned) and role (Teacher, Student)
- Pagination (10 users per page)
- User details dialog on row click
flowchart TD
A[Total Users Screen] --> B[Load Users from Firebase]
B --> C[Display User List]
C --> D{User Actions}
D -->|Search| E[Filter by Name/ID]
D -->|Filter Button| F[Show Filter Dialog]
D -->|Row Click| G[Show User Details Dialog]
F --> H[Select Status/Role Filters]
H --> I[Apply Filters]
I --> C
G --> J[View User Info]
J --> K[Close Dialog]
C --> L[Pagination Controls]
L -->|Previous| M[Load Previous Page]
L -->|Next| N[Load Next Page]
Related Screens:
- Dashboard (navigates back)
Screenshot Descriptions:
- Total Users List: List view showing user avatars, names, IDs, status badges, and roles
- Search with Autocomplete: Search field with dropdown showing matching user suggestions
- Filter Dialog Open: Dialog with status checkboxes (Normal, Reminded, Warned, Banned) and role options (Teacher, Student)
- Filtered Results: User list after applying filters with filter indicator visible
- User Details Dialog: Modal showing user avatar, full name, ID, email, role, status, and close button
- Pagination Controls: Bottom pagination showing "Page X of Y" with Previous/Next buttons
- Empty Search Results: Screen showing "No results found" message
Description:
This screen presents all forum posts with comprehensive filtering options. Administrators can filter posts by date range (maximum 31 days), search by title, author, or content, and navigate to detailed post views.
Features:
- Post cards showing title, author, date, topic tags, AI approval status
- Date range picker (Start Date - End Date, max 31 days)
- Search by title, author, or content
- Pagination (10 posts per page)
- Click to view full post details
flowchart TD
A[Total Posts Screen] --> B[Load Posts from Firebase]
B --> C[Apply Default Date Range]
C --> D[Display Posts List]
D --> E{User Actions}
E -->|Search| F[Filter by Title/Author/Content]
E -->|Set Date Range| G[Select Start/End Dates]
E -->|Apply Filter| H[Filter Posts by Date]
E -->|Click Post| I[Navigate to Post Detail]
G --> J[Show Date Picker]
J --> K[Validate Date Range ≤31 days]
K --> H
D --> L[Pagination]
L --> M[Navigate Pages]
Related Screens:
- Dashboard (navigates back)
- Post Detail Screen (on post click)
Screenshot Descriptions:
- Total Posts List: Grid/list of post cards with titles, authors, dates, and topic tags
- Date Range Picker: Two date input fields showing Start Date and End Date with date picker dialogs
- Post Card with Tags: Individual post card showing topic tags (e.g., "Technology", "Education")
- AI Approved Badge: Post card showing green checkmark or "AI Approved" indicator
- Search Results: Filtered post list based on search query
- Empty State: "No posts found" message when no posts match criteria
Description:
The Post Detail Screen provides a comprehensive view of an individual post, displaying all associated metadata, full content, attached images, and engagement statistics including upvotes, downvotes, and comments.
Features:
- Post title and full content
- Author info (name, ID, avatar)
- Post metadata (date, categories/topics, status)
- Engagement statistics (upvotes, downvotes, comments)
- Report count and violation types (if any)
- Image gallery for posts with images
flowchart TD
A[Post Detail Screen] --> B[Load Post by ID]
B --> C{Post Found?}
C -->|Yes| D[Display Post Details]
C -->|No| E[Show Error & Navigate Back]
D --> F[Show Author Section]
D --> G[Show Post Content]
D --> H[Show Statistics]
D --> I[Show Images if Available]
D --> J[Show Violations if Any]
K[Back Button] --> L[Navigate Up]
Related Screens:
- Total Posts Screen (navigates back)
- Reported Posts Screen (navigates back)
Screenshot Descriptions:
- Post Detail Full View: Complete post detail screen showing title, author with avatar, date, topic breadcrumb
- Post Content Section: Main content area with post text
- Statistics Row: Upvote/downvote/comment counts with icons
- Post with Images: Image gallery section below content
- Post with Violations: Red violation type badges displayed
- Reported Post Detail: Post showing report count badge
- Status Indicator: Post status badge (Approved/Pending/Rejected)
Description:
The Reported Posts Screen enables administrators to manage posts that have been flagged by users for potential violations. Administrators can review report details, view violation types, dismiss reports, or delete posts with automatic status escalation for the post author.
Features:
- List of reported posts with report count and violation count badges
- Search reported posts
- Sort by reports (Low→High, High→Low) or violations (Low→High, High→Low)
- View violation types on badge click
- View report details (reasons) on badge click
- Dismiss reports (clears all reports for a post)
- Delete post (removes post and escalates author status)
flowchart TD
A[Reported Posts Screen] --> B[Load Posts with reportCount > 0]
B --> C[Display Reported Posts List]
C --> D{User Actions}
D -->|Click Report Badge| E[Show Report Details Dialog]
D -->|Click Violation Badge| F[Show Violations Dialog]
D -->|Click Post| G[Navigate to Post Detail]
D -->|Click Dismiss| H[Confirm Dismiss Dialog]
D -->|Click Delete| I[Confirm Delete Dialog]
D -->|Sort Button| J[Show Sort Dialog]
H -->|Confirm| K[Clear All Reports]
K --> L[Remove from List]
I -->|Confirm| M[Delete Post from Firebase]
M --> N[Escalate Author Status]
N --> O[Send Email Notification]
N --> P[Send Push Notification]
O --> L
P --> L
J --> Q[Select Sort Criteria]
Q --> R[Apply Sort]
Related Screens:
- Dashboard (navigates back)
- Post Detail Screen (on post click)
Screenshot Descriptions:
- Reported Posts List: List showing posts with red report count badges and orange violation badges
- Sort Dialog: Dialog with "Sort by Reports/Violations" and "Low to High/High to Low" options
- Report Details Dialog: Modal showing list of report reasons from different users
- Violations Dialog: Modal listing all violation types detected on the post
- Dismiss Confirmation: Alert dialog confirming report dismissal
- Delete Confirmation: Alert dialog confirming post deletion with warning
- Empty State: "No reported posts" message when all reports are handled
Description:
The AI Moderation Screen allows administrators to review posts that have been analyzed by the artificial intelligence moderation system. Administrators have the authority to override AI decisions by approving AI-rejected posts or rejecting AI-approved posts, with appropriate notification triggers.
Features:
- Two tabs: AI Approved / AI Rejected
- Post cards with AI confidence score, violation types
- Search posts by title or content
- Sort by time (Newest/Oldest first)
- Filter by violation type (dynamic from Firebase)
- Approve/Reject actions with confirmation dialogs
- Status escalation on rejection (sends notifications)
flowchart TD
A[AI Moderation Screen] --> B{Select Tab}
B -->|AI Approved| C[Load Approved Posts]
B -->|AI Rejected| D[Load Rejected Posts]
C --> E[Display Post Cards]
D --> E
E --> F{User Actions}
F -->|Search| G[Filter by Query]
F -->|Sort| H[Show Sort Dialog]
F -->|Filter| I[Show Violation Filter Dialog]
F -->|Approve Button| J[Show Approve Confirmation]
F -->|Reject Button| K[Show Reject Confirmation]
H --> L[Sort Newest/Oldest]
I --> M[Select Violation Types]
J -->|Confirm| N[Approve Post in Firebase]
N --> O[Send Approval Notification]
K -->|Confirm| P[Reject/Delete Post]
P --> Q[Escalate Author Status]
Q --> R[Send Rejection Notification]
Q --> S[Send Email Notification]
Related Screens:
- Navigation Drawer (source)
Screenshot Descriptions:
- AI Approved Tab Active: List of AI-approved posts with approve tab highlighted
- AI Rejected Tab Active: List of AI-rejected posts with violations displayed
- AI Post Card: Individual card showing title, content preview, violation types, and approve/reject buttons
- Sort Dialog: Time-based sort options (Newest First, Oldest First)
- Violation Filter Dialog: Scrollable list of violation type checkboxes (Toxicity, Spam, etc.)
- Approve Confirmation Dialog: Confirmation for approving an AI-rejected post
- Reject Confirmation Dialog: Confirmation for rejecting an AI-approved post
- Empty State - No Posts: "No posts found" when tab is empty
- Loading State: Circular progress indicator while loading
Description:
The Blacklist Management Screen provides administrators with tools to manage users who have been flagged with warning statuses (Reminded, Warned, or Banned). It supports status escalation, de-escalation, and complete removal from the blacklist with appropriate email and push notifications.
Features:
- List of users with status != Normal
- Status badge showing current level (Reminded, Warned, Banned)
- Search with autocomplete
- Filter by status
- Change user status (escalate/de-escalate)
- Remove from blacklist (set status to Normal)
- Email and push notifications on status change
flowchart TD
A[Blacklist Screen] --> B[Load Users with status != NORMAL]
B --> C[Display Blacklisted Users]
C --> D{User Actions}
D -->|Search| E[Filter by Name/ID]
D -->|Filter| F[Show Status Filter Dialog]
D -->|Click Status Badge| G[Show Status Action Menu]
D -->|Click Remove| H[Show Remove Confirmation]
G --> I{Select New Status}
I -->|Ban| J[Confirm Ban]
I -->|Warn| K[Confirm Warning]
I -->|Remind| L[Confirm Reminder]
J --> M[Update Status in Firebase]
K --> M
L --> M
M --> N{Is Escalation?}
N -->|Yes| O[Send Escalation Email]
N -->|No| P[Send De-escalation Email]
O --> Q[Send Push Notification]
P --> Q
Q --> R[Update UI]
H -->|Confirm| S[Set Status to NORMAL]
S --> T[Send Congratulatory Email]
T --> U[Remove from List]
Related Screens:
- Dashboard (navigates back)
Screenshot Descriptions:
- Blacklist User List: Users with colored status badges (Red=Banned, Orange=Warned, Yellow=Reminded)
- Status Filter Dialog: Checkboxes for Banned, Warned, Reminded statuses
- Status Action Menu: Popup menu with Ban, Warn, Remind options
- Change Status Confirmation: Alert dialog confirming status change with user name
- Remove Confirmation: Alert confirming removal from blacklist
- Search with Autocomplete: Search field with matching user suggestions
- Empty Blacklist: "No blacklisted users" message when all users are Normal
Description:
The Settings Screen enables administrators to configure application appearance and language preferences. All settings are persisted using SharedPreferences and applied immediately upon selection.
Features:
- Theme Selection: Light, Dark, Auto (System)
- Language Selection: English, Vietnamese
- Persistence using SharedPreferences
- Immediate application of changes
flowchart TD
A[Settings Screen] --> B[Load Saved Preferences]
B --> C[Display Current Selection]
C --> D{User Selection}
D -->|Theme| E[Select Light/Dark/Auto]
D -->|Language| F[Select English/Vietnamese]
E --> G[Save Theme Preference]
G --> H[Apply Theme Immediately]
F --> I[Save Language Preference]
I --> J[Recreate Activity with New Locale]
Related Screens:
- Navigation Drawer (source)
Screenshot Descriptions:
- Settings - Light Theme Selected: Settings screen with Light theme button highlighted/selected
- Settings - Dark Theme Selected: Settings screen with Dark theme button highlighted
- Settings - Auto Theme Selected: Settings screen with Auto theme button highlighted
- Settings - English Selected: Language section with English option selected
- Settings - Vietnamese Selected: Language section with Vietnamese option selected
- Settings in Dark Mode: Entire settings screen displayed in dark theme
- Settings in Vietnamese: Entire settings screen with Vietnamese labels
Description:
The Email Notification Service is responsible for sending automated email notifications to users regarding their account status changes. Communication is handled via an external REST API using Retrofit.
Email Types:
- Escalation Email: When status increases (Normal→Reminded→Warned→Banned)
- De-escalation Email: Congratulatory message when status improves
- Includes user name, new status, and optional list of reported posts
flowchart TD
A[Status Change Trigger] --> B{Direction?}
B -->|Escalation| C[Prepare Escalation Email]
B -->|De-escalation| D[Prepare Congratulatory Email]
C --> E[Include Reported Posts]
E --> F[Send via Retrofit API]
D --> F
F --> G{Success?}
G -->|Yes| H[Log Success]
G -->|No| I[Log Error - Non-blocking]
Screenshot Descriptions:
- (No UI - backend service)
Description:
The Push Notification Service delivers real-time push notifications to user devices regarding administrative actions. Notifications are triggered via an external REST API and delivered through Firebase Cloud Messaging (FCM).
Notification Types:
POST_DELETED: When admin/AI deletes user's postPOST_APPROVED: When admin/AI approves user's postPOST_REJECTED: When admin/AI rejects user's postSTATUS_CHANGED: When user account status changes
flowchart TD
A[Admin Action] --> B{Action Type}
B -->|Delete Post| C[POST_DELETED Notification]
B -->|Approve Post| D[POST_APPROVED Notification]
B -->|Reject Post| E[POST_REJECTED Notification]
B -->|Change Status| F[STATUS_CHANGED Notification]
C --> G[Build Notification Request]
D --> G
E --> G
F --> G
G --> H[Send via Retrofit API]
H --> I{Success?}
I -->|Yes| J[Log Success]
I -->|No| K[Log Error - Non-blocking]
Screenshot Descriptions:
- (No UI - backend service, but user app receives notifications)
Description:
The User Status Escalation Service automatically escalates user account status when their posts are deleted, whether by AI rejection or administrative action. This service ensures consistent enforcement of community guidelines.
Status Escalation Order:
| Level | Status | Description |
|---|---|---|
| 0 | NORMAL | User in good standing |
| 1 | REMINDED | First warning issued |
| 2 | WARNED | Serious warning issued |
| 3 | BANNED | Account suspended |
Features:
- Automatic status level calculation
- Firebase Firestore update
- Triggers email notification
- Triggers push notification
- Returns detailed escalation result
flowchart TD
A[Post Deleted Trigger] --> B[Get User by ID]
B --> C[Get Current Status Level]
C --> D{Already Banned?}
D -->|Yes| E[No Escalation Needed]
D -->|No| F[Calculate Next Level]
F --> G[Update Status in Firebase]
G --> H{Success?}
H -->|No| I[Return Error]
H -->|Yes| J[Send Email Notification]
J --> K[Send Push Notification]
K --> L[Return Escalation Result]
Screenshot Descriptions:
- (No direct UI - integrated into delete/reject actions)
Description:
The Dashboard Caching System implements an efficient caching mechanism for dashboard data to minimize Firebase database calls and enhance application responsiveness.
Cached Data:
- Dashboard statistics (4 stat card values)
- Posts data (for bar charts)
- Topics data (for pie chart)
Cache Configuration:
- Expiration: 5 minutes
- Storage: SharedPreferences with Gson serialization
- Manual invalidation on pull-to-refresh
flowchart TD
A[Request Dashboard Data] --> B{Is Cache Valid?}
B -->|Yes, < 5 min| C[Return Cached Data]
B -->|No| D[Fetch from Firebase]
D --> E[Serialize with Gson]
E --> F[Save to SharedPreferences]
F --> G[Update Timestamp]
G --> C
H[Pull to Refresh] --> I[Invalidate Cache]
I --> D
Screenshot Descriptions:
- (Transparent to user - shows cached vs fresh data load timing)
| Library | Version | Purpose |
|---|---|---|
| Firebase Firestore | BOM 34.6.0 | Database |
| Firebase Auth | BOM 34.6.0 | Authentication |
| Firebase Storage | BOM 34.6.0 | File storage |
| MPAndroidChart | 3.1.0 | Bar & Pie charts |
| Glide | 4.16.0 | Image loading & caching |
| Retrofit | 2.9.0 | REST API calls |
| OkHttp | 4.11.0 | HTTP client |
| Gson | 2.10.1 | JSON serialization |
| SwipeRefreshLayout | 1.1.0 | Pull-to-refresh |
| Navigation Component | Jetpack | Fragment navigation |
| Material Design | 3.x | UI components |
The app supports 2 languages:
- English (default)
- Vietnamese (vi)
All user-facing strings are externalized in:
res/values/strings.xml(English)res/values-vi/strings.xml(Vietnamese)
Description:
Core data structures used throughout the application for type-safe data handling.
| Model | Fields | Purpose |
|---|---|---|
FirestoreUser |
email, fullName, profilePictureUrl, role, uid, status | Raw Firestore user document |
User |
id, name, avatarUrl, status, role | UI display model |
BlacklistedUser |
id, name, avatarUrl, status, uid | Blacklist-specific model |
UserSuggestion |
id, name, displayText | Autocomplete suggestions |
| Model | Fields | Purpose |
|---|---|---|
FirestorePost |
authorId, authorName, author_avatar_url, comment_count, content, createdAt, downvote_count, image_link, post_id, reportCount, status, title, topic, uid, upvote_count, video_link, violation_type | Raw Firestore post document |
Post |
id, title, author, date, description, tags, isAiApproved | UI display model |
ReportedPost |
id, title, author, authorId, date, categories, description, fullContent, violationCount, reportCount, violationTypes | Reported posts screen model |
| Enum | Values | Description |
|---|---|---|
| UserStatus | NORMAL, REMINDED, WARNED, BANNED | Represents user account standing levels |
| UserStatusLevel | NORMAL, REMINDED, WARNED, BANNED | Status level with string value mapping |
| Model | Fields | Purpose |
|---|---|---|
AiModerationResult |
postData, isApproved, confidenceScore, violationTypes | AI analysis result |
AiModerationRequest |
postId, title, content | Request to AI service |
Violation |
violation (ID), name, description | Violation type definition |
| Model | Fields | Purpose |
|---|---|---|
NotificationTriggerRequest |
type, actorId, actorName, targetId, targetUserId, previewText, originalPostTitle, originalPostContent | Push notification payload |
NotificationType |
POST_DELETED, POST_APPROVED, STATUS_CHANGED, POST_REJECTED | Notification categories |
ReportEmailRequest |
recipientEmail, userName, userStatus, reportedPosts | Email API payload |
classDiagram
class FirestoreUser {
+String email
+String fullName
+String profilePictureUrl
+String role
+String uid
+String status
}
class UserStatus {
<<enumeration>>
NORMAL
REMINDED
WARNED
BANNED
}
class FirestorePost {
+String authorId
+String title
+String content
+String status
+Long reportCount
+List~String~ violation_type
}
class AiModerationResult {
+Post postData
+Boolean isApproved
+Float confidenceScore
+List~String~ violationTypes
}
FirestoreUser --> UserStatus
FirestorePost --> AiModerationResult
Description:
Data access layer abstracting Firebase Firestore operations with caching support.
| Repository | Collection | Key Methods |
|---|---|---|
UserRepository |
users | getAllUsers(), getBlacklistedUsers(), getUserById(), updateUserStatus() |
PostRepository |
posts | getAllPosts(), getPaginatedPosts(), deletePost(), getPostsByViolationTypes() |
TopicRepository |
topics | getAllTopics(), addTopic(), updateTopic(), deleteTopic() |
ReportRepository |
reports | getReportsForPost(), dismissReportsForPost() |
ViolationRepository |
violations | getAllViolations() |
AiModerationRepository |
posts | getApprovedPosts(), getRejectedPosts(), overrideModerationDecision() |
flowchart TD
subgraph UI Layer
A[Fragments/ViewModels]
end
subgraph Repository Layer
B[UserRepository]
C[PostRepository]
D[TopicRepository]
E[ReportRepository]
F[ViolationRepository]
G[AiModerationRepository]
end
subgraph Firebase
H[(Firestore)]
end
A --> B
A --> C
A --> D
A --> E
A --> F
A --> G
B --> H
C --> H
D --> H
E --> H
F --> H
G --> H
The repository layer implements an in-memory caching strategy to optimize performance:
| Parameter | Value | Description |
|---|---|---|
| Cache Expiration | 5 minutes | Duration before cache invalidation |
| Cache Storage | In-memory variable | Temporary storage for fetched data |
| Timestamp Tracking | System milliseconds | Used to determine cache validity |
| Invalidation Trigger | Manual refresh or expiration | When cache is cleared |
Description:
REST API client for external services (email notifications, push notifications).
| Service | Base URL | Endpoints |
|---|---|---|
EmailApiService |
External server | POST /send-report-email |
NotificationApiService |
External server | POST /trigger-notification |
The REST API client is configured with the following parameters:
| Configuration | Value | Description |
|---|---|---|
| Base URL | External server endpoint | API server address |
| HTTP Client | OkHttpClient | Underlying HTTP client |
| Logging | HttpLoggingInterceptor | Request/response logging |
| Connect Timeout | 30 seconds | Connection establishment timeout |
| Read Timeout | 30 seconds | Data reading timeout |
| Converter | GsonConverterFactory | JSON serialization/deserialization |
sequenceDiagram
participant App as Admin App
participant Retrofit as Retrofit Client
participant API as External API Server
participant User as User Device
App->>Retrofit: Send notification request
Retrofit->>API: POST /trigger-notification
API->>User: Push notification via FCM
API-->>Retrofit: 200 OK
Retrofit-->>App: Result.success()
Description:
Reusable RecyclerView adapters and UI components.
| Adapter | Purpose | Item Layout |
|---|---|---|
TotalUsersAdapter |
Display user list | item_total_user.xml |
TotalPostsAdapter |
Display post list | item_total_post.xml |
BlacklistAdapter |
Display blacklisted users | item_blacklist_user.xml |
ReportedPostsAdapter |
Display reported posts | item_reported_post_card.xml |
AiPostsAdapter |
Display AI-moderated posts | item_ai_post_card.xml |
ManageTopicsAdapter |
Topic management list | item_manage_topic.xml |
UserAutoCompleteAdapter |
Search autocomplete | item_autocomplete_suggestion.xml |
| Component | Purpose |
|---|---|
StatCard |
Dashboard statistic card with icon, label, value |
| Custom Legend | Pie chart legend items |
| Status Badge | Colored badge for user status |
| Tag Chips | Topic/category tag display |
flowchart LR
A[Data List] --> B[RecyclerView]
B --> C[Adapter]
C --> D[ViewHolder]
D --> E[Item Layout XML]
C -->|Click Events| F[Fragment/Activity]
F -->|Update Data| C
Description:
Model-View-ViewModel architecture pattern implementation.
flowchart TB
subgraph View Layer
A[MainActivity]
B[DashboardFragment]
C[BlacklistFragment]
D[SettingsFragment]
E[AssistantFragment]
end
subgraph ViewModel Layer
F[DashboardViewModel]
G[AssistantViewModel]
H[SettingsViewModel]
end
subgraph Model/Data Layer
I[Repositories]
J[Services]
K[Cache Manager]
end
subgraph External
L[(Firebase Firestore)]
M[REST APIs]
end
B --> F
E --> G
D --> H
F --> I
G --> I
G --> J
I --> L
J --> M
I --> K
The application uses immutable state classes to manage UI state. Each ViewModel maintains a LiveData object containing the current state.
AI Moderation State Properties:
| Property | Type | Description |
|---|---|---|
| currentTab | TabType | Currently selected tab (Approved/Rejected) |
| allPosts | List | Complete list of posts |
| filteredPosts | List | Posts after applying filters |
| searchQuery | String | Current search query |
| sortOrder | SortOrder | Current sort order (Newest/Oldest) |
| selectedViolationIds | Set | Selected violation type filters |
| isLoading | Boolean | Loading state indicator |
| error | String (nullable) | Error message if any |
The application implements lifecycle-aware coroutine launching to ensure safe UI updates:
| Aspect | Implementation |
|---|---|
| Scope | viewLifecycleOwner.lifecycleScope |
| Safety Check | Verify fragment is still added before UI updates |
| Binding Check | Verify binding is not null before accessing views |
| Error Handling | Try-catch blocks for exception handling |
| Screen | Layout File | Key Components |
|---|---|---|
| Main Activity | activity_main.xml | DrawerLayout, NavigationView, NavHostFragment |
| Dashboard | fragment_dashboard.xml | SwipeRefreshLayout, StatCards, BarChart, PieChart |
| Blacklist | fragment_blacklist.xml | SearchView, RecyclerView, Pagination |
| AI Moderation | fragment_ai_moderation.xml | TabLayout, RecyclerView, FilterButtons |
| Settings | fragment_settings.xml | Theme buttons, Language buttons |
| Total Posts | fragment_total_posts.xml | DatePickers, SearchView, RecyclerView |
| Total Users | fragment_total_users.xml | SearchView, FilterButton, RecyclerView |
| Post Detail | fragment_post_detail.xml | ScrollView, Author section, Content, Statistics |
| Reported Posts | fragment_reported_posts.xml | SearchView, SortButton, RecyclerView |
| Dialog | Layout File | Purpose |
|---|---|---|
| Manage Topics | dialog_manage_topics.xml | CRUD for topics |
| Edit Topic | dialog_edit_topic.xml | Edit topic name/description |
| Topic Description | dialog_topic_description.xml | Add topic with description |
| Sort Options | dialog_sort.xml | Sort by reports/violations |
| Sort Time | dialog_sort_time.xml | Sort by newest/oldest |
| Filter Status | dialog_filter_status.xml | Filter by user status |
| Filter Users | dialog_filter_users.xml | Filter by status & role |
| Filter Violation | dialog_filter_violation.xml | Filter by violation type |
| User Details | dialog_user_details.xml | View user information |
| Report Details | dialog_report_details.xml | View report reasons |
| Violations | dialog_violations.xml | View violation types |
| Metric | Count |
|---|---|
| Total Screens | 7 main screens |
| Total Dialogs | 11 dialogs |
| RecyclerView Adapters | 7 adapters |
| Repositories | 6 repositories |
| Services | 4 services |
| Data Models | 15+ models |
| Layout Files | 34 layouts |
| Supported Languages | 2 (English, Vietnamese) |
| Theme Modes | 3 (Light, Dark, Auto) |
Document generated for Forumus Admin App v1.0
Last updated: January 2026