2024年3月14日发(作者:)
基于Android平台的手机电子书阅读器代码
package ;
/**
* 书籍阅读
*/
import ption;
import ;
import imal;
import ist;
import p;
import ;
import ;
import ;
import r;
import n;
import .R;
import geFactory;
import Operation;
import ;
import dget;
import til;
import ;
import il;
import il;
import ty;
import ialog;
import tResolver;
import tValues;
import Interface;
import ;
import ;
import ;
import ;
import ;
import ;
import r;
import e;
import gs;
import yMetrics;
import ;
import y;
import nt;
import ;
import Event;
import ;
import kListener;
import hListener;
import Params;
import ;
import Manager;
import rView;
import ClickListener;
import xt;
import ew;
import utton;
import Layout;
import indow;
import ssBar;
import r;
import Adapter;
import ew;
import BarChangeListener;
import ;
public class BookReadActivity extends Activity
{
private PageWidget mPageWidget;
Bitmap mCurPageBitmap, mNextPageBitmap;
Canvas mCurPageCanvas, mNextPageCanvas;
public static BookPageFactory pagefactory;
int screenWidth ,screenHeight;
int bookId;
String bookPath,bookName,bookProgress;
private int bookBeginPosition;
//db
private ContentResolver resolver;
//tabMenu
public final static int TITLE_USING_OFTEN = 0;
public final static int TITLE_TOOLS = 1;
public final static int MENU_FONT_SIZE = 0;
public final static int MENU_READ_THEME = 1;
public final static int MENU_BRIGHTNESS_CONTROL = 2;
public final static int MENU_FLIP_OVER = 3;
public final static int MENU_JUMP = 4;
public final static int MENU_SEARCH = 5;
public final static int MENU_PRE_CHAPTER = 6;
public final static int MENU_NEXT_CHAPTER= 7;
public final static int MENU_CUSTOM_THEME = 0;
public final static int MENU_AUDIO_BOOK = 1;
public final static int MENU_BOOK_CHAPTER = 2;
public final static int MENU_BOOK_CODE = 3;
public final static int MENU_BOOK_MARK = 4;
public final static int MENU_SETTING = 5;
public final static int MENU_SHARE = 6;
public final static int MENU_BACK = 7;
dyAdapter
dyAdapter[2];
[]bodyAdapter=new
tleAdapter titleAdapter;
TabMenu tabMenu;
int selTitle=0;
PopupWindow popupWindow;
//定义每项分页栏的内容
String[] title1BodyName , title2BodyName;
int[] title1BodyIcon , title2BodyIcon;
private SeekBar sbFontSize,sbBrightnessControl,sbJump;
//menu jump
private TextView tvCurrentProgress ;
private ImageButton ibtnJumpUp,ibtnJumpDown;
//flip over
private Handler readHandler = new Handler();
private FlipOverRunnable flipOverRunnable = new FlipOverRunnable();
private boolean isRead = true;
//menu custom theme
private SeekBar
redForegroundSeekBar,greenForegroundSeekBar,blueForegroundSeekBar,
redBackgroundSeekBar,greenBackgroundSeekBar,blueBackgroundSeekBar;
int currentProgress;
private TextView fontColorTxt,backgroundColorTxt,themeStyleTxt ;
private int
redForegoundProgress,greenForegroundProgress,blueForegroundProgress,
redBackgoundProgress,greenBackgroundProgress,blueBackgroundProgress;
private String
foreColor,foreR="00",foreG="00",foreB="00",backColor,backR="00",backG="00",b
ackB="00";
private int currentForeColorId,currentBackColorId;
//chapter
Pattern pattern = e("第{1}.+章{1}.+");
Matcher matcher;
List
List
Vector
int chapterNum = 0;
private AlertDialog chapterDialog;
private String currentChapterName = "wu";
private int currentBeginPosition = 0;
Handler chapterHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
Message(msg);
if( == 0)
{
// updateView();
showChapterDialog();
}
else if( == 1)
{
sage("正在提取章节,请稍后...n已发现章节:
["+chapterNum+"] "+currentChapterName);
}
else if( == 2)
{
date();
}
}
};
//pre and next chapter
private String currentChapter;
private int currentChapterIndex;
private boolean preOrNext = true;
Handler preHandler = new Handler(){
@Override
public void handleMessage(Message msg)
{
Message(msg);
for(int i=0;i<();i++)
{
if((i).equals(currentChapter))
{
currentChapterIndex = i;
Log.i("chapter"+i+"-->",currentChapterIndex+"");
break;
}
}
if(currentChapterIndex==0)
{
new r().setTitle("提示").setMessage("已
是第一章!").setPositiveButton("确定", null).show();
}
else
{
_mbBufBegin((currentChapterInde
x-1));
updateView();
}
}
};
Handler nextHandler = new Handler(){
@Override
public void handleMessage(Message msg)
{
Message(msg);
for(int i=0;i<();i++)
{
Log.i("name"+i,(i));
if((i).equals(currentChapter))
{
currentChapterIndex = i;
Log.i("chapter"+i+"-->",currentChapterIndex+"");
break;
}
}
if(currentChapterIndex==(()-1))
{
new r().setTitle("提示").setMessage("已
是最后一章!").setPositiveButton("确定", null).show();
}
else
{
_mbBufBegin((currentChapterInde
x+1));
updateView();
}
}
};
@Override
public void onCreate(Bundle savedInstanceState)
{
te(savedInstanceState);
resolver = getContentResolver();
requestWindowFeature(E_NO_TITLE);
getWindow().setFlags(_FULLSCREEN,Wi
_FULLSCREEN);
mPageWidget = new PageWidget(this);
setContentView(mPageWidget);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
screenWidth = ixels;
screenHeight = Pixels;
mCurPageBitmap = Bitmap(screenWidth, screenHeight,
_8888);
mNextPageBitmap = Bitmap
.createBitmap(screenWidth, screenHeight, _8888);
mCurPageCanvas = new Canvas(mCurPageBitmap);
mNextPageCanvas = new Canvas(mNextPageBitmap);
pagefactory = new BookPageFactory(screenWidth, screenHeight);
itmap(tableBg(this,screenWidth,screenHeight
,_bg_3));
try
{
bookPath = getIntent().getExtras().getString(_BOOK_PATH);
bookName = getIntent().getExtras().getString(_BOOK_NAME);
bookId = getIntent().getExtras().getInt(_BOOK_ID);
bookProgress
getIntent().getExtras().getString(_BOOK_PROGRESS);
bookBeginPosition
getIntent().getExtras().getInt(_BOOK_BEGIN_POSITION);
ok(bookPath);
if(bookProgress==null||("onlyRead"))
{
(mCurPageCanvas);
n("1");
}
else if(("begin"))
{
=
=
_mbBufBegin(getIntent().getIntExtra("begin", 0));
updateView();
n("2");
}
else
{
_mbBufBegin(bookBeginPosition);
n("3");
updateView();
}
}
catch (IOException e1)
{
tackTrace();
xt(this, "电子书不存在",
_SHORT).show();
}
maps(mCurPageBitmap, mCurPageBitmap);
ouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent e)
{
boolean ret=false;
if(popupWindow==null||!ing())
{
if (v == mPageWidget)
{
if (ion() == _DOWN) {
nimation();
rnerXY((), ());
(mCurPageCanvas);
if (Right())
{
try
{
e();
}
catch (IOException e1)
{
tackTrace();
}
if(tPage())
{
// xt(,
页!", 200).show();
return false;
}
(mNextPageCanvas);
} else
{
try
{
ge();
已到第一"
}
catch (IOException e1)
{
tackTrace();
}
if(Page())
{
// xt(,
一页!", 200).show();
return false;
}
(mNextPageCanvas);
}
maps(mCurPageBitmap, mNextPageBitmap);
已到最后"
}
ret = hEvent(e);
return ret;
}
}
return false;
}
});
//设置分页栏的标题
titleAdapter = new tleAdapter(this, new String[] { "常用",
"工具",}, 16, 0xFF222222,,);
//定义每项分页栏的内容
title1BodyName = new String[] { "字体大小", "阅读主题", "亮度调节","开始翻
页","跳转","搜索","上一章","下一章"};
title1BodyIcon = new int[]
{ _fontsize,_theme,_light,
_play,_jump,_search,
_pre,_next};
title2BodyName = new String[] { "自定主题", "开始朗诵","章节目录", "文章编
码", "书签", "设置", "分享", "退出"};
title2BodyIcon
{
= new int[]
_theme,_play, _extract,
_charset, _bookmark
, _setting, _share,
_exit};
bodyAdapter[0]=new
dyAdapter(this,title1BodyName,title1BodyIcon,12, 0xFF000000);
bodyAdapter[1]=new
dyAdapter(this,title2BodyName,title2BodyIcon,12, 0xFF000000);
tabMenu=new TabMenu(this,
new TitleClickEvent(),
new BodyClickEvent(),
titleAdapter,
0xFFFFFFFF,//TabMenu的背景颜色
nimation);//出现与消失的动画
();
leSelect(0);
yAdapter(bodyAdapter[0]);
}
class TitleClickEvent implements OnItemClickListener
{
public void onItemClick(AdapterView> arg0, View arg1, int arg2,
long arg3)
{
selTitle=arg2;
leSelect(arg2);
yAdapter(bodyAdapter[arg2]);
}
}
class BodyClickEvent implements OnItemClickListener ,kListener
{
MySeekBarChangedListener
MySeekBarChangedListener();
seekBarChangedListener = new
//Bg Drawable
int[] bgs = new
int[]{_bg_1,_bg_2,_bg_3,l
_bg_6,_bg_7};
int[] styles = new
int[]{01,02,03,06,
07};
String[] styleName = new String[]{"羊皮纸","粉红回忆","蓝色幻想","咖啡时光","
水墨江南"};
GridView gvReadTheme;
//search
EditText etSearchContent;
ImageButton
ibtnSearch,ibtnSearchBack,ibtnSearchForward,ibtnSearchClear;
public void onItemClick(AdapterView> arg0, View arg1, int position,
long arg3)
{
yClick(position,);
if(selTitle==TITLE_USING_OFTEN)
{
if(position==MENU_FONT_SIZE)
{
LinearLayout fontSizeView = null;
if(fontSizeView==null)
fontSizeView
(LinearLayout)getLayoutInflater().inflate(ze_view, null);
=
showPopupWindowAtBottom(fontSizeView,_PARENT,
100,
_HORIZONTAL|,0,0);
kgroundDrawable(getResources().getDrawable(
_listview));
sbFontSize = (SeekBar)
ewById(zeProgress);
gress(_fontSize());
eekBarChangeListener(seekBarChangedListener);
}
else if(position==MENU_READ_THEME)
{
LinearLayout readThemeView = null;
if(readThemeView==null)
readThemeView =
(LinearLayout)getLayoutInflater().inflate(_theme_view, null);
gvReadTheme =
ewById(Theme);
List
ArrayList
for(int i=0;i<;i++)
{
Map
HashMap
("themeStyle", styles[i]);
(themeMap);
}
(GridView)
= new
new =
SimpleAdapter simpleAdapter = new
SimpleAdapter(,themeList,_imageview,
new String[]{"themeStyle"},new int[]{tyle});
pter(simpleAdapter);
temClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView> parent,
View view, int position, long id)
{
xt(, styleName[position], 50).show();
_backColor(0x000000);
itmap(tableBg(,screenW
idth,screenHeight,bgs[position]));
updateView();
}
});
showPopupWindowAtBottom(readThemeView,_PARENT,
110,
_HORIZONTAL|,0,0);
kgroundDrawable(getResources().getDrawable(
_listview));
usable(true);
}
else if(position==MENU_BRIGHTNESS_CONTROL)
{
LinearLayout brightnessControlView = null;
if(brightnessControlView==null)
brightnessControlView =
(LinearLayout)getLayoutInflater().inflate(ness_control_view, null);
showPopupWindowAtBottom(brightnessControlView,_PARE
NT,
100,
_HORIZONTAL|,0,0);
kgroundDrawable(getResources().getDrawable(
_listview));
sbBrightnessControl = (SeekBar)
ewById(nessControlProgress);
gress((int)
((
getContentResolver(),
_BRIGHTNESS, 255) ));
eekBarChangeListener(seekBarChangedListener);
}
else if(position==MENU_FLIP_OVER)
{
if(isRead)
{
layed(flipOverRunnable, 1000);
isRead = false;
title1BodyName[MENU_FLIP_OVER] = "停止阅读";
title1BodyIcon[MENU_FLIP_OVER] = _stop;
xt(, "开始阅读", 500).show();
}
else
{
Callbacks(flipOverRunnable);
isRead = true;
title1BodyName[MENU_FLIP_OVER] = "开始阅读";
title1BodyIcon[MENU_FLIP_OVER] = _play;
xt(, "停止阅读", 500).show();
}
bodyAdapter[0]=new
dyAdapter(,title1BodyName,title1BodyIco
n,12, 0xFF000000);
yAdapter(bodyAdapter[0]);
}
else if(position==MENU_JUMP)
{
LinearLayout bookJumpView = null;
if(bookJumpView==null)
bookJumpView =
(LinearLayout)getLayoutInflater().inflate(ip_byprogress_view, null);
showPopupWindowAtBottom(bookJumpView,_PARENT,
130,
_HORIZONTAL|,0,0);
kgroundDrawable(getResources().getDrawable(
_listview));
tvCurrentProgress =
(TextView)ewById(entProgress);
ibtnJumpUp =
(ImageButton)ewById(mpUp);
ibtnJumpDown =
(ImageButton)ewById(mpDown);
sbJump = (SeekBar) ewById();
String currentProgress = Percent();
String temp = ("%")[0];//去除掉%
gress((int)(loat(temp)*1000)/100);
eekBarChangeListener(seekBarChangedListener);
t(currentProgress);
lickListener(new OnClickListener()
{
public void onClick(View v)
{
gress(gress()+1);
}
});
lickListener(new OnClickListener()
{
public void onClick(View v)
{
gress(gress()-1);
}
});
}
else if(position==MENU_SEARCH)
{
//方式1
Intent intent =
Intent(,);
ra(_BOOK_PATH, bookPath);
startActivity(intent);
//方式2
// LinearLayout bookSearchView = null;
new
// if(bookSearchView==null)
// bookSearchView
(LinearLayout)getLayoutInflater().inflate(_view, null);
// etSearchContent
(EditText)ewById(chContent);
// ibtnSearch
(ImageButton)ewById(arch);
// lickListener(this);
//
showPopupWindowAtBottom(bookSearchView,_PARENT,
// 70,
_HORIZONTAL|,0,dth());
}
else if(position==MENU_PRE_CHAPTER)
{
=
=
=
preOrNext = true;
if(()<=0)
{
new r().setTitle("提示
").setMessage("章节还未提取,请先提取章节").setPositiveButton("确定", new
kListener()
{
public void onClick(DialogInterface dialog, int which)
{
}
}).show();
}
else
{
getCureentChapter();
}
}
else if(position==MENU_NEXT_CHAPTER)
{
preOrNext = false;
if(()<=0)
{
new r().setTitle("提示
").setMessage("章节还未提取,请先提取章节").setPositiveButton("确定", new
kListener()
{
public void onClick(DialogInterface dialog, int which)
{
}
}).show();
}
else
{
getCureentChapter();
}
}
}
else if(selTitle==TITLE_TOOLS)
{
if(position==MENU_CUSTOM_THEME)
{
LinearLayout customThemeLayout
(LinearLayout)getLayoutInflater().inflate(theme_view, null);
redForegroundSeekBar
(SeekBar)ewById(egroundSeekBar);
greenForegroundSeekBar
(SeekBar)ewById(oregroundSeekBar);
blueForegroundSeekBar
(SeekBar)ewById(regroundSeekBar);
redBackgroundSeekBar
(SeekBar)ewById(kgroundSeekBar);
greenBackgroundSeekBar
(SeekBar)ewById(ackgroundSeekBar);
blueBackgroundSeekBar
(SeekBar)ewById(ckgroundSeekBar);
fontColorTxt
(TextView)ewById(lorTxt);
=
=
=
=
=
=
=
=
backgroundColorTxt =
(TextView)ewById(oundColorTxt);
themeStyleTxt =
(TextView)ewById(tyleTxt);
);
eekBarChangeListener(seekBarChangedListener
eekBarChangeListener(seekBarChangedListen
er);;
r);;
eekBarChangeListener(seekBarChangedListene
);;
eekBarChangeListener(seekBarChangedListener
eekBarChangeListener(seekBarChangedListe
ner);;
r);;
eekBarChangeListener(seekBarChangedListene
AlertDialog ad = new
r().create();
w(customThemeLayout);
ton("确定", new kListener()
{
public void onClick(DialogInterface dialog, int which)
{
int().setColor(currentForeColorId);
_book_bg(null);
_backColor(currentBackColorId);
updateView();
}
});
ton2("取消", new kListener()
{
public void onClick(DialogInterface dialog, int which)
{
}
});
();
}
else if(position==MENU_AUDIO_BOOK)
{
}
else if(position==MENU_BOOK_CHAPTER)
{
if(()<=0)
{
chapterDialog =
r().create();
sage("正在提取章节,请稍后...");
();
new Thread(new Runnable()
{
new
public void run()
{
//
_mbBufBegin(0);
Vector
for(int j=0;j<();j++)
{
currentBeginPosition+=(j).length();
}
while(!_islastPage())
{
lines= wn();
ptyMessage(2);
if(()>0)
{
for(int i=0;i<();i++)
{
matcher = r((i));
if(i==0)
currentBeginPosition+=
(i).length();
else
currentBeginPosition+=
(i-1).length()+(i).length();
if(())
{
currentChapterName = ();
(currentChapterName);
(currentBeginPosition);
chapterNum++;
ptyMessage(1);
}
}
}
else
{
_islastPage(true);
s();
ptyMessage(0);
break;
}
}
}
}).start();
}
else
{
showChapterDialog();
}
}
else if(position==MENU_BOOK_CODE)
{
}
else if(position==MENU_BOOK_MARK)
{
if(("onlyRead"))
{
new r().setTitle("提示
").setMessage("电子书书未添加到书架,无法添加书签").setPositiveButton("确定",
null).show();
}
else
{
ContentValues values = new ContentValues();
(_BOOK_ID, bookId);
(_BOOK_NAME, bookName);
n("name -->"+bookName);
(_BOOK_PATH, bookPath);
(_BOOK_MARK_ADD_TIME,
rentTime());
(_BOOK_MARK_PROGRESS,
Percent());
(_BOOK_MARK_BEGIN_POSITION,
_mbBufBegin());
try
{
ge();
} catch (IOException e)
{
tackTrace();
}
Vector
(0));
(_BOOK_MARK_DETAIL,
values);
((_TABLE_BOOK_MARK),
200).show();
xt(, "添加书签成功",
}
}
else if(position==MENU_SETTING)
{
}
else if(position==MENU_SHARE)
{
}
else if(position==MENU_BACK)
{
if(!("onlyRead"))
{
ContentValues values = new ContentValues();
(_BOOK_PROGRESS,
Percent());
int bookId =
getIntent().getExtras().getInt(_BOOK_ID);
ValuesToTable(resolver,((_TABLE_
BOOK_INFO)),values, _BOOK_ID+"=?", new String[]{bookId+""});
}
();
}
}
}
@Override
public void onClick(View v)
{
if(v==ibtnSearch)
{
s();
popupWindow = null;
String searchContent = t().toString();
wn();
Vector
for(int i=0;i<();i++)
{
if((i).contains(searchContent))
{
}
}
LinearLayout searchControlView = null;
if(searchControlView==null)
searchControlView
(LinearLayout)getLayoutInflater().inflate(_control, null);
ibtnSearchBack
(ImageButton)ewById(archBack);
ibtnSearchForward
(ImageButton)ewById(archForward);
ibtnSearchClear
(ImageButton)ewById(archClear);
lickListener(this);
lickListener(this);
lickListener(this);
=
=
=
=
showPopupWindowAtBottom(searchControlView,_PARENT,
100, _HORIZONTAL|,0,0);
}
else if(v==ibtnSearchBack)
{
}
else if(v==ibtnSearchForward)
{
}
else if(v==ibtnSearchClear)
{
}
}
}
public boolean onCreateOptionsMenu(Menu menu)
{
("menu");// 必须创建一项
return teOptionsMenu(menu);
}
@Override
/**
* 拦截MENU
*/
public boolean onMenuOpened(int featureId, Menu menu)
{
if (tabMenu != null)
{
if (ing())
{
s();
tabMenu = null;
}
else
{
Location(mPageWidget, , 0, 0);
}
}
return false;// 返回为true 则显示系统menu
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if(keyCode==E_BACK)
{
if(popupWindow!=null&&ing())
{
s();
popupWindow = null;
return true;
}
if(!("onlyRead"))
{
ContentValues values = new ContentValues();
(_BOOK_PROGRESS, Percent());
(_BOOK_BEGIN_POSITION,
_mbBufBegin());
ValuesToTable(resolver,((_TABLE_
BOOK_INFO)),values, _BOOK_ID+"=?", new String[]{bookId+""});
}
}
else if(keyCode==E_MENU)
{
if(tabMenu!=null&&ing())
{
s();
tabMenu = null;
return true;
}
if(popupWindow!=null&&ing())
{
s();
popupWindow = null;
return true;
}
}
return own(keyCode, event);
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
if(popupWindow!=null&&ing())
{
s();
popupWindow = null;
}
return hEvent(event);
}
//SeekBar事件监听器
class MySeekBarChangedListener implements OnSeekBarChangeListener
{
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
currentProgress = gress();
if(seekBar==sbFontSize)
{
_fontSize(currentProgress);
int().setTextSize(currentProgress);
neCount((int)sibleHeight()/pagefactory
.getM_fontSize());
xt(, currentProgress+" 号", 50).show();
updateView();
}
else if(seekBar==sbBrightnessControl)
{
xt(, "亮度:"+currentProgress, 100).show();
(getContentResolver(),
_BRIGHTNESS, currentProgress);
currentProgress = (getContentResolver(),
_BRIGHTNESS,-1);
Params lp = getWindow().getAttributes();
if(0<=currentProgress&¤tProgress<=255)
Brightness = currentProgress;
getWindow().setAttributes(lp);
Log.i("亮度-->",""+Brightness);
}
else if(seekBar==sbJump)
{
//计算并设置tvCurrentProgress显示当前进度
double progressD = ((double)currentProgress/1000)*100 ;
BigDecimal bd = new BigDecimal(progressD);
String progressStr = le(2,
_HALF_UP).doubleValue()+" %";
t(progressStr);
//跳转进度
_mbBufBegin((int)
(_mbBufLen()*progressD/100));
updateView();
}
else if(seekBar==redForegroundSeekBar)
{
redForegoundProgress = gress();
foreR = (redForegoundProgress);
foreColor = foreR+foreG+foreB;
currentForeColorId = 0xFF000000+nt(foreColor, 16);
tColor(currentForeColorId);
t("字体颜色:
R:"+redForegoundProgress+",G:"+greenForegroundProgress+",B:"+blueForegrou
ndProgress+" -->#"+foreColor);
}
else if(seekBar==greenForegroundSeekBar)
{
greenForegroundProgress = gress();
foreG = (greenForegroundProgress);
foreColor = foreR+foreG+foreB;
currentForeColorId = 0xFF000000+nt(foreColor, 16);
tColor(currentForeColorId);
t("字体颜色:
R:"+redForegoundProgress+",G:"+greenForegroundProgress+",B:"+blueForegrou
ndProgress+" -->#"+foreColor);
}
else if(seekBar==blueForegroundSeekBar)
{
blueForegroundProgress = gress();
foreB = (blueForegroundProgress);
foreColor = foreR+foreG+foreB;
currentForeColorId = 0xFF000000+nt(foreColor, 16);
tColor(currentForeColorId);
t("字体颜色:
R:"+redForegoundProgress+",G:"+greenForegroundProgress+",B:"+blueForegrou
ndProgress+" -->#"+foreColor);
}
else if(seekBar==redBackgroundSeekBar)
{
redBackgoundProgress = gress();
backR = (redBackgoundProgress);
backColor = backR+backG+backB;
currentBackColorId = 0xFF000000+nt(backColor, 16);
kgroundColor(currentBackColorId);
t("背景颜色:
R:"+redBackgoundProgress+",G:"+greenBackgroundProgress+",B:"+blueBackgro
undProgress+" -->#"+backColor);
}
else if(seekBar==greenBackgroundSeekBar)
{
greenBackgroundProgress = gress();
backG = (greenBackgroundProgress);
backColor = backR+backG+backB;
currentBackColorId = 0xFF000000+nt(backColor, 16);
kgroundColor(currentBackColorId);
t("背景颜色:
R:"+redBackgoundProgress+",G:"+greenBackgroundProgress+",B:"+blueBackgro
undProgress+" -->#"+backColor);
}
else if(seekBar==blueBackgroundSeekBar)
{
blueBackgroundProgress = gress();
backB = (blueBackgroundProgress);
backColor = backR+backG+backB;
currentBackColorId = 0xFF000000+nt(backColor, 16);
kgroundColor(currentBackColorId);
t("背景颜色:
R:"+redBackgoundProgress+",G:"+greenBackgroundProgress+",B:"+blueBackgro
undProgress+" -->#"+backColor);
}
}
public void onStartTrackingTouch(SeekBar seekBar)
{
}
public void onStopTrackingTouch(SeekBar seekBar)
{
}
}
/**
* 根据新的设置更新界面
*/
public void updateView()
{
date();
try
{
e();
ge();
}
catch (IOException e)
{
tackTrace();
}
(mCurPageCanvas);
(mNextPageCanvas);
}
/**
* 初始化,并根据view显示响应的Popupwindow
* @param view Popupwindow中的内容
*/
public void showPopupWindowAtBottom(View view,int width,int height,final
int gravity,final int x,final int y)
{
popupWindow = new PopupWindow(view, width,
height);
Handler handler = null;
if(handler==null)
handler = new Handler();
layed(new Runnable()
{
public void run()
{
Location(mPageWidget,gravity, x, y);
}
}, 250);
}
/**
* 自动阅读
*
*/
class FlipOverRunnable implements Runnable
{
public void run()
{
try
{
ge();
layed(this, 1000);
}
catch (IOException e)
{
tackTrace();
}
updateView();
}
}
/**
* 显示章节目录
*/
public void showChapterDialog()
{
new
r().setItems(ingArray(chapt
erName), new kListener()
{
public void onClick(DialogInterface dialog, int which)
{
// for(int i=0;i<())
_mbBufBegin((which));
updateView();
}
}).show();
}
public void getCureentChapter()
{
new Thread(new Runnable()
{
public void run()
{
boolean isFind = true;
();
while(isFind)
{
lines= wn();
if(()>0)
{
for(int i=0;i<();i++)
{
matcher = r((i));
if(())
{
currentChapter = ();
Log.i("chapter"+i+"-->",());
isFind = false;
break;
}
}
}
}
if(preOrNext)
ptyMessage(1);
else
ptyMessage(1);
}
}).start();
}
}


发布评论