Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_book
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_book
Commits
6c6fcdaa
Commit
6c6fcdaa
authored
Sep 29, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化章节页样式
parent
0dead3f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
17 deletions
+55
-17
YPageView.java
...rc/main/java/com/duben/infinitefunjia/read/YPageView.java
+3
-0
PageAnim.java
...ain/java/com/duben/infinitefunjia/read/anim/PageAnim.java
+20
-2
LongBookReadActivity.kt
...duben/infinitefunjia/ui/activitys/LongBookReadActivity.kt
+30
-13
activity_long_book_read.xml
book/app/src/main/res/layout/activity_long_book_read.xml
+2
-2
No files found.
book/app/src/main/java/com/duben/infinitefunjia/read/YPageView.java
View file @
6c6fcdaa
...
...
@@ -186,6 +186,7 @@ public class YPageView extends View implements SlideAnim.OnPageChangeListener {
if
(
isMove
)
{
// if (isNext) mPageLoader.nextPage();
// else mPageLoader.prePage();
if
(
listener
!=
null
)
listener
.
touPage
();
isNext
=
true
;
isMove
=
!
isMove
;
...
...
@@ -238,6 +239,8 @@ public class YPageView extends View implements SlideAnim.OnPageChangeListener {
/*********************interface implements*************************/
public
interface
OnCenterClickListener
{
void
centerClicked
();
void
touPage
();
}
...
...
book/app/src/main/java/com/duben/infinitefunjia/read/anim/PageAnim.java
View file @
6c6fcdaa
...
...
@@ -3,6 +3,7 @@ package com.duben.infinitefunjia.read.anim;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.Rect
;
import
android.view.MotionEvent
;
import
android.view.View
;
...
...
@@ -21,6 +22,8 @@ public abstract class PageAnim {
//需要动画的视图
View
mView
;
private
Paint
paint
;
private
int
bgColor
=
Color
.
parseColor
(
"#E0E4E7"
);
//视图的尺寸
protected
int
mViewWidth
;
protected
int
mViewHeight
;
...
...
@@ -61,10 +64,16 @@ public abstract class PageAnim {
/***********************************public***********************************/
//初始化数据
protected
void
initData
()
{
paint
=
new
Paint
(
Paint
.
DITHER_FLAG
);
paint
.
setColor
(
bgColor
);
mViewWidth
=
mView
.
getWidth
();
mViewHeight
=
mView
.
getHeight
();
mCurBitmap
=
Bitmap
.
createBitmap
(
mView
.
getWidth
(),
mView
.
getHeight
(),
Bitmap
.
Config
.
RGB_565
);
mNextBitmap
=
Bitmap
.
createBitmap
(
mView
.
getWidth
(),
mView
.
getHeight
(),
Bitmap
.
Config
.
RGB_565
);
// mCurBitmap = Bitmap.createBitmap(mView.getWidth(), mView.getHeight(), Bitmap.Config.RGB_565);
// mNextBitmap = Bitmap.createBitmap(mView.getWidth(), mView.getHeight(), Bitmap.Config.RGB_565);
mCurBitmap
=
createBitmap
(
mView
.
getWidth
(),
mView
.
getHeight
());
mNextBitmap
=
createBitmap
(
mView
.
getWidth
(),
mView
.
getHeight
());
mSrcRect
=
new
Rect
(
0
,
0
,
mViewWidth
,
mViewHeight
);
mDestRect
=
new
Rect
(
0
,
0
,
mViewWidth
,
mViewHeight
);
slop
=
ViewConfiguration
.
get
(
mView
.
getContext
()).
getScaledTouchSlop
();
...
...
@@ -86,6 +95,15 @@ public abstract class PageAnim {
}
private
Bitmap
createBitmap
(
int
width
,
int
height
)
{
Bitmap
bitmap
=
Bitmap
.
createBitmap
(
width
,
height
,
Bitmap
.
Config
.
RGB_565
);
bitmap
.
eraseColor
(
bgColor
);
Canvas
canvas
=
new
Canvas
(
bitmap
);
canvas
.
drawColor
(
bgColor
);
canvas
.
drawBitmap
(
bitmap
,
null
,
new
Rect
(
0
,
0
,
width
,
height
),
paint
);
return
bitmap
;
}
public
void
changePage
()
{
Bitmap
bitmap
=
mCurBitmap
;
...
...
book/app/src/main/java/com/duben/infinitefunjia/ui/activitys/LongBookReadActivity.kt
View file @
6c6fcdaa
...
...
@@ -17,6 +17,7 @@ import com.duben.infinitefunjia.mvp.views.BookReadView
import
com.duben.infinitefunjia.read.AnimType
import
com.duben.infinitefunjia.read.PageLoader
import
com.duben.infinitefunjia.read.ReadChaptersAdapter
import
com.duben.infinitefunjia.read.YPageView.OnCenterClickListener
import
com.duben.infinitefunjia.read.models.BookModel
import
com.duben.infinitefunjia.read.models.BookRecordModel
import
com.duben.infinitefunjia.read.models.TxtChapterModel
...
...
@@ -36,7 +37,7 @@ class LongBookReadActivity : BaseActivity(), View.OnClickListener, BookReadView
private
var
mBookModel
:
BookModel
?
=
null
private
var
mPageLoader
:
PageLoader
?
=
null
private
var
isShowSetting
=
fals
e
private
var
isShowSetting
=
tru
e
private
var
bookSettingDialog
:
LongBookSettingDialog
?
=
null
private
var
bookVipDialog
:
BookVipDialog
?
=
null
...
...
@@ -61,6 +62,8 @@ class LongBookReadActivity : BaseActivity(), View.OnClickListener, BookReadView
initListener
()
popBookSettingDialog
()
popBookVipDialog
()
readPresenter
.
attachView
(
this
)
mBookModel
?.
let
{
readPresenter
.
addReadRecord
(
it
.
bookId
)
}
}
override
fun
onResume
()
{
...
...
@@ -176,22 +179,36 @@ class LongBookReadActivity : BaseActivity(), View.OnClickListener, BookReadView
}
}
}
else
{
mPageLoader
?.
setPageBgColor
(
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
)
mPageLoader
?.
setTextSize
(
18
)
mPageLoader
?.
textColor
=
Color
.
BLACK
mPageLoader
?.
let
{
it
.
setPageBgColor
(
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
)
it
.
setTextSize
(
18
)
it
.
textColor
=
Color
.
BLACK
}
// pageview.animType = AnimType.SLIDE
bookSettingDialog
?.
setSetting
(
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
,
18
)
}
pageview
.
setOnCenterClickListener
{
if
(
isShowSetting
)
{
view_setting
.
visibility
=
View
.
VISIBLE
tab_setting_top
.
visibility
=
View
.
VISIBLE
}
else
{
view_setting
.
visibility
=
View
.
GONE
tab_setting_top
.
visibility
=
View
.
GONE
pageview
.
setOnCenterClickListener
(
object
:
OnCenterClickListener
{
override
fun
centerClicked
()
{
if
(
isShowSetting
)
{
view_setting
.
visibility
=
View
.
VISIBLE
tab_setting_top
.
visibility
=
View
.
VISIBLE
}
else
{
view_setting
.
visibility
=
View
.
GONE
tab_setting_top
.
visibility
=
View
.
GONE
}
isShowSetting
=
!
isShowSetting
}
isShowSetting
=
!
isShowSetting
}
override
fun
touPage
()
{
if
(
isShowSetting
)
{
view_setting
.
visibility
=
View
.
GONE
tab_setting_top
.
visibility
=
View
.
GONE
isShowSetting
=
false
}
}
})
//初始化目录
initChapterRecyclerView
()
...
...
book/app/src/main/res/layout/activity_long_book_read.xml
View file @
6c6fcdaa
...
...
@@ -22,7 +22,7 @@
android:orientation=
"horizontal"
android:paddingTop=
"5dp"
android:paddingBottom=
"5dp"
android:visibility=
"
gon
e"
>
android:visibility=
"
visibl
e"
>
<LinearLayout
android:id=
"@+id/tab_setting_chapter"
...
...
@@ -109,7 +109,7 @@
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:paddingTop=
"25dp"
android:visibility=
"
gon
e"
>
android:visibility=
"
visibl
e"
>
<ImageView
android:id=
"@+id/iv_back"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment