yashketkar/video-player

View on GitHub

Showing 108 of 144 total issues

Method endFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private Uri endFile(FileCacheEntry entry) throws RemoteException {
      Uri tableUri;
      boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0;
      if (isVideo) {
        tableUri = Video.Media.CONTENT_URI;
Severity: Minor
Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

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

      private void updateSub(int subType, byte[] bytes, String encoding, int width, int height) {
        if (mEventHandler != null) {
          Message m = mEventHandler.obtainMessage(MEDIA_TIMED_TEXT, width, height);
          Bundle b = m.getData();
          if (subType == SUBTITLE_TEXT) {
    Severity: Minor
    Found in vitamio/src/io/vov/vitamio/MediaPlayer.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 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 onCreate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            hideUI();
    Severity: Minor
    Found in app/src/main/java/com/yashketkar/ykplayer/VideoPlayerActivity.java - About 1 hr to fix

      Method onRequestPermissionsResult has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void onRequestPermissionsResult(int requestCode,
                                                 String permissions[], int[] grantResults) {
              switch (requestCode) {
                  case MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE: {
      Severity: Minor
      Found in app/src/main/java/com/yashketkar/ykplayer/MainActivity.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 handleStringTag has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public void handleStringTag(String name, byte[] valueBytes, String valueEncoding) {
            String value;
            try {
              value = new String(valueBytes, valueEncoding);
            } catch (Exception e) {
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/MediaScanner.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 saveMiniThumbToFile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        protected synchronized void saveMiniThumbToFile(byte[] data, long id, long magic) throws IOException {
          RandomAccessFile r = miniThumbDataFile();
          if (r == null)
            return;
      
      
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.java - About 1 hr to fix

        Method getMiniThumbFromFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected synchronized byte[] getMiniThumbFromFile(long id, byte[] data) {
            RandomAccessFile r = miniThumbDataFile();
            if (r == null)
              return null;
        
        
        Severity: Minor
        Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.java - About 1 hr to fix

          Method onKeyDown has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            @Override
            public boolean onKeyDown(int keyCode, KeyEvent event) {
              boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL;
              if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) {
                if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE) {
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 1 hr to fix

            Method setVideoLayout has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void setVideoLayout(int layout, float aspectRatio) {
                    LayoutParams lp = getLayoutParams();
                    Pair<Integer, Integer> res = ScreenResolution.getResolution(mContext);
                    int windowWidth = res.first.intValue(), windowHeight = res.second.intValue();
                    float windowRatio = windowWidth / (float) windowHeight;
            Severity: Minor
            Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 1 hr to fix

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

                  public Uri doScanFile(String path, long lastModified, long fileSize, boolean scanAlways) {
                    Uri result = null;
                    try {
                      FileCacheEntry entry = beginFile(path, lastModified, fileSize);
                      if (entry != null && (entry.mLastModifiedChanged || scanAlways)) {
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/MediaScanner.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 attachMediaController has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                private void attachMediaController() {
                  if (mMediaPlayer != null && mMediaController != null) {
                    mMediaController.setMediaPlayer(this);
                    View anchorView = this.getParent() instanceof View ? (View) this.getParent() : this;
                    mMediaController.setAnchorView(anchorView);
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/widget/VideoView.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 surfaceChanged has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
                    mSurfaceWidth = w;
                    mSurfaceHeight = h;
                    boolean isValidState = (mTargetState == STATE_PLAYING);
                    boolean hasValidSize = (mVideoWidth == w && mVideoHeight == h);
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/widget/VideoView.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 convertToInt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static int convertToInt(String str) throws NumberFormatException {
                      int s, e;
                      for (s = 0; s < str.length(); s++)
                          if (Character.isDigit(str.charAt(s)))
                              break;
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/utils/StringUtils.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 createSurface has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                public GL createSurface(Surface surface) {
                  if (mEgl == null)
                    throw new RuntimeException("egl not initialized");
                  if (mEglDisplay == null)
                    throw new RuntimeException("eglDisplay not initialized");
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/EGL.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 onPrepared has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void onPrepared(MediaPlayer mp) {
                    Log.d("onPrepared");
                          mCurrentState = STATE_PREPARED;
                          // mTargetState = STATE_PLAYING;
              
              
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 1 hr to fix

                Method getMagic has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected synchronized long getMagic(long id) {
                    RandomAccessFile r = miniThumbDataFile();
                    if (r != null) {
                      long pos = id * BYTES_PER_MINTHUMB;
                      FileLock lock = null;
                Severity: Minor
                Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.java - About 1 hr to fix

                  Method parseTrackInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private SparseArray<MediaFormat> parseTrackInfo(byte[] tracks, String encoding) {
                      SparseArray<MediaFormat> trackSparse = new SparseArray<MediaFormat>();
                      String trackString;
                      int trackNum;
                      try {
                  Severity: Minor
                  Found in vitamio/src/io/vov/vitamio/MediaPlayer.java - About 1 hr to fix

                    Method requestPermissions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private void requestPermissions(final Activity thisActivity, View videosFragmentView) {
                            if (ContextCompat.checkSelfPermission(thisActivity,
                                    Manifest.permission.READ_EXTERNAL_STORAGE)
                                    != PackageManager.PERMISSION_GRANTED) {
                                // Should we show an explanation?
                    Severity: Minor
                    Found in app/src/main/java/com/yashketkar/ykplayer/VideosFragment.java - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language