Android Client Application - Detailed Structure

Project: Psyter Android Client
Package: com.psyter.www
Version: 2.0.15 (Code: 50)
Last Updated: November 5, 2025


๐Ÿ“ Root Structure

Android/
โ”œโ”€โ”€ app/                           # Main application module
โ”‚   โ”œโ”€โ”€ src/                       # Source code
โ”‚   โ”‚   โ”œโ”€โ”€ main/                  # Main source set
โ”‚   โ”‚   โ”œโ”€โ”€ test/                  # Unit tests
โ”‚   โ”‚   โ””โ”€โ”€ androidTest/           # Instrumented tests
โ”‚   โ”œโ”€โ”€ libs/                      # Local library files (JARs)
โ”‚   โ”œโ”€โ”€ build.gradle               # App-level build configuration
โ”‚   โ”œโ”€โ”€ google-services.json       # Firebase configuration
โ”‚   โ””โ”€โ”€ proguard-rules.pro         # ProGuard/R8 rules
โ”œโ”€โ”€ duo-navigation-drawer/         # Custom navigation drawer module
โ”œโ”€โ”€ intlphoneinput/               # International phone input module
โ”œโ”€โ”€ gradle/                        # Gradle wrapper files
โ”œโ”€โ”€ build.gradle                   # Project-level build configuration
โ”œโ”€โ”€ gradle.properties              # Gradle properties
โ”œโ”€โ”€ settings.gradle                # Project settings
โ”œโ”€โ”€ gradlew                        # Gradle wrapper script (Unix)
โ”œโ”€โ”€ gradlew.bat                   # Gradle wrapper script (Windows)
โ””โ”€โ”€ README.md                     # Project documentation

๐Ÿ“ฆ Main Application Module (/app)

Build Configuration

File: app/build.gradle

Purpose: Defines app configuration, dependencies, and build variants

Key Configurations:
- Compile SDK: 33 (Android 13)
- Min SDK: 21 (Android 5.0 Lollipop)
- Target SDK: 33
- Application ID: com.psyter.www
- Version Code: 50
- Version Name: 2.0.15

Build Features:
- Data Binding enabled
- View Binding enabled
- NDK support (version 23.1.7779620)
- Language splitting disabled (all languages in one APK)

Dependencies Summary:
- AndroidX libraries
- Firebase (Messaging, Auth, Crashlytics, Analytics)
- WebRTC for video calls
- Networking libraries (Android Networking, Async HTTP)
- Image loading (Glide, Picasso)
- PDF viewer
- Custom UI components
- WebSocket client
- Payment SDK integration


๐Ÿ“ฑ Source Code Structure (/app/src/main)

1. Android Manifest (AndroidManifest.xml)

Purpose: App configuration, permissions, and component declarations

Key Permissions:
- INTERNET - Network access
- CAMERA - Video calls
- RECORD_AUDIO - Audio calls
- READ/WRITE_EXTERNAL_STORAGE - File access
- ACCESS_NETWORK_STATE - Network monitoring
- SYSTEM_ALERT_WINDOW - Overlay windows
- BLUETOOTH - Bluetooth device support
- READ_PHONE_STATE - Phone state detection
- GET_ACCOUNTS - Account access

Main Components:
- 50+ Activities declared
- Firebase Messaging Service
- Background workers
- Broadcast receivers

Application Settings:
- Network Security Config enabled
- Legacy storage support
- RTL layout support
- No backup allowed
- Custom theme (AppTheme.NoActionBar)

Entry Point:
- Launch Activity: Registration.Activities.SplashActivity


2. Assets Folder (/assets)

Purpose: Contains static files bundled with the app

Files:

assets/
โ”œโ”€โ”€ ParametersToEncrypt.txt           # Payment encryption parameters
โ”œโ”€โ”€ ParametersToEncodeForSecureHash.txt  # Secure hash parameters
โ”œโ”€โ”€ ParametersToEncode.txt            # General encoding parameters
โ”œโ”€โ”€ Generic.txt                       # Generic configuration
โ””โ”€โ”€ ExcludedParametersFromSecureHash.txt  # Exclusion list for hashing

Usage: These files are used by the STS Payment SDK for secure payment processing


3. Java Source Code (/java/com/psyter/www)

๐ŸŽฏ Package Organization

Root Level (com.psyter.www)

Firebase Services

