Skip to content
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

chore: AGP 8, Java 17, SSO 1.0.0 #242

Merged
merged 16 commits into from
Jan 20, 2024
Merged
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
16 changes: 14 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'gradle'
- name: Unit tests
run: bash ./gradlew test --stacktrace
run: bash ./gradlew test --stacktrace --no-configuration-cache

aar:
name: Generate AAR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
cache: 'gradle'
- name: Build debug AAR
run: bash ./gradlew assemble --stacktrace
run: bash ./gradlew assemble --stacktrace --no-configuration-cache
- name: Upload AAR
uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
buildscript {
ext.version_code = 1008002
ext.version_name = '1.8.2'
ext.kotlin_version = '1.8.22'
ext.sso_version = '0.8.1'
ext.kotlin_version = '1.9.22'
ext.sso_version = '1.0.0'

repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22"
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand Down
27 changes: 17 additions & 10 deletions exception/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ apply plugin: 'kotlin-android'
apply plugin: 'maven-publish' // needed for JitPack.io

android {
compileSdkVersion 33
buildToolsVersion "33.0.1"
compileSdk 34
namespace 'it.niedermann.nextcloud.exception'

defaultConfig {
minSdkVersion 22
targetSdkVersion 33
versionCode version_code
versionName version_name
minSdk 22
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}

testOptions {
Expand All @@ -34,6 +36,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

lintOptions {
disable 'MissingTranslation'
abortOnError false
}
}

afterEvaluate {
Expand All @@ -55,11 +62,11 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

api "com.github.nextcloud:Android-SingleSignOn:$sso_version"
implementation 'com.github.stefan-niedermann:android-commons:0.2.9'
implementation 'com.github.stefan-niedermann:android-commons:0.4.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

testImplementation 'junit:junit:4.13.2'
testImplementation "io.mockk:mockk:1.13.7"
testImplementation "io.mockk:mockk:1.13.9"
testImplementation 'org.robolectric:robolectric:4.11.1'
}
3 changes: 2 additions & 1 deletion exception/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<manifest package="it.niedermann.nextcloud.exception" />
<?xml version="1.0" encoding="utf-8"?>
<manifest />
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.nextcloud.android.sso.model.FilesAppType
import java.io.PrintWriter
import java.io.StringWriter

@Suppress("unused")
@Suppress("unused", "MemberVisibilityCanBePrivate")
object ExceptionUtil {
fun getDebugInfos(context: Context, throwable: Throwable): String {
return getDebugInfos(context, throwable, null, null)
Expand Down Expand Up @@ -84,7 +84,7 @@ object ExceptionUtil {
"App Flavor: $flavor\n"
}
}
val types = FilesAppType.values()
val types = FilesAppType.entries
types.forEach {
try {
versions += "\nFiles App Version Code: ${VersionCheckHelper.getNextcloudFilesVersionCode(context, it)} (${it})"
Expand Down
21 changes: 2 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4096m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
org.gradle.configuration-cache=true
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
# Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
android.disableAutomaticComponentCreation=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jdk: openjdk11
jdk: openjdk17
24 changes: 13 additions & 11 deletions markdown/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ apply plugin: 'kotlin-android'
apply plugin: 'maven-publish' // needed for JitPack.io

android {
compileSdkVersion 33
buildToolsVersion "33.0.1"
compileSdk 34
namespace 'it.niedermann.android.markdown'

defaultConfig {
minSdkVersion 22
targetSdkVersion 33
versionCode version_code
versionName version_name
minSdk 22
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}

testOptions {
Expand All @@ -46,10 +48,10 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

api "com.github.nextcloud:Android-SingleSignOn:$sso_version"
implementation 'com.github.stefan-niedermann:android-commons:0.2.9'
implementation 'com.github.stefan-niedermann:android-commons:0.4.0'

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-livedata:2.6.2'
implementation 'androidx.lifecycle:lifecycle-livedata:2.7.0'

implementation 'org.jsoup:jsoup:1.17.2'

Expand Down Expand Up @@ -77,6 +79,6 @@ dependencies {
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'androidx.arch.core:core-testing:2.2.0'
testImplementation 'junit:junit:4.13.2'
testImplementation "io.mockk:mockk:1.13.7"
testImplementation "io.mockk:mockk:1.13.9"
testImplementation 'org.robolectric:robolectric:4.11.1'
}
4 changes: 1 addition & 3 deletions markdown/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="it.niedermann.android.markdown">

</manifest>
<manifest />
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
/**
* Can be used for editors and viewers as well.
* Viewer can support basic edit features, like toggling checkboxes
*
* @noinspection unused
*/
public interface MarkdownEditor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ private MarkdownUtil() {
* <p>
* Since {@link Markwon} makes heavy use of custom spans, this won't look nice e. g. at app widgets, because they simply won't be rendered.
* Therefore we currently use {@link HtmlCompat} to filter supported spans from the output of {@link HtmlRenderer} as an intermediate step.
*
* @noinspection unused
*/
public static CharSequence renderForRemoteView(@NonNull Context context, @NonNull String content) {
// Create HTML string from Markup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
item = menu.findItem(styleFormatMap.keyAt(i));
title = item.getTitle();
spannableString = new SpannableString(title);
spannableString.setSpan(new StyleSpan(styleFormatMap.valueAt(i)), 0, title.length(), 0);
spannableString.setSpan(new StyleSpan(styleFormatMap.valueAt(i)), 0, title == null ? 0 : title.length(), 0);
item.setTitle(spannableString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,15 @@ public void handleMarkdownSpan(
final HeadingSpan newSpan;

switch (span.getLevel()) {
case 1:
newSpan = persistedSpans.get(Heading1Span.class);
break;
case 2:
newSpan = persistedSpans.get(Heading2Span.class);
break;
case 3:
newSpan = persistedSpans.get(Heading3Span.class);
break;
case 4:
newSpan = persistedSpans.get(Heading4Span.class);
break;
case 5:
newSpan = persistedSpans.get(Heading5Span.class);
break;
case 6:
newSpan = persistedSpans.get(Heading6Span.class);
break;
default:
case 1 -> newSpan = persistedSpans.get(Heading1Span.class);
case 2 -> newSpan = persistedSpans.get(Heading2Span.class);
case 3 -> newSpan = persistedSpans.get(Heading3Span.class);
case 4 -> newSpan = persistedSpans.get(Heading4Span.class);
case 5 -> newSpan = persistedSpans.get(Heading5Span.class);
case 6 -> newSpan = persistedSpans.get(Heading6Span.class);
default -> {
return;

}
}
final int newStart = getNewSpanStart(input, spanStart);
final int newEnd = findEnd(input, newStart, newSpan.getLevel());
Expand Down
25 changes: 18 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ plugins {
}

android {
compileSdk 34
namespace 'it.niedermann.nextcloud.sample'
compileSdk 33

defaultConfig {
applicationId "it.niedermann.nextcloud.sample"
minSdk 24
targetSdk 33
targetSdk 34
versionCode version_code
versionName version_name

Expand All @@ -23,24 +23,35 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

lint {
abortOnError false
disable 'MissingTranslation'
}
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

implementation project(path: ':exception')
implementation project(path: ':markdown')
implementation project(path: ':sso-glide')
implementation 'androidx.core:core-ktx:1.10.1'

implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package it.niedermann.nextcloud.sample

import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -16,6 +17,7 @@ import it.niedermann.nextcloud.exception.ExceptionUtil
class MainActivity : AppCompatActivity() {

private lateinit var signOn: Button
private lateinit var currentUser: TextView
private lateinit var sampleException: TextView
private lateinit var markdownEditor: MarkdownEditor
private lateinit var markdownViewer: MarkdownEditor
Expand All @@ -26,6 +28,7 @@ class MainActivity : AppCompatActivity() {
setContentView(R.layout.activity_main)

signOn = findViewById<MaterialButton>(R.id.signOn)
currentUser = findViewById(R.id.currentUser)
sampleException = findViewById(R.id.sampleException)
markdownEditor = findViewById<MarkdownEditorImpl>(R.id.markdown_editor)
markdownViewer = findViewById<MarkdownViewerImpl>(R.id.markdown_viewer)
Expand All @@ -47,6 +50,8 @@ class MainActivity : AppCompatActivity() {
AccountImporter.onActivityResult(requestCode, resultCode, data, this) {
SingleAccountHelper.commitCurrentAccount(this, it.name)
mentions[it.userId] = it.name
currentUser.text = it.name
currentUser.visibility = View.VISIBLE
}
}
}
Loading