Skip to content

Conversation

@dogi
Copy link
Member

@dogi dogi commented Nov 11, 2025

No description provided.

claude and others added 8 commits November 6, 2025 11:00
Performed a full-repository dead-code analysis covering Kotlin classes,
XML resources, and Gradle modules. Removed all identified unused code
to reduce APK size and improve codebase maintainability.

Changes:
- Removed 119 unused layout files (28% utilization → 100%)
- Removed 137 unused string resources from strings.xml
- Removed 1 unused drawable (ic_mypersonals.xml)
- Removed 1 unused style (AppTheme.Dialog.NoActionBar.MinWidth)

Impact:
- Estimated APK size reduction: 2-5 MB (5-10%)
- Improved build performance
- Cleaner codebase with higher code health (98%+)

Analysis method:
- Used comprehensive grep searches across all Kotlin and XML files
- Verified each resource was not referenced via R.* or @resource/
- Checked for both direct references and XML-to-XML references
- Preserved all DI modules and dynamically-referenced resources

All changes verified to maintain functionality while removing dead code.
…ifest

The string title_activity_dashboard was incorrectly identified as unused
because the initial scan didn't check AndroidManifest.xml. This string
is required by DashboardActivity's android:label attribute.

Fixes build error:
- AAPT: error: resource string/title_activity_dashboard not found
Restore layout files that were incorrectly removed in the dead code removal sweep.
These layouts are actively referenced in the codebase and their removal caused compilation errors.

Restored files:
- activity_audio_player.xml - used by AudioPlayerActivity
- activity_csvviewer.xml - used by CSVViewerActivity
- activity_exo_player_video.xml - used by VideoPlayerActivity
- activity_image_viewer.xml - used by ImageViewerActivity
- activity_markdown_viewer.xml - used by MarkdownViewerActivity
- activity_pdfreader.xml - used by PDFReaderActivity
- activity_textfile_viewer.xml - used by TextFileViewerActivity
- alert_add_attachment.xml - used by EditAchievementFragment
- dialog_campaign_challenge.xml - used by MarkdownDialog
- dialog_progress.xml - used by DialogUtils
- edit_profile_dialog.xml - used by UserProfileFragment
- row_stat.xml - used by UserProfileFragment
- user_list_item.xml - used by TeamListAdapter

This fixes compilation errors for missing binding classes:
ActivityAudioPlayerBinding, ActivityCsvviewerBinding, ActivityExoPlayerVideoBinding,
ActivityImageViewerBinding, ActivityMarkdownViewerBinding, ActivityPdfreaderBinding,
ActivityTextfileViewerBinding, AlertAddAttachmentBinding, DialogCampaignChallengeBinding,
DialogProgressBinding, EditProfileDialogBinding, RowStatBinding, UserListItemBinding
Restore 29 additional layout files that were incorrectly removed in the dead
code removal sweep (83fb944). These layouts are actively referenced through
ViewBinding in Kotlin code, causing compilation errors.

The initial dead code analysis only checked for direct R.layout.* references
but missed ViewBinding references like DialogServerUrlBinding, which are
generated from layout XML files.