File: MyFirebaseMessagingService.java
- Purpose: Handles Firebase Cloud Messaging (push notifications)
- Key Functions:
- Receives notification messages
- Displays notifications to user
- Handles notification click actions
- Background/foreground message handling
- Connections:
- Firebase Console
- Backend APIs for notification data
- Android notification system

File: MyFirebaseInstanceIdService.java
- Purpose: Manages Firebase device token
- Key Functions:
- Token generation/refresh
- Sends token to backend server
- Handles token updates
- Connections:
- Firebase Auth
- Backend API for token registration

File: OnClickPrescriptionList.java
- Purpose: Interface for prescription list item clicks
- Type: Callback interface
- Usage: Implemented by activities showing prescriptions


๐Ÿ“ฑ Client Package (/Client)

Purpose: All client-side (patient) functionality

Activities (/Client/Activities)

Core Activities:

1. BlogsActivity.kt
- Purpose: Display health/mental wellness blog posts
- Language: Kotlin
- Features:
- List of blog articles
- Search/filter functionality
- Categories
- Connections:
- Backend API: /api/blogs
- BlogDetailsActivity

2. BlogDetailsActivity.kt
- Purpose: Show full blog article content
- Features:
- Rich text display
- Share functionality
- Related articles
- Data Model: BlogModel.java

3. PaymentWebActivity.java
- Purpose: WebView for payment processing
- Features:
- STS payment gateway integration
- JavaScript interface
- Payment status callbacks
- Flow:
- Receives payment URL
- Loads payment page
- Captures success/failure
- Returns to booking flow

4. PDFviewerActivity.java
- Purpose: Display PDF documents (prescriptions, reports)
- Library: android-pdf-viewer:2.8.2
- Features:
- Zoom, scroll, page navigation
- Download capability
- Share PDF

5. ViewDocWebActivity.java
- Purpose: WebView for document viewing
- Supports: Online document URLs
- Use Cases:
- Terms & conditions
- Privacy policy
- Treatment agreements

6. HomeWrokSubmitActivity.java
- Purpose: Submit therapeutic homework assignments
- Features:
- File upload (images, documents)
- Text input
- Submission confirmation
- Connections: Backend API for homework submissions

7. NotificationsActivity.java
- Purpose: Display notification history
- Features:
- List all notifications
- Mark as read
- Navigate to related content
- Data Source: Local database + Firebase

8. AddUpdateDiaryActivity.java
- Purpose: Mood diary/journal entry creation
- Features:
- Mood selection
- Text entry
- Date/time
- Save/update entries
- Connections: Backend API + local storage


Fragments (/Client/Fragments)

1. MainFragmentClient.java
- Purpose: Main dashboard/home screen
- Components:
- Upcoming appointments
- Quick actions
- Recent activity
- Notifications badge
- Navigation Hub: Links to all major features

2. FindCPFragment.java
- Purpose: Search and browse care providers
- Features:
- Filter by specialty, location, price
- Grid/list view toggle
- Provider cards with basic info
- Favorite providers
- Search Criteria:
- Specialty (Psychiatrist, Psychologist, etc.)
- Gender preference
- Language
- Price range
- Rating
- Availability
- Connections:
- Backend API: /api/providers/search
- CarePDataModel

3. MyCPFragment.java
- Purpose: View booked/favorite care providers
- Features:
- Current therapist
- Past providers
- Favorites list
- Quick booking
- Actions:
- View profile
- Book appointment
- Send message
- Rate provider

4. MyProfileFragmentClient.java
- Purpose: Client profile management
- Sections:
- Personal information
- Medical history
- Insurance details
- Privacy settings
- Language preferences
- Actions:
- Edit profile
- Change password
- Upload profile photo
- Update emergency contact

5. QuestionnaireFragment.java
- Purpose: Display available questionnaires
- Types:
- Initial assessment
- Progress tracking
- Symptom checkers
- Flow:
- List questionnaires
- Complete questionnaire
- View results

6. MyQyestionaireFragment.java
- Purpose: Completed questionnaire history
- Features:
- Past results
- Progress charts
- Compare over time

7. MyHomeWorkFragment.java
- Purpose: Therapeutic homework assignments
- Features:
- Active assignments
- Completed work
- Due dates
- Submission status
- Actions:
- View details
- Submit work
- View feedback

8. MyDiaryFragment.java
- Purpose: Mood diary/journal entries
- Features:
- Calendar view
- Entry list
- Mood trends
- Export data
- Visualization:
- Mood charts
- Activity patterns

