diff --git a/build.gradle b/build.gradle index 143e57b76..ba432242b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { apply from: 'versions.gradle' @@ -20,6 +19,14 @@ buildscript { } } +plugins { + id "com.github.spotbugs" version "2.0.0" apply(false) +} + +// Workaround to be able to access SpotBugsTask from external gradle script. +// More info: https://discuss.gradle.org/t/buildscript-dependencies-in-external-script/23243 +project.extensions.extraProperties.set('SpotBugsTask', com.github.spotbugs.SpotBugsTask) + allprojects { configurations.all { diff --git a/config/quality/quality.gradle b/config/quality/quality.gradle index f7f6f45ec..f76738cbd 100755 --- a/config/quality/quality.gradle +++ b/config/quality/quality.gradle @@ -3,7 +3,7 @@ * * Gradle tasks added: * - checkstyle - * - findbugs + * - spotbugs * - pmd * * The three tasks above are added as dependencies of the check task so running check will @@ -11,7 +11,7 @@ */ apply plugin: 'checkstyle' -apply plugin: 'findbugs' +apply plugin: 'com.github.spotbugs' apply plugin: 'pmd' dependencies { @@ -21,7 +21,7 @@ dependencies { def qualityConfigDir = "$project.rootDir/config/quality" def reportsDir = "$project.buildDir/reports" -check.dependsOn 'checkstyle', 'findbugs', 'pmd' +check.dependsOn 'checkstyle', 'spotbugs', 'pmd' task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') { configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml") @@ -38,36 +38,37 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code classpath = files() } -task findbugs(type: FindBugs, - group: 'Verification', - description: 'Inspect java bytecode for bugs', - dependsOn: ['compileDebugSources', 'compileReleaseSources']) { - +spotbugs { ignoreFailures = false effort = "max" reportLevel = "high" - excludeFilter = new File("$qualityConfigDir/findbugs/android-exclude-filter.xml") + + includeFilter = file("**/*.java") + excludeFilter = file("**/gen/**") +} + +tasks.withType(SpotBugsTask) { + dependsOn 'assemble' + group = "verification" + excludeFilter = new File("$qualityConfigDir/spotbugs/android-exclude-filter.xml") classes = files("$project.rootDir/folioreader/build/intermediates/javac") - source 'src' - include '**/*.java' - exclude '**/gen/**' + source = fileTree('src') reports { xml.enabled = false html.enabled = true xml { - destination = file("$reportsDir/findbugs/findbugs.xml") + destination = file("$reportsDir/spotbugs/spotbugs.xml") } html { - destination = file("$reportsDir/findbugs/findbugs.html") + destination = file("$reportsDir/spotbugs/spotbugs.html") } } classpath = files() } - task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for bugs') { ruleSetFiles = files("$qualityConfigDir/pmd/pmd-ruleset.xml") ignoreFailures = false diff --git a/folioreader/res/layout/folio_activity.xml b/folioreader/res/layout/folio_activity.xml index b4a01b5ee..fc65623ba 100644 --- a/folioreader/res/layout/folio_activity.xml +++ b/folioreader/res/layout/folio_activity.xml @@ -24,7 +24,8 @@ android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> + app:layout_constraintTop_toTopOf="parent" + android:animateLayoutChanges="true"> + style="?android:attr/progressBarStyle" /> distractionFreeMode = $distractionFreeMode") - if (actionBar != null) { - if (distractionFreeMode) { - actionBar!!.hide() - } else { - actionBar!!.show() - } + if (distractionFreeMode) { + appBarLayout?.visibility = View.GONE + actionBar?.hide() + } else { + appBarLayout?.visibility = View.VISIBLE + actionBar?.show() } + } override fun toggleSystemUI() { @@ -717,41 +718,20 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle private fun showSystemUI() { Log.v(LOG_TAG, "-> showSystemUI") - if (Build.VERSION.SDK_INT >= 16) { - val decorView = window.decorView - decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE - or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) - } else { - window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) - if (appBarLayout != null) - appBarLayout!!.setTopMargin(statusBarHeight) - onSystemUiVisibilityChange(View.SYSTEM_UI_FLAG_VISIBLE) - } + window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE + or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) } private fun hideSystemUI() { Log.v(LOG_TAG, "-> hideSystemUI") - if (Build.VERSION.SDK_INT >= 16) { - val decorView = window.decorView - decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE - // Set the content to appear under the system bars so that the - // content doesn't resize when the system bars hide and show. - or View.SYSTEM_UI_FLAG_LAYOUT_STABLE - or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - // Hide the nav bar and status bar - or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - or View.SYSTEM_UI_FLAG_FULLSCREEN) - } else { - window.setFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, - WindowManager.LayoutParams.FLAG_FULLSCREEN or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS - ) - // Specified 1 just to mock anything other than View.SYSTEM_UI_FLAG_VISIBLE - onSystemUiVisibilityChange(1) - } + window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE + or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + or View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar + or View.SYSTEM_UI_FLAG_IMMERSIVE) } override fun getEntryReadLocator(): ReadLocator? { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 57054cde5..4406e2cbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Sep 25 12:48:54 IST 2018 +#Wed Jun 24 19:36:22 BRT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/sample/build.gradle b/sample/build.gradle index 54caa7c76..965560e4c 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -64,11 +64,4 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-databind:$versions.jackson" implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$versions.jackson" - //progressBar error solve - configurations.matching { it.name == '_internal_aapt2_binary' }.all { config -> - config.resolutionStrategy.eachDependency { details -> - details.useVersion("3.3.2-5309881") - } - } - } diff --git a/versions.gradle b/versions.gradle index ec456b157..bf833f022 100644 --- a/versions.gradle +++ b/versions.gradle @@ -11,8 +11,8 @@ versions.androidMinSdk = 21 versions.androidCompileSdk = 28 versions.androidTargetSdk = 28 -versions.androidGradlePlugin = "3.5.3" -versions.kotlin = "1.3.11" +versions.androidGradlePlugin = '4.0.0' +versions.kotlin = "1.3.72" versions.appcompat = "1.1.0" versions.constraintLayout = "1.1.3"