From 4725680f61665a666a8474285f638112c036214c Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Thu, 25 Nov 2021 15:22:09 +0100 Subject: [PATCH] Release 1.9.0 (#215) * Refresh, configure publishing * Configure CI for deploy and snapshots * Adjust repository in docs * Write changelog * Fix dokka task --- .github/workflows/build.yml | 28 ++++---- .github/workflows/deploy.yml | 25 ++++--- .github/workflows/snapshot.yml | 25 +++++++ README.md | 4 +- app/build.gradle.kts | 14 ++-- app/src/main/AndroidManifest.xml | 4 +- .../otaliastudios/zoom/demo/MainActivity.java | 40 ++++++------ build.gradle.kts | 25 +------ docs/_about/changelog.md | 16 ++++- docs/_about/install.md | 33 ++++++---- docs/_config.yml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle.kts | 65 ++++++++++++------- settings.gradle.kts | 20 ++++++ 14 files changed, 188 insertions(+), 115 deletions(-) create mode 100644 .github/workflows/snapshot.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17f66d4..a3db4f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,29 +1,35 @@ # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions # Renaming ? Change the README badge. -name: Build +name: 'Build' on: push: branches: - - master + - main pull_request: + jobs: + ANDROID_BASE_CHECKS: - name: Base Checks + name: 'Base Checks' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: - java-version: 1.8 - - name: Perform base checks - run: ./gradlew app:assembleDebug library:dokka + java-version: 11 + distribution: temurin + cache: gradle + - name: 'Perform base checks' + run: ./gradlew app:assembleDebug library:dokkaJavadoc + ANDROID_UNIT_TESTS: - name: Unit Tests + name: 'Unit Tests' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: - java-version: 1.8 - - name: Execute unit tests + java-version: 11 + distribution: temurin + - name: 'Execute unit tests' run: ./gradlew library:testDebugUnitTest \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5bb530e..cb15df6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,20 +1,25 @@ # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions -name: Deploy +name: 'Deploy' on: release: types: [published] + jobs: - BINTRAY_UPLOAD: - name: Bintray Upload + + SONATYPE_DEPLOY: + name: 'Deploy to Sonatype' runs-on: ubuntu-latest env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} - BINTRAY_REPO: ${{ secrets.BINTRAY_REPO }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} steps: - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: - java-version: 1.8 - - name: Perform bintray upload - run: ./gradlew bintrayUpload + java-version: 11 + distribution: temurin + cache: gradle + - name: 'Publish library' + run: ./gradlew library:publishToSonatype diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000..ff8b362 --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,25 @@ +name: 'Snapshot' +on: + push: + branches: + - main + +jobs: + + SNAPSHOT: + name: 'Publish Snapshot' + runs-on: ubuntu-latest + env: + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: temurin + cache: gradle + - name: 'Publish library snapshot' + run: ./gradlew library:publishToSonatypeSnapshot diff --git a/README.md b/README.md index dcbf1c3..6d19a79 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ A collection of flexible Android components that support zooming and panning of View hierarchies, images, video streams, and much more - either programmatically or through touch events. -```groovy -implementation 'com.otaliastudios:zoomlayout:1.8.0' +```kotlin +implementation("com.otaliastudios:zoomlayout:1.9.0") ``` - `ZoomLayout`: a container that supports 2D pan and zoom to a View hierarchy, even supporting clicks [[docs]](https://natario1.github.io/ZoomLayout/docs/zoom-layout) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9a5a3d0..8c47529 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -3,12 +3,12 @@ plugins { } android { - setCompileSdkVersion(rootProject.extra["compileSdkVersion"] as Int) + compileSdk = 31 defaultConfig { applicationId = "com.otaliastudios.zoom.demo" - setMinSdkVersion(rootProject.extra["minSdkVersion"] as Int) - setTargetSdkVersion(rootProject.extra["targetSdkVersion"] as Int) + minSdk = 21 + targetSdk = 31 versionCode = 1 versionName = "1.0" setProperty("archivesBaseName", "ZoomLayout_v${versionName}_($versionCode)") @@ -21,9 +21,9 @@ android { } dependencies { - implementation("androidx.appcompat:appcompat:1.1.0") - implementation("com.google.android.exoplayer:exoplayer-core:2.9.3") - implementation("com.google.android.exoplayer:exoplayer-ui:2.9.3") - implementation("com.otaliastudios.opengl:egloo:0.4.0") + implementation("androidx.appcompat:appcompat:1.4.0") + implementation("com.google.android.exoplayer:exoplayer-core:2.16.1") + implementation("com.google.android.exoplayer:exoplayer-ui:2.16.1") + implementation("com.otaliastudios.opengl:egloo:0.6.1") implementation(project(":library")) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6ffe91f..c191734 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,7 +14,9 @@ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/com/otaliastudios/zoom/demo/MainActivity.java b/app/src/main/java/com/otaliastudios/zoom/demo/MainActivity.java index 0930940..57b8be1 100644 --- a/app/src/main/java/com/otaliastudios/zoom/demo/MainActivity.java +++ b/app/src/main/java/com/otaliastudios/zoom/demo/MainActivity.java @@ -8,29 +8,27 @@ import android.widget.Button; import android.widget.Toast; +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; -import com.google.android.exoplayer2.ExoPlayerFactory; -import com.google.android.exoplayer2.SimpleExoPlayer; -import com.google.android.exoplayer2.source.ExtractorMediaSource; +import com.google.android.exoplayer2.ExoPlayer; +import com.google.android.exoplayer2.MediaItem; +import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.source.MediaSource; +import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.ui.PlayerControlView; import com.google.android.exoplayer2.upstream.DataSource; -import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; -import com.google.android.exoplayer2.util.Util; -import com.google.android.exoplayer2.video.VideoListener; +import com.google.android.exoplayer2.upstream.DefaultDataSource; +import com.google.android.exoplayer2.video.VideoSize; import com.otaliastudios.zoom.ZoomImageView; import com.otaliastudios.zoom.ZoomLayout; import com.otaliastudios.zoom.ZoomLogger; import com.otaliastudios.zoom.ZoomSurfaceView; -import org.jetbrains.annotations.NotNull; - - public class MainActivity extends AppCompatActivity { - private SimpleExoPlayer player; + private ExoPlayer player; @Override protected void onCreate(Bundle savedInstanceState) { @@ -111,34 +109,34 @@ protected void onStart() { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private void setUpVideoPlayer() { - player = ExoPlayerFactory.newSimpleInstance(this); + player = new ExoPlayer.Builder(this).build(); PlayerControlView controls = findViewById(R.id.player_control_view); final ZoomSurfaceView surface = findViewById(R.id.surface_view); - player.addVideoListener(new VideoListener() { + player.addListener(new Player.Listener() { @Override - public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { - surface.setContentSize(width, height); + public void onVideoSizeChanged(@NonNull VideoSize videoSize) { + surface.setContentSize(videoSize.width, videoSize.height); } }); surface.setBackgroundColor(ContextCompat.getColor(this, R.color.background)); surface.addCallback(new ZoomSurfaceView.Callback() { @Override - public void onZoomSurfaceCreated(@NotNull ZoomSurfaceView view) { + public void onZoomSurfaceCreated(@NonNull ZoomSurfaceView view) { player.setVideoSurface(view.getSurface()); } @Override - public void onZoomSurfaceDestroyed(@NotNull ZoomSurfaceView view) { } + public void onZoomSurfaceDestroyed(@NonNull ZoomSurfaceView view) { } }); controls.setPlayer(player); controls.setShowTimeoutMs(0); controls.show(); - DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, - Util.getUserAgent(this, "ZoomLayoutLib")); + DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(this); Uri videoUri = Uri.parse("https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"); - MediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory) - .createMediaSource(videoUri); - player.prepare(videoSource); + MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory) + .createMediaSource(MediaItem.fromUri(videoUri)); + player.setMediaSource(videoSource); + player.prepare(); } @Override diff --git a/build.gradle.kts b/build.gradle.kts index 6bea076..051393e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,32 +1,9 @@ buildscript { - - extra["minSdkVersion"] = 16 - extra["compileSdkVersion"] = 29 - extra["targetSdkVersion"] = 29 - extra["kotlinVersion"] = "1.3.72" - repositories { mavenCentral() google() - jcenter() } - dependencies { - val kotlinVersion = property("kotlinVersion") as String - classpath("com.android.tools.build:gradle:4.0.0") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath("com.otaliastudios.tools:publisher:0.1.5") + classpath("io.deepmedia.tools:publisher:0.6.0") } } - -allprojects { - repositories { - mavenCentral() - google() - jcenter() - } -} - -tasks.register("clean", Delete::class) { - delete(buildDir) -} diff --git a/docs/_about/changelog.md b/docs/_about/changelog.md index 18f052f..fae7166 100644 --- a/docs/_about/changelog.md +++ b/docs/_about/changelog.md @@ -9,7 +9,17 @@ New versions are released through GitHub, so the reference page is the [GitHub R Starting from 1.7.0, you can now [support development](https://github.com/natario1/ZoomLayout/issues/125) through the GitHub Sponsors program. Companies can share a tiny part of their revenue and get private support hours in return. Thanks! -#### v1.8.0 +## v1.9.0 + +The library is now hosted on the Maven Central repository. + +- Enhancement: open ZoomEngine constructor, thanks to [@coffeemakr][coffeemakr] ([#193][193]) +- Fix: improved moveTo animation ([#189][189]) +- Fix: fix verbose logging, thanks to [@r4zzz4k][r4zzz4k] ([#214][214]) + + + +## v1.8.0 - Enhancement: raise an exception if a drawable without intrinsic dimensions is used ([#157][157]) - Enhancement: overzoom customization ([#164][164]) @@ -82,6 +92,7 @@ Companies can share a tiny part of their revenue and get private support hours i [Sly112]: https://github.com/Sly112 [RayyanTahir]: https://github.com/RayyanTahir [r4zzz4k]: https://github.com/r4zzz4k +[coffeemakr]: https://github.com/coffeemakr [38]: https://github.com/natario1/ZoomLayout/pull/38 [70]: https://github.com/natario1/ZoomLayout/pull/70 @@ -107,3 +118,6 @@ Companies can share a tiny part of their revenue and get private support hours i [159]: https://github.com/natario1/ZoomLayout/pull/159 [158]: https://github.com/natario1/ZoomLayout/pull/158 [156]: https://github.com/natario1/ZoomLayout/pull/156 +[193]: https://github.com/natario1/ZoomLayout/pull/193 +[189]: https://github.com/natario1/ZoomLayout/pull/189 +[214]: https://github.com/natario1/ZoomLayout/pull/214 diff --git a/docs/_about/install.md b/docs/_about/install.md index 6857960..f62a5f1 100644 --- a/docs/_about/install.md +++ b/docs/_about/install.md @@ -8,21 +8,32 @@ order: 1 The library works on API 16+ (except for ZoomSurfaceView), which is the only requirement and should be met by most projects nowadays. -It is publicly hosted on [JCenter](https://bintray.com/natario/android/ZoomLayout), where you -can download the AAR package. To fetch with Gradle, make sure you add the JCenter repository in your root projects `build.gradle` file: - -```groovy -allprojects { - repositories { - jcenter() - } +It is publicly hosted on [Maven Central](https://repo.maven.apache.org/maven2/com/otaliastudios), where you +can download the AAR package. To fetch with Gradle, make sure you add the Maven Central repository: + +```kotlin +repositories { + mavenCentral() } ``` Then simply download the latest version: -```groovy -implementation 'com.otaliastudios:zoomlayout:{{ site.github_version }}' +```kotlin +implementation("com.otaliastudios:zoomlayout:{{ site.github_version }}") +``` + +No other configuration steps are needed. If you want to try features that were not released yet, +you can pull the latest snapshot by adding the Sonatype snapshot repository: + +```kotlin +repositories { + maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") +} ``` -No other configuration steps are needed. \ No newline at end of file +And depending on the latest-SNAPSHOT version: + +```kotlin +api("com.otaliastudios:zoomlayout:latest-SNAPSHOT") +``` \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml index 55af2ca..1648467 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -12,7 +12,7 @@ google_analytics_id: 'UA-155077779-4' google_site_verification: '4x49i17ABIrSvUl52SeL0-t0341aTnWWaC62-FYCRT4' github: [metadata] # TODO What's this? github_repo: ZoomLayout -github_version: 1.8.0 +github_version: 1.9.0 github_branch: master baseurl: '/ZoomLayout' # Keep as an empty string if served up at the root collections: diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8e335f1..7d0e989 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip diff --git a/library/build.gradle.kts b/library/build.gradle.kts index eaaf528..b5a4fd0 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -1,47 +1,62 @@ -import com.otaliastudios.tools.publisher.PublisherExtension.License -import com.otaliastudios.tools.publisher.PublisherExtension.Release +import io.deepmedia.tools.publisher.common.License +import io.deepmedia.tools.publisher.common.Release +import io.deepmedia.tools.publisher.common.GithubScm +import io.deepmedia.tools.publisher.sonatype.Sonatype plugins { id("com.android.library") id("kotlin-android") - id("maven-publisher-bintray") + id("io.deepmedia.tools.publisher") } android { - setCompileSdkVersion(property("compileSdkVersion") as Int) - + compileSdk = 31 defaultConfig { - setMinSdkVersion(property("minSdkVersion") as Int) - setTargetSdkVersion(property("targetSdkVersion") as Int) - versionName = "1.8.0" - versionNameSuffix = "" + minSdk = 16 + targetSdk = 31 } - buildTypes { get("release").consumerProguardFile("proguard-rules.pro") } } dependencies { - val kotlinVersion = property("kotlinVersion") as String - api("androidx.annotation:annotation:1.1.0") - api("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion") - api("com.otaliastudios.opengl:egloo:0.4.0") - - testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1") + api("androidx.annotation:annotation:1.3.0") + api("com.otaliastudios.opengl:egloo:0.6.1") + testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0") } publisher { - auth.user = "BINTRAY_USER" - auth.key = "BINTRAY_KEY" - auth.repo = "BINTRAY_REPO" - project.group = "com.otaliastudios" + project.description = "A collection of Android components that support zooming and panning of " + + "View hierarchies, images, video streams, and much more." project.artifact = "zoomlayout" - project.description = "A collection of Android components that support zooming and panning of View hierarchies, images, video streams, and much more." + project.group = "com.otaliastudios" project.url = "https://github.com/natario1/ZoomLayout" - project.vcsUrl = "https://github.com/natario1/ZoomLayout.git" + project.scm = GithubScm("natario1", "ZoomLayout") + project.addLicense(License.APACHE_2_0) - release.setSources(Release.SOURCES_AUTO) - release.setDocs(Release.DOCS_AUTO) + project.addDeveloper("Mattia Iavarone", "mat.iavarone@gmail.com") + // project.addDeveloper("Markus Ressel", email = "???") + release.sources = Release.SOURCES_AUTO + release.docs = Release.DOCS_AUTO + release.version = "1.9.0" + + directory() + + sonatype { + auth.user = "SONATYPE_USER" + auth.password = "SONATYPE_PASSWORD" + signing.key = "SIGNING_KEY" + signing.password = "SIGNING_PASSWORD" + } + + sonatype("snapshot") { + repository = Sonatype.OSSRH_SNAPSHOT_1 + release.version = "latest-SNAPSHOT" + auth.user = "SONATYPE_USER" + auth.password = "SONATYPE_PASSWORD" + signing.key = "SIGNING_KEY" + signing.password = "SIGNING_PASSWORD" + } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 7853fb8..8b28bd1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,21 @@ +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } + plugins { + id("com.android.application") version "7.0.3" + id("com.android.library") version "7.0.3" + id("org.jetbrains.kotlin.android") version "1.6.0" + } +} + include(":app", ":library")