From 38bdc3fcfc6d643461fc5dcfe2213ca8d11e76e7 Mon Sep 17 00:00:00 2001 From: Synced Synapse Date: Fri, 10 Nov 2023 18:19:17 +0000 Subject: [PATCH 1/4] Upgrade Gradle version --- build.gradle | 2 +- gradle.properties | 3 +++ gradle/wrapper/gradle-wrapper.properties | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index bbdec9a2e..6420f66b2 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.1.3' // NOTE: Do not place your application dependencies here; // they belong in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index e9b7062a0..fa93afc10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,3 +14,6 @@ org.gradle.jvmargs=-Xmx1024M -Dkotlin.daemon.jvm.options\="-Xmx1024M" android.useAndroidX=true android.enableJetifier=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c684f..38d781592 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Fri Nov 10 18:48:14 WET 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 7e1fb80972bc3365867e1fffcc72ddbe95782f2a Mon Sep 17 00:00:00 2001 From: Synced Synapse Date: Fri, 10 Nov 2023 19:53:07 +0000 Subject: [PATCH 2/4] Update compileSdk and library versions To solve compiling errors it was necessary to update all library versions and the compileSdk to the latest version. Also removed: - butterknife rules from proguard-rules - nonFinalResIds directive as non final R resources were fixed in #838 --- app/build.gradle | 45 +++++++++++++++++++++--------------------- app/proguard-rules.pro | 5 ----- gradle.properties | 1 - 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 83850c092..94fec36ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ def getVersionName = { -> } android { - compileSdkVersion 32 + compileSdk 34 defaultConfig { applicationId "org.xbmc.kore" @@ -99,27 +99,27 @@ ext { } dependencies { - implementation 'com.google.android.material:material:1.6.1' - implementation 'androidx.preference:preference:1.2.0' - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'androidx.recyclerview:recyclerview:1.2.1' + implementation 'com.google.android.material:material:1.10.0' + implementation 'androidx.preference:preference:1.2.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation('androidx.core:core-google-shortcuts:1.0.1') { + implementation('androidx.core:core-google-shortcuts:1.1.0') { exclude group:'com.google.android.gms' } implementation 'androidx.media:media:1.6.0' - implementation "androidx.viewpager2:viewpager2:1.1.0-beta01" + implementation "androidx.viewpager2:viewpager2:1.1.0-beta02" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation "androidx.fragment:fragment:1.5.2" - implementation "androidx.fragment:fragment-ktx:1.5.2" + implementation "androidx.fragment:fragment:1.6.2" + implementation "androidx.fragment:fragment-ktx:1.6.2" // Dependency resolution - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" - implementation "androidx.lifecycle:lifecycle-viewmodel:2.5.1" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2" + implementation "androidx.lifecycle:lifecycle-viewmodel:2.6.2" implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3' - implementation 'com.squareup.okhttp3:okhttp:4.10.0' + implementation 'com.squareup.okhttp3:okhttp:4.11.0' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'org.greenrobot:eventbus:3.3.1' implementation 'org.jmdns:jmdns:3.5.7' @@ -129,24 +129,25 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test:rules:1.4.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test:rules:1.5.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1' androidTestImplementation 'androidx.legacy:legacy-support-v13:1.0.0' androidTestImplementation 'org.hamcrest:hamcrest-library:2.2' androidTestImplementation 'junit:junit:4.13.2' - androidTestUtil 'androidx.test:orchestrator:1.4.1' + androidTestUtil 'androidx.test:orchestrator:1.4.2' testImplementation 'org.robolectric:robolectric:4.8.1' - testImplementation 'androidx.test:core:1.4.0' - testImplementation 'androidx.test.ext:junit:1.1.3' + testImplementation 'androidx.test:core:1.5.0' + testImplementation 'androidx.test.ext:junit:1.1.5' debugImplementation 'junit:junit:4.13.2' } def adb = android.getAdbExecutable().toString() afterEvaluate { - task grantAnimationPermissionDev(type: Exec, dependsOn: installDebug) { + tasks.register('grantAnimationPermissionDev', Exec) { + dependsOn installDebug doFirst { println("Executing: $adb shell pm grant $android.defaultConfig.applicationId android.permission.SET_ANIMATION_SCALE") commandLine "$adb shell pm grant $android.defaultConfig.applicationId android.permission.SET_ANIMATION_SCALE".split(' ') @@ -162,12 +163,12 @@ afterEvaluate { /** * Makes sure assets are copied before running the unit tests */ -tasks.whenTaskAdded { task -> +tasks.configureEach { task -> if (task.name.contains("testDebugUnitTest")) { task.dependsOn assembleDebug } } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.compilerArgs << '-Xlint:unchecked' // << '-Xlint:deprecation' } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 463dacb46..77bbdd5f9 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,11 +18,6 @@ # okio via OkHttp -dontwarn okio.** -# Butterknife --dontwarn butterknife.internal.** --keep class **$$ViewBinder { *; } --keepnames class * { @butterknife.BindView *;} - # Jackson -dontskipnonpubliclibraryclassmembers -keepattributes EnclosingMethod, Signature diff --git a/gradle.properties b/gradle.properties index fa93afc10..89f3a2439 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,4 +16,3 @@ android.useAndroidX=true android.enableJetifier=true android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false -android.nonFinalResIds=false From ba3cf0531691ee95e9f1ce56282d788fec6bd927 Mon Sep 17 00:00:00 2001 From: Synced Synapse Date: Mon, 13 Nov 2023 16:07:28 +0000 Subject: [PATCH 3/4] Add back-button navigation in pinned addons directories Following #980, and for consistency, this also applies the back navigation to pinned addons directories. --- .../addon/AddonListContainerFragment.java | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/xbmc/kore/ui/sections/addon/AddonListContainerFragment.java b/app/src/main/java/org/xbmc/kore/ui/sections/addon/AddonListContainerFragment.java index d9db9dda4..8ec6850f8 100644 --- a/app/src/main/java/org/xbmc/kore/ui/sections/addon/AddonListContainerFragment.java +++ b/app/src/main/java/org/xbmc/kore/ui/sections/addon/AddonListContainerFragment.java @@ -15,8 +15,11 @@ */ package org.xbmc.kore.ui.sections.addon; +import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; + +import androidx.fragment.app.Fragment; import androidx.preference.PreferenceManager; import android.view.View; @@ -29,6 +32,8 @@ import org.xbmc.kore.jsonrpc.method.Files; import org.xbmc.kore.ui.AbstractInfoFragment; import org.xbmc.kore.ui.AbstractTabsFragment; +import org.xbmc.kore.ui.BaseMediaActivity; +import org.xbmc.kore.ui.OnBackPressedListener; import org.xbmc.kore.ui.sections.file.MediaFileListFragment; import org.xbmc.kore.utils.LogUtils; import org.xbmc.kore.utils.TabsAdapter; @@ -36,7 +41,10 @@ import java.util.Collections; import java.util.Set; -public class AddonListContainerFragment extends AbstractTabsFragment { +public class AddonListContainerFragment + extends AbstractTabsFragment + implements OnBackPressedListener { + private static final String TAG = LogUtils.makeLogTag(AddonListContainerFragment.class); @Override @@ -80,6 +88,39 @@ protected TabsAdapter createTabsAdapter(AbstractInfoFragment.DataHolder dataHold return tabsAdapter; } + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + try { + BaseMediaActivity listenerActivity = (BaseMediaActivity) context; + listenerActivity.setBackPressedListener(this); + } catch (ClassCastException e) { + throw new ClassCastException(context + " unable to register BackPressedListener"); + } + } + + @Override + public void onDestroy() { + try { + BaseMediaActivity listenerActivity = (BaseMediaActivity) getContext(); + assert listenerActivity != null; + listenerActivity.setBackPressedListener(null); + } catch (ClassCastException e) { + throw new ClassCastException(getContext() + " unable to unregister BackPressedListener"); + } + super.onDestroy(); + } + + @Override + public boolean onBackPressed() { + // Tell current fragment to move up one directory, if possible + Fragment fragment = getCurrentSelectedFragment(); + if (fragment instanceof MediaFileListFragment) { + return ((MediaFileListFragment) fragment).navigateToParentDir(); + } + return false; + } + @Override protected boolean shouldRememberLastTab() { return true; From 6fe08a001f1caa8ae14c83229060a0e728c3d4c2 Mon Sep 17 00:00:00 2001 From: Synced Synapse Date: Mon, 13 Nov 2023 17:54:38 +0000 Subject: [PATCH 4/4] Update java compile version --- .github/workflows/build.yml | 2 +- .travis.yml | 2 +- Dockerfile | 4 ++-- app/build.gradle | 8 +++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4761ed3a..c6425fd28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Validate Gradle Wrapper uses: gradle/wrapper-validation-action@v1.0.4 diff --git a/.travis.yml b/.travis.yml index b35a79ea7..a43febc2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: android -jdk: oraclejdk8 +jdk: oraclejdk17 sudo: false env: diff --git a/Dockerfile b/Dockerfile index 78f73a826..c40686d2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,14 +4,14 @@ FROM ubuntu:20.04 # Install Java -ARG JDK_VERSION=11 +ARG JDK_VERSION=17 RUN apt-get update && \ apt-get install -y --no-install-recommends openjdk-${JDK_VERSION}-jdk && \ apt-get install -y --no-install-recommends git wget unzip # Install Gradle # https://services.gradle.org/distributions/ -ARG GRADLE_VERSION=7.3.3 +ARG GRADLE_VERSION=8.4 ARG GRADLE_DIST=bin RUN cd /opt && \ wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-${GRADLE_DIST}.zip && \ diff --git a/app/build.gradle b/app/build.gradle index 94fec36ee..ccc10a4cc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -88,9 +88,11 @@ android { } namespace 'org.xbmc.kore' - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 +} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) } }