9. ReferralsFragment.java
- Purpose: Manage referrals to other specialists
- Features:
- Referral list
- Referral details
- Accept/decline
- Contact specialist

10. BookSlotActivity.java
- Purpose: Appointment booking interface
- Features:
- Calendar view
- Available time slots
- Provider selection
- Payment processing
- Flow:
- Select date
- Choose time
- Confirm booking
- Process payment


Adapters (/Client/Adapters)

Purpose: RecyclerView/ListView adapters for displaying lists

1. BlogsAdapter.java
- Binds: Blog posts to list items
- View Holder: Blog card with image, title, summary
- Actions: Click to view details

2. MyCarePGridAdapter.java
- Binds: Care provider cards in grid layout
- View Holder: Provider photo, name, specialty, rating
- Actions: Click to view profile, favorite toggle

3. DiaryListAdapter.java
- Binds: Diary entries to list
- View Holder: Date, mood icon, preview text
- Actions: Click to view/edit entry

4. HomeWorkListAdapter.java
- Binds: Homework assignments
- View Holder: Title, due date, status badge
- Actions: Click to submit/view

5. ReferralClientAdapter.java
- Binds: Referral items
- View Holder: Specialist info, referral date, status
- Actions: Accept, decline, view details

6. GridAdapterMonth.java
- Purpose: Calendar month grid adapter
- View Holder: Individual day cells
- Highlights: Available days, selected date, today


Data Models (/Client/DataModels)

1. BlogModel.java

class BlogModel {
    String id;
    String title;
    String content;
    String summary;
    String imageUrl;
    String author;
    Date publishDate;
    String category;
    List<String> tags;
}

2. HomeWorkListDataModel.java

class HomeWorkListDataModel {
    String homeworkId;
    String title;
    String description;
    String assignedBy;
    Date assignedDate;
    Date dueDate;
    String status; // Pending, Submitted, Completed
    String submittedFilePath;
    String feedback;
}

3. ReferralListDataModel.java

class ReferralListDataModel {
    String referralId;
    String fromProviderId;
    String toProviderId;
    String patientId;
    String reason;
    Date referralDate;
    String status;
    String notes;
}


Book Slots Module (/Client/BookSlots)

Purpose: Complete appointment booking system

Activities:

1. SelectSlotActivity.java
- Purpose: Time slot selection interface
- Features:
- Week/month view toggle
- Time grid display
- Slot availability status
- Multi-slot booking
- UI Components:
- Calendar picker
- Time slot RecyclerView
- Filter options (morning, afternoon, evening)

2. MonthViewClient.java
- Purpose: Monthly calendar view
- Features:
- Custom calendar rendering
- Highlight available days
- Mark booked appointments
- Navigation between months

3. SlotPaymentSuggestActivity.java
- Purpose: Payment options and suggestions
- Features:
- Show booking summary
- Display pricing
- Payment method selection
- Wallet balance usage
- Package/discount suggestions
- Payment Methods:
- Credit/Debit card
- Wallet balance
- Insurance
- Payment plans

Adapters (/BookSlots/Adapters)

1. SlotsListAdapter.java
- Binds: Available time slots
- View Holder: Time, duration, status badge
- States: Available, Booked, Unavailable

2. SuggestionGridAdapter.java
- Binds: Package/discount suggestions
- View Holder: Package name, price, savings, benefits

Data Models (/BookSlots/DataModels & /BookSlots/DataModel)

1. AvailableSlotsDataModel.java

class AvailableSlotsDataModel {
    String slotId;
    String providerId;
    Date date;
    String startTime;
    String endTime;
    int durationMinutes;
    boolean isAvailable;
    double price;
    String sessionType; // Video, Audio, In-person
}

2. EventsDataModel.java

class EventsDataModel {
    String eventId;
    Date date;
    String eventType; // Appointment, Holiday, Blocked
    String title;
    String description;
}

3. SuggestionsDataModel.java

class SuggestionsDataModel {
    String suggestionId;
    String packageName;
    String description;
    double originalPrice;
    double discountedPrice;
    int numberOfSessions;
    String validUntil;
    List<String> benefits;
}

4. MarkedSlotDataModel.java

class MarkedSlotDataModel {
    String date;
    boolean hasAppointment;
    boolean hasEvent;
    boolean isHoliday;
    int appointmentCount;
}


๐Ÿ‘จโ€โš•๏ธ Care Provider Package (/CareProvider)

