berict/Tapad

View on GitHub
app/src/main/java/com/bedrock/padder/helper/WindowHelper.java

Summary

Maintainability
F
6 days
Test Coverage

File WindowHelper.java has 656 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.bedrock.padder.helper;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
Severity: Major
Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 1 day to fix

    WindowHelper has 55 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class WindowHelper {
    
        public void setNavigationBar(int colorId, Activity activity) {
            if (Build.VERSION.SDK_INT >= 16) {
                if (colorId == R.color.transparent) {
    Severity: Major
    Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 7 hrs to fix

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

          public void setNavigationBar(int colorId, Activity activity) {
              if (Build.VERSION.SDK_INT >= 16) {
                  if (colorId == R.color.transparent) {
                      activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
                      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      Severity: Minor
      Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.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 getStatusBar has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public int getStatusBar(final int id, final Activity activity) {
              /* Must be a parent view */
      
              final SharedPreferences prefs = activity.getSharedPreferences(APPLICATION_ID, MODE_PRIVATE);
              final int[] statBarHeight = {-1};
      Severity: Minor
      Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 1 hr to fix

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

            private void setButtonPatternDefault(int patternPreset[][][], int btnId, int colorUp, Activity activity) {
                if (btnId >= 0) {
                    for (int i = 0; i < patternPreset[btnId].length; i++) {
                        for (int j = 0; j < patternPreset[btnId][i].length; j++) {
                            try {
        Severity: Minor
        Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.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 setMarginRelativePX has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public void setMarginRelativePX(int id, int left, int top, int right, int bottom, Activity activity) {
        Severity: Minor
        Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 45 mins to fix

          Method setMarginRelativeDP has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public void setMarginRelativeDP(int id, int left, int top, int right, int bottom, Activity activity) {
          Severity: Minor
          Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 45 mins to fix

            Method setMarginLinearDP has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public void setMarginLinearDP(int id, int left, int top, int right, int bottom, Activity activity) {
            Severity: Minor
            Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 45 mins to fix

              Method setMarginLinearPX has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public void setMarginLinearPX(int id, int left, int top, int right, int bottom, Activity activity) {
              Severity: Minor
              Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 45 mins to fix

                Method getBackgroundColor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static int getBackgroundColor(int id, Activity activity) {
                        View view = activity.findViewById(id);
                        Drawable drawable = view.getBackground();
                        if (drawable instanceof ColorDrawable) {
                            ColorDrawable colorDrawable = (ColorDrawable) drawable;
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 35 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 getBackgroundColor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static int getBackgroundColor(View view) {
                        Drawable drawable = view.getBackground();
                        if (drawable instanceof ColorDrawable) {
                            ColorDrawable colorDrawable = (ColorDrawable) drawable;
                            if (Build.VERSION.SDK_INT >= 11) {
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 35 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 setRecentColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void setRecentColor(String title, int color, Activity activity) {
                        if (Build.VERSION.SDK_INT >= 21) {
                            if (title == null) {
                                // Default app name
                                title = activity.getResources().getString(R.string.app_name);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 25 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 setRecentColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void setRecentColor(int titleId, int color, Activity activity) {
                        if (Build.VERSION.SDK_INT >= 21) {
                            if (titleId == 0) {
                                // Default app name
                                titleId = R.string.app_name;
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 25 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 setRecentColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void setRecentColor(int titleId, int iconId, int color, Activity activity) {
                        if (Build.VERSION.SDK_INT >= 21) {
                            if (titleId == 0) {
                                // Default app name
                                titleId = R.string.app_name;
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 25 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 setRecentColor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void setRecentColor(String title, int iconId, int color, Activity activity) {
                        if (Build.VERSION.SDK_INT >= 21) {
                            if (title == null) {
                                // Default app name
                                title = activity.getResources().getString(R.string.app_name);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java - About 25 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getWindowHeightPx(Activity activity) {
                        Display display = activity.getWindowManager().getDefaultDisplay();
                        int realHeight;
                
                        if (Build.VERSION.SDK_INT >= 17) {
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 470..496

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 146.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getWindowWidthPx(Activity activity) {
                        Display display = activity.getWindowManager().getDefaultDisplay();
                        int realWidth;
                
                        if (Build.VERSION.SDK_INT >= 17) {
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 442..468

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 146.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        if (drawable instanceof ColorDrawable) {
                            ColorDrawable colorDrawable = (ColorDrawable) drawable;
                            if (Build.VERSION.SDK_INT >= 11) {
                                return colorDrawable.getColor();
                            }
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 550..567

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 126.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        if (drawable instanceof ColorDrawable) {
                            ColorDrawable colorDrawable = (ColorDrawable) drawable;
                            if (Build.VERSION.SDK_INT >= 11) {
                                return colorDrawable.getColor();
                            }
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 527..544

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 126.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public void setVisible(final int viewId, final int delay, final Activity activity) {
                        final View view = activity.findViewById(viewId);
                        if (view != null) {
                            if (delay > 0) {
                                Handler handler = new Handler();
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 185..200
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 202..217

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 81.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public void setInvisible(final int viewId, final int delay, final Activity activity) {
                        final View view = activity.findViewById(viewId);
                        if (view != null) {
                            if (delay > 0) {
                                Handler handler = new Handler();
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 168..183
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 202..217

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 81.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public void setGone(final int viewId, final int delay, final Activity activity) {
                        final View view = activity.findViewById(viewId);
                        if (view != null) {
                            if (delay > 0) {
                                Handler handler = new Handler();
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 168..183
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 185..200

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 81.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            try {
                                ActivityManager.TaskDescription taskDesc =
                                        new ActivityManager.TaskDescription(
                                                activity.getResources().getString(titleId),
                                                icon,
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 251..266

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 80.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            try {
                                ActivityManager.TaskDescription taskDesc =
                                        new ActivityManager.TaskDescription(
                                                activity.getResources().getString(titleId),
                                                icon,
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 284..299

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 80.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public void setMarginRelativeDP(int id, int left, int top, int right, int bottom, Activity activity) {
                        View v = activity.findViewById(id);
                
                        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) v.getLayoutParams();
                        params.setMargins(
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 684..694

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public void setMarginLinearDP(int id, int left, int top, int right, int bottom, Activity activity) {
                        View v = activity.findViewById(id);
                
                        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) v.getLayoutParams();
                        params.setMargins(
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 664..674

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            try {
                                ActivityManager.TaskDescription taskDesc =
                                        new ActivityManager.TaskDescription(
                                                title,
                                                icon,
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 372..381

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 68.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            try {
                                ActivityManager.TaskDescription taskDesc =
                                        new ActivityManager.TaskDescription(title, icon, activity.getResources().getColor(color));
                                activity.setTaskDescription(taskDesc);
                            } catch (Resources.NotFoundException e) {
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 339..354

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 68.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getStatusBarFromPrefs(Activity activity) {
                        int statusHeight;
                        SharedPreferences sharedPreferences = activity.getSharedPreferences(APPLICATION_ID, MODE_PRIVATE);
                        statusHeight = sharedPreferences.getInt("statBarPX", 72);
                
                
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 89..100

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 68.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getNavigationBarFromPrefs(Activity activity) {
                        int navigationHeight;
                        SharedPreferences sharedPreferences = activity.getSharedPreferences(APPLICATION_ID, MODE_PRIVATE);
                        navigationHeight = sharedPreferences.getInt("navBarPX", 144);
                
                
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 155..166

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 68.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getStringId(String id) {
                        try {
                            Class res = R.string.class;
                            Field field = res.getField(id);
                            return field.getInt(null);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 55 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 644..654

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getDrawableId(String id) {
                        try {
                            Class res = R.drawable.class;
                            Field field = res.getField(id);
                            return field.getInt(null);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 55 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 587..597

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public static int getId(String id) {
                        try {
                            Class res = R.id.class;
                            Field field = res.getField(id);
                            return field.getInt(null);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 50 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 571..581

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 58.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public int getColorId(String id) {
                        try {
                            Class res = R.color.class;
                            Field field = res.getField(id);
                            return field.getInt(null);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 50 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 599..609

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 58.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public void setMarginLinearPX(int id, int left, int top, int right, int bottom, Activity activity) {
                        View v = activity.findViewById(id);
                
                        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) v.getLayoutParams();
                        params.setMargins(left, top, right, bottom);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 45 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 656..662

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 55.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public void setMarginRelativePX(int id, int left, int top, int right, int bottom, Activity activity) {
                        View v = activity.findViewById(id);
                
                        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) v.getLayoutParams();
                        params.setMargins(left, top, right, bottom);
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 45 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 676..682

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 55.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public void setViewBackgroundColor(int viewId, int colorId, Activity activity) {
                        try {
                            activity.findViewById(viewId).setBackgroundColor(activity.getResources().getColor(colorId));
                        } catch (Resources.NotFoundException e) {
                            Log.i("NotFoundException", "Handling with normal value");
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 40 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 418..425

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public void setViewBackgroundColor(int viewId, int colorId, Activity activity, View view) {
                        try {
                            view.findViewById(viewId).setBackgroundColor(activity.getResources().getColor(colorId));
                        } catch (Resources.NotFoundException e) {
                            Log.i("NotFoundException", "Handling with normal value");
                Severity: Minor
                Found in app/src/main/java/com/bedrock/padder/helper/WindowHelper.java and 1 other location - About 40 mins to fix
                app/src/main/java/com/bedrock/padder/helper/WindowHelper.java on lines 409..416

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status