-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3edd67b
commit 7cc6db2
Showing
46 changed files
with
1,400 additions
and
272 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/charon/www/younghawkdemo/biz/EndLessRecyclerOnScrollListener.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.charon.www.younghawkdemo.biz; | ||
|
||
/** | ||
* Created by Administrator on 2017/4/26. | ||
*/ | ||
|
||
public class EndLessRecyclerOnScrollListener { | ||
} |
100 changes: 100 additions & 0 deletions
100
app/src/main/java/com/charon/www/younghawkdemo/biz/ScrollAwareFABBehavior.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package com.charon.www.younghawkdemo.biz; | ||
|
||
import android.content.Context; | ||
import android.os.Build; | ||
import android.support.design.widget.CoordinatorLayout; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.v4.view.ViewCompat; | ||
import android.support.v4.view.ViewPropertyAnimatorListener; | ||
import android.support.v4.view.animation.FastOutSlowInInterpolator; | ||
import android.util.AttributeSet; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.view.animation.Animation; | ||
import android.view.animation.AnimationUtils; | ||
import android.view.animation.Interpolator; | ||
|
||
import com.charon.www.younghawkdemo.R; | ||
|
||
/** | ||
* Created by Administrator on 2017/4/25. | ||
*/ | ||
|
||
public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { | ||
private static final Interpolator INTERPOLATOR = new FastOutSlowInInterpolator(); | ||
private boolean mIsAnimatingOut = false; | ||
|
||
public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { | ||
super(); | ||
} | ||
|
||
@Override | ||
public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View directTargetChild, final View target, final int nestedScrollAxes) { | ||
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes); | ||
} | ||
|
||
@Override | ||
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) { | ||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); | ||
Log.d("behavior", "dy" + dyConsumed + "dyu"+dyUnconsumed); | ||
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE){ | ||
Log.d("behavior", "out"); | ||
animateOut(child); | ||
} | ||
else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE){ | ||
Log.d("behavior", "in"); | ||
animateIn(child); | ||
} | ||
|
||
} | ||
|
||
private void animateOut(final FloatingActionButton button) { | ||
if (Build.VERSION.SDK_INT >= 14) { | ||
ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR).withLayer().setListener(new ViewPropertyAnimatorListener() { | ||
public void onAnimationStart(View view) { | ||
ScrollAwareFABBehavior.this.mIsAnimatingOut = true; | ||
} | ||
|
||
public void onAnimationCancel(View view) { | ||
ScrollAwareFABBehavior.this.mIsAnimatingOut = false; | ||
} | ||
|
||
public void onAnimationEnd(View view) { | ||
ScrollAwareFABBehavior.this.mIsAnimatingOut = false; | ||
view.setVisibility(View.INVISIBLE); | ||
} | ||
}).start(); | ||
} else { | ||
Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_out); | ||
anim.setInterpolator(INTERPOLATOR); | ||
anim.setDuration(200L); | ||
anim.setAnimationListener(new Animation.AnimationListener() { | ||
public void onAnimationStart(Animation animation) { | ||
ScrollAwareFABBehavior.this.mIsAnimatingOut = true; | ||
} | ||
|
||
public void onAnimationEnd(Animation animation) { | ||
ScrollAwareFABBehavior.this.mIsAnimatingOut = false; | ||
button.setVisibility(View.INVISIBLE); | ||
} | ||
|
||
@Override | ||
public void onAnimationRepeat(final Animation animation) { | ||
} | ||
}); | ||
button.startAnimation(anim); | ||
} | ||
} | ||
|
||
private void animateIn(FloatingActionButton button) { | ||
button.setVisibility(View.VISIBLE); | ||
if (Build.VERSION.SDK_INT >= 14) { | ||
ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR).withLayer().setListener(null).start(); | ||
} else { | ||
Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_in); | ||
anim.setDuration(200L); | ||
anim.setInterpolator(INTERPOLATOR); | ||
button.startAnimation(anim); | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
app/src/main/java/com/charon/www/younghawkdemo/model/HomeItem.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.charon.www.younghawkdemo.model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by Administrator on 2017/4/25. | ||
*/ | ||
|
||
public class HomeItem { | ||
private int img; | ||
private String userName; | ||
private Time pubTime; | ||
private String pubContent; | ||
private int likeNum; | ||
private int commentNum; | ||
|
||
public HomeItem(int img, String userName, Time pubTime, String pubContent, int likeNum, int commentNum) { | ||
this.img = img; | ||
this.userName = userName; | ||
this.pubTime = pubTime; | ||
this.pubContent = pubContent; | ||
this.likeNum = likeNum; | ||
this.commentNum = commentNum; | ||
} | ||
|
||
public int getImg() { | ||
return img; | ||
} | ||
|
||
public void setImg(int img) { | ||
this.img = img; | ||
} | ||
|
||
public String getUserName() { | ||
return userName; | ||
} | ||
|
||
public void setUserName(String userName) { | ||
this.userName = userName; | ||
} | ||
|
||
public Time getPubTime() { | ||
return pubTime; | ||
} | ||
|
||
public void setPubTime(Time pubTime) { | ||
this.pubTime = pubTime; | ||
} | ||
|
||
public String getPubContent() { | ||
return pubContent; | ||
} | ||
|
||
public void setPubContent(String pubContent) { | ||
this.pubContent = pubContent; | ||
} | ||
|
||
public int getLikeNum() { | ||
return likeNum; | ||
} | ||
|
||
public void setLikeNum(int likeNum) { | ||
this.likeNum = likeNum; | ||
} | ||
|
||
public int getCommentNum() { | ||
return commentNum; | ||
} | ||
|
||
public void setCommentNum(int commentNum) { | ||
this.commentNum = commentNum; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/charon/www/younghawkdemo/model/PlanItem.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.charon.www.younghawkdemo.model; | ||
|
||
/** | ||
* Created by Administrator on 2017/4/26. | ||
*/ | ||
|
||
public class PlanItem { | ||
private String userName; | ||
private Time pubTime; | ||
private String pubContent; | ||
|
||
public PlanItem(String userName, Time pubTime, String pubContent) { | ||
this.userName = userName; | ||
this.pubTime = pubTime; | ||
this.pubContent = pubContent; | ||
} | ||
|
||
public String getUserName() { | ||
return userName; | ||
} | ||
|
||
public void setUserName(String userName) { | ||
this.userName = userName; | ||
} | ||
|
||
public Time getPubTime() { | ||
return pubTime; | ||
} | ||
|
||
public void setPubTime(Time pubTime) { | ||
this.pubTime = pubTime; | ||
} | ||
|
||
public String getPubContent() { | ||
return pubContent; | ||
} | ||
|
||
public void setPubContent(String pubContent) { | ||
this.pubContent = pubContent; | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
app/src/main/java/com/charon/www/younghawkdemo/model/Time.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.charon.www.younghawkdemo.model; | ||
|
||
/** | ||
* Created by Administrator on 2017/4/25. | ||
*/ | ||
|
||
public class Time { | ||
private int year; | ||
private int month; | ||
private int day; | ||
private int hour; | ||
private int min; | ||
private int sec; | ||
|
||
public Time() { | ||
|
||
} | ||
|
||
public Time(int year, int month, int day) { | ||
this.year = year; | ||
this.month = month; | ||
this.day = day; | ||
} | ||
|
||
public Time(int year, int month, int day, int hour, int min) { | ||
this.year = year; | ||
this.month = month; | ||
this.day = day; | ||
this.hour = hour; | ||
this.min = min; | ||
} | ||
|
||
public int getYear() { | ||
return year; | ||
} | ||
|
||
public void setYear(int year) { | ||
this.year = year; | ||
} | ||
|
||
public int getMonth() { | ||
return month; | ||
} | ||
|
||
public void setMonth(int month) { | ||
this.month = month; | ||
} | ||
|
||
public int getDay() { | ||
return day; | ||
} | ||
|
||
public void setDay(int day) { | ||
this.day = day; | ||
} | ||
|
||
public int getHour() { | ||
return hour; | ||
} | ||
|
||
public void setHour(int hour) { | ||
this.hour = hour; | ||
} | ||
|
||
public int getMin() { | ||
return min; | ||
} | ||
|
||
public void setMin(int min) { | ||
this.min = min; | ||
} | ||
|
||
public int getSec() { | ||
return sec; | ||
} | ||
|
||
public void setSec(int sec) { | ||
this.sec = sec; | ||
} | ||
} |
Oops, something went wrong.