Purpose: Care provider-specific features (subset in client app for viewing)

Note: This package contains minimal provider-specific code as this is the client app. Full provider features are in AndroidCareProvider project.

Activities Available:

1. AppointmentBookingSuccessActivity.java
- Purpose: Success confirmation screen
- Shows: Booking details, next steps
- Actions: View appointment, add to calendar

2. CarePListingFiltersActivity.java
- Purpose: Advanced filter interface
- Filters:
- Specialty checkboxes
- Gender radio buttons
- Price range slider
- Rating minimum
- Language selection
- Experience years
- Availability (immediate, within week, etc.)

3. ReserveSlotActivity.java
- Purpose: Hold a slot temporarily
- Use Case: When client needs time to decide
- Duration: 15-minute hold

4. ReferralActivity.java
- Purpose: Process provider referrals
- Features: Accept/decline referral, view details


๐ŸŒ Common User Package (/CommonUser)

Purpose: Shared functionality between clients and providers

Activities (/CommonUser/Activities)

1. RateCareProviderActivity.java
- Purpose: Rate and review care provider
- Components:
- Star rating (1-5)
- Review text
- Service aspects rating
- Anonymous option
- Aspects:
- Professionalism
- Communication
- Effectiveness
- Environment (if applicable)

2. MedicalSourcesActivity.java
- Purpose: Educational resources
- Content:
- Articles
- Videos
- FAQ
- External links to credible sources

Data Models (/CommonUser/DataModel)

1. CarePDataModel.java

class CarePDataModel {
    String providerId;
    String fullName;
    String email;
    String phone;
    String photoUrl;
    String specialty;
    String subSpecialty;
    String bio;
    String education;
    int experienceYears;
    double rating;
    int reviewCount;
    String gender;
    List<String> languages;
    String licenseNumber;
    AddressModel address;
    PricingModel pricing;
    AvailabilityModel availability;
    boolean isFavorite;
    boolean isVerified;
}


๐ŸŽฅ Collaboration Package (/Collaboration)

Purpose: Real-time video/audio call functionality

Structure:

Collaboration/
โ”œโ”€โ”€ Common/                    # Shared collaboration code
โ”‚   โ”œโ”€โ”€ ClientData.java       # Client connection data
โ”‚   โ”œโ”€โ”€ CConnectionMode.java  # Connection modes enum
โ”‚   โ””โ”€โ”€ CCommand.java         # Command constants
โ”œโ”€โ”€ Presence/                  # User presence management
โ”‚   โ”œโ”€โ”€ PresenceUserModel.java
โ”‚   โ”œโ”€โ”€ StatusAdapter.java
โ”‚   โ”œโ”€โ”€ NaiveSSLContext.java  # SSL for WebSocket
โ”‚   โ””โ”€โ”€ WebAPICall.java       # API communication
โ”œโ”€โ”€ NetWorkDetectionHelpers/  # Network monitoring
โ”‚   โ”œโ”€โ”€ NetworkUtil.java
โ”‚   โ””โ”€โ”€ NetworkChangeReceiver.java
โ””โ”€โ”€ Utility.java              # Helper functions

Common Classes

CConnectionMode.java

enum CConnectionMode {
    NONE,
    PRESENCE,      // Online status
    COLLABORATION  // Active call
}

CCommand.java
- Purpose: WebSocket command constants
- Commands:
- AUTHENTICATE
- INITIATE_CALL
- ACCEPT_CALL
- REJECT_CALL
- END_CALL
- HOLD
- UNHOLD
- MUTE_AUDIO
- MUTE_VIDEO
- SDP_OFFER
- SDP_ANSWER
- ICE_CANDIDATE

ClientData.java

class ClientData {
    String userId;
    String communicationKey;
    String deviceId;
    String connectionMode;
    boolean isPresenceConnected;
    boolean isInCall;
}

Presence Management

PresenceUserModel.java

class PresenceUserModel {
    String userId;
    String userName;
    String status; // Online, Offline, Away, Busy
    long lastSeen;
    String deviceType;
}

StatusAdapter.java
- Purpose: Display user online status
- Shows: Status indicator, last seen time

NaiveSSLContext.java
- Purpose: SSL configuration for WebSocket
- Note: Accepts all certificates (dev only)

WebAPICall.java
- Purpose: HTTP API calls during collaboration
- Methods:
- getSessionDetails()
- updateSessionStatus()
- recordCallQuality()

Network Detection

