Skip to content

Instantly share code, notes, and snippets.

View andremion's full-sized avatar
:octocat:
Set your status

André Mion andremion

:octocat:
Set your status
View GitHub Profile

Keybase proof

I hereby claim:

  • I am andremion on github.
  • I am andremion (https://keybase.io/andremion) on keybase.
  • I have a public key ASA_YvZFMLvI_8FhDr13_nBSqkX2WZBWg1beEjMxGckmQwo

To claim this, I am signing this object:

@andremion
andremion / TabbedCollapsingToolbarLayout.java
Created March 28, 2017 16:50
CollapsingToolbarLayout subclass that adjust its collapsed height according to tabs.
/**
* {@link CollapsingToolbarLayout} subclass that adjust its collapsed height according to tabs.
*/
public class TabbedCollapsingToolbarLayout extends CollapsingToolbarLayout {
private Toolbar toolbar;
private TabLayout tabLayout;
private int toolbarBottomMargin;
public TabbedCollapsingToolbarLayout(Context context) {
/*
* Copyright (c) 2017. André Mion
*
* 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

http://www.martinfowler.com/bliki/TestDouble.html

##TestDouble

Martin Fowler

17 January 2006

Gerard Meszaros is working on a book to capture patterns for using the various Xunit frameworks. One of the awkward things he's run into is the various names for stubs, mocks, fakes, dummies, and other things that people use to stub out parts of a system for testing. To deal with this he's come up with his own vocabulary which I think is worth spreading further.

public class AutofitGridRecyclerView extends RecyclerView {
private final int mColumnWidth;
private final GridLayoutManager mLayoutManager;
public AutofitRecyclerGridView(Context context) {
this(context, null, 0);
}
public AutofitRecyclerGridView(Context context, @Nullable AttributeSet attrs) {
public class CharacterImageView extends ImageView {
private final Path mPath = new Path();
public CharacterImageView(Context context) {
this(context, null, 0);
}
public CharacterImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
public class GridSpacingDecoration extends RecyclerView.ItemDecoration {
private final int mSpacing;
public GridSpacingDecoration(int spacing) {
mSpacing = spacing;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.ic_menu_animatable);
imageView.setImageDrawable(drawable);
drawable.start();
<!-- res/drawable/ic_menu_animatable.xml -->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_menu_vector">
<target
android:name="menu"
android:animation="@anim/ic_menu_morph"/>
<target
android:name="rotation"
android:animation="@anim/clockwise_rotation"/>
<!-- res/anim/ic_menu_morph.xml -->
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:propertyName="pathData"
android:valueFrom="M20 30,L80 30,M20 50,L80 50,M20 70,L80 70"
android:valueTo= "M50 25,L80 50,M20 50,L80 50,M50 75,L80 50"
android:valueType="pathType"/>