yashketkar/video-player

View on GitHub
vitamio/src/io/vov/vitamio/widget/MediaController.java

Summary

Maintainability
C
1 day
Test Coverage

File MediaController.java has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (C) 2006 The Android Open Source Project
 * Copyright (C) 2013 YIXIA.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
Severity: Minor
Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 4 hrs to fix

    MediaController has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class MediaController extends FrameLayout {
      private static final int sDefaultTimeout = 3000;
      private static final int FADE_OUT = 1;
      private static final int SHOW_PROGRESS = 2;
      private MediaPlayerControl mPlayer;
    Severity: Minor
    Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 3 hrs to fix

      Method dispatchKeyEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        @Override
        public boolean dispatchKeyEvent(KeyEvent event) {
          int keyCode = event.getKeyCode();
          if (event.getRepeatCount() == 0 && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
            doPauseResume();
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        public void show(int timeout) {
          if (!mShowing && mAnchor != null && mAnchor.getWindowToken() != null) {
            if (mPauseButton != null)
              mPauseButton.requestFocus();
      
      
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method setProgress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        private long setProgress() {
          if (mPlayer == null || mDragging)
            return 0;
      
          long position = mPlayer.getCurrentPosition();
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method hide has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        public void hide() {
          if (mAnchor == null)
            return;
      
          if (mShowing) {
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/widget/MediaController.java - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      There are no issues that match your filters.

      Category
      Status