working on txt import
This commit is contained in:
		
							parent
							
								
									bca7b2f4bb
								
							
						
					
					
						commit
						d1a7c6346f
					
				| 
						 | 
					@ -83,11 +83,16 @@
 | 
				
			||||||
            android:label="@string/title_activity_book"
 | 
					            android:label="@string/title_activity_book"
 | 
				
			||||||
            android:parentActivityName=".Main2Activity"
 | 
					            android:parentActivityName=".Main2Activity"
 | 
				
			||||||
            android:theme="@style/ToolBarTheme.NoActionBar" />
 | 
					            android:theme="@style/ToolBarTheme.NoActionBar" />
 | 
				
			||||||
 | 
					        <activity
 | 
				
			||||||
 | 
					            android:name=".ReadActivity"
 | 
				
			||||||
 | 
					            android:label="@string/app_name"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            android:theme="@style/ToolBarTheme.NoActionBar">
 | 
				
			||||||
 | 
					        </activity>
 | 
				
			||||||
        <activity
 | 
					        <activity
 | 
				
			||||||
            android:name=".Main2Activity"
 | 
					            android:name=".Main2Activity"
 | 
				
			||||||
            android:label="@string/app_name"
 | 
					            android:label="@string/app_name"
 | 
				
			||||||
            android:launchMode="singleTask"
 | 
					            android:launchMode="singleTop"
 | 
				
			||||||
            android:theme="@style/ToolBarTheme.NoActionBar">
 | 
					            android:theme="@style/ToolBarTheme.NoActionBar">
 | 
				
			||||||
            <intent-filter>
 | 
					            <intent-filter>
 | 
				
			||||||
                <action android:name="android.intent.action.MAIN" />
 | 
					                <action android:name="android.intent.action.MAIN" />
 | 
				
			||||||
