(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| public Bitmap blurBitmap(Bitmap bitmap){ | |
| //Let's create an empty bitmap with the same size of the bitmap we want to blur | |
| Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); | |
| //Instantiate a new Renderscript | |
| RenderScript rs = RenderScript.create(getApplicationContext()); | |
| //Create an Intrinsic Blur Script using the Renderscript | |
| ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| <?xml version="1.0" encoding="utf-8"?> | |
| <resources> | |
| <!-- google's material design colours from | |
| http://www.google.com/design/spec/style/color.html#color-ui-color-palette --> | |
| <!--reds--> | |
| <color name="md_red_50">#FFEBEE</color> | |
| <color name="md_red_100">#FFCDD2</color> | |
| <color name="md_red_200">#EF9A9A</color> |
| package com.pascalwelsch.utils; | |
| import android.support.annotation.Nullable; | |
| import android.support.v7.util.DiffUtil; | |
| import android.support.v7.widget.RecyclerView; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.Comparator; | |
| import java.util.List; |
| public class BatteryActivity extends Activity { | |
| //UI Elements | |
| private TextView mTextViewLevel; | |
| private TextView mTextViewTemperature; | |
| private TextView mTextViewVoltage; | |
| private TextView mTextViewHealth; | |
| //Battery details | |
| private int level; |
| public class AccountAuthenticator extends AbstractAccountAuthenticator { | |
| private final Context context; | |
| @Inject @ClientId String clientId; | |
| @Inject @ClientSecret String clientSecret; | |
| @Inject ApiService apiService; | |
| public AccountAuthenticator(Context context) { | |
| super(context); |
| public class SimpleListLayout extends TwoWayLayoutManager { | |
| public SimpleListLayout(Context context, Orientation orientation) { | |
| super(context, orientation); | |
| } | |
| @Override | |
| protected void measureChild(View child, Direction direction) { | |
| measureChildWithMargins(child, 0, 0); | |
| } |
| <!-- Required for on Android TV to receive Boot Completed events --> | |
| <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |
| <!-- Need to Register the Recommendation Intent Service --> | |
| <service android:name="us.nineworlds.serenity.core.services.OnDeckRecommendationIntentService" | |
| android:enabled="true" android:exported="true"/> | |
| <!-- The Receiver that actually responds to the Boot Completed event, needed | |
| to start the recommendation service automatically when bootup has |
| import com.google.auto.value.AutoValue; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.Target; | |
| import static java.lang.annotation.ElementType.TYPE; | |
| import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| /** | |
| * Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization. | |
| * <p> |