View UserCard.jsx
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
const UserCard = ({ user, withAvatar }) => { | |
return ( | |
<div> | |
{ withAvatar && <img src={user.avatarUrl}/> } | |
<span> | |
{user.name} | |
</span> | |
<span> | |
{user.info} | |
</span> |
View userCard.jsx
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
const UserCard = ({ user, withAvatar }) => { | |
return ( | |
<div> | |
{ withAvatar && <img src={user.avatarUrl}/> } | |
<span> | |
{user.name} | |
</span> | |
<span> | |
{user.info} | |
</span> |
View userCard.jsx
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
const UserCard = ({ user, withAvatar }) => { | |
return ( | |
<div> | |
{ withAvatar && <img src={user.avatarUrl}/> } | |
<span> | |
user.name | |
</span> | |
<span> | |
user.info | |
</span> |
View gist:699352da50c20dd0ed3c40fd0796259d
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
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
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
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
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
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
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
<?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
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
<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
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
<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
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
<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" /> |
NewerOlder