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);
 }
예제 #2
0
  /** @param context */
  public ChapterView(Context context, Book bok, BookViewController controller) {
    super(context);
    // TODO Auto-generated constructor stub
    mContext = context;
    this.book = bok;
    mBookViewController = controller;
    display = ((Activity) context).getWindowManager().getDefaultDisplay();
    setBackgroundColor(Color.WHITE);

    prefsManager = new PrefsManager(mContext);
    hasHistory = prefsManager.hashistory();

    int btnWidth = display.getWidth() / 2;

    layout = new LinearLayout(context);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setGravity(Gravity.CENTER_HORIZONTAL);

    continuBtn = new Button(context);
    continuBtn.setId(0);
    continuBtn.setText("¼ÌÐøÉÏ´ÎÔĶÁ");
    continuBtn.setOnClickListener(this);
    continuBtn.setEnabled(hasHistory);
    layout.addView(continuBtn, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

    for (int i = 0; i < book.getFlatNavPoints().size(); i++) {
      NavPoint np = book.getFlatNavPoints().get(i);
      Button b = new Button(context);
      b.setId(i + 1);
      b.setText(np.getLabel());
      b.setWidth(btnWidth);
      b.setOnClickListener(this);
      layout.addView(b, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    }

    addView(layout);
  }
 private void savehistory() {
   float per = content.getScrollPer();
   prefsManager.savehistory(currentPageNo, per);
 }