yashketkar/video-player

View on GitHub

Showing 108 of 144 total issues

Method beginFile has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public FileCacheEntry beginFile(String path, long lastModified, long fileSize) {
      int lastSlash = path.lastIndexOf('/');
      if (lastSlash >= 0 && lastSlash + 2 < path.length()) {
        if (path.regionMatches(lastSlash + 1, "._", 0, 2))
          return null;
Severity: Minor
Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 2 hrs 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 onKeyDown has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 setVideoLayout has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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

File MediaStore.java has 272 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/provider/MediaStore.java - About 2 hrs to fix

    Method prescan has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      private void prescan(String filePath) throws RemoteException {
        mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY);
        Cursor c = null;
        String where = null;
        String[] selectionArgs = null;
    Severity: Minor
    Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 2 hrs 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 getThumbnail has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static Bitmap getThumbnail(Context ctx, ContentResolver cr, long origId, long groupId, int kind, BitmapFactory.Options options, Uri baseUri) {
          Bitmap bitmap = null;
          MiniThumbFile thumbFile = MiniThumbFile.instance(baseUri);
          long magic = thumbFile.getMagic(origId);
          if (magic != 0) {
    Severity: Major
    Found in vitamio/src/io/vov/vitamio/provider/MediaStore.java - About 2 hrs to fix

      Method getCachedFeature has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private static int getCachedFeature() {
              if (cachedFeatureString == null) {
                  StringBuffer sb = new StringBuffer();
                  if ((cachedFeature & FEATURE_ARM_V5TE) > 0)
                      sb.append("V5TE ");
      Severity: Minor
      Found in vitamio/src/io/vov/vitamio/utils/CPU.java - About 2 hrs 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 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
      
      
      Severity: Minor
      Found in app/src/main/java/com/yashketkar/ykplayer/MainActivity.java - About 2 hrs to fix

        Method onCreate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
        
                adapter = new LiveTVAdapter(getActivity(), tvList);
        Severity: Minor
        Found in app/src/main/java/com/yashketkar/ykplayer/LiveTVFragment.java - About 1 hr to fix

          Method endFile has a Cognitive Complexity of 15 (exceeds 5 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

          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 transform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            private static Bitmap transform(Matrix scaler, Bitmap source, int targetWidth, int targetHeight, int options) {
              boolean scaleUp = (options & OPTIONS_SCALE_UP) != 0;
              boolean recycle = (options & OPTIONS_RECYCLE_INPUT) != 0;
          
              int deltaX = source.getWidth() - targetWidth;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/ThumbnailUtils.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 getMagic has a Cognitive Complexity of 14 (exceeds 5 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

          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 onInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean onInfo(MediaPlayer mp, int what, int extra) {
                Log.d("onInfo: (%d, %d)", what, extra);
                  
                    if(MediaPlayer.MEDIA_INFO_UNKNOW_TYPE == what){
          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 prescan has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private void prescan(String filePath) throws RemoteException {
              mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY);
              Cursor c = null;
              String where = null;
              String[] selectionArgs = null;
          Severity: Minor
          Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

            Method transform has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private static Bitmap transform(Matrix scaler, Bitmap source, int targetWidth, int targetHeight, int options) {
                boolean scaleUp = (options & OPTIONS_SCALE_UP) != 0;
                boolean recycle = (options & OPTIONS_RECYCLE_INPUT) != 0;
            
                int deltaX = source.getWidth() - targetWidth;
            Severity: Minor
            Found in vitamio/src/io/vov/vitamio/ThumbnailUtils.java - About 1 hr to fix

              Method miniThumbDataFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                private RandomAccessFile miniThumbDataFile() {
                  if (mMiniThumbFile == null) {
                    removeOldFile();
                    String path = randomAccessFilePath(MINI_THUMB_DATA_FILE_VERSION);
                    File directory = new File(path).getParentFile();
              Severity: Minor
              Found in vitamio/src/io/vov/vitamio/provider/MiniThumbFile.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 loadFragment has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void loadFragment(int fragmentID) {
                      if(MainActivity.permissionsSnackbar != null){
                          MainActivity.permissionsSnackbar.dismiss();
                      }
                      Fragment fragment = null;
              Severity: Minor
              Found in app/src/main/java/com/yashketkar/ykplayer/MainActivity.java - About 1 hr to fix

                Method beginFile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public FileCacheEntry beginFile(String path, long lastModified, long fileSize) {
                      int lastSlash = path.lastIndexOf('/');
                      if (lastSlash >= 0 && lastSlash + 2 < path.length()) {
                        if (path.regionMatches(lastSlash + 1, "._", 0, 2))
                          return null;
                Severity: Minor
                Found in vitamio/src/io/vov/vitamio/MediaScanner.java - About 1 hr to fix

                  Method openVideo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private void openVideo() {
                  //    if (mUri == null || mSurfaceHolder == null || !Vitamio.isInitialized(mContext))
                  //      return;
                      if (mUri == null || mSurfaceHolder == null )
                      return;
                  Severity: Minor
                  Found in vitamio/src/io/vov/vitamio/widget/VideoView.java - About 1 hr to fix

                    Method onCreateView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                                 Bundle savedInstanceState) {
                            // Inflate the layout for this fragment
                            View InputFragmentView = inflater.inflate(R.layout.fragment_zbigz, container, false);
                    Severity: Minor
                    Found in app/src/main/java/com/yashketkar/ykplayer/ZbigzFragment.java - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language