public void showLastRead() { int num = prefsManager.getLastnum(); float per = prefsManager.getLastPer(); currentPageNo = num; String path = book.getFlatNavPoints().get(currentPageNo - 1).getContent().getPath(); content.loadContent(path, per); chapter.startAnimation(chapterLeftOut); }
public void showPre() { if (currentPageNo == 1) { Toast.makeText(mContext, "已经是最前一章", Toast.LENGTH_SHORT).show(); return; } currentPageNo--; String path = book.getFlatNavPoints().get(currentPageNo - 1).getContent().getPath(); content.loadContent(path, 0); }
public BookViewController(Context context, Book boo) { mContext = context; layout = new RelativeLayout(mContext); book = boo; // allPageNo = book.getNavPoints().size(); allPageNo = book.getFlatNavPoints().size(); display = ((Activity) mContext).getWindowManager().getDefaultDisplay(); prefsManager = new PrefsManager(mContext); /** chapter view */ chapter = new ChapterView(mContext, book, this); /* *content view */ content = new ContentView(mContext); controllBarClickListener = new ControllBarClickListener(mContext, this); content.setControllButtonsClickListener(controllBarClickListener); adView = new AdView(mContext); LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); adView.setId(genID); adView.setVisibility(View.INVISIBLE); adView.postDelayed( new Runnable() { @Override public void run() { // TODO Auto-generated method stub adView.setVisibility(View.VISIBLE); } }, 1000 * 60); LayoutParams mainParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); mainParams.addRule(RelativeLayout.BELOW, adView.getId()); layout.addView(adView, params); layout.addView(content, mainParams); layout.addView(chapter, mainParams); chapterLeftOut = new TranslateAnimation(0, -display.getWidth(), 0, 0); chapterLeftOut.setDuration(300); chapterLeftOut.setAnimationListener( new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation animation) { // TODO Auto-generated method stub chapter.setVisibility(View.INVISIBLE); } }); chapterLeftIn = new TranslateAnimation(-display.getWidth(), 0, 0, 0); chapterLeftIn.setDuration(300); }
private void savehistory() { float per = content.getScrollPer(); prefsManager.savehistory(currentPageNo, per); }
public void showPage(int number) { currentPageNo = number; String path = book.getFlatNavPoints().get(currentPageNo - 1).getContent().getPath(); content.loadContent(path, 0); chapter.startAnimation(chapterLeftOut); }