| 
						 | 
					@ -105,11 +110,7 @@
 | 
				
			||||||
            android:label="@string/app_name"
 | 
					            android:label="@string/app_name"
 | 
				
			||||||
            android:theme="@style/ToolBarTheme.NoActionBar">
 | 
					            android:theme="@style/ToolBarTheme.NoActionBar">
 | 
				
			||||||
        </activity>
 | 
					        </activity>
 | 
				
			||||||
        <activity
 | 
					
 | 
				
			||||||
            android:name=".ReadActivity"
 | 
					 | 
				
			||||||
            android:label="@string/app_name"
 | 
					 | 
				
			||||||
            android:theme="@style/ToolBarTheme.NoActionBar">
 | 
					 | 
				
			||||||
        </activity>
 | 
					 | 
				
			||||||
        <activity
 | 
					        <activity
 | 
				
			||||||
            android:name=".MarkActivity"
 | 
					            android:name=".MarkActivity"
 | 
				
			||||||
            android:label="@string/app_name"
 | 
					            android:label="@string/app_name"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -448,7 +448,8 @@ public class PageFactory {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   //向前翻页
 | 
					   //向前翻页
 | 
				
			||||||
    public void prePage(){
 | 
					    public void prePage(){
 | 
				
			||||||
        if (currentPage.getBegin() <= 0) {
 | 
					        m_isfirstPage = false;
 | 
				
			||||||
 | 
					        if (currentPage.getBegin() <= 1) {
 | 
				
			||||||
           Log.d(TAG,"当前是本章第一页");
 | 
					           Log.d(TAG,"当前是本章第一页");
 | 
				
			||||||
            m_isfirstPage =currentChapter ==1;
 | 
					            m_isfirstPage =currentChapter ==1;
 | 
				
			||||||
            if ( m_isfirstPage){
 | 
					            if ( m_isfirstPage){
 | 
				
			||||||
| 
						 | 
					@ -466,6 +467,7 @@ public class PageFactory {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //向后翻页
 | 
					    //向后翻页
 | 
				
			||||||
    public void nextPage(){
 | 
					    public void nextPage(){
 | 
				
			||||||
 | 
					        m_islastPage = false;
 | 
				
			||||||
        if (currentPage.getEnd() >= mBookUtil.getBookLen()) {
 | 
					        if (currentPage.getEnd() >= mBookUtil.getBookLen()) {
 | 
				
			||||||
           Log.d(TAG,"已经是本章最后一页了");
 | 
					           Log.d(TAG,"已经是本章最后一页了");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -584,8 +586,10 @@ public class PageFactory {
 | 
				
			||||||
        trPage.setEnd(mBookUtil.getPosition());
 | 
					        trPage.setEnd(mBookUtil.getPosition());
 | 
				
			||||||
        return trPage;
 | 
					        return trPage;
 | 
				
			||||||
        */
 | 
					        */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       int nextPageNo =currentPage.getPageNo();
 | 
					       int nextPageNo =currentPage.getPageNo();
 | 
				
			||||||
       if(nextPageNo == currentChaptPages.size()){
 | 
					       Log.e(TAG,"currentChaptPages.size() is " + currentChaptPages.size() +", currentpage pageno is " + nextPageNo);
 | 
				
			||||||
 | 
					       if(nextPageNo >= currentChaptPages.size()){
 | 
				
			||||||
           preChaptPages =currentChaptPages;
 | 
					           preChaptPages =currentChaptPages;
 | 
				
			||||||
           currentChapter++;
 | 
					           currentChapter++;
 | 
				
			||||||
            mBookUtil.setChapterNo(currentChapter);
 | 
					            mBookUtil.setChapterNo(currentChapter);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -147,6 +147,7 @@ public class PageWidget extends View {
 | 
				
			||||||
            isRuning = false;
 | 
					            isRuning = false;
 | 
				
			||||||
            mAnimationProvider.setStartPoint(downX,downY);
 | 
					            mAnimationProvider.setStartPoint(downX,downY);
 | 
				
			||||||
            abortAnimation();
 | 
					            abortAnimation();
 | 
				
			||||||
 | 
					            mAnimationProvider.setCancel(false);
 | 
				
			||||||
            Log.e(TAG,"ACTION_DOWN");
 | 
					            Log.e(TAG,"ACTION_DOWN");
 | 
				
			||||||
        }else if (event.getAction() == MotionEvent.ACTION_MOVE){
 | 
					        }else if (event.getAction() == MotionEvent.ACTION_MOVE){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -238,7 +239,7 @@ public class PageWidget extends View {
 | 
				
			||||||
                    Boolean isNext = mTouchListener.nextPage();
 | 
					                    Boolean isNext = mTouchListener.nextPage();
 | 
				
			||||||
                    mAnimationProvider.setDirection(AnimationProvider.Direction.next);
 | 
					                    mAnimationProvider.setDirection(AnimationProvider.Direction.next);
 | 
				
			||||||
                    if (!isNext) {
 | 
					                    if (!isNext) {
 | 
				
			||||||
                        return true;
 | 
					                         return true;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    Boolean isPre = mTouchListener.prePage();
 | 
					                    Boolean isPre = mTouchListener.prePage();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ public class SimulationAnimation extends AnimationProvider {
 | 
				
			||||||
        float array[] = { 1, 0, 0, 0, 0,
 | 
					        float array[] = { 1, 0, 0, 0, 0,
 | 
				
			||||||
                0, 1, 0, 0, 0,
 | 
					                0, 1, 0, 0, 0,
 | 
				
			||||||
                0, 0,1, 0, 0,
 | 
					                0, 0,1, 0, 0,
 | 
				
			||||||
                0, 0, 0, 1, 0 };
 | 
					                0, 0.2f, 0.2f, 1, 0 };
 | 
				
			||||||
        cm.set(array);
 | 
					        cm.set(array);
 | 
				
			||||||
        mColorMatrixFilter = new ColorMatrixColorFilter(cm);
 | 
					        mColorMatrixFilter = new ColorMatrixColorFilter(cm);
 | 
				
			||||||
        mMatrix = new Matrix();
 | 
					        mMatrix = new Matrix();
 | 
				
			||||||
| 
						 | 
					@ -86,10 +86,10 @@ public class SimulationAnimation extends AnimationProvider {
 | 
				
			||||||
    public void drawMove(Canvas canvas) {
 | 
					    public void drawMove(Canvas canvas) {
 | 
				
			||||||
        if (getDirection().equals(Direction.next)) {
 | 
					        if (getDirection().equals(Direction.next)) {
 | 
				
			||||||
            calcPoints();
 | 
					            calcPoints();
 | 
				
			||||||
            drawCurrentPageArea(canvas, mCurPageBitmap, mPath0);
 | 
					             drawCurrentPageArea(canvas, mCurPageBitmap, mPath0);
 | 
				
			||||||
            drawNextPageAreaAndShadow(canvas, mNextPageBitmap);
 | 
					             drawNextPageAreaAndShadow(canvas, mNextPageBitmap);
 | 
				
			||||||
            drawCurrentPageShadow(canvas);
 | 
					           // drawCurrentPageShadow(canvas);                       //去除阴影
 | 
				
			||||||
            drawCurrentBackArea(canvas, mCurPageBitmap);
 | 
					             drawCurrentBackArea(canvas, mCurPageBitmap);
 | 
				
			||||||
        }else{
 | 
					        }else{
 | 
				
			||||||
            calcPoints();
 | 
					            calcPoints();
 | 
				
			||||||
            drawCurrentPageArea(canvas, mNextPageBitmap, mPath0);
 | 
					            drawCurrentPageArea(canvas, mNextPageBitmap, mPath0);
 | 
				
			||||||
| 
						 | 
					@ -304,13 +304,13 @@ public class SimulationAnimation extends AnimationProvider {
 | 
				
			||||||
        mMatrix.setValues(mMatrixArray);
 | 
					        mMatrix.setValues(mMatrixArray);
 | 
				
			||||||
        mMatrix.preTranslate(-mBezierControl1.x, -mBezierControl1.y);
 | 
					        mMatrix.preTranslate(-mBezierControl1.x, -mBezierControl1.y);
 | 
				
			||||||
        mMatrix.postTranslate(mBezierControl1.x, mBezierControl1.y);
 | 
					        mMatrix.postTranslate(mBezierControl1.x, mBezierControl1.y);
 | 
				
			||||||
 | 
					       // mPaint.setAlpha(0x90);
 | 
				
			||||||
        canvas.drawBitmap(bitmap, mMatrix, mPaint);
 | 
					        canvas.drawBitmap(bitmap, mMatrix, mPaint);
 | 
				
			||||||
        // canvas.drawBitmap(bitmap, mMatrix, null);
 | 
					        // canvas.drawBitmap(bitmap, mMatrix, null);
 | 
				
			||||||
        mPaint.setColorFilter(null);
 | 
					        mPaint.setColorFilter(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        canvas.rotate(mDegrees, mBezierStart1.x, mBezierStart1.y);
 | 
					        canvas.rotate(mDegrees, mBezierStart1.x, mBezierStart1.y);
 | 
				
			||||||
        mFolderShadowDrawable.setBounds(left, (int) mBezierStart1.y, right,
 | 
					        mFolderShadowDrawable.setBounds(left, (int) mBezierStart1.y, right,  (int) (mBezierStart1.y + mMaxLength));
 | 
				
			||||||
                (int) (mBezierStart1.y + mMaxLength));
 | 
					 | 
				
			||||||
        mFolderShadowDrawable.draw(canvas);
 | 
					        mFolderShadowDrawable.draw(canvas);
 | 
				
			||||||
        canvas.restore();
 | 
					        canvas.restore();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -481,9 +481,9 @@ public class SimulationAnimation extends AnimationProvider {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        canvas.save();
 | 
					        canvas.save();
 | 
				
			||||||
        if(Build.VERSION.SDK_INT >= 26){
 | 
					        if(Build.VERSION.SDK_INT >= 26){
 | 
				
			||||||
            canvas.clipPath(path);
 | 
					         //  canvas.clipPath(path);  //将正面变空白了
 | 
				
			||||||
        }else {
 | 
					        }else {
 | 
				
			||||||
            canvas.clipPath(path, Region.Op.XOR);
 | 
					         //   canvas.clipPath(path, Region.Op.XOR); //未试过,低版本手机上效果如何?
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        canvas.drawBitmap(bitmap, 0, 0, null);
 | 
					        canvas.drawBitmap(bitmap, 0, 0, null);
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
| 
						 | 
					@ -618,11 +618,11 @@ public class SimulationAnimation extends AnimationProvider {
 | 
				
			||||||
        // Log.i("hmg", "mBezierEnd2.x  " + mBezierEnd2.x + "  mBezierEnd2.y  "
 | 
					        // Log.i("hmg", "mBezierEnd2.x  " + mBezierEnd2.x + "  mBezierEnd2.y  "
 | 
				
			||||||
        // + mBezierEnd2.y);
 | 
					        // + mBezierEnd2.y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
					        /*
 | 
				
			||||||
		 * mBeziervertex1.x 推导
 | 
					         * mBeziervertex1.x 推导
 | 
				
			||||||
		 * ((mBezierStart1.x+mBezierEnd1.x)/2+mBezierControl1.x)/2 化简等价于
 | 
					         * ((mBezierStart1.x+mBezierEnd1.x)/2+mBezierControl1.x)/2 化简等价于
 | 
				
			||||||
		 * (mBezierStart1.x+ 2*mBezierControl1.x+mBezierEnd1.x) / 4
 | 
					         * (mBezierStart1.x+ 2*mBezierControl1.x+mBezierEnd1.x) / 4
 | 
				
			||||||
		 */
 | 
					         */
 | 
				
			||||||
        mBeziervertex1.x = (mBezierStart1.x + 2 * mBezierControl1.x + mBezierEnd1.x) / 4;
 | 
					        mBeziervertex1.x = (mBezierStart1.x + 2 * mBezierControl1.x + mBezierEnd1.x) / 4;
 | 
				
			||||||
        mBeziervertex1.y = (2 * mBezierControl1.y + mBezierStart1.y + mBezierEnd1.y) / 4;
 | 
					        mBeziervertex1.y = (2 * mBezierControl1.y + mBezierStart1.y + mBezierEnd1.y) / 4;
 | 
				
			||||||
        mBeziervertex2.x = (mBezierStart2.x + 2 * mBezierControl2.x + mBezierEnd2.x) / 4;
 | 
					        mBeziervertex2.x = (mBezierStart2.x + 2 * mBezierControl2.x + mBezierEnd2.x) / 4;
 | 
				
			||||||
| 
						 | 
					@ -650,5 +650,4 @@ public class SimulationAnimation extends AnimationProvider {
 | 
				
			||||||
        CrossP.y = a1 * CrossP.x + b1;
 | 
					        CrossP.y = a1 * CrossP.x + b1;
 | 
				
			||||||
        return CrossP;
 | 
					        return CrossP;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue