diff options
author | Yuichi Araki <yaraki@google.com> | 2016-07-08 13:54:27 +0900 |
---|---|---|
committer | Yuichi Araki <yaraki@google.com> | 2016-07-08 13:55:50 +0900 |
commit | 39b01293e262ed3b5fda41be6f33ae1124ffecbe (patch) | |
tree | abf09c8e0bcb411c8f8d65ba60281ff3b467cd72 /renderScript | |
parent | f879eeb37fa4727d338ff5bad71698d0c6f45153 (diff) | |
download | android-39b01293e262ed3b5fda41be6f33ae1124ffecbe.tar.gz |
RenderScriptIntrinsic: Several fixes
- Materialize
- Lower the minSdkVersion to 14
Change-Id: I08b7b1bea42f8dba200aea04ab14a4f709ce5976
Diffstat (limited to 'renderScript')
21 files changed, 207 insertions, 206 deletions
diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/AndroidManifest.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/AndroidManifest.xml index e108aff2..f34e2bcf 100644 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/AndroidManifest.xml +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,31 +14,22 @@ See the License for the specific language governing permissions and limitations under the License. --> - - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.renderscriptintrinsic" - android:versionCode="1" - android:versionName="1.0"> - - <!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle --> +<manifest package="com.example.android.renderscriptintrinsic" + xmlns:android="http://schemas.android.com/apk/res/android"> <application android:allowBackup="true" + android:icon="@mipmap/ic_launcher" android:label="RenderScriptIntrinsic" - android:icon="@drawable/ic_launcher" - android:theme="@style/AppTheme"> - + android:theme="@style/Theme.RenderScriptIntrinsic"> <activity android:name=".MainActivity" - android:label="RenderScriptIntrinsic" - android:theme="@style/FullscreenTheme"> + android:label="RenderScriptIntrinsic"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> - </manifest> diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java b/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java index 4b6f5ce1..fa1e6f5b 100644 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/MainActivity.java @@ -16,25 +16,32 @@ package com.example.android.renderscriptintrinsic; -import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.support.v8.renderscript.Allocation; +import android.support.v8.renderscript.Element; +import android.support.v8.renderscript.Matrix3f; +import android.support.v8.renderscript.RenderScript; +import android.support.v8.renderscript.ScriptIntrinsicBlur; +import android.support.v8.renderscript.ScriptIntrinsicColorMatrix; +import android.support.v8.renderscript.ScriptIntrinsicConvolve5x5; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; -import android.support.v8.renderscript.*; -public class MainActivity extends Activity { - /* Number of bitmaps that is used for renderScript thread and UI thread synchronization. - Ideally, this can be reduced to 2, however in some devices, 2 buffers still showing tierings on UI. - Investigating a root cause. +public class MainActivity extends AppCompatActivity { + + /** + * Number of bitmaps that is used for renderScript thread and UI thread synchronization. */ - private final int NUM_BITMAPS = 3; + private final int NUM_BITMAPS = 2; private int mCurrentBitmap = 0; private Bitmap mBitmapIn; private Bitmap[] mBitmapsOut; @@ -59,14 +66,10 @@ public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); + setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); - /* - * Initialize UI - */ - - //Set up main image view + // Set up main image view mBitmapIn = loadBitmap(R.drawable.data); mBitmapsOut = new Bitmap[NUM_BITMAPS]; for (int i = 0; i < NUM_BITMAPS; ++i) { @@ -131,20 +134,13 @@ public class MainActivity extends Activity { } }); - /* - * Create renderScript - */ + // Create renderScript createScript(); - /* - * Create thumbnails - */ + // Create thumbnails createThumbnail(); - - /* - * Invoke renderScript kernel and update imageView - */ + // Invoke renderScript kernel and update imageView mFilterMode = MODE_BLUR; updateImage(50); } @@ -159,12 +155,10 @@ public class MainActivity extends Activity { mOutAllocations[i] = Allocation.createFromBitmap(mRS, mBitmapsOut[i]); } - /* - Create intrinsics. - RenderScript has built-in features such as blur, convolve filter etc. - These intrinsics are handy for specific operations without writing RenderScript kernel. - In the sample, it's creating blur, convolve and matrix intrinsics. - */ + // Create intrinsics. + // RenderScript has built-in features such as blur, convolve filter etc. + // These intrinsics are handy for specific operations without writing RenderScript kernel. + // In the sample, it's creating blur, convolve and matrix intrinsics. mScriptBlur = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS)); mScriptConvolve = ScriptIntrinsicConvolve5x5.create(mRS, @@ -177,18 +171,15 @@ public class MainActivity extends Activity { Allocation outAllocation, Bitmap bitmapOut, float value) { switch (mFilterMode) { case MODE_BLUR: - /* - * Set blur kernel size - */ + // Set blur kernel size mScriptBlur.setRadius(value); - /* - * Invoke filter kernel - */ + // Invoke filter kernel mScriptBlur.setInput(inAllocation); mScriptBlur.forEach(outAllocation); break; case MODE_CONVOLVE: { + @SuppressWarnings("UnnecessaryLocalVariable") float f1 = value; float f2 = 1.0f - f1; @@ -196,24 +187,18 @@ public class MainActivity extends Activity { float coefficients[] = {-f1 * 2, 0, -f1, 0, 0, 0, -f2 * 2, -f2, 0, 0, -f1, -f2, 1, f2, f1, 0, 0, f2, f2 * 2, 0, 0, 0, f1, 0, f1 * 2,}; - /* - * Set kernel parameter - */ + // Set kernel parameter mScriptConvolve.setCoefficients(coefficients); - /* - * Invoke filter kernel - */ + // Invoke filter kernel mScriptConvolve.setInput(inAllocation); mScriptConvolve.forEach(outAllocation); break; } case MODE_COLORMATRIX: { - /* - * Set HUE rotation matrix - * The matrix below performs a combined operation of, - * RGB->HSV transform * HUE rotation * HSV->RGB transform - */ + // Set HUE rotation matrix + // The matrix below performs a combined operation of, + // RGB->HSV transform * HUE rotation * HSV->RGB transform float cos = (float) Math.cos((double) value); float sin = (float) Math.sin((double) value); Matrix3f mat = new Matrix3f(); @@ -228,23 +213,19 @@ public class MainActivity extends Activity { mat.set(2, 2, (float) (.114 + .886 * cos - .203 * sin)); mScriptMatrix.setColorMatrix(mat); - /* - * Invoke filter kernel - */ + // Invoke filter kernel mScriptMatrix.forEach(inAllocation, outAllocation); } break; } - /* - * Copy to bitmap and invalidate image view - */ + // Copy to bitmap and invalidate image view outAllocation.copyTo(bitmapOut); } - /* - Convert seekBar progress parameter (0-100 in range) to parameter for each intrinsic filter. - (e.g. 1.0-25.0 in Blur filter) + /** + * Convert seekBar progress parameter (0-100 in range) to parameter for each intrinsic filter. + * (e.g. 1.0-25.0 in Blur filter) */ private float getFilterParameter(int i) { float f = 0.f; @@ -269,21 +250,24 @@ public class MainActivity extends Activity { break; } return f; - } - /* + /** * In the AsyncTask, it invokes RenderScript intrinsics to do a filtering. - * After the filtering is done, an operation blocks at Allication.copyTo() in AsyncTask thread. - * Once all operation is finished at onPostExecute() in UI thread, it can invalidate and update ImageView UI. + * + * <p>After the filtering is done, an operation blocks at Allocation.copyTo() in AsyncTask + * thread. Once all operation is finished at onPostExecute() in UI thread, it can invalidate + * and + * update ImageView UI.</p> */ private class RenderScriptTask extends AsyncTask<Float, Integer, Integer> { - Boolean issued = false; + + private boolean mIssued; protected Integer doInBackground(Float... values) { int index = -1; - if (isCancelled() == false) { - issued = true; + if (!isCancelled()) { + mIssued = true; index = mCurrentBitmap; performFilter(mInAllocation, mOutAllocations[index], mBitmapsOut[index], values[0]); @@ -305,16 +289,17 @@ public class MainActivity extends Activity { } protected void onCancelled(Integer result) { - if (issued) { + if (mIssued) { updateView(result); } } } - /* - Invoke AsynchTask and cancel previous task. - When AsyncTasks are piled up (typically in slow device with heavy kernel), - Only the latest (and already started) task invokes RenderScript operation. + /** + * Invoke AsyncTask and cancel previous task. + * + * <p>When AsyncTasks are piled up (typically in slow device with heavy kernel), + * Only the latest (and already started) task invokes RenderScript operation.</p> */ private void updateImage(int progress) { float f = getFilterParameter(progress); @@ -326,8 +311,8 @@ public class MainActivity extends Activity { mLatestTask.execute(f); } - /* - Helper to load Bitmap from resource + /** + * Helper to load Bitmap from resource */ private Bitmap loadBitmap(int resource) { final BitmapFactory.Options options = new BitmapFactory.Options(); @@ -335,9 +320,9 @@ public class MainActivity extends Activity { return BitmapFactory.decodeResource(getResources(), resource, options); } - /* - Create thumbNail for UI. It invokes RenderScript kernel synchronously in UI-thread, - which is OK for small thumbnail (but not ideal). + /** + * Create thumbNail for UI. It invokes RenderScript kernel synchronously in UI-thread, + * which is OK for small thumbnail (but not ideal). */ private void createThumbnail() { int width = 72; @@ -346,11 +331,11 @@ public class MainActivity extends Activity { int pixelsWidth = (int) (width * scale + 0.5f); int pixelsHeight = (int) (height * scale + 0.5f); - //Temporary image + // Temporary image Bitmap tempBitmap = Bitmap.createScaledBitmap(mBitmapIn, pixelsWidth, pixelsHeight, false); Allocation inAllocation = Allocation.createFromBitmap(mRS, tempBitmap); - //Create thumbnail with each RS intrinsic and set it to radio buttons + // Create thumbnail with each RS intrinsic and set it to radio buttons int[] modes = {MODE_BLUR, MODE_CONVOLVE, MODE_COLORMATRIX}; int[] ids = {R.id.radio0, R.id.radio1, R.id.radio2}; int[] parameter = {50, 100, 25}; @@ -358,13 +343,13 @@ public class MainActivity extends Activity { mFilterMode = mode; float f = getFilterParameter(parameter[mode]); - Bitmap destBitpmap = Bitmap.createBitmap(tempBitmap.getWidth(), + Bitmap destBitmap = Bitmap.createBitmap(tempBitmap.getWidth(), tempBitmap.getHeight(), tempBitmap.getConfig()); - Allocation outAllocation = Allocation.createFromBitmap(mRS, destBitpmap); - performFilter(inAllocation, outAllocation, destBitpmap, f); + Allocation outAllocation = Allocation.createFromBitmap(mRS, destBitmap); + performFilter(inAllocation, outAllocation, destBitmap, f); ThumbnailRadioButton button = (ThumbnailRadioButton) findViewById(ids[mode]); - button.setThumbnail(destBitpmap); + button.setThumbnail(destBitmap); } } } diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java b/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java index 160e970b..0a42fbe4 100644 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/java/com/example/android/renderscriptintrinsic/ThumbnailRadioButton.java @@ -16,6 +16,7 @@ package com.example.android.renderscriptintrinsic; +import android.content.Context; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Paint; @@ -26,16 +27,17 @@ import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.StateListDrawable; import android.graphics.drawable.shapes.RectShape; import android.os.Build; +import android.util.AttributeSet; import android.view.Gravity; import android.widget.RadioButton; -import android.content.Context; -import android.util.AttributeSet; -/* - A button with Thumbnail which extends Radio Button. - The widget override a background drawable of Radio Button with a StateList Drawable. - Each state has a LayerDrawable with a Thumbnail image and a Focus rectangle. - It's using original Radio Buttons text as a label, because LayerDrawable showed some issues with Canvas.drawText(). +/** + * A button with Thumbnail which extends Radio Button. + * + * <p>The widget override a background drawable of Radio Button with a StateList Drawable. Each + * state has a LayerDrawable with a Thumbnail image and a Focus rectangle. It's using original + * Radio Buttons text as a label, because LayerDrawable showed some issues with + * Canvas.drawText().</p> */ public class ThumbnailRadioButton extends RadioButton { public ThumbnailRadioButton(Context context) { @@ -58,12 +60,12 @@ public class ThumbnailRadioButton extends RadioButton { } public void setThumbnail(Bitmap bitmap) { - //Bitmap drawable + // Bitmap drawable BitmapDrawable bmp = new BitmapDrawable(getResources(), bitmap); bmp.setGravity(Gravity.CENTER); int strokeWidth = 24; - //Checked state + // Checked state ShapeDrawable rectChecked = new ShapeDrawable(new RectShape()); rectChecked.getPaint().setColor(0xFFFFFFFF); rectChecked.getPaint().setStyle(Paint.Style.STROKE); @@ -73,7 +75,7 @@ public class ThumbnailRadioButton extends RadioButton { Drawable drawableArray[] = new Drawable[]{bmp, rectChecked}; LayerDrawable layerChecked = new LayerDrawable(drawableArray); - //Unchecked state + // Unchecked state ShapeDrawable rectUnchecked = new ShapeDrawable(new RectShape()); rectUnchecked.getPaint().setColor(0x0); rectUnchecked.getPaint().setStyle(Paint.Style.STROKE); @@ -83,17 +85,19 @@ public class ThumbnailRadioButton extends RadioButton { Drawable drawableArray2[] = new Drawable[]{bmp, rectUnchecked}; LayerDrawable layerUnchecked = new LayerDrawable(drawableArray2); - //Statelist drawable + // StateList drawable StateListDrawable states = new StateListDrawable(); states.addState(new int[]{android.R.attr.state_checked}, layerChecked); states.addState(new int[]{}, layerUnchecked); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { setBackground(states); - else + } else { + //noinspection deprecation setBackgroundDrawable(states); + } //Offset text to center/bottom of the checkbox Paint paint = new Paint(); diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-hdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 75b3c978..00000000 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-mdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 4ccd98e0..00000000 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 7c5aeed0..00000000 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 3c45f511..00000000 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/layout/main_layout.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/res/layout/main_layout.xml index 13516d8c..714be844 100644 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/layout/main_layout.xml +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/layout/main_layout.xml @@ -1,44 +1,69 @@ -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#0099cc" tools:context=".MainActivity"> <ImageView android:id="@+id/imageView" android:layout_width="match_parent" android:layout_height="match_parent" + android:contentDescription="@null" android:scaleType="centerCrop" - android:src="@drawable/data" /> + android:src="@drawable/data"/> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="@color/primary_translucent" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> <RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerHorizontal="true" - android:orientation="horizontal" android:layout_above="@+id/seekBar1" - android:layout_marginBottom="8dp"> + android:layout_centerHorizontal="true" + android:layout_marginBottom="8dp" + android:orientation="horizontal"> <com.example.android.renderscriptintrinsic.ThumbnailRadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" - android:text="Blur" /> + android:text="@string/blur"/> <com.example.android.renderscriptintrinsic.ThumbnailRadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Emboss" /> + android:text="@string/emboss"/> <com.example.android.renderscriptintrinsic.ThumbnailRadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Hue" /> + android:text="@string/hue"/> + </RadioGroup> <SeekBar @@ -46,6 +71,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:layout_marginBottom="16dp" /> + android:layout_margin="16dp"/> </RelativeLayout> diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-hdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..933f5634 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-mdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..f0404d61 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..4afeeb58 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..2dde891f --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..adca6170 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values-v11/styles.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values-v11/styles.xml deleted file mode 100644 index f3a90c68..00000000 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values-v11/styles.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <!-- - Base application theme for API 11+. This theme completely replaces - AppBaseTheme from res/values/styles.xml on API 11+ devices. - --> - <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> - <!-- API 11 theme customizations can go here. --> - </style> - - <style name="FullscreenTheme" parent="android:Theme.Holo"> - <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item> - <item name="android:windowActionBarOverlay">true</item> - <item name="android:windowBackground">@null</item> - <item name="buttonBarStyle">?android:attr/buttonBarStyle</item> - <item name="buttonBarButtonStyle">?android:attr/buttonBarButtonStyle</item> - </style> - - <style name="FullscreenActionBarStyle" parent="android:Widget.Holo.ActionBar"> - <item name="android:background">@color/black_overlay</item> - </style> - -</resources> diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values-v14/styles.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values-v14/styles.xml deleted file mode 100644 index a91fd037..00000000 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ -<resources> - - <!-- - Base application theme for API 14+. This theme completely replaces - AppBaseTheme from BOTH res/values/styles.xml and - res/values-v11/styles.xml on API 14+ devices. - --> - <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> - <!-- API 14 theme customizations can go here. --> - </style> - -</resources> diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/colors.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/colors.xml index 327c0604..24618bb9 100644 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/colors.xml +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/colors.xml @@ -1,5 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> <resources> - <color name="black_overlay">#66000000</color> + <color name="primary">#FF5722</color> + <color name="primary_translucent">#99FF5722</color> + <color name="primary_dark">#E64A19</color> + <color name="accent">#00BCD4</color> </resources> diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/strings.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/strings.xml new file mode 100644 index 00000000..837523f2 --- /dev/null +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2016 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> + <string name="blur">Blur</string> + <string name="emboss">Emboss</string> + <string name="hue">Hue</string> +</resources> diff --git a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/styles.xml b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/styles.xml index 12eb9302..3ecc30ea 100644 --- a/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/styles.xml +++ b/renderScript/RenderScriptIntrinsic/Application/src/main/res/values/styles.xml @@ -1,33 +1,25 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2016 The Android Open Source Project - <!-- - Base application theme, dependent on API level. This theme is replaced - by AppBaseTheme from res/values-vXX/styles.xml on newer devices. - --> - <style name="AppBaseTheme" parent="android:Theme.Light"> - <!-- - Theme customizations available in newer API levels can go in - res/values-vXX/styles.xml, while customizations related to - backward-compatibility can go here. - --> - </style> + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - <style name="FullscreenTheme" parent="android:Theme.NoTitleBar"> - <item name="android:windowContentOverlay">@null</item> - <item name="android:windowBackground">@null</item> - <item name="buttonBarStyle">@style/ButtonBar</item> - <item name="buttonBarButtonStyle">@style/ButtonBarButton</item> - </style> + http://www.apache.org/licenses/LICENSE-2.0 - <style name="ButtonBar"> - <item name="android:paddingLeft">2dp</item> - <item name="android:paddingTop">5dp</item> - <item name="android:paddingRight">2dp</item> - <item name="android:paddingBottom">0dp</item> - <item name="android:background">@android:drawable/bottom_bar</item> - </style> + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<resources> - <style name="ButtonBarButton" /> + <style name="Theme.RenderScriptIntrinsic" parent="Theme.AppCompat.NoActionBar"> + <item name="colorPrimary">@color/primary</item> + <item name="colorPrimaryDark">@color/primary_dark</item> + <item name="colorAccent">@color/accent</item> + </style> </resources> diff --git a/renderScript/RenderScriptIntrinsic/README.md b/renderScript/RenderScriptIntrinsic/README.md index 06dc559c..05e1207a 100644 --- a/renderScript/RenderScriptIntrinsic/README.md +++ b/renderScript/RenderScriptIntrinsic/README.md @@ -9,9 +9,9 @@ Also shows how to extends RedioButton with StateListDrawable. Introduction ------------ -[RenderScript][1] is a framework for running computationally intensive tasks at high performance on Android. RenderScript is -primarily oriented for use with data-parallel computation, although serial computationally intensive workloads can -benefit as well. +[RenderScript][1] is a framework for running computationally intensive tasks at high performance on +Android. RenderScript is primarily oriented for use with data-parallel computation, although serial +computationally intensive workloads can benefit as well. RenderScript **intrinsics** are built-in functions that perform well-defined operations often seen in image processing. Intrinsics provide extremely high-performance implementations of standard @@ -27,17 +27,18 @@ mScriptMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS)); ``` -RenderScript intrinsics will usually be the fastest possible way for a developer to perform these operations. The -Android team works closely with our partners to ensure that the intrinsics perform as fast as possible on their -architectures — often far beyond anything that can be achieved in a general-purpose language. +RenderScript intrinsics will usually be the fastest possible way for a developer to perform these +operations. The Android team works closely with our partners to ensure that the intrinsics perform +as fast as possible on their architectures — often far beyond anything that can be achieved in a +general-purpose language. [1]: http://developer.android.com/guide/topics/renderscript/compute.html Pre-requisites -------------- -- Android SDK v23 -- Android Build Tools v23.0.0 +- Android SDK 24 +- Android Build Tools v24.0.0 - Android Support Repository Screenshots @@ -66,7 +67,7 @@ submitting a pull request through GitHub. Please see CONTRIBUTING.md for more de License ------- -Copyright 2014 The Android Open Source Project, Inc. +Copyright 2016 The Android Open Source Project, Inc. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for diff --git a/renderScript/RenderScriptIntrinsic/screenshots/icon-web.png b/renderScript/RenderScriptIntrinsic/screenshots/icon-web.png Binary files differindex 87f9dac0..20c9776d 100644 --- a/renderScript/RenderScriptIntrinsic/screenshots/icon-web.png +++ b/renderScript/RenderScriptIntrinsic/screenshots/icon-web.png diff --git a/renderScript/RenderScriptIntrinsic/template-params.xml b/renderScript/RenderScriptIntrinsic/template-params.xml index a2a93700..0a63cdb2 100644 --- a/renderScript/RenderScriptIntrinsic/template-params.xml +++ b/renderScript/RenderScriptIntrinsic/template-params.xml @@ -20,28 +20,26 @@ <group>RenderScript</group> <package>com.example.android.renderscriptintrinsic</package> - <!-- change minSdk if needed--> - <minSdk>13</minSdk> + <minSdk>14</minSdk> <dependency_external>'renderscript-v8.jar'</dependency_external> <defaultConfig> - renderscriptTargetApi 18 + renderscriptTargetApi 24 renderscriptSupportModeEnabled true </defaultConfig> <strings> <intro> <![CDATA[ - RenderScriptIntrinsic sample that demonstrates how to use RenderScript intrinsics. - Creates several RenderScript intrinsics and shows a filtering result with various parameters. - Also shows how to extends RedioButton with StateListDrawable. +RenderScriptIntrinsic sample that demonstrates how to use RenderScript intrinsics. +Creates several RenderScript intrinsics and shows a filtering result with various parameters. +Also shows how to extends RadioButton with StateListDrawable. ]]> </intro> </strings> <template src="base"/> - <common src="logger"/> <metadata> <status>PUBLISHED</status> @@ -59,7 +57,6 @@ <android>android.renderscript.ScriptIntrinsicBlur</android> <android>android.renderscript.ScriptIntrinsicConvolve5x5</android> <android>android.renderscript.ScriptIntrinsicColorMatrix</android> - <android></android> </api_refs> <description> @@ -71,10 +68,10 @@ Also shows how to extends RedioButton with StateListDrawable. </description> <intro> -<![CDATA[ -[RenderScript][1] is a framework for running computationally intensive tasks at high performance on Android. RenderScript is -primarily oriented for use with data-parallel computation, although serial computationally intensive workloads can -benefit as well. + <![CDATA[ +[RenderScript][1] is a framework for running computationally intensive tasks at high performance on +Android. RenderScript is primarily oriented for use with data-parallel computation, although serial +computationally intensive workloads can benefit as well. RenderScript **intrinsics** are built-in functions that perform well-defined operations often seen in image processing. Intrinsics provide extremely high-performance implementations of standard @@ -90,9 +87,10 @@ mScriptMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS)); ``` -RenderScript intrinsics will usually be the fastest possible way for a developer to perform these operations. The -Android team works closely with our partners to ensure that the intrinsics perform as fast as possible on their -architectures — often far beyond anything that can be achieved in a general-purpose language. +RenderScript intrinsics will usually be the fastest possible way for a developer to perform these +operations. The Android team works closely with our partners to ensure that the intrinsics perform +as fast as possible on their architectures — often far beyond anything that can be achieved in a +general-purpose language. [1]: http://developer.android.com/guide/topics/renderscript/compute.html ]]> |