Skip to content

Updated gradle & kotlin #455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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 {
Expand Down
31 changes: 16 additions & 15 deletions config/quality/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
*
* Gradle tasks added:
* - checkstyle
* - findbugs
* - spotbugs
* - pmd
*
* The three tasks above are added as dependencies of the check task so running check will
* run all of them.
*/

apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'com.github.spotbugs'
apply plugin: 'pmd'

dependencies {
Expand All @@ -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")
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion folioreader/res/layout/folio_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
Expand Down
2 changes: 1 addition & 1 deletion folioreader/res/layout/progress_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/android:progressBarStyle" />
style="?android:attr/progressBarStyle" />

<TextView
android:id="@+id/label_loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,14 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle
distractionFreeMode = visibility != View.SYSTEM_UI_FLAG_VISIBLE
Log.v(LOG_TAG, "-> 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() {
Expand All @@ -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? {
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

}
4 changes: 2 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down