Git Product home page Git Product logo

hwtxtreader's Introduction

HwTxtReader

前言:

之前项目中有播放txt文件的功能,虽然是一个不难的功能,但是也不简单,陆陆续续做了很久,于是结合之前的经验,决定重新设计代码, 打造一个轻量级Txt阅读器组件,用于提供快速集成加载txt文件的功能,从2017-11月开始,空余时间慢慢做,目前把基本功能实现,剩下的就是优化了。

该库的作用:

针对于要求不是特别高的,想快速实现一个效果还不错的加载txt文件功能,这个应该还是不错的。如果是想做专业的阅读器,你可以去啃fbReader之类的。

目前实现了的功能:

1.字体设置与调节。包括大小、颜色、是否加粗。
2.页面风格设置,夜间模式等。
3.进度跳转与当前进度获取。
4.章节获取与章节跳转。
5.可以滑盖翻页与平移翻页切换。
6.可以进行长按滑动选择复制文字。
7.数字与英文字符显示特点颜色。

更新日志请查看 updateLog.txt文件


目前demo效果图:

image

章节列表效果图:

image

覆盖翻页效果:

image

平移翻页效果:

image

文字复制效果:

image

使用方法:



添加hwtxtreaderlib依赖

    allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
  

 
  dependencies {
	        compile 'com.github.bifan-wei:HwTxtReader:V1.1'
	}
	

使用默认界面使用的话,只需要一句代码:

HwTxtPlayActivity.loadTxtFile(this, FilePath);

使用自定义view的话,直接使用TxtReaderView

xml中:

  <com.hw.txtreaderlib.main.TxtReaderView 
        android:id="@+id/activity_hwtxtplay_readerView" 
        android:layout_width="match_parent"  
        android:layout_height="match_parent" 
       />

代码中调用loadTxtFile方法直接加载文件:

mTxtReaderView.loadTxtFile(FilePath, new ILoadListener() { 
           @Override 
           public void onSuccess() { 
            //加载成功回调 
               initWhenLoadDone(); 
           } 

           @Override 
           public void onFail(TxtMsg txtMsg) { 
              //加载失败回调 
           } 

           @Override 
           public void onMessage(String message) {  
           //加载过程信息回调 
           } 
       }); 


后话:想认真做好这个库,陆陆续续空余时间折腾了一个月才把基本功能做完。忽然发现好累,想想开源也不容易,为那些开源的大神致敬,也希望自己也能做点贡献,如果你觉得还不错,欢迎start支持。

hwtxtreader's People

Contributors

bifan-wei avatar huangwei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.