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