-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from HanteIsHante/develop
Develop
- Loading branch information
Showing
28 changed files
with
1,093 additions
and
382 deletions.
There are no files selected for viewing
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
16 changes: 0 additions & 16 deletions
16
app/src/main/java/com/example/hante/thirdopen/ThirdOpenApplication.java
This file was deleted.
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
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/example/hante/thirdopen/activity/BookInfoActivity.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,57 @@ | ||
package com.example.hante.thirdopen.activity; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.widget.Toolbar; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import com.example.hante.thirdopen.R; | ||
import com.example.hante.thirdopen.base.BaseActivity; | ||
import com.example.hante.thirdopen.mvp.model.FreeBookModel; | ||
|
||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
|
||
/** | ||
* Created By HanTe | ||
*/ | ||
|
||
public class BookInfoActivity extends BaseActivity { | ||
|
||
|
||
@BindView(R.id.toolbar) | ||
Toolbar toolbar; | ||
@BindView(R.id.book_image) | ||
ImageView bookImage; | ||
@BindView(R.id.book_name) | ||
TextView bookName; | ||
@BindView(R.id.book_auth) | ||
TextView bookAuth; | ||
@BindView(R.id.booktype) | ||
TextView bookype; | ||
@BindView(R.id.book_progress) | ||
TextView bookProgress; | ||
@BindView(R.id.download) | ||
TextView download; | ||
@BindView(R.id.book_desc) | ||
TextView bookDesc; | ||
|
||
@Override | ||
protected void onCreate (Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.book_info); | ||
ButterKnife.bind(this); | ||
int id = getIntent().getIntExtra("id", 0); | ||
if (id != 0){ | ||
FreeBookModel.getFreeBookInfo(id); | ||
} | ||
} | ||
|
||
public static void setId (Activity activity, int id) { | ||
Intent intent = new Intent(activity, BookInfoActivity.class); | ||
intent.putExtra("id", id); | ||
activity.startActivity(intent); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
app/src/main/java/com/example/hante/thirdopen/animation/SpringScrollView.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.example.hante.thirdopen.animation; | ||
|
||
import android.content.Context; | ||
import android.support.animation.SpringAnimation; | ||
import android.support.v4.widget.NestedScrollView; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
|
||
/** | ||
* 在刚推出的 Support Library 25.3.0 | ||
* 里面新增了一个叫 SpringAnimation 的动画,也就是弹簧动画。 | ||
* 用它来做一个滑动控件下拉回弹的效果 | ||
* 回弹 动画 | ||
*/ | ||
|
||
public class SpringScrollView extends NestedScrollView { | ||
|
||
private float startDragY; | ||
private SpringAnimation mSpringAnimation; | ||
|
||
public SpringScrollView (Context context) { | ||
super(context); | ||
} | ||
|
||
public SpringScrollView (Context context, AttributeSet attrs) { | ||
super(context, attrs, 0); | ||
} | ||
|
||
public SpringScrollView (Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
mSpringAnimation = new SpringAnimation(this, SpringAnimation.TRANSLATION_Y, 0); | ||
// 刚度 默认1200 值越大回弹的速度越快 | ||
mSpringAnimation.getSpring().setStiffness(800.0f); | ||
// 阻尼 默认0.5 值越小,回弹之后来回的次数越多 | ||
mSpringAnimation.getSpring().setDampingRatio(0.50f); | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent (MotionEvent ev) { | ||
switch(ev.getAction()){ | ||
case MotionEvent.ACTION_MOVE: | ||
if(getScrollY() <= 0) { | ||
// 顶部下拉 | ||
if (startDragY == 0){ | ||
startDragY = ev.getRawY(); | ||
} | ||
if (ev.getRawX() - startDragY > 0){ | ||
setTranslationY((ev.getRawY() - startDragY) / 3); | ||
return true; | ||
} else { | ||
startDragY = 0; | ||
mSpringAnimation.cancel(); | ||
setTranslationY(0); | ||
} | ||
} else if ((getScrollY() + getHeight()) >= getChildAt(0).getMeasuredHeight()) { | ||
//底部上拉 | ||
if (startDragY == 0) { | ||
startDragY = ev.getRawY(); | ||
} | ||
if (ev.getRawY() - startDragY < 0) { | ||
setTranslationY((ev.getRawY() - startDragY) / 3); | ||
return true; | ||
} else { | ||
startDragY = 0; | ||
mSpringAnimation.cancel(); | ||
setTranslationY(0); | ||
} | ||
} | ||
break; | ||
case MotionEvent.ACTION_UP: | ||
case MotionEvent.ACTION_CANCEL: | ||
if (getTranslationY() != 0) { | ||
mSpringAnimation.start(); | ||
} | ||
startDragY = 0; | ||
break; | ||
} | ||
return super.onTouchEvent(ev); | ||
} | ||
} |
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
9 changes: 0 additions & 9 deletions
9
app/src/main/java/com/example/hante/thirdopen/base/BaseLazyFragment.java
This file was deleted.
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
2 changes: 1 addition & 1 deletion
2
...xample/hante/thirdopen/base/BaseView.java → ...example/hante/thirdopen/mvp/BaseView.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.example.hante.thirdopen.base; | ||
package com.example.hante.thirdopen.mvp; | ||
|
||
/** | ||
* Created By HanTe | ||
|
Oops, something went wrong.