(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 |
(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 class HelperUtil { | |
| public static HelperUtilBase getInstance(Context context) { | |
| if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { | |
| return new HelperUtilL(context); | |
| } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { | |
| return new HelperUtilKK(context); | |
| } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { | |
| return new HelperUtilJB(context); |
| public class HelperUtil { | |
| private final HelperUtilImpl mImpl; | |
| public HelperUtil (Context context) { | |
| if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { | |
| mImpl = new HelperUtilImplL(context); | |
| } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { | |
| mImpl = new HelperUtilImplKK(context); |
| <!-- You can change the parent around to whatever you normally use --> | |
| <style name="DebugColors" parent="Theme.AppCompat"> | |
| <!-- System colors --> | |
| <item name="android:windowBackground">@color/__debugWindowBackground</item> | |
| <item name="android:colorPressedHighlight">#FF4400</item> | |
| <item name="android:colorLongPressedHighlight">#FF0044</item> | |
| <item name="android:colorFocusedHighlight">#44FF00</item> | |
| <item name="android:colorActivatedHighlight">#00FF44</item> |
| Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix. | |
| All Clickable Views: | |
| ----------- | |
| * ripple effect (Lollipop only) -- "colorControlHighlight" | |
| Status Bar: | |
| ------------ | |
| * background (Lollipop only) - "colorPrimaryDark" |
| /* | |
| * 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 |
| // your code | |
| apply from: "build-plugins/idea-gradle-sources.gradle" |
| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Copyright (C) 2015 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 |
| public class MyFragment { | |
| boolean loaded; | |
| private void maybeLoad() { | |
| if (!loaded && getUserVisibleHint()) { | |
| loaded = true; | |
| loadMyData(); | |
| } | |
| } | |
| @Override |