Skip to content

Instantly share code, notes, and snippets.

@sebaslogen
Last active March 3, 2018 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebaslogen/ffdcb15d641e3324c2e4fa0a6002135b to your computer and use it in GitHub Desktop.
Save sebaslogen/ffdcb15d641e3324c2e4fa0a6002135b to your computer and use it in GitHub Desktop.
Imaginary new Android Toolbar constructor
public class Toolbar extends ViewGroup {
public Toolbar(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, getToolbarStyle());
}
private static int getToolbarStyle() {
return (BuildConfig.VERSION_CODE >= Build.VERSION_CODES.O) ? R.attr.newCompatToolbarStyle : R.attr.toolbarStyle;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment