Skip to content

Conversation

@kristofnemere
Copy link
Contributor

@kristofnemere kristofnemere commented Dec 18, 2025

Test Plan

  1. Open the Student app
  2. Navigate to Global Files or course-specific Files
  3. Select and play an MP4 video file
  4. Verify the video plays correctly in VideoViewActivity
  5. Verify the fullscreen button is no longer visible in the video player controls

References

refs: MBL-19498

Impact

affects: Student

Release Note

release note: Removed non-functional fullscreen button from video player

Checklist

  • Dark/light mode testing
  • Landscape/tablet testing
  • Accessibility testing
  • Product approval (if needed)

The fullscreen button in VideoViewActivity did nothing when tapped.
Instead of trying to implement fullscreen functionality, removed the
button entirely since it was non-functional.

Changes:
- Added View and ImageButton imports
- Added setGone extension function import
- Hidden fullscreen button in onCreate by setting it to GONE

Test plan:
- Open a video file from Global Files or course Files
- Verify video plays correctly
- Verify fullscreen button is no longer visible

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR adds functionality to hide the fullscreen button in the video player. The change is straightforward, but there are some important concerns to address.

Issues Found

  • Critical: Potential NullPointerException (line 78) - findViewById() can return null, which would crash when calling setGone(). Use safe call operator ?. to prevent crashes.
  • Timing/Lifecycle Issue (line 78) - The button hiding logic runs before the PlayerView is fully initialized, which may cause the findViewById to fail even when the button exists. Consider using post {} to defer execution.
  • Code Style: Import Organization (line 24) - ImageButton import breaks the logical grouping of imports. Consider organizing imports by category.

Positive Aspects

✓ The approach of using setGone() is consistent with the codebase's utility methods
✓ Minimal, focused change that addresses a specific UI requirement
✓ Proper imports added for new dependencies

Recommendations

  1. Add null safety: Use binding.playerView.findViewById<ImageButton>(R.id.fullscreenButton)?.setGone() to prevent crashes
  2. Consider timing: Wrap the call in binding.playerView.post { } to ensure the view hierarchy is ready
  3. Add unit/UI test: Consider adding a test to verify the fullscreen button is properly hidden when the activity loads

Test Coverage

No test changes were included in this PR. Consider adding:

  • UI test verifying the fullscreen button is not visible after activity creation
  • Unit test if there's logic to conditionally show/hide the button

Overall, this is a simple change that needs defensive coding to handle potential null cases and timing issues with view initialization.

mainHandler = Handler()
val videoTrackSelectionFactory: ExoTrackSelection.Factory = AdaptiveTrackSelection.Factory()
trackSelector = DefaultTrackSelector(applicationContext, videoTrackSelectionFactory)
binding.playerView.findViewById<ImageButton>(R.id.fullscreenButton).setGone()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential NullPointerException: The findViewById<ImageButton>(R.id.fullscreenButton) call could return null if the button doesn't exist in the player view's layout. This would cause a crash when calling setGone() on a null object.

Consider using a safe call or null check:

binding.playerView.findViewById<ImageButton>(R.id.fullscreenButton)?.setGone()

Or verify the button exists and handle the null case:

binding.playerView.findViewById<ImageButton>(R.id.fullscreenButton)?.let { button ->
    button.setGone()
} ?: run {
    // Log warning or handle missing button case
}

mainHandler = Handler()
val videoTrackSelectionFactory: ExoTrackSelection.Factory = AdaptiveTrackSelection.Factory()
trackSelector = DefaultTrackSelector(applicationContext, videoTrackSelectionFactory)
binding.playerView.findViewById<ImageButton>(R.id.fullscreenButton).setGone()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timing concern: This code runs in onCreate() before fetchMediaUri() is called. If the PlayerView hasn't fully initialized its internal layout at this point, the findViewById() might not locate the button even if it exists.

Consider moving this after the player is fully set up, or using a post handler:

binding.playerView.post {
    binding.playerView.findViewById<ImageButton>(R.id.fullscreenButton)?.setGone()
}

import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.widget.ImageButton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import ordering: The ImageButton import appears to be placed between OS imports and Media3 imports. Consider organizing imports by grouping (Android framework, third-party libraries, app-specific) for better readability.

@github-actions
Copy link

📊 Code Coverage Report

ℹ️ Student

  • PR Coverage: 42.91%
  • Master Coverage: N/A

ℹ️ Teacher

  • PR Coverage: 25.48%
  • Master Coverage: N/A

ℹ️ Pandautils

  • PR Coverage: 22.49%
  • Master Coverage: N/A

@github-actions
Copy link

🧪 Unit Test Results

✅ 📱 Student App

  • Tests: 1241 total, 0 failed, 0 skipped
  • Duration: 0.000s
  • Success Rate: 100%

✅ 🌅 Horizon

  • Tests: 449 total, 0 failed, 0 skipped
  • Duration: 33.852s
  • Success Rate: 100%

✅ 📦 Submodules

  • Tests: 2472 total, 0 failed, 0 skipped
  • Duration: 45.659s
  • Success Rate: 100%

📊 Summary

  • Total Tests: 4162
  • Failed: 0
  • Skipped: 0
  • Status: ✅ All tests passed!

Last updated: Thu, 18 Dec 2025 10:23:36 GMT

@github-actions
Copy link

Student Install Page

@kristofnemere kristofnemere merged commit 2371331 into master Dec 18, 2025
31 checks passed
@kristofnemere kristofnemere deleted the MBL-19498-remove-fullscreen-button branch December 18, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants