(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.
| package com.example.scalpeldrawer; | |
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.support.v4.widget.DrawerLayout; | |
| import android.util.AttributeSet; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.widget.CheckBox; |
| /* | |
| * Copyright 2014 Google Inc. | |
| * | |
| * 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 |
| import android.animation.ObjectAnimator; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.Color; | |
| import android.graphics.Paint; | |
| import android.util.AttributeSet; | |
| import android.util.TypedValue; | |
| import android.widget.CheckBox; | |
| import android.widget.ImageView; |
| /* | |
| * Copyright (C) 2014 Antonio Leiva Gordillo. | |
| * | |
| * 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 |
| /* | |
| * Copyright 2014 Chris Banes | |
| * | |
| * 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 |
| import android.content.res.Resources; | |
| import android.graphics.drawable.Drawable; | |
| import android.text.Spannable; | |
| import android.text.SpannableStringBuilder; | |
| import android.text.style.ImageSpan; | |
| import android.view.View; | |
| import android.widget.ImageView; | |
| import android.widget.LinearLayout; | |
| import android.widget.SearchView; | |
| import android.widget.TextView; |
(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.
| /* | |
| * Copyright 2014 Chris Banes | |
| * | |
| * 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 |
| /** | |
| * Show the activity over the lockscreen and wake up the device. If you launched the app manually | |
| * both of these conditions are already true. If you deployed from the IDE, however, this will | |
| * save you from hundreds of power button presses and pattern swiping per day! | |
| */ | |
| public static void riseAndShine(Activity activity) { | |
| activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED); | |
| PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE); | |
| PowerManager.WakeLock lock = |