NetworkUtil.java
- Purpose: Check network connectivity and type
- Methods:
- isConnected() - Boolean check
- getNetworkType() - WiFi, Mobile, None
- getConnectionQuality() - Strong, Medium, Weak
- monitorBandwidth() - Track available bandwidth

NetworkChangeReceiver.java
- Purpose: Broadcast receiver for network changes
- Actions:
- Notify user when connection lost
- Attempt reconnection
- Quality warning on weak connection


๐Ÿ“ Registration Package (/Registration)

Purpose: User onboarding and registration flow

Activities (/Registration/Activities)

1. SplashActivity.java
- Purpose: App entry point, initialization
- Functions:
- Check authentication status
- Load user preferences
- Navigate to appropriate screen
- Routing:
- New user โ†’ OnboardingActivity
- Returning user โ†’ Login or Main screen

Data Models (/Registration/DataModel)

1. ScreeningQusDataModel.java

class ScreeningQusDataModel {
    String questionId;
    String questionText;
    String questionType; // Radio, Checkbox, Text, Scale
    List<String> options;
    boolean isRequired;
    int orderIndex;
}

2. ScreeningAnsDataModel.java

class ScreeningAnsDataModel {
    String answerId;
    String questionId;
    String answerValue;
    int score;
}

3. HistoryDataModel.java

class HistoryDataModel {
    String medicalCondition;
    Date diagnosisDate;
    String medications;
    boolean isOngoing;
    String notes;
}

4. CountriesDataModel.java

class CountriesDataModel {
    String countryCode;
    String countryName;
    String dialCode;
    String flagUrl;
}

5. EventObjects.java
- Purpose: Event bus objects for registration flow
- Events:
- RegistrationCompleteEvent
- VerificationSuccessEvent
- ProfileUpdateEvent

6. attendanceDetailDataModel.java

class attendanceDetailDataModel {
    String sessionId;
    Date sessionDate;
    int durationMinutes;
    String attendanceStatus;
    String notes;
}


๐Ÿ“… Scheduling Package (/Scheduling)

Purpose: Provider schedule and availability management

Weekly Schedule (/Scheduling/WeeklySchedule)

WeeklyScheduleFragment.java
- Purpose: View/edit weekly availability
- Features:
- 7-day grid view
- Time block creation
- Recurring schedules
- Exception dates
- UI:
- Drag to create time blocks
- Color coding by session type
- Copy week functionality


๐Ÿ› ๏ธ Stats/Utilities Package (/Stats)

Purpose: Utility classes, helpers, and custom views

Permission Helpers

1. clsCameraPermission.java
- Purpose: Request and check camera permission
- Methods: checkPermission(), requestPermission()

2. clsStoragePermission.java
- Purpose: Storage permission handling
- Handles: Read/Write external storage

3. clsRecordingPermission.java
- Purpose: Audio recording permission
- Use: Video call audio

4. clsDrawOverAppPermission.java
- Purpose: Overlay window permission
- Use: Floating call window

Custom Views

1. CalendarCustomView.java
- Purpose: Custom calendar widget
- Features:
- Month/week view
- Event markers
- Date selection
- Custom styling

2. CalendarClientView.java
- Purpose: Client-specific calendar
- Shows: Appointments, events, holidays

3. CustomWebview.java
- Purpose: Enhanced WebView
- Features:
- JavaScript interface
- Progress bar
- Error handling
- Download support

4. CustomScrollView.java
- Purpose: Custom ScrollView with callbacks
- Use: Detect scroll events

5. GoEditText.java
- Purpose: EditText with “Go” button behavior
- Feature: IME action handling

6. GoEditTextListener.java
- Purpose: Interface for Go button clicks

7. EditTextKeyboardSafe.java
- Purpose: EditText that handles keyboard visibility

8. ExpandableHeightGridView.java
- Purpose: GridView that expands to content
- Use: Inside ScrollView

9. NonScrollListView.java
- Purpose: ListView that doesn’t scroll
- Use: Inside ScrollView

10. AsteriskTextView.java
- Purpose: TextView with asterisk for required fields

Utility Classes

1. Utils.java
- Purpose: General utility functions
- Methods:
- Date formatting
- String validation
- Image compression
- File operations
- Network checks

2. Internet.java
- Purpose: Internet connectivity check
- Methods:
- isConnected()
- showNoInternetDialog()

3. BaseURLS.java
- Purpose: API endpoint constants
- Contains:
- Base URLs for different environments
- API endpoints
- WebSocket URLs

