Swati4star/Images-to-PDF

View on GitHub
app/src/main/java/swati4star/createpdf/activity/MainActivity.java

Summary

Maintainability
D
1 day
Test Coverage

File MainActivity.java has 366 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package swati4star.createpdf.activity;

import static swati4star.createpdf.util.Constants.IS_WELCOME_ACTIVITY_SHOWN;
import static swati4star.createpdf.util.Constants.LAUNCH_COUNT;
import static swati4star.createpdf.util.Constants.THEME_BLACK;
Severity: Minor
Found in app/src/main/java/swati4star/createpdf/activity/MainActivity.java - About 4 hrs to fix

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

    public class MainActivity extends AppCompatActivity
            implements NavigationView.OnNavigationItemSelectedListener {
    
        private static final String WRITE_STORAGE_PERMISSION = Manifest.permission.WRITE_EXTERNAL_STORAGE;
        private FeedbackUtils mFeedbackUtils;
    Severity: Minor
    Found in app/src/main/java/swati4star/createpdf/activity/MainActivity.java - About 3 hrs to fix

      Method setThemeOnActivityExclusiveComponents has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void setThemeOnActivityExclusiveComponents() {
              RelativeLayout toolbarBackgroundLayout = findViewById(R.id.toolbar_background_layout);
              MaterialCardView content = findViewById(R.id.content);
              SharedPreferences mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
              String themeName = mSharedPreferences.getString(Constants.DEFAULT_THEME_TEXT,
      Severity: Minor
      Found in app/src/main/java/swati4star/createpdf/activity/MainActivity.java - About 1 hr to fix

        Method requestStoragePermission_API30AndAbove has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void requestStoragePermission_API30AndAbove(boolean giveExplanation) {
                DialogUtils.showChoiceDialog(
                        this,
                        giveExplanation ?
                                R.string.manage_storage_permission_denied_alert_dialog_title :
        Severity: Minor
        Found in app/src/main/java/swati4star/createpdf/activity/MainActivity.java - About 1 hr to fix

          Method setTitleMap has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void setTitleMap() {
                  mFragmentSelectedMap = new SparseIntArray();
                  mFragmentSelectedMap.append(R.id.nav_home, R.string.app_name);
                  mFragmentSelectedMap.append(R.id.nav_camera, R.string.images_to_pdf);
                  mFragmentSelectedMap.append(R.id.nav_qrcode, R.string.qr_barcode_pdf);
          Severity: Minor
          Found in app/src/main/java/swati4star/createpdf/activity/MainActivity.java - About 1 hr to fix

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

                        case THEME_DARK:
                            toolbarBackgroundLayout.setBackgroundResource(R.color.colorBlackAltLight);
                            content.setCardBackgroundColor(getResources().getColor(R.color.colorBlackAlt));
                            mNavigationView.setBackgroundResource(R.color.colorBlackAlt);
                            mNavigationView.setItemTextColor(ColorStateList.valueOf(getResources().getColor(R.color.white)));
            app/src/main/java/swati4star/createpdf/activity/MainActivity.java on lines 439..446

            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 98.

            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

                        case THEME_BLACK:
                            toolbarBackgroundLayout.setBackgroundResource(R.color.black);
                            content.setCardBackgroundColor(getResources().getColor(R.color.black));
                            mNavigationView.setBackgroundResource(R.color.black);
                            mNavigationView.setItemTextColor(ColorStateList.valueOf(getResources().getColor(R.color.white)));
            app/src/main/java/swati4star/createpdf/activity/MainActivity.java on lines 447..454

            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 98.

            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