berict/Tapad

View on GitHub

Showing 231 of 426 total issues

Method setUi has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void setUi() {
        // status bar
        activity.findViewById(R.id.status_bar).setBackgroundColor(about.getColor());

        if (about == null) {
Severity: Major
Found in app/src/main/java/com/bedrock/padder/activity/AboutActivity.java - About 2 hrs to fix

    Method onWindowFocusChanged has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public void onWindowFocusChanged(boolean hasFocus) {
            Log.i("MainActivity", "onWindowFocusChanged");
    
            if (preferences.getStopOnFocusLoss()) {
    Severity: Minor
    Found in app/src/main/java/com/bedrock/padder/activity/MainActivity.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 onAnimationEnd has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            @Override
            public void onAnimationEnd(Animation anim) {
                if (!isOnAnimationEndCalled) {
                    Log.d("TutorialView", "animation.onAnimationEnd " + view.getTag());
                    if (view != null) {
    Severity: Major
    Found in app/src/main/java/com/bedrock/padder/model/tutorial/TutorialView.java - About 2 hrs to fix

      Method onPostExecute has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              @Override
              protected void onPostExecute(Void aVoid) {
                  if (isCancelled()) {
                      onLoadFinish();
                  } else {
      Severity: Major
      Found in app/src/main/java/com/bedrock/padder/helper/SoundHelper.java - About 2 hrs to fix

        Method setPad has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            void setPad() {
                // set the onTouchListener
                if (view != null && color != 0 && colorDef != 0 && activity != null) {
                    // initialized check
                    view.setOnTouchListener(new OnSwipeTouchListener(activity) {
        Severity: Minor
        Found in app/src/main/java/com/bedrock/padder/model/sound/Pad.java - About 2 hrs to fix

          Method setViewPager has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void setViewPager() {
                  if (hasPermission) {
                      Log.d(TAG, "setViewPager");
          
                      installedFragment = new PresetStoreInstalledFragment();

            Consider simplifying this complex logical expression.
            Open

                    if (presetName != null) {
                        // preset available
                        File folderSound = new File(PROJECT_LOCATION_PRESETS + "/" + presetName + "/sounds");
                        File folderTiming = new File(PROJECT_LOCATION_PRESETS + "/" + presetName + "/timing");
                        File folderAbout = new File(PROJECT_LOCATION_PRESETS + "/" + presetName + "/about");
            Severity: Critical
            Found in app/src/main/java/com/bedrock/padder/helper/FileHelper.java - About 2 hrs to fix

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

                  private void setButtonLayout() {
                      int screenWidthPx = (int) (w.getWindowWidthPx(a) * preferences.getDeckMargin());
                      int marginPx = w.getWindowWidthPx(a) / 160;
                      int newWidthPx;
                      int newHeightPx;
              Severity: Minor
              Found in app/src/main/java/com/bedrock/padder/activity/MainActivity.java - About 1 hr to fix

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

                        @Override
                        protected void onPostExecute(Integer integer) {
                            if (!isCancelled()) {
                                // Completed downloading
                                item.clear();
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/model/preset/store/Item.java - About 1 hr to fix

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

                      public void fadeOut(final int id, final int delay, final long duration, Activity activity) {
                          final AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
                          final View view = activity.findViewById(id);
                  
                          if (view.getVisibility() == View.VISIBLE) {
                  Severity: Minor
                  Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix

                    Method setPadColor has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        void setPadColor() {
                            setPadColor(color);
                    
                            switch (PAD_PATTERN) {
                                case 1:
                    Severity: Minor
                    Found in app/src/main/java/com/bedrock/padder/model/sound/Pad.java - About 1 hr to fix

                      Method fadeOut has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public void fadeOut(final View view, final int delay, final long duration, Activity activity) {
                              final AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
                      
                              if (view.getVisibility() == View.VISIBLE) {
                                  PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
                      Severity: Minor
                      Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix

                        Method setPadColorToDefault has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            void setPadColorToDefault() {
                                switch (PAD_PATTERN) {
                                    case 1:
                                        // 4 side
                                        if (row - 1 > 0) {
                        Severity: Minor
                        Found in app/src/main/java/com/bedrock/padder/model/sound/Pad.java - About 1 hr to fix

                          Method fadeOut has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public void fadeOut(final int id, final int delay, final long duration, View parentView, Activity activity) {
                                  final AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
                                  final View view = parentView.findViewById(id);
                                  PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
                          
                          
                          Severity: Minor
                          Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix

                            Method download has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public void download(final Runnable onFinish, final Activity activity) {
                                    // download the preset from presetStore
                                    final Item item = this;
                                    if (isConnected(activity)) {
                                        if (isWifiConnected(activity)) {
                            Severity: Minor
                            Found in app/src/main/java/com/bedrock/padder/model/preset/store/Item.java - About 1 hr to fix

                              Method fadeIn has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public void fadeIn(final int id, final int delay, final long duration, String handlerName, View parentView, Activity activity) {
                                      final AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
                                      final View view = parentView.findViewById(id);
                                      view.setVisibility(View.INVISIBLE);
                                      PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
                              Severity: Minor
                              Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix

                                Method fadeIn has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public void fadeIn(final int id, final int delay, final long duration, String handlerName, Activity activity) {
                                        final AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
                                        final View view = activity.findViewById(id);
                                        view.setVisibility(View.INVISIBLE);
                                        PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
                                Severity: Minor
                                Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix

                                  Method setPad has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      @Override
                                      void setPad() {
                                          if (normal != null && view != null && color != 0 && colorDef != 0 && activity != null) {
                                              // initialized check, normal should be not null
                                              view.setOnTouchListener(new OnSwipeTouchListener(activity) {
                                  Severity: Minor
                                  Found in app/src/main/java/com/bedrock/padder/model/sound/GesturePad.java - About 1 hr to fix

                                    Method fadeIn has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public void fadeIn(final View view, final int delay, final long duration, String handlerName, Activity activity) {
                                            final AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
                                            view.setVisibility(View.INVISIBLE);
                                            PowerManager powerManager = (PowerManager) activity.getSystemService(POWER_SERVICE);
                                    
                                    
                                    Severity: Minor
                                    Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix

                                      Method moveXYinDP has 14 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          public void moveXYinDP(View view,
                                                                 int fromX, int toX,
                                                                 int durationX, int delayX, TimeInterpolator intX,
                                                                 int fromY, int toY,
                                                                 int durationY, int delayY, TimeInterpolator intY,
                                      Severity: Major
                                      Found in app/src/main/java/com/bedrock/padder/helper/AnimateHelper.java - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language