This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Behavior for FABs that does not support anchoring to AppBarLayout, but instead translates the FAB | |
* out of the bottom in sync with the AppBarLayout collapsing towards the top. | |
* <p> | |
* Extends FloatingActionButton.Behavior to keep using the pre-Lollipop shadow padding offset. | |
*/ | |
public class AppBarBoundFabBehavior extends FloatingActionButton.Behavior { | |
public AppBarBoundFabBehavior(Context context, AttributeSet attrs) { | |
super(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Prompts for device to use from adb devices -l first; inserts -s parameter. | |
# No sanitizing, error checking or warranties! | |
# Use like | |
# $choose_device adb shell | |
DEVICES=`adb devices -l | sed 1d` | |
PS3="Choose device or Ctrl+C to quit: " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using ListAdapter for the shorter example; the same holds for any use of (Async)ListDiffer - the point here | |
// is about easy implementation of [areContentsTheSame] by just using equality on data class items. | |
// The expectation here is that updates to the item list result in the correct adapter notifications (and resulting | |
// animations). | |
class ExampleAdapter : ListAdapter<ExampleViewHolder, ExampleItem>(ExampleDiffCallback) { | |
object ExampleDiffCallback : DiffUtil.ItemCallback<ExampleItem> { | |
override fun areItemsTheSame(oldItem: ExampleItem, newItem: ExampleItem) = oldItem.id == newItem.id | |
override fun areContentsTheSame(oldItem: ExampleItem, newItem: ExampleItem) = oldItem == newItem |