diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 170f790..ea7e0e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,26 @@ name: Build -on: [pull_request, push] + +on: + push: + pull_request: + jobs: build: runs-on: ubuntu-latest + steps: - - name: Checkout the code - uses: actions/checkout@v2 - - name: Build the app + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure JDK + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: '17' + cache: gradle + + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@v4 + + - name: Build run: ./gradlew build diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..ff2fd61 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,33 @@ +name: Publish Release + +on: + push: + tags: + - '*' + +env: + RELEASE_SIGNING_ENABLED: true + +jobs: + publish: + runs-on: ubuntu-latest + if: github.repository == 'Commit451/QuickActionView' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install JDK + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: '17' + cache: gradle + + - name: Release to Maven Central + run: ./gradlew publishAndReleaseToMavenCentral -PVERSION_NAME="${GITHUB_REF_NAME}" --no-configuration-cache + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/README.md b/README.md index 93aa14d..c93c2eb 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,17 @@ # QuickActionView View that shows quick actions when long pressed, inspired by Pinterest -[![Build Status](https://travis-ci.org/Commit451/QuickActionView.svg?branch=master)](https://travis-ci.org/Commit451/QuickActionView) [![](https://jitpack.io/v/Commit451/QuickActionView.svg)](https://jitpack.io/#Commit451/QuickActionView) +[![Build](https://github.com/Commit451/QuickActionView/actions/workflows/ci.yml/badge.svg)](https://github.com/Commit451/QuickActionView/actions/workflows/ci.yml) [![Maven Central](https://img.shields.io/maven-central/v/com.commit451/quickactionview.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/com.commit451/quickactionview) -![Sample Gif](https://raw.githubusercontent.com/Commit451/QuickActionView/master/screenshots/qav.gif) +![Sample Gif](https://raw.githubusercontent.com/Commit451/QuickActionView/main/screenshots/qav.gif) # Gradle Dependency -Add this in your root `build.gradle` file (**not** your module `build.gradle` file): +Add the library to your project `build.gradle`: -```gradle -allprojects { - repositories { - ... - maven { url "https://jitpack.io" } - } -} -``` - -Then, add the library to your project `build.gradle` ```gradle dependencies { - compile 'com.github.Commit451:QuickActionView:latest.release.here' + implementation("com.commit451:quickactionview:latest.release.here") } ``` diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index ad7cadc..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -apply plugin: 'com.android.application' - -apply plugin: 'kotlin-android' - -android { - compileSdkVersion 33 - - defaultConfig { - applicationId "com.commit451.quickactionview.sample" - minSdkVersion 21 - targetSdkVersion 33 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - lintOptions { - abortOnError false - } -} - -dependencies { - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.7.0' - implementation 'androidx.recyclerview:recyclerview:1.2.1' - - implementation project(':quickactionview') -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..3eb4819 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,40 @@ +plugins { + id("com.android.application") +} + +android { + namespace = "com.commit451.quickactionview.sample" + compileSdk = 35 + + defaultConfig { + applicationId = "com.commit451.quickactionview.sample" + minSdk = 21 + targetSdk = 35 + versionCode = 1 + versionName = "1.0" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } +} + +dependencies { + implementation("androidx.appcompat:appcompat:1.7.1") + implementation("com.google.android.material:material:1.13.0") + implementation("androidx.recyclerview:recyclerview:1.4.0") + + implementation(project(":quickactionview")) +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8dcadda..2cb816c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - - - + diff --git a/build.gradle b/build.gradle deleted file mode 100644 index a01b45c..0000000 --- a/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -buildscript { - ext.kotlin_version = '1.7.20' - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..d709a4e --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("com.android.application") version "9.1.0" apply false + id("com.android.library") version "9.1.0" apply false + id("com.vanniktech.maven.publish") version "0.30.0" apply false +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/gradle.properties b/gradle.properties index acf164f..c9f8cca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,26 @@ -# Project-wide Gradle settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +android.useAndroidX=true -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. +GROUP=com.commit451 +POM_ARTIFACT_ID=quickactionview +VERSION_NAME=2.0.1 -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html +POM_NAME=QuickActionView +POM_DESCRIPTION=View that shows quick actions when long pressed, inspired by Pinterest +POM_INCEPTION_YEAR=2020 +POM_URL=https://github.com/Commit451/QuickActionView/ -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +POM_LICENSE_NAME=The Apache Software License, Version 2.0 +POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENSE_DIST=repo -# 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 -android.enableJetifier=true -android.useAndroidX=true +POM_SCM_URL=https://github.com/Commit451/QuickActionView/ +POM_SCM_CONNECTION=scm:git:git://github.com/Commit451/QuickActionView.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/Commit451/QuickActionView.git + +POM_DEVELOPER_ID=Commit451 +POM_DEVELOPER_NAME=Commit 451 +POM_DEVELOPER_URL=https://github.com/Commit451/ + +SONATYPE_CONNECT_TIMEOUT_SECONDS=60 +SONATYPE_CLOSE_TIMEOUT_SECONDS=900 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b1159fc..0c65c65 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/quickactionview/build.gradle b/quickactionview/build.gradle deleted file mode 100644 index adc31ff..0000000 --- a/quickactionview/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: 'com.android.library' - -apply plugin: 'kotlin-android' - -android { - compileSdkVersion 33 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 33 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - lintOptions { - abortOnError false - } -} - -dependencies { - api 'androidx.appcompat:appcompat:1.5.1' -} diff --git a/quickactionview/build.gradle.kts b/quickactionview/build.gradle.kts new file mode 100644 index 0000000..03b7283 --- /dev/null +++ b/quickactionview/build.gradle.kts @@ -0,0 +1,53 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary +import com.vanniktech.maven.publish.SonatypeHost + +plugins { + id("com.android.library") + id("com.vanniktech.maven.publish") +} + +group = findProperty("GROUP") as String +version = findProperty("VERSION_NAME") as String + +android { + namespace = "com.commit451.quickactionview" + compileSdk = 35 + + defaultConfig { + minSdk = 21 + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } +} + +dependencies { + api("androidx.appcompat:appcompat:1.7.1") +} + +mavenPublishing { + configure( + AndroidSingleVariantLibrary( + variant = "release", + sourcesJar = true, + publishJavadocJar = true, + ) + ) + coordinates("com.commit451", "quickactionview", version.toString()) + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + if (System.getenv("RELEASE_SIGNING_ENABLED") == "true") { + signAllPublications() + } +} diff --git a/quickactionview/src/main/AndroidManifest.xml b/quickactionview/src/main/AndroidManifest.xml index 233edb1..cc947c5 100644 --- a/quickactionview/src/main/AndroidManifest.xml +++ b/quickactionview/src/main/AndroidManifest.xml @@ -1,5 +1 @@ - - - - - + diff --git a/quickactionview/src/main/java/com/commit451/quickactionview/Action.kt b/quickactionview/src/main/java/com/commit451/quickactionview/Action.kt index e8ac362..0ef26d5 100644 --- a/quickactionview/src/main/java/com/commit451/quickactionview/Action.kt +++ b/quickactionview/src/main/java/com/commit451/quickactionview/Action.kt @@ -33,7 +33,7 @@ class Action * Configuration for the [Action] which controls the visuals. */ class Config constructor(context: Context) { - internal var backgroundColorStateList: ColorStateList = ColorStateList.valueOf(ColorUtils.getThemeAttrColor(context, R.attr.colorAccent)) + internal var backgroundColorStateList: ColorStateList = ColorStateList.valueOf(ColorUtils.getThemeAttrColor(context, androidx.appcompat.R.attr.colorAccent)) internal var textColor: Int = Color.WHITE @DrawableRes internal var textBackgroundDrawable: Int = R.drawable.qav_text_background diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index da40ed7..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app', ':quickactionview' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..8b93f53 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,18 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "QuickActionView" +include(":app", ":quickactionview")