4. MySharedPreferences.java
- Purpose: SharedPreferences wrapper
- Methods:
- Save/retrieve user data
- Session management
- Settings storage

5. LocaleUtils.java
- Purpose: Language/locale management
- Methods:
- Set app language
- Get current locale
- RTL support

6. LangHelper.java
- Purpose: Language helper functions
- Methods:
- Apply locale
- Get string resources in specific language

7. ImageFilePath.java
- Purpose: Get file path from URI
- Use: Image picker results

8. PowerSaverHelper.java
- Purpose: Handle battery optimization
- Methods:
- Check if app is optimized
- Request whitelist
- Show battery settings

9. TransparentProgressDialog.java
- Purpose: Custom loading dialog
- Features: Transparent background, custom animation

10. ReasonsEnum.java
- Purpose: Enum for various reason codes
- Values:
- Cancellation reasons
- Rejection reasons
- Report reasons

11. OnSwipeTouchListener.java
- Purpose: Swipe gesture detector
- Methods:
- onSwipeLeft()
- onSwipeRight()
- onSwipeUp()
- onSwipeDown()

Payment Integration

STSPaymentManager.java
- Purpose: STS payment gateway integration
- Methods:
- initializePayment()
- processPayment()
- handleCallback()
- encryptParameters()
- Security:
- Parameter encryption
- Secure hash generation
- Certificate validation

Activity Helpers

WeekDisplayActivity.java
- Purpose: Display week view
- Use: Schedule visualization


๐Ÿ‘๏ธ Views Package (/views)

Purpose: Custom views and onboarding flow

Onboarding Fragments (/views/fragments)

1. OnboardingFragmentA.java
- Screen: Welcome screen
- Content: App introduction, key features

2. OnboardingFragmentB.java
- Screen: How it works
- Content: Booking process, communication methods

3. OnboardingFragmentC.java
- Screen: Privacy and security
- Content: Data protection, confidentiality

Registration Fragments (/views/fragments/register)

1. RegisterNumberOrEmail.java
- Purpose: Initial registration input
- Fields:
- Phone number OR Email
- Country selection (for phone)
- Validation:
- Format check
- Duplicate check via API
- Next: Verification code sent

2. RegisterVerification.java
- Purpose: OTP verification
- Features:
- 6-digit OTP input
- Resend code (with timer)
- Auto-submit on complete
- Methods:
- SMS verification (phone)
- Email verification (email)

3. RegisterVerificationConfirm.java
- Purpose: Verification success confirmation
- Shows: Success message, next steps

4. RegisterBasicInfo.java
- Purpose: Collect basic user information
- Fields:
- Full name
- Gender
- Date of birth
- Password creation
- Terms acceptance
- Validation:
- Name format
- Age restriction (18+)
- Password strength
- Required field check

Activities (/views/activity)

1. OnboardingActivity.java
- Purpose: Host onboarding fragments
- Features:
- ViewPager2 for swiping
- Page indicators
- Skip button
- Get Started button

2. RegisterActivity.java
- Purpose: Host registration fragments
- Features:
- Step-by-step navigation
- Progress indicator
- Back navigation handling
- Data persistence between steps


โš™๏ธ Workers Package (/workers)

Purpose: Background tasks and scheduled jobs

1. AlarmWorkManager.java
- Purpose: WorkManager for appointment reminders
- Schedule: Appointment time - notification lead time
- Actions:
- Show notification
- Update appointment status
- Handle user actions (join, reschedule)

2. clsShow_Alarm.java
- Purpose: Display alarm/notification
- Features:
- Custom notification layout
- Action buttons
- Sound/vibration

3. Tags.java
- Purpose: Work request tags for WorkManager
- Constants:
- APPOINTMENT_REMINDER
- SESSION_SYNC
- MESSAGE_SYNC


๐Ÿ“‚ Resources (/app/src/main/res)

Layout Files (/res/layout)

Categories:
1. Activity Layouts - Full screen activities
2. Fragment Layouts - Fragment views
3. Item Layouts - RecyclerView/ListView items
4. Dialog Layouts - Custom dialogs
5. Include Layouts - Reusable components

Naming Convention:
- Activities: activity_*.xml
- Fragments: fragment_*.xml
- List Items: item_*.xml or *_item.xml
- Dialogs: dialog_*.xml

Drawable Resources (/res/drawable)

