package com.aiteu.dailyreading.reader;

import android.graphics.Color;
import android.graphics.Paint;

/**
 * 定义页面工程：产生页面模型,字体，大小
 * @author liwei
 *
 */
public class BookPageFactory {
	
	private static BookPageFactory mFactory = null;
	private Paint mTextPaint = null;
	private int mPageWidth = 100;
	private float textSize = 24;
	private int mTextColor = Color.rgb(0x43, 0x43, 0x43);
	
	private BookPageFactory(){
		mTextPaint = new Paint();
		mTextPaint.setTextSize(textSize);
		mTextPaint.setColor(mTextColor);
		mTextPaint.setAntiAlias(true);
	}
	
	public static synchronized BookPageFactory create(){
		if(mFactory == null){
			mFactory = new BookPageFactory();
		}
		return mFactory;
	}
	
	private int lines = 3; //每页包含的行数
	
	public BookPage createPage(){
		BookPage mPage = new BookPage();
		
		return mPage;
	}

	public int getLines() {
		return lines;
	}

	public void setLines(int lines) {
		this.lines = lines;
	}
	
	public float getTextSize() {
		return textSize;
	}

	public void setTextSize(float textSize) {
		this.textSize = textSize;
	}
	
	public int getTextColor(){
		return this.mTextColor;
	}
	
	public void setTextColor(int color){
		this.mTextColor = color;
	}

	public int spiltParagraphToLine(String paragraph){
		return mTextPaint.breakText(paragraph, true, mPageWidth, null);
	}
}

@@ -379,16 +379,50 @@
  0x43);%0A
+%09private int lines = 3; //%E6%AF%8F%E9%A1%B5%E5%8C%85%E5%90%AB%E7%9A%84%E8%A1%8C%E6%95%B0%0A
 %09%0A%09priva
@@ -727,44 +727,8 @@
 %7D%0A%09%0A
-%09private int lines = 3; //%E6%AF%8F%E9%A1%B5%E5%8C%85%E5%90%AB%E7%9A%84%E8%A1%8C%E6%95%B0%0A%09%0A
 %09pub

modify book page factory of size