You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HTTP/2 request/response tagged with ID inside frames
headers/body are separate frames
HPACK compresses header names and values into numbers
-> look into gzip encoding for JSON
bit.ly/ok-libs
bit.ly/decoding-secrets
Direct actions vs Conversation actions
Direct actions no available (yet)
Develop a "persona" to keep conversations consistent
- whimsical vs serious
- write sample dialogs
- Google has a persona design guide sheet
API.AI
Welcome intent response could include available actions
Always close the microphone when conversation ends (Hidden at page bottom under "Actions on Google")
Animations should be:
* Give life and character
* Use an appropriate interpolator
* Be consistent
* BE SUBTLE
* Remain true to your brand
Do not:
* Move things for no reason
* "Overstay your welcome" Don't make animations introduce "lag"
* Be distracting "Always think of clippy"
* Dont animate too many things at once
`Nearby.Messages.publish(client, new Message(bytes))
new play services apis can allow scanning for BTLE beacons without requiring location permission pre android M
Can have beacons show local notification for an app or website (without requiring app to be installed)
* notifications are a reward for "good behavior", not a guarantee
Notifications can target users who dont have the app installed specifically. Can also target at specific times of day
AwarenessFence api is awesome. Looks like you can filter by geolocation, dwell time, even if the phone has headphones plugged in!
New stuff coming in I/O17
iOS nearby apis has "almost near feature parity" with android APIs. Background modes are more difficult though
Android Things provides: IoT Developer Console, Automatic security updates, Signed images, Verified boot
Managed by Google:
Android Framework
Hardware Libraries
Linux Kernel
Managed By Developers:
Apps
User Drivers
Hardware
Supported Platforms:
Raspberry Pi 3
Intel Edison
NXP Pico
An android things system runs 1 app (yours)
Android System UI is not present, app gets the full window for display
Can't assume that a display exists
* All requested permissions granted at install time because there is no way to request them at runtime
Otherwise the SDK is the same as regular Android
Reqs to make a things app
link to provided "com.google.android.things:androidthings support library
<uses-library android:name="com.google.android.things" /> in manifest
Tell andoid to launch app on boot with <intent-filter>
Things support lib
Peripheral I/O
GPIO, PWM, I2C, SPI, UART
User drivers
Bind data from peripherals into the android framework
Used to link a GPS peripheral to LocationManager API, etc.
Allows android to use your sensors intelligently and provide additional functionality (e.g. fused location provider apis)
Peripheral driver libraries (not actually in support lib, on github)
Drivers for common/popular periphperal devices
Animating Hardware :o
Can use ObjectAnimator and interpolators to control outputs
DI separates the logic that creates the dependencies from the logic that uses them
Why Dagger?
Testing!
Instance management
Singletons
New instances each time injected
Release instance in response to memory pressure
Recycle objects
NEW STUFF! Dagger 2.11
AppComponent uses module AndroidSupportInjectionModule and extend AndroidComponent<App>App class extends DaggerApplicationDaggerAppCompatActivity (Super types are convenience types, the stuff they do seems pretty simple and could be copied to a custom class)
@ContributesAndroidInjector <- things that "just makes things work" No more @Subcomponent
Common scopes
- @ApplicationScope
- @ActivityScope
Common modules for system services
RIP Thermosiphon
Constraints -> Equations -> Solver (Cassowary Linear Arithmetic Constraint Solving Algorithm like on iOS)
Vocabulary
Edge constraint
Source and target
One side of source view constrained to one side of target view
Center Constraint
Position center of a view on an axis
Adjustable bias controls distribution of space allocated to opposing edge constraints
Baseline constraint
Align TextViews based on their text baselines
Size constraints
Fixed
Wrap
Match constraints (like match_parent?)
REQUIRES 2 LAYOUT PASSES (like relative layouts)
Guidelines
Targets which are not views (like layout guides in storyboards)
Can define as:
offset from a view
Percent
What can it do?
Square image view
Dimension ratio layout_constraintDimensionRatio="W,1:1"
eliminates need for measuring code
Ratios can be defined as R.string resources
Better than RelativeLayout?
Relative layout has to make 2 passes for each layout
StylingANdroid constraint layout blog post #6
Relative layout is very generic and not very powerful
CHAINS!
Seems like stackview/linear layout
* spread chain
* spread inside chain
- set on head item in chain (left/top)
* weighted chain
- set weight on each item
* packed chain
* packed chain with bias
ConstraintSet
save a set of constraints and apply later
can create manually
from layout file
Animate between alternate constraint sets
List items can be constraint layouts
Can be used to replace custom ViewGroups
Inefficient memory access
* Unneccesary: Fetch what we already have
* Repetitive: Fetch one at a time
* Lazy: Not fetching until we need it urgently
* Redundant: Writing values that will be re-written later
Reordered code and memory access make impossible things possible
github.com/googlesamples/android-architecture
Unit tests cant test concurrency
One-in-a-million bugs happen all the time
⚔️⚔️⚔️⚔️⚔️⚔️⚔️⚔️⚔️⚔️
ExecutorService - manages thread creation
volatile (guards fields)
* ALWAYS READS/WRITES TO/FROM RAM IMMEDITELY (not L1/2 cache)
* reading/writing volatile field causes all reads to be refreshed
* IS NOT ATOMIC, still reads, then writes
synchronized (guards methods)
* Every object has a lock
* On entry, all reads are refreshed
* On exit, all writes are flushed
* github.com/square/okhttp/wiki/concurrency
AtomicInteger etc
CountDownLatchBlockingQueue
* Watch your capacity!
ScheduledThreadPoolExecutor
* run after a delay or repeating interval
* Handler.postDelayed() no!
Effective concurrency
Main thread is the Boss!
* owns all the data
* Delegates immutable tasks to worker threads
* Workers post immutable results back to main thread
Immutable values
* Shared objects in threads are unsafe to change
* AutoValue
* Kotlin data classes!
Models go on the main thread
* App state on main thread
* Keep main thread synchronous
* Dont Handler.post() on main thread (unless wait for layout to complete)
I/O goes on worker threads
* be deliberate about posting back to the main thread
* @MainThread@WorkerThread
* Rx on main. Define a checkMainThread that crashes if not on main
No gratuitous animations! Motion should provide meaning
8dp baseline grid
keylines
ratios
changes in nested layouts require remeasuring parent components
Gone margins
Tools attributes
* tools:showIn - show this layout embedded in another one
* tools:layout - which layout to use for a fragment
* tools:listItem - Layout for item rows
* tools:parentTag - define which layout to use as parent for merge tag
Shortcuts
* <esc> select parent group
* <ctrl><shift> <r/l arrow> switch between xml/design mode
Inference
* Based on probability model for connections
* Automatically creates constraints for unconstrained views
* Doesn't move views or remove existing constraints
Inter-activity transitions
* explode, slide, fade
* Shared elements
- Bounds, clip, transform, image transform
* Flow from one to the other
Constraint sets
* Separates views from how they are laid out
* Encapsulate all constraints into a single object
* Apply constraint set to an existing constraint layout
* Switch and transition between multiple constraint sets
* overriding `configChanges`???
ConstraintLayouts and Motion
* flat hierarchy == no clipping
* Scene graph
* Constraint set == a keyframe
Slice Editor !
* Shows the attributes from xlm _accross all files_ that affect selected object
- Layout XML
- Dimens
- etc
ConstraintLayout 1.1 (!)
* Barriers - Min and Max for constraints
* Percent dimensions
- current default on match parent is spread
- define max dimension of spread as percentage of parent size
* Groups - Apply an operation to several views at once