Comments (6)
这个也可以,有点点不好加,我晚上看看写个监听器吧
from hwtxtreader.
可以通过这个方法监听
mTxtReaderView.setOnPageEdgeListener(new IPageEdgeListener() {
@OverRide
public void onCurrentFirstPage() {
toast("onCurrentFirstPage");
}
@Override
public void onCurrentLastPage() {
toast("onCurrentLastPage");
}
});
from hwtxtreader.
一般的需求应该是是翻书到最后一页继续往左滑才提醒,已经是最后一页了,所以我在onScroll的方法里面加了一个监听。。。
from hwtxtreader.
@TrebleZ 你好 能详细说一下怎么弄的么?
from hwtxtreader.
@saljfla 1、在IPageChangeListener接口中加个方法
void onPageChange(boolean isLast);
2、然后在TxtReaderBaseView的onScroll中实现这个方法
/**
* @param motionEvent motionEvent
* @param motionEvent1 motionEvent1
* @param v v
* @param v1 v1
* @return
*/
@OverRide
public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) {
pageChangeListener.onPageChange(isLastPage()&&v>0
&& CurrentMode != Mode.PressSelectText
&& CurrentMode != Mode.PressUnSelectText
&& CurrentMode != Mode.SelectMoveForward
&& CurrentMode != Mode.SelectMoveBack
);//并且向右滑
return false;
}
3、最后就可以愉快的使用了
textView.setPageChangeListener(object :IPageChangeListener{
override fun onPageChange(isLast: Boolean) {
if(isLast){
ToastUitls.getToast(this@BookReadActivity,"已经是最后一页了")
}
}
override fun onCurrentPage(progress: Float) {
}
})
from hwtxtreader.
@TrebleZ 多谢大佬
from hwtxtreader.
Related Issues (20)
- 添加章节 HOT 14
- 字体 HOT 1
- 调用loadText()方法的时候,文字不会换行 HOT 1
- 请问调用HwTxtPlayActivity.loadTxtFile(this,path),默认文字是竖向如何改成横向 HOT 2
- 选择文件--最近使用过的文件 没东西啊 HOT 1
- AndroidX支持 HOT 2
- 从网络获取目录,从网络获取章节内容,接口在哪? HOT 2
- 怎么一个章节一个章节的加载 HOT 4
- TxtReaderView设置字体大小时崩溃 HOT 1
- Failed to resolve: com.github.bifan-wei:HwTxtReader:V2.2 HOT 4
- Bug HOT 3
- 在模拟器上的运行问题 HOT 10
- 仿真翻页 HOT 1
- 英文单词换行问题 HOT 1
- 为什么一直是竖版显示?如何设置更改? HOT 1
- 兼容sdk 32
- 如何修改字体?
- 上下滑动阅读 HOT 1
- 上下滑动 HOT 7
- 重复字符串导致ANR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hwtxtreader.