Made the project compatible with Android Studios new "instant run" feature. Also using the native renderscript libraries instead of the support version now.
This commit is contained in:
parent
1cde43af07
commit
418713df8a
4 changed files with 27 additions and 25 deletions
|
|
@ -61,7 +61,6 @@ android {
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
|
|
||||||
renderscriptTargetApi 23
|
renderscriptTargetApi 23
|
||||||
renderscriptSupportModeEnabled true
|
|
||||||
|
|
||||||
applicationId "com.kabouzeid.gramophone"
|
applicationId "com.kabouzeid.gramophone"
|
||||||
versionCode 80
|
versionCode 80
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,14 @@ import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.renderscript.Allocation;
|
||||||
|
import android.renderscript.Element;
|
||||||
|
import android.renderscript.RSRuntimeException;
|
||||||
|
import android.renderscript.RenderScript;
|
||||||
|
import android.renderscript.ScriptIntrinsicBlur;
|
||||||
import android.support.annotation.FloatRange;
|
import android.support.annotation.FloatRange;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v8.renderscript.Allocation;
|
|
||||||
import android.support.v8.renderscript.Element;
|
|
||||||
import android.support.v8.renderscript.RSRuntimeException;
|
|
||||||
import android.support.v8.renderscript.RenderScript;
|
|
||||||
import android.support.v8.renderscript.ScriptIntrinsicBlur;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.BuildConfig;
|
import com.kabouzeid.gramophone.BuildConfig;
|
||||||
import com.kabouzeid.gramophone.helper.StackBlur;
|
import com.kabouzeid.gramophone.helper.StackBlur;
|
||||||
|
|
@ -56,6 +57,7 @@ public class BlurProcessor implements BitmapProcessor {
|
||||||
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
|
||||||
canvas.drawBitmap(bitmap, 0, 0, paint);
|
canvas.drawBitmap(bitmap, 0, 0, paint);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT > 16) {
|
||||||
try {
|
try {
|
||||||
final RenderScript rs = RenderScript.create(context.getApplicationContext());
|
final RenderScript rs = RenderScript.create(context.getApplicationContext());
|
||||||
final Allocation input = Allocation.createFromBitmap(rs, out, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
|
final Allocation input = Allocation.createFromBitmap(rs, out, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
|
||||||
|
|
@ -75,10 +77,11 @@ public class BlurProcessor implements BitmapProcessor {
|
||||||
} catch (RSRuntimeException e) {
|
} catch (RSRuntimeException e) {
|
||||||
// on some devices RenderScript.create() throws: android.support.v8.renderscript.RSRuntimeException: Error loading libRSSupport library
|
// on some devices RenderScript.create() throws: android.support.v8.renderscript.RSRuntimeException: Error loading libRSSupport library
|
||||||
if (BuildConfig.DEBUG) e.printStackTrace();
|
if (BuildConfig.DEBUG) e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return StackBlur.blur(out, blurRadius);
|
return StackBlur.blur(out, blurRadius);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
|
||||||
classpath 'com.github.triplet.gradle:play-publisher:1.1.3'
|
classpath 'com.github.triplet.gradle:play-publisher:1.1.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
#Wed Apr 10 15:27:10 PDT 2013
|
#Mon Nov 23 22:29:57 CET 2015
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue