diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..bd24548 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,10 @@ +# Releases + +## v0.3.0 +* first version in jcenter +* updates renderscriptTargetApi to 20 +* updates target sdk and build tools to 25 +* adds debug view in app + +## v0.2.0 + initial release \ No newline at end of file diff --git a/DaliTestApp/build.gradle b/DaliTestApp/build.gradle index 140e962..6ac5b25 100644 --- a/DaliTestApp/build.gradle +++ b/DaliTestApp/build.gradle @@ -16,7 +16,7 @@ android { } defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion + minSdkVersion 14 targetSdkVersion rootProject.ext.targetSdkVersion versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName @@ -42,7 +42,8 @@ android { dependencies { compile 'com.android.support:appcompat-v7:25.1.0' compile 'com.android.support:appcompat-v7:25.1.0' - compile 'com.squareup.picasso:picasso:2.5.+' + compile 'com.squareup.picasso:picasso:2.5.2' - compile 'at.favre.lib:dali:0.2' + compile 'at.favre.lib:dali:0.3.0' + compile 'at.favre.lib.hood:hood-extended:0.2.3' } diff --git a/DaliTestApp/proguard-rules.txt b/DaliTestApp/proguard-rules.txt index 9b48231..e467b94 100644 --- a/DaliTestApp/proguard-rules.txt +++ b/DaliTestApp/proguard-rules.txt @@ -14,4 +14,6 @@ # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; -#} \ No newline at end of file +#} + +-keep public **.BuildConfig {public static *;} \ No newline at end of file diff --git a/DaliTestApp/src/main/AndroidManifest.xml b/DaliTestApp/src/main/AndroidManifest.xml index 5e7632d..9d26b00 100644 --- a/DaliTestApp/src/main/AndroidManifest.xml +++ b/DaliTestApp/src/main/AndroidManifest.xml @@ -1,26 +1,30 @@ - + + android:theme="@style/AppTheme"> + android:label="@string/app_name"> - + - + - + + - diff --git a/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/DebugActivity.java b/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/DebugActivity.java new file mode 100644 index 0000000..e8626cb --- /dev/null +++ b/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/DebugActivity.java @@ -0,0 +1,24 @@ +package at.favre.app.dalitest.activity; + +import android.support.annotation.NonNull; + +import at.favre.app.dalitest.BuildConfig; +import at.favre.lib.hood.extended.PopHoodActivity; +import at.favre.lib.hood.interfaces.Page; +import at.favre.lib.hood.interfaces.Pages; +import at.favre.lib.hood.util.defaults.DefaultProperties; + +public class DebugActivity extends PopHoodActivity { + @NonNull + @Override + public Pages getPageData(@NonNull Pages emptyPages) { + Page page = emptyPages.addNewPage(); + page.add(DefaultProperties.createSectionBasicDeviceInfo()); + page.add(DefaultProperties.createDetailedDeviceInfo(this)); + page.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(BuildConfig.class)); + page.add(DefaultProperties.createSectionAppVersionInfoFromBuildConfig(at.favre.lib.dali.BuildConfig.class).removeHeader()); + + + return emptyPages; + } +} diff --git a/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/MainMenuActivity.java b/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/MainMenuActivity.java index 96c0d84..134ff7d 100644 --- a/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/MainMenuActivity.java +++ b/DaliTestApp/src/main/java/at/favre/app/dalitest/activity/MainMenuActivity.java @@ -9,9 +9,12 @@ import at.favre.app.dalitest.R; import at.favre.lib.dali.Dali; +import at.favre.lib.hood.Hood; +import at.favre.lib.hood.interfaces.actions.ManagerControl; public class MainMenuActivity extends AppCompatActivity { + private ManagerControl control; @Override protected void onCreate(Bundle savedInstanceState) { @@ -22,42 +25,57 @@ protected void onCreate(Bundle savedInstanceState) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - findViewById(R.id.btn_blur1).setOnClickListener(new StartActivityListener(this,0)); - findViewById(R.id.btn_liveblur1).setOnClickListener(new StartActivityListener(this,1)); - findViewById(R.id.btn_animation1).setOnClickListener(new StartActivityListener(this,2)); - findViewById(R.id.btn_viewblur).setOnClickListener(new StartActivityListener(this,3)); - findViewById(R.id.btn_blur2).setOnClickListener(new StartActivityListener(this,4)); - findViewById(R.id.btn_blur_misc).setOnClickListener(new StartActivityListener(this,5)); - findViewById(R.id.btn_navdrawer).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - startActivity(new Intent(MainMenuActivity.this,NavigationDrawerActivity.class)); - } - }); - - findViewById(R.id.btn_clear_cache).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Dali.resetAndSetNewConfig(MainMenuActivity.this,new Dali.Config()); - Dali.setDebugMode(true); - } - }); + findViewById(R.id.btn_blur1).setOnClickListener(new StartActivityListener(this, 0)); + findViewById(R.id.btn_liveblur1).setOnClickListener(new StartActivityListener(this, 1)); + findViewById(R.id.btn_animation1).setOnClickListener(new StartActivityListener(this, 2)); + findViewById(R.id.btn_viewblur).setOnClickListener(new StartActivityListener(this, 3)); + findViewById(R.id.btn_blur2).setOnClickListener(new StartActivityListener(this, 4)); + findViewById(R.id.btn_blur_misc).setOnClickListener(new StartActivityListener(this, 5)); + findViewById(R.id.btn_navdrawer).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivity(new Intent(MainMenuActivity.this, NavigationDrawerActivity.class)); + } + }); + + findViewById(R.id.btn_clear_cache).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Dali.resetAndSetNewConfig(MainMenuActivity.this, new Dali.Config()); + Dali.setDebugMode(true); + } + }); + + control = Hood.ext().registerShakeToOpenDebugActivity(getApplicationContext(), + DebugActivity.createIntent(this, DebugActivity.class)); + } + + @Override + protected void onResume() { + super.onResume(); + control.start(); } - private static class StartActivityListener implements View.OnClickListener { - private int fragmentId; - private Activity activity; - - private StartActivityListener(Activity ctx, int fragmentId) { - this.fragmentId = fragmentId; - this.activity = ctx; - } - - @Override - public void onClick(View view) { - Intent i = new Intent(activity, GenericActivity.class); - i.putExtra(GenericActivity.FRAGMENT_ID,fragmentId); - activity.startActivity(i); - } - } + @Override + protected void onPause() { + super.onPause(); + control.stop(); + } + + private static class StartActivityListener implements View.OnClickListener { + private int fragmentId; + private Activity activity; + + private StartActivityListener(Activity ctx, int fragmentId) { + this.fragmentId = fragmentId; + this.activity = ctx; + } + + @Override + public void onClick(View view) { + Intent i = new Intent(activity, GenericActivity.class); + i.putExtra(GenericActivity.FRAGMENT_ID, fragmentId); + activity.startActivity(i); + } + } } diff --git a/README.md b/README.md index 87c0568..7316f58 100644 --- a/README.md +++ b/README.md @@ -11,31 +11,16 @@ easily extended and pretty every configuration can be changed. *Note: This library is in prototype state and not ready for prime time. It is mostly feature complete (except for the animation module) although bugs are to be expected.* -# Usage +# Install -Add the lib as gradle dependency either by using the provided `.aar` file (see releases) -[as local dependency](http://stackoverflow.com/questions/24506648/adding-local-aar-files-to-gradle-build-using-flatdirs-is-not-working) -or use the maven dependency: +Add the following to your dependencies ([add jcenter to your repositories](https://developer.android.com/studio/build/index.html#top-level) if you haven't) ```gradle dependencies { - compile 'at.favre.lib:dali:0.2' + compile 'at.favre.lib:dali:0.3.0' } ``` -Currently the lib is not on jcenter or maven central yet, therefore you need to add my maven repo in your root build.gradle: - -```gradle - allprojects { - repositories { - jcenter() - maven { - url 'https://dl.bintray.com/patrickfav/maven/' - } - } - } -``` - Then add the following to your app's build.gradle to get Renderscript to work ```gradle diff --git a/build.gradle b/build.gradle index 2e521d4..3b7b754 100644 --- a/build.gradle +++ b/build.gradle @@ -16,9 +16,6 @@ plugins { allprojects { repositories { jcenter() - maven { - url 'https://dl.bintray.com/patrickfav/maven/' - } } } diff --git a/dali/build.gradle b/dali/build.gradle index 41b85b4..66137b2 100644 --- a/dali/build.gradle +++ b/dali/build.gradle @@ -1,29 +1,5 @@ apply plugin: 'com.android.library' -ext { - bintrayRepo = 'maven' - bintrayName = 'dali' - - publishedGroupId = 'at.favre.lib' - libraryName = 'Dali' - artifact = 'dali' - - libraryDescription = 'Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live blurring and animations.' - - siteUrl = 'https://github.com/patrickfav/Dali' - gitUrl = 'https://github.com/patrickfav/Dali.git' - - libraryVersion = rootProject.ext.versionName - - developerId = 'patrickfav' - developerName = 'Patrick Favre-Bulle' - developerEmail = 'patrick.favrebulle@gmail.com' - - licenseName = 'The Apache Software License, Version 2.0' - licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - allLicenses = ["Apache-2.0"] -} - def Properties localProps = getSigningProperties() android { @@ -69,5 +45,4 @@ dependencies { compile 'com.android.support:recyclerview-v7:25.1.0' } -//apply from: '../gradle/install.gradle' -//apply from: '../gradle/publish.gradle' \ No newline at end of file +apply from: "$rootDir/publish.gradle" \ No newline at end of file diff --git a/gradle/install.gradle b/gradle/install.gradle deleted file mode 100644 index cdb363c..0000000 --- a/gradle/install.gradle +++ /dev/null @@ -1,42 +0,0 @@ -apply plugin: 'com.github.dcendents.android-maven' - -group = publishedGroupId // Maven Group ID for the artifact - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - groupId publishedGroupId - artifactId artifact - - // Add your description here - name libraryName - description libraryDescription - url siteUrl - - // Set your license - licenses { - license { - name licenseName - url licenseUrl - } - } - developers { - developer { - id developerId - name developerName - email developerEmail - } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - - } - } - } - } -} \ No newline at end of file diff --git a/gradle/publish.gradle b/gradle/publish.gradle deleted file mode 100644 index ab5bd30..0000000 --- a/gradle/publish.gradle +++ /dev/null @@ -1,59 +0,0 @@ -apply plugin: 'com.jfrog.bintray' - -version = libraryVersion - -if (project.hasProperty("android")) { // Android libraries - task sourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - } - -// task javadoc(type: Javadoc) { -// source = android.sourceSets.main.java.srcDirs -// classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -// } -} else { // Java libraries - task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource - } -} - -//task javadocJar(type: Jar, dependsOn: javadoc) { -// classifier = 'javadoc' -// from javadoc.destinationDir -//} - -artifacts { -// archives javadocJar - archives sourcesJar -} - -// Bintray -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = bintrayRepo - name = bintrayName - desc = libraryDescription - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = allLicenses - publish = true - publicDownloadNumbers = true - version { - desc = libraryDescription - gpg { - sign = false //Determines whether to GPG sign the files. The default is false - passphrase = properties.getProperty("bintray.gpg.password") - //Optional. The passphrase for GPG signing' - } - } - } -} \ No newline at end of file diff --git a/publish.gradle b/publish.gradle new file mode 100644 index 0000000..6ebbfcf --- /dev/null +++ b/publish.gradle @@ -0,0 +1,107 @@ +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' + +def siteUrl = 'https://github.com/patrickfav/Dali' // Homepage URL of the library +def gitUrl = 'https://github.com/patrickfav/Dali.git' // Git repository URL +def descriptionText = 'Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live blurring and animations.' +group = "at.favre.lib" // Maven Group ID for the artifact + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + version rootProject.ext.versionName + project { + packaging 'aar' + // Add your description here + description descriptionText + url siteUrl + + // Set your license + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id 'pfavre' + name 'Patrick Favre-Bulle' + email 'patrick.favrebulle@gmail.com' + } + } + scm { + connection gitUrl + developerConnection gitUrl + url siteUrl + } + } + } + } +} + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + failOnError false + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives javadocJar + archives sourcesJar +} + +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) + +// https://github.com/bintray/gradle-bintray-plugin +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + + configurations = ['archives'] + + dryRun = false + publish = true //Whether version should be auto published after an upload + override = false //[Default: false] Whether to override version artifacts already published + + pkg { + repo = "maven" + // it is the name that appears in bintray when logged + name = project.buildDir.getParentFile().name + desc = descriptionText + issueTrackerUrl = 'https://github.com/patrickfav/Dali/issues' + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["Apache-2.0"] + githubRepo = 'patrickfav/Dali' + githubReleaseNotesFile = 'CHANGELOG' + labels = ['android', 'debugging', 'noop', 'debug-view'] + version { + name = rootProject.ext.versionName + vcsTag = rootProject.ext.versionName + released = new Date() + gpg { + sign = true //Determines whether to GPG sign the files. The default is false + passphrase = properties.getProperty("bintray.gpg.password") + } +// mavenCentralSync { +// sync = true //Optional (true by default). Determines whether to sync the version to Maven Central. +// user = properties.getProperty("bintray.oss.user") //OSS user token +// password = properties.getProperty("bintray.oss.password") //OSS user password +// close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually. +// } + } + } +} \ No newline at end of file