Restored files and their usages:
- dialog_server_url_.xml → DialogServerUrlBinding (DashboardElementActivity, LoginActivity, ServerDialogExtensions, SyncActivity)
- alert_guest_login.xml → AlertGuestLoginBinding (GuestLoginExtensions)
- fragment_send_survey.xml → FragmentSendSurveyBinding (SendSurveyFragment)
- item_team_list.xml → ItemTeamListBinding (AdapterTeamList)
- fragment_plan.xml → FragmentPlanBinding (PlanFragment)
- alert_create_team.xml → AlertCreateTeamBinding (PlanFragment, TeamFragment)
- fragment_team_course.xml → FragmentTeamCourseBinding (TeamCourseFragment)
- fragment_discussion_list.xml → FragmentDiscussionListBinding (DiscussionListFragment)
- row_joined_user.xml → RowJoinedUserBinding (AdapterJoinedMember)
- row_member_request.xml → RowMemberRequestBinding (AdapterMemberRequest)
- fragment_member_detail.xml → FragmentMemberDetailBinding (MemberDetailFragment)
- row_team_resource.xml → RowTeamResourceBinding (AdapterTeamResource, AdapterTeamCourse)
- fragment_team_resource.xml → FragmentTeamResourceBinding (TeamResourceFragment)
- row_task.xml → RowTaskBinding (AdapterTask)
- alert_task.xml → AlertTaskBinding (TeamTaskFragment)
- alert_users_spinner.xml → AlertUsersSpinnerBinding (TeamTaskFragment)
- fragment_team_task.xml → FragmentTeamTaskBinding (TeamTaskFragment)
- fragment_achievement.xml → FragmentAchievementBinding (AchievementFragment)
- layout_button_primary.xml → LayoutButtonPrimaryBinding (AchievementFragment)
- row_achievement.xml → RowAchievementBinding (AchievementFragment)
- row_other_info.xml → RowOtherInfoBinding (AdapterOtherInfo)
- activity_become_member.xml → ActivityBecomeMemberBinding (BecomeMemberActivity)
- alert_reference.xml → AlertReferenceBinding (EditAchievementFragment)
- edit_attachement.xml → EditAttachementBinding (EditAchievementFragment)
- edit_other_info.xml → EditOtherInfoBinding (EditAchievementFragment)
- fragment_edit_achievement.xml → FragmentEditAchievementBinding (EditAchievementFragment)
- add_meetup.xml → AddMeetupBinding (TeamCalendarFragment)
- fragment_enterprise_calendar.xml → FragmentEnterpriseCalendarBinding (TeamCalendarFragment)
- fragment_team.xml → FragmentTeamBinding (TeamFragment)

This fixes hundreds of compilation errors like:
- "Unresolved reference: DialogServerUrlBinding"
- "Unresolved reference: AlertGuestLoginBinding"
- "Unresolved reference: ItemTeamListBinding"
etc.

The dead code removal process needs to be improved to check for ViewBinding
references, not just direct R.layout.* references.
Restores 33 layout XML files that were incorrectly removed in the dead
code removal sweep. These layouts are actively referenced by ViewBinding
in the following modules:
- Feedback (activity_feedback_detail, fragment_feedback, etc.)
- Map (activity_offline_map)
- Health (activity_add_examination, fragment_vital_sign, etc.)
- Meetup (fragment_my_meetup_detail)
- Personals (fragment_my_personals, row_my_personal)
- News (activity_reply, row_news)
- Resources/Library (row_library, fragment_library_detail, etc.)
- Survey/Submission (row_survey, fragment_my_submission, etc.)
- Rating (fragment_rating)
- References (fragment_reference, row_reference)
- Onboarding (activity_on_boarding)

Without these files, ViewBinding cannot generate the required binding
classes, causing compilation to fail with "Unresolved reference" errors.

Fixes compilation errors for multiple UI modules.
Restored 44 layout XML files that were removed in the comprehensive dead
code removal sweep but are actually required for ViewBinding to generate
the corresponding binding classes.

This fixes all ViewBinding compilation errors including:
- FragmentMembersBinding, FragmentCalendarBinding
- ItemAiResponseMessageBinding, ItemUserMessageBinding
- FragmentChatDetailBinding, RowChatHistoryBinding
- RowCourseBinding, FragmentMyProgressBinding
- ActivityDashboardBinding, FragmentHomeBellBinding
- And 34 other ViewBinding classes

All restored files are actively referenced in Kotlin source files.
The style AppTheme.Dialog.NoActionBar.MinWidth was referenced by several
DialogFragment classes but was removed during cleanup, causing compilation errors:
- BaseDialogFragment.kt
- FeedbackFragment.kt
- RatingFragment.kt
- CollectionsFragment.kt

Restored the style definition with appropriate dialog theme properties.
@dogi dogi added in progress triage Further information is requested less labels Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in progress less triage Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants