Skip to content

Commit

Permalink
V2.0 加入了讨论界面
Browse files Browse the repository at this point in the history
  • Loading branch information
Charon1997 committed Apr 26, 2017
1 parent 3edd67b commit 7cc6db2
Show file tree
Hide file tree
Showing 46 changed files with 1,400 additions and 272 deletions.
11 changes: 0 additions & 11 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

12 changes: 12 additions & 0 deletions .idea/libraries/circleimageview_2_1_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ dependencies {
compile'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.ashokvarma.android:bottom-navigation-bar:1.3.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
5 changes: 0 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ui.Activities.ContractActivity"
android:label="@string/contract"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"></activity>
<activity
android:name=".ui.Activities.WelcomeActivity"
android:theme="@style/WelcomeTheme">
Expand Down
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 {
}
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 app/src/main/java/com/charon/www/younghawkdemo/model/HomeItem.java
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 app/src/main/java/com/charon/www/younghawkdemo/model/PlanItem.java
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 app/src/main/java/com/charon/www/younghawkdemo/model/Time.java
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;
}
}
Loading

0 comments on commit 7cc6db2

Please sign in to comment.