Skip to content

Instantly share code, notes, and snippets.

Shem shem8

Block or report user

Report or block shem8

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View UserCard.jsx
const UserCard = ({ user, withAvatar }) => {
return (
<div>
{ withAvatar && <img src={user.avatarUrl}/> }
<span>
{user.name}
</span>
<span>
{user.info}
</span>
View userCard.jsx
const UserCard = ({ user, withAvatar }) => {
return (
<div>
{ withAvatar && <img src={user.avatarUrl}/> }
<span>
{user.name}
</span>
<span>
{user.info}
</span>
View userCard.jsx
const UserCard = ({ user, withAvatar }) => {
return (
<div>
{ withAvatar && <img src={user.avatarUrl}/> }
<span>
user.name
</span>
<span>
user.info
</span>
View gist:699352da50c20dd0ed3c40fd0796259d
final View container = findViewById(R.id.container);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) container.getLayoutParams();
final CoordinatorLayout.Behavior<View> behavior = new CoordinatorLayout.Behavior<View>() {
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
return dependency.getId() == R.id.dismiss;
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
View gist:0d59e089f5bce63028d1ba92c5767582
public class SwipeDismissOnlyOnViewBehavior<V extends View> extends SwipeDismissBehavior<V> {
/**
* Handle only touches on this current view
*/
@Override
public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) {
if (parent.isPointInChildBounds(child, (int) event.getX(), (int) event.getY())) {
return super.onTouchEvent(parent, child, event);
}
View gist:5bf21b24c8eca00b08daf782921e4f4a
View dismiss = findViewById(R.id.dismiss);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) dismiss.getLayoutParams();
SwipeDismissBehavior<View> behavior = new SwipeDismissBehavior<>();
behavior.setSwipeDirection(SwipeDismissBehavior.SWIPE_DIRECTION_START_TO_END);
behavior.setListener(new SwipeDismissBehavior.OnDismissListener() {
@Override
public void onDismiss(final View view) {
finish();
}
View CoordinatorLayout-layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:background="#06ff87"/>
View search_to_cancel.xml
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/searchback_search">
<target
android:name="line"
android:animation="@animator/line_to_cancel" />
<target
android:name="circle1"
View circle2_to_cancel.xml
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="trimPathStart"
android:valueFrom="0.4"
android:valueTo="0"
android:duration="600" />
View circle1_to_cancel.xml
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="trimPathStart"
android:valueFrom="0"
android:valueTo="0.6"
android:duration="450" />
You can’t perform that action at this time.