Types:
- XML Drawables: Shapes, selectors, gradients
- Vector Assets: SVG-based icons
- Layer Lists: Layered backgrounds

Folders:
- /drawable - Default drawables
- /drawable-hdpi through /drawable-xxxhdpi - Density-specific images
- /drawable-v24 - API 24+ specific drawables

Values (/res/values)

Files:
- strings.xml - All text strings
- colors.xml - Color definitions
- styles.xml - UI styles and themes
- dimens.xml - Dimension values
- arrays.xml - String/integer arrays
- attrs.xml - Custom attribute definitions

Localization:
- /values-ar - Arabic translations (RTL support)

Files:
- Navigation graphs for Navigation Component
- Define fragment destinations and transitions

Raw (/res/raw)

Purpose: Raw resource files
Contents:
- Sound files
- Video files
- JSON config files

XML (/res/xml)

Files:
- network_security_config.xml - Network security rules
- file_paths.xml - FileProvider paths
- Preferences XML


๐Ÿงช Test Code (/app/src)

Unit Tests (/test)

Location: /test/java/com/psyter/www/

ExampleUnitTest.java
- Purpose: Template for unit tests
- Framework: JUnit 4
- Type: Local tests (run on JVM)

Instrumented Tests (/androidTest)

Location: /androidTest/java/com/psyter/www/

ExampleInstrumentedTest.java
- Purpose: Template for UI tests
- Framework: AndroidX Test, Espresso
- Type: Instrumented tests (run on device/emulator)


๐Ÿ”ง Configuration Files

Gradle Files

1. Project-level build.gradle
- Purpose: Project-wide configuration
- Contains:
- Repository declarations
- Gradle plugin dependencies
- Global variables

2. App-level app/build.gradle
- Purpose: App module configuration
- Contains:
- Application ID
- Version info
- SDK versions
- Dependencies
- Build types
- Product flavors (if any)

3. gradle.properties
- Purpose: Gradle properties
- Contains:
- Memory settings
- Build optimization flags
- Android build features

4. settings.gradle
- Purpose: Project settings
- Contains:
- Module inclusions
- Plugin management

Firebase Configuration

google-services.json
- Purpose: Firebase project configuration
- Contains:
- Project ID
- App ID
- API keys
- FCM sender ID
- Note: Environment-specific (dev/prod)

ProGuard

proguard-rules.pro
- Purpose: Code obfuscation rules
- Contains:
- Keep rules for classes
- Optimization settings
- Attribute preservation


๐Ÿ”— Key Connections & Data Flow

1. Authentication Flow

SplashActivity
    โ†“
OnboardingActivity (first time)
    โ†“
RegisterActivity
    โ†“ (steps)
RegisterNumberOrEmail โ†’ RegisterVerification โ†’ RegisterBasicInfo
    โ†“
Backend API: /api/auth/register
    โ†“
MyFirebaseInstanceIdService (register FCM token)
    โ†“
MainFragmentClient (dashboard)

2. Booking Flow

FindCPFragment (search providers)
    โ†“
CarePDataModel (provider details)
    โ†“
BookSlotActivity
    โ†“
SelectSlotActivity (choose slot)
    โ†“
Backend API: /api/slots/available
    โ†“
SlotPaymentSuggestActivity (payment)
    โ†“
PaymentWebActivity (STS gateway)
    โ†“
Backend API: /api/booking/confirm
    โ†“
AppointmentBookingSuccessActivity
    โ†“
MyFirebaseMessagingService (confirmation notification)

3. Video Call Flow

MyFirebaseMessagingService (incoming call notification)
    โ†“
Collaboration package
    โ†“
WebSocket connection to Node server
    โ†“
CCommand.INITIATE_CALL
    โ†“
WebRTC peer connection setup
    โ†“
SDP offer/answer exchange
    โ†“
ICE candidate exchange
    โ†“
Active video/audio stream
    โ†“
CCommand.END_CALL
    โ†“
Backend API: /api/session/complete

4. Data Synchronization

App Launch
    โ†“
MySharedPreferences (load cached data)
    โ†“
Network check (Internet.java)
    โ†“
Backend APIs (sync latest data)
    โ†“
Local storage update
    โ†“
UI refresh

๐Ÿ“Š Dependencies Breakdown

Core Android

  • androidx.appcompat:appcompat
  • androidx.constraintlayout:constraintlayout
  • com.google.android.material:material

Firebase

  • firebase-messaging (push notifications)
  • firebase-auth (authentication)
  • firebase-crashlytics (crash reporting)
  • firebase-analytics (usage analytics)

Networking

  • com.amitshekhar.android:android-networking (HTTP)
  • com.loopj.android:android-async-http (async HTTP)
  • com.neovisionaries:nv-websocket-client (WebSocket)

WebRTC

  • org.webrtc:google-webrtc:1.0.28513

Image Loading

  • com.github.bumptech.glide:glide (primary)
  • com.squareup.picasso:picasso (legacy)

UI Components

  • de.hdodenhof:circleimageview (circular images)
  • com.github.warkiz.widget:indicatorseekbar (range sliders)
  • com.crystal:crystalrangeseekbar (range picker)
  • com.ncorti:slidetoact (slide button)
  • com.github.ybq:Android-SpinKit (loading animations)
  • com.github.GrenderG:Toasty (styled toasts)

PDF & File

  • com.github.barteksc:android-pdf-viewer (PDF viewer)
  • com.github.hedzr:android-file-chooser (file picker)

Utilities

  • com.google.code.gson:gson (JSON parsing)
  • nu.aaro.gustav:passwordstrengthmeter (password validation)
  • com.github.aabhasr1:OtpView (OTP input)
  • com.intuit.sdp:sdp-android (scalable DP)
  • com.intuit.ssp:ssp-android (scalable SP)
  • androidx.navigation:navigation-fragment
  • androidx.navigation:navigation-ui

Background Work

  • androidx.work:work-runtime-ktx (WorkManager)

Payment

  • STS Payment SDK (custom)

๐ŸŽจ UI/UX Patterns

  • Type: Bottom Navigation + Navigation Drawer
  • Tabs:
    1. Home/Dashboard
    2. Find Providers
    3. My Care Providers
    4. Profile
    5. More (drawer)

Design System

  • Material Design 3 components
  • Color Scheme: Defined in colors.xml
  • Typography: Custom fonts in /res/font
  • Icons: Mix of Material Icons and custom SVGs

Responsive Design

  • Scalable DP/SP using sdp/ssp libraries
  • Multiple layouts for different screen sizes
  • RTL support for Arabic

๐Ÿ” Security Features

Data Protection

  • Encryption: Payment parameters encrypted
  • Secure Storage: Sensitive data in encrypted SharedPreferences
  • HTTPS Only: Network security config enforces HTTPS
  • Certificate Pinning: For critical API calls

Authentication

  • JWT Tokens: Stored securely
  • Token Refresh: Automatic refresh before expiry
  • Biometric: Optional fingerprint/face authentication

Privacy

  • Permissions: Runtime permission requests
  • Data Minimization: Only collect necessary data
  • User Control: Privacy settings in profile

๐Ÿ“ˆ Performance Optimizations

Image Loading

  • Glide caching for efficient image loading
  • Image compression before upload
  • Lazy loading in lists

Network

  • Request caching for repeated calls
  • Batch requests where possible
  • Retry logic for failed requests

Memory

  • ViewHolder pattern in adapters
  • Bitmap recycling after use
  • WeakReference for callbacks

Background Work

  • WorkManager for deferrable tasks
  • Foreground service for calls
  • Job scheduler for periodic sync

๐Ÿ› Debugging & Logging

Logging

  • Firebase Crashlytics: Automatic crash reporting
  • Custom logging: Debug logs for development

Testing

  • Unit tests: Business logic testing
  • UI tests: Espresso for UI automation
  • Manual testing: On multiple devices

๐Ÿ“ฆ Build Variants

Debug Build

  • Purpose: Development testing
  • Features:
  • Debug logging enabled
  • Dev server URLs
  • Detailed error messages
  • No obfuscation

Release Build

  • Purpose: Production deployment
  • Features:
  • ProGuard enabled
  • Production URLs
  • Crashlytics enabled
  • Signed APK/AAB

๐Ÿš€ Deployment

Build Process

  1. Update version code/name
  2. Run lint checks
  3. Run unit tests
  4. Generate release build
  5. Sign with release keystore
  6. Upload to Play Console

Distribution

  • Google Play Store (primary)
  • Internal testing track for beta
  • APK distribution for specific cases

End of Android Client Documentation


Next Steps:
- โœ… Android Client (COMPLETED)
- โญ๏ธ AndroidCareProvider (NEXT)
- Pending: APIs, Media, NodeServer, Tahoon_API, Web, WindowsService, IOSCareProvider