您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 基于Android平台的手机电子书阅读器代码模板
基于Android平台的手机电子书阅读器代码packagecom.lrc.view;/***书籍阅读*/importjava.io.IOException;importjava.lang.reflect.Array;importjava.math.BigDecimal;importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;importjava.util.Vector;importjava.util.regex.Matcher;importjava.util.regex.Pattern;importcom.lrc.R;importcom.lrc.bll.BookPageFactory;importcom.lrc.bll.DbDataOperation;importcom.lrc.bll.DbTags;importcom.lrc.bll.PageWidget;importcom.lrc.util.ArrayUtil;importcom.lrc.util.BgUtil;importcom.lrc.util.MathUtil;importcom.lrc.util.TimeUtil;importandroid.app.Activity;importandroid.app.AlertDialog;importandroid.content.ContentResolver;importandroid.content.ContentValues;importandroid.content.DialogInterface;importandroid.content.Intent;importandroid.graphics.Bitmap;importandroid.graphics.Canvas;importandroid.graphics.Color;importandroid.net.Uri;importandroid.os.Bundle;importandroid.os.Handler;importandroid.os.Message;importandroid.provider.Settings;importandroid.util.DisplayMetrics;importandroid.util.Log;importandroid.view.Gravity;importandroid.view.KeyEvent;importandroid.view.Menu;importandroid.view.MotionEvent;importandroid.view.View;importandroid.view.View.OnClickListener;importandroid.view.View.OnTouchListener;importandroid.view.ViewGroup.LayoutParams;importandroid.view.Window;importandroid.view.WindowManager;importandroid.widget.AdapterView;importandroid.widget.AdapterView.OnItemClickListener;importandroid.widget.EditText;importandroid.widget.GridView;importandroid.widget.ImageButton;importandroid.widget.LinearLayout;importandroid.widget.PopupWindow;importandroid.widget.ProgressBar;importandroid.widget.SeekBar;importandroid.widget.SimpleAdapter;importandroid.widget.TextView;importandroid.widget.SeekBar.OnSeekBarChangeListener;importandroid.widget.Toast;publicclassBookReadActivityextendsActivity{privatePageWidgetmPageWidget;BitmapmCurPageBitmap,mNextPageBitmap;CanvasmCurPageCanvas,mNextPageCanvas;publicstaticBookPageFactorypagefactory;intscreenWidth,screenHeight;intbookId;StringbookPath,bookName,bookProgress;privateintbookBeginPosition;//dbprivateContentResolverresolver;//tabMenupublicfinalstaticintTITLE_USING_OFTEN=0;publicfinalstaticintTITLE_TOOLS=1;publicfinalstaticintMENU_FONT_SIZE=0;publicfinalstaticintMENU_READ_THEME=1;publicfinalstaticintMENU_BRIGHTNESS_CONTROL=2;publicfinalstaticintMENU_FLIP_OVER=3;publicfinalstaticintMENU_JUMP=4;publicfinalstaticintMENU_SEARCH=5;publicfinalstaticintMENU_PRE_CHAPTER=6;publicfinalstaticintMENU_NEXT_CHAPTER=7;publicfinalstaticintMENU_CUSTOM_THEME=0;publicfinalstaticintMENU_AUDIO_BOOK=1;publicfinalstaticintMENU_BOOK_CHAPTER=2;publicfinalstaticintMENU_BOOK_CODE=3;publicfinalstaticintMENU_BOOK_MARK=4;publicfinalstaticintMENU_SETTING=5;publicfinalstaticintMENU_SHARE=6;publicfinalstaticintMENU_BACK=7;TabMenu.MenuBodyAdapter[]bodyAdapter=newTabMenu.MenuBodyAdapter[2];TabMenu.MenuTitleAdaptertitleAdapter;TabMenutabMenu;intselTitle=0;PopupWindowpopupWindow;//定义每项分页栏的内容String[]title1BodyName,title2BodyName;int[]title1BodyIcon,title2BodyIcon;privateSeekBarsbFontSize,sbBrightnessControl,sbJump;//menujumpprivateTextViewtvCurrentProgress;privateImageButtonibtnJumpUp,ibtnJumpDown;//flipoverprivateHandlerreadHandler=newHandler();privateFlipOverRunnableflipOverRunnable=newFlipOverRunnable();privatebooleanisRead=true;//menucustomthemeprivateSeekBarredForegroundSeekBar,greenForegroundSeekBar,blueForegroundSeekBar,redBackgroundSeekBar,greenBackgroundSeekBar,blueBackgroundSeekBar;intcurrentProgress;privateTextViewfontColorTxt,backgroundColorTxt,themeStyleTxt;privateintredForegoundProgress,greenForegroundProgress,blueForegroundProgress,redBackgoundProgress,greenBackgroundProgress,blueBackgroundProgress;privateStringforeColor,foreR=00,foreG=00,foreB=00,backColor,backR=00,backG=00,backB=00;privateintcurrentForeColorId,currentBackColorId;//chapterPatternpattern=Pattern.compile(第{1}.+章{1}.+);Matchermatcher;ListStringchapterName=newArrayListString();ListIntegerchapterBeginPositions=newArrayListInteger();VectorStringlines;intchapterNum=0;privateAlertDialogchapterDialog;privateStringcurrentChapterName=wu;privateintcurrentBeginPosition=0;HandlerchapterHandler=newHandler(){@OverridepublicvoidhandleMessage(Messagemsg){super.handleMessage(msg);if(msg.what==0){//updateView();showChapterDialog();}elseif(msg.what==1){chapterDialog.setMessage(正在提取章节,请稍后...\n已发现章节:[+chapterNum+]+currentChapterName);}elseif(msg.what==2){mPageWidget.invalidate();}}};//preandnextchapterprivateStringcurrentChapter;privateintcurrentChapterIndex;privatebooleanpreOrNext=true;HandlerpreHandler=newHandler(){@OverridepublicvoidhandleMessage(Messagemsg){super.handleMessage(msg);for(inti=0;ichapterName.size();i++){if(chapterName.get(i).equals(currentChapter)){currentChapterIndex=i;Log.i(chapter+i+--,currentChapterIndex+);break;}}if(currentChapterIndex==0){newAlertDialog.Builder(BookReadActivity.this).setTitle(提示).setMessage(已是第一章!).setPositiveButton(确定,null).show();}else{pagefactory.setM_mbBufBegin(chapterB
本文标题:基于Android平台的手机电子书阅读器代码模板
链接地址:https://www.777doc.com/doc-3496079 .html