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
7f90e6c6
Commit
7f90e6c6
authored
Sep 24, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
17282d82
Changes
39
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1053 additions
and
185 deletions
+1053
-185
BookConstant.kt
...rc/main/java/com/mints/enjoyboxjia/common/BookConstant.kt
+9
-11
ReadTimeCount.kt
.../main/java/com/mints/enjoyboxjia/manager/ReadTimeCount.kt
+72
-0
BookReadPresenter.kt
...com/mints/enjoyboxjia/mvp/presenters/BookReadPresenter.kt
+1
-1
BookSearchPresenter.kt
...m/mints/enjoyboxjia/mvp/presenters/BookSearchPresenter.kt
+42
-4
BookShelfPresenter.kt
...om/mints/enjoyboxjia/mvp/presenters/BookShelfPresenter.kt
+2
-2
BookSearchView.kt
...in/java/com/mints/enjoyboxjia/mvp/views/BookSearchView.kt
+6
-1
LoanService.java
.../src/main/java/com/mints/enjoyboxjia/net/LoanService.java
+1
-1
BookReadActivity.kt
...va/com/mints/enjoyboxjia/ui/activitys/BookReadActivity.kt
+36
-7
BookSearchActivity.kt
.../com/mints/enjoyboxjia/ui/activitys/BookSearchActivity.kt
+199
-4
BookShelfAdapter.kt
...java/com/mints/enjoyboxjia/ui/adapter/BookShelfAdapter.kt
+34
-15
SearchBookAdapter.kt
...ava/com/mints/enjoyboxjia/ui/adapter/SearchBookAdapter.kt
+44
-0
SearchHistoryAdapter.kt
.../com/mints/enjoyboxjia/ui/adapter/SearchHistoryAdapter.kt
+15
-0
SearchHotBookAdapter.kt
.../com/mints/enjoyboxjia/ui/adapter/SearchHotBookAdapter.kt
+44
-0
BookCityFragment.kt
...ava/com/mints/enjoyboxjia/ui/fragment/BookCityFragment.kt
+9
-14
BookShelfFragment.kt
...va/com/mints/enjoyboxjia/ui/fragment/BookShelfFragment.kt
+72
-10
BookSettingDialog.kt
...ava/com/mints/enjoyboxjia/ui/widgets/BookSettingDialog.kt
+76
-31
TimeRender.kt
...p/src/main/java/com/mints/enjoyboxjia/utils/TimeRender.kt
+36
-13
selector_book_content_1.xml
book/app/src/main/res/drawable/selector_book_content_1.xml
+2
-2
selector_book_content_2.xml
book/app/src/main/res/drawable/selector_book_content_2.xml
+2
-2
selector_book_content_3.xml
book/app/src/main/res/drawable/selector_book_content_3.xml
+2
-2
selector_book_content_4.xml
book/app/src/main/res/drawable/selector_book_content_4.xml
+2
-2
selector_book_content_5.xml
book/app/src/main/res/drawable/selector_book_content_5.xml
+2
-2
selector_book_content_6.xml
book/app/src/main/res/drawable/selector_book_content_6.xml
+2
-2
selector_search_edit.xml
book/app/src/main/res/drawable/selector_search_edit.xml
+5
-0
shape_bg_time.xml
book/app/src/main/res/drawable/shape_bg_time.xml
+6
-0
shape_full_blue.xml
book/app/src/main/res/drawable/shape_full_blue.xml
+6
-0
shape_half_trans.xml
book/app/src/main/res/drawable/shape_half_trans.xml
+10
-0
shape_round_gray.xml
book/app/src/main/res/drawable/shape_round_gray.xml
+13
-0
shape_search_gary.xml
book/app/src/main/res/drawable/shape_search_gary.xml
+10
-0
activity_book_search.xml
book/app/src/main/res/layout/activity_book_search.xml
+184
-32
dialog_book_setting.xml
book/app/src/main/res/layout/dialog_book_setting.xml
+14
-11
fragment_main_bookcity.xml
book/app/src/main/res/layout/fragment_main_bookcity.xml
+1
-1
fragment_main_bookshelf.xml
book/app/src/main/res/layout/fragment_main_bookshelf.xml
+64
-6
item_bookshelf.xml
book/app/src/main/res/layout/item_bookshelf.xml
+6
-9
item_search_history.xml
book/app/src/main/res/layout/item_search_history.xml
+23
-0
bg_book_data.png
book/app/src/main/res/mipmap-xhdpi/bg_book_data.png
+0
-0
bg_book_more.png
book/app/src/main/res/mipmap-xhdpi/bg_book_more.png
+0
-0
bg_search_data.png
book/app/src/main/res/mipmap-xhdpi/bg_search_data.png
+0
-0
colors.xml
book/app/src/main/res/values/colors.xml
+1
-0
No files found.
book/app/src/main/java/com/mints/enjoyboxjia/common/BookConstant.kt
View file @
7f90e6c6
package
com.mints.enjoyboxjia.common
package
com.mints.enjoyboxjia.common
import
com.mints.enjoyboxjia.R
import
android.graphics.Color
const
val
BOOK_BOOK_CONTENT_COLOR
=
"BOOK_CONTENT_COLOR"
const
val
BOOK_CONTENT_COLOR
=
"BOOK_CONTENT_COLOR"
const
val
BOOK_CONTENT_SIZE
=
"BOOK_CONTENT_SIZE"
enum
class
BookConstant
(
var
color
:
Int
)
{
enum
class
BookConstant
(
var
color
:
Int
)
{
BOOK_CONTENT_COLOR_1
(
Color
.
parseColor
(
"#ffffff"
)),
BOOK_CONTENT_COLOR_1
(
R
.
color
.
book_content_color1
),
BOOK_CONTENT_COLOR_2
(
Color
.
parseColor
(
"#e7e7e7"
)),
BOOK_CONTENT_COLOR_2
(
R
.
color
.
book_content_color2
),
BOOK_CONTENT_COLOR_3
(
Color
.
parseColor
(
"#d4e0c6"
)),
BOOK_CONTENT_COLOR_3
(
R
.
color
.
book_content_color3
),
BOOK_CONTENT_COLOR_4
(
Color
.
parseColor
(
"#ccd8e4"
)),
BOOK_CONTENT_COLOR_4
(
R
.
color
.
book_content_color4
),
BOOK_CONTENT_COLOR_5
(
Color
.
parseColor
(
"#f9d4d4"
)),
BOOK_CONTENT_COLOR_5
(
R
.
color
.
book_content_color5
),
BOOK_CONTENT_COLOR_6
(
Color
.
parseColor
(
"#b1b1b1"
)),
BOOK_CONTENT_COLOR_6
(
R
.
color
.
book_content_color6
),
}
}
\ No newline at end of file
book/app/src/main/java/com/mints/enjoyboxjia/manager/ReadTimeCount.kt
0 → 100644
View file @
7f90e6c6
package
com.mints.enjoyboxjia.manager
import
com.mints.enjoyboxjia.utils.AppPreferencesManager
import
com.mints.enjoyboxjia.utils.TimeRender
import
java.util.*
class
ReadTimeCount
{
companion
object
{
const
val
KEY_STORAGE_READ_TIME_COUNT
=
"READ_TIME_COUNT"
val
instance
by
lazy
(
LazyThreadSafetyMode
.
NONE
)
{
ReadTimeCount
()
}
}
private
var
startReadTime
:
Date
?
=
null
// 开始阅读时间
private
var
readTimeCountMap
:
String
=
""
fun
getReadTime
():
Array
<
String
>
{
if
(
readTimeCountMap
==
""
)
{
readTimeCountMap
=
AppPreferencesManager
.
get
()
.
getString
(
KEY_STORAGE_READ_TIME_COUNT
,
TimeRender
.
formatDate
(
Date
())
+
"*0"
)
!!
}
val
date
=
readTimeCountMap
.
split
(
"*"
)[
0
]
if
(
date
!=
TimeRender
.
formatDate
(
Date
()))
{
return
TimeRender
.
ms2HMS_S
(
0
)
}
val
time
=
readTimeCountMap
.
split
(
"*"
)[
1
].
toInt
()
return
TimeRender
.
ms2HMS_S
(
time
)
}
/**
* 存储阅读时间计时
*/
private
fun
setReadTimeCount
(
count
:
Int
)
{
if
(
readTimeCountMap
==
""
)
{
readTimeCountMap
=
AppPreferencesManager
.
get
()
.
getString
(
KEY_STORAGE_READ_TIME_COUNT
,
TimeRender
.
formatDate
(
Date
())
+
"*0"
)
!!
}
var
time
=
readTimeCountMap
.
split
(
"*"
)[
1
].
toInt
()
time
+=
count
readTimeCountMap
=
TimeRender
.
formatDate
(
Date
())
+
"*"
+
time
AppPreferencesManager
.
get
().
put
(
KEY_STORAGE_READ_TIME_COUNT
,
readTimeCountMap
)
}
/**
* 开始阅读计时
*/
fun
startCountReadTime
()
{
startReadTime
=
Date
()
}
/**
* 停止阅读计时
*/
fun
endCountReadTime
()
{
if
(
startReadTime
==
null
)
return
val
endReadTime
=
Date
()
val
count
=
(
endReadTime
.
time
-
startReadTime
!!
.
time
).
toInt
()
startReadTime
=
null
setReadTimeCount
(
count
)
}
}
\ No newline at end of file
book/app/src/main/java/com/mints/enjoyboxjia/mvp/presenters/BookReadPresenter.kt
View file @
7f90e6c6
...
@@ -52,7 +52,7 @@ class BookReadPresenter : BasePresenter<BookReadView>() {
...
@@ -52,7 +52,7 @@ class BookReadPresenter : BasePresenter<BookReadView>() {
val
vo
=
HashMap
<
String
,
Any
>()
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"articleId"
]
=
bookId
vo
[
"articleId"
]
=
bookId
AppHttpManager
.
getInstance
(
loanApplication
)
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getBookDetail
(
vo
),
.
call
(
loanService
.
addReadRecord
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
override
fun
onCompleted
()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
if
(
isLinkView
)
return
...
...
book/app/src/main/java/com/mints/enjoyboxjia/mvp/presenters/BookSearchPresenter.kt
View file @
7f90e6c6
package
com.mints.enjoyboxjia.mvp.presenters
package
com.mints.enjoyboxjia.mvp.presenters
import
com.google.gson.JsonObject
import
com.mints.library.net.neterror.Throwable
import
com.mints.library.net.neterror.Throwable
import
com.mints.enjoyboxjia.manager.AppHttpManager
import
com.mints.enjoyboxjia.manager.AppHttpManager
import
com.mints.enjoyboxjia.mvp.model.BaseResponse
import
com.mints.enjoyboxjia.mvp.model.BaseResponse
import
com.mints.enjoyboxjia.mvp.model.BookListBean
import
com.mints.enjoyboxjia.mvp.views.BookSearchView
import
com.mints.enjoyboxjia.mvp.views.BookSearchView
import
com.mints.library.net.neterror.BaseSubscriber
import
com.mints.library.net.neterror.BaseSubscriber
import
java.util.HashMap
import
java.util.HashMap
...
@@ -13,16 +13,16 @@ class BookSearchPresenter : BasePresenter<BookSearchView>() {
...
@@ -13,16 +13,16 @@ class BookSearchPresenter : BasePresenter<BookSearchView>() {
fun
getHotBook
()
{
fun
getHotBook
()
{
val
vo
=
HashMap
<
String
,
Any
>()
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"flag"
]
=
"hot"
vo
[
"flag"
]
=
"hot"
vo
[
"quantity"
]
=
"
5
"
vo
[
"quantity"
]
=
"
8
"
AppHttpManager
.
getInstance
(
loanApplication
)
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getRecommendV1
(
vo
),
.
call
(
loanService
.
getRecommendV1
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
object
:
BaseSubscriber
<
BaseResponse
<
BookListBean
>>()
{
override
fun
onCompleted
()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
hideLoading
()
}
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
JsonObject
>)
{
override
fun
onNext
(
baseResponse
:
BaseResponse
<
BookListBean
>)
{
if
(
isLinkView
)
return
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
hideLoading
()
...
@@ -44,6 +44,44 @@ class BookSearchPresenter : BasePresenter<BookSearchView>() {
...
@@ -44,6 +44,44 @@ class BookSearchPresenter : BasePresenter<BookSearchView>() {
view
.
showToast
(
e
?.
message
)
view
.
showToast
(
e
?.
message
)
view
.
getHotBookFail
()
view
.
getHotBookFail
()
}
}
})
}
fun
searchBook
(
searchName
:
String
,
pageNo
:
Int
,
pageSize
:
Int
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"searchName"
]
=
searchName
vo
[
"pageNo"
]
=
pageNo
vo
[
"pageSize"
]
=
pageSize
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getHomeV1List
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
BookListBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
view
.
hideLoading
()
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
BookListBean
>)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
when
(
code
)
{
200
->
view
.
getSearchBookSuc
(
baseResponse
.
data
)
else
->
{
view
.
getSearchBookFail
()
view
.
showToast
(
message
)
}
}
}
override
fun
onError
(
e
:
Throwable
?)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
showToast
(
e
?.
message
)
view
.
getSearchBookFail
()
}
})
})
...
...
book/app/src/main/java/com/mints/enjoyboxjia/mvp/presenters/BookShelfPresenter.kt
View file @
7f90e6c6
...
@@ -49,9 +49,9 @@ class BookShelfPresenter : BasePresenter<BookShelfView>() {
...
@@ -49,9 +49,9 @@ class BookShelfPresenter : BasePresenter<BookShelfView>() {
})
})
}
}
fun
cancelCollect
(
videoId
:
List
<
String
>
)
{
fun
cancelCollect
(
bookId
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"
list"
]
=
video
Id
vo
[
"
articleId"
]
=
book
Id
AppHttpManager
.
getInstance
(
loanApplication
)
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
collectCancel
(
vo
),
.
call
(
loanService
.
collectCancel
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
...
...
book/app/src/main/java/com/mints/enjoyboxjia/mvp/views/BookSearchView.kt
View file @
7f90e6c6
package
com.mints.enjoyboxjia.mvp.views
package
com.mints.enjoyboxjia.mvp.views
import
com.mints.enjoyboxjia.mvp.model.BookListBean
interface
BookSearchView
:
BaseView
{
interface
BookSearchView
:
BaseView
{
fun
getHotBookSuc
(
data
:
Any
)
fun
getHotBookSuc
(
data
:
BookListBean
)
fun
getHotBookFail
()
fun
getHotBookFail
()
fun
getSearchBookSuc
(
data
:
BookListBean
)
fun
getSearchBookFail
()
}
}
book/app/src/main/java/com/mints/enjoyboxjia/net/LoanService.java
View file @
7f90e6c6
...
@@ -179,7 +179,7 @@ public interface LoanService {
...
@@ -179,7 +179,7 @@ public interface LoanService {
Observable
<
BaseResponse
<
Object
>>
collectCancel
(
@Body
Map
<
String
,
Object
>
vo
);
Observable
<
BaseResponse
<
Object
>>
collectCancel
(
@Body
Map
<
String
,
Object
>
vo
);
/**
/**
* 书库列表
* 书库列表
和 搜索
*
*
* @return
* @return
*/
*/
...
...
book/app/src/main/java/com/mints/enjoyboxjia/ui/activitys/BookReadActivity.kt
View file @
7f90e6c6
...
@@ -2,14 +2,18 @@ package com.mints.enjoyboxjia.ui.activitys
...
@@ -2,14 +2,18 @@ package com.mints.enjoyboxjia.ui.activitys
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.core.content.ContextCompat
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.common.BOOK_CONTENT_COLOR
import
com.mints.enjoyboxjia.common.BOOK_CONTENT_SIZE
import
com.mints.enjoyboxjia.manager.ReadTimeCount
import
com.mints.enjoyboxjia.mvp.model.BookContentBean
import
com.mints.enjoyboxjia.mvp.model.BookContentBean
import
com.mints.enjoyboxjia.mvp.presenters.BookReadPresenter
import
com.mints.enjoyboxjia.mvp.presenters.BookReadPresenter
import
com.mints.enjoyboxjia.mvp.views.BookReadView
import
com.mints.enjoyboxjia.mvp.views.BookReadView
import
com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import
com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import
com.mints.enjoyboxjia.ui.widgets.BookSettingDialog
import
com.mints.enjoyboxjia.ui.widgets.BookSettingDialog
import
com.mints.enjoyboxjia.utils.AppPreferencesManager
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.Utils
import
kotlinx.android.synthetic.main.activity_book_read.*
import
kotlinx.android.synthetic.main.activity_book_read.*
import
kotlinx.android.synthetic.main.header_layout.*
import
kotlinx.android.synthetic.main.header_layout.*
import
net.nightwhistler.htmlspanner.HtmlSpanner
import
net.nightwhistler.htmlspanner.HtmlSpanner
...
@@ -39,14 +43,24 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
...
@@ -39,14 +43,24 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
}
}
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
tv_title
.
text
=
"书"
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
readPresenter
.
attachView
(
this
)
readPresenter
.
attachView
(
this
)
initListener
()
popBookSettingDialog
()
}
override
fun
onResume
()
{
super
.
onResume
()
readPresenter
.
getBookDetail
(
bookId
)
readPresenter
.
getBookDetail
(
bookId
)
readPresenter
.
addReadRecord
(
bookId
)
readPresenter
.
addReadRecord
(
bookId
)
initListener
()
ReadTimeCount
.
instance
.
startCountReadTime
()
}
override
fun
onPause
()
{
super
.
onPause
()
ReadTimeCount
.
instance
.
endCountReadTime
()
}
}
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
...
@@ -56,13 +70,13 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
...
@@ -56,13 +70,13 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
setIsCollect
(!
isCollect
)
setIsCollect
(!
isCollect
)
}
}
R
.
id
.
tab_setting_book
->
{
R
.
id
.
tab_setting_book
->
{
popBookSettingDialog
()
bookSettingDialog
?.
show
()
}
}
R
.
id
.
tab_setting_share
->
{
R
.
id
.
tab_setting_share
->
{
}
}
R
.
id
.
btn_submit
->
{
R
.
id
.
btn_submit
->
{
readyGo
(
VipActivity
::
class
.
java
)
}
}
}
}
}
}
...
@@ -73,18 +87,19 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
...
@@ -73,18 +87,19 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
BookSettingDialog
.
OnBookSettingCallback
{
BookSettingDialog
.
OnBookSettingCallback
{
override
fun
onFontSize
(
size
:
Int
)
{
override
fun
onFontSize
(
size
:
Int
)
{
tv_content
.
textSize
=
size
.
toFloat
()
tv_content
.
textSize
=
size
.
toFloat
()
AppPreferencesManager
.
get
().
put
(
BOOK_CONTENT_SIZE
,
size
)
}
}
override
fun
onBgColor
(
color
:
Int
)
{
override
fun
onBgColor
(
color
:
Int
)
{
view_book
.
setBackgroundColor
(
color
)
view_book
.
setBackgroundColor
(
color
)
AppPreferencesManager
.
get
().
put
(
BOOK_CONTENT_COLOR
,
color
)
}
}
})
})
bookSettingDialog
?.
show
()
bookSettingDialog
?.
loadSetting
()
}
}
private
fun
initListener
()
{
private
fun
initListener
()
{
iv_left_icon
.
setOnClickListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
tab_setting_collect
.
setOnClickListener
(
this
)
tab_setting_collect
.
setOnClickListener
(
this
)
tab_setting_share
.
setOnClickListener
(
this
)
tab_setting_share
.
setOnClickListener
(
this
)
tab_setting_book
.
setOnClickListener
(
this
)
tab_setting_book
.
setOnClickListener
(
this
)
...
@@ -104,10 +119,22 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
...
@@ -104,10 +119,22 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
}
}
private
fun
setBookThumb
(
data
:
BookContentBean
)
{
private
fun
setBookThumb
(
data
:
BookContentBean
)
{
tv_title
.
text
=
"阅读:${data.title}"
GlideUtils
.
loadImageViewNoAnim2
(
this
,
data
.
avatar
,
image_iv
)
GlideUtils
.
loadImageViewNoAnim2
(
this
,
data
.
avatar
,
image_iv
)
title_tv
.
text
=
data
.
title
title_tv
.
text
=
data
.
title
info_tv
.
text
=
data
.
summary
info_tv
.
text
=
data
.
summary
label_tv
.
text
=
data
.
author
label_tv
.
text
=
data
.
author
if
(
data
.
isCollect
==
1
)
{
tab_iv_bookshelf
.
setImageResource
(
R
.
mipmap
.
bookshelf
)
tab_tv_bookshelf
.
text
=
"已收藏"
tab_tv_bookshelf
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
color_goldenrod
))
}
else
{
tab_iv_bookshelf
.
setImageResource
(
R
.
mipmap
.
bookshelf
)
tab_tv_bookshelf
.
text
=
"收藏"
tab_tv_bookshelf
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
black
))
}
}
}
private
fun
setIsCollect
(
collect
:
Boolean
)
{
private
fun
setIsCollect
(
collect
:
Boolean
)
{
...
@@ -115,10 +142,12 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
...
@@ -115,10 +142,12 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
if
(
isCollect
)
{
if
(
isCollect
)
{
tab_iv_bookshelf
.
setImageResource
(
R
.
mipmap
.
bookshelf
)
tab_iv_bookshelf
.
setImageResource
(
R
.
mipmap
.
bookshelf
)
tab_tv_bookshelf
.
text
=
"已收藏"
tab_tv_bookshelf
.
text
=
"已收藏"
tab_tv_bookshelf
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
color_goldenrod
))
readPresenter
.
collect
(
bookId
)
readPresenter
.
collect
(
bookId
)
}
else
{
}
else
{
tab_iv_bookshelf
.
setImageResource
(
R
.
mipmap
.
bookshelf
)
tab_iv_bookshelf
.
setImageResource
(
R
.
mipmap
.
bookshelf
)
tab_tv_bookshelf
.
text
=
"收藏"
tab_tv_bookshelf
.
text
=
"收藏"
tab_tv_bookshelf
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
black
))
readPresenter
.
cancelCollect
(
bookId
)
readPresenter
.
cancelCollect
(
bookId
)
}
}
}
}
...
...
book/app/src/main/java/com/mints/enjoyboxjia/ui/activitys/BookSearchActivity.kt
View file @
7f90e6c6
package
com.mints.enjoyboxjia.ui.activitys
package
com.mints.enjoyboxjia.ui.activitys
import
android.os.Bundle
import
android.text.Editable
import
android.text.TextWatcher
import
android.view.View
import
android.view.View
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.google.android.flexbox.FlexWrap
import
com.google.android.flexbox.FlexboxLayoutManager
import
com.google.android.flexbox.JustifyContent
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.common.Constant
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.mvp.model.BookListBean
import
com.mints.enjoyboxjia.mvp.presenters.BookSearchPresenter
import
com.mints.enjoyboxjia.mvp.presenters.BookSearchPresenter
import
com.mints.enjoyboxjia.mvp.views.BookSearchView
import
com.mints.enjoyboxjia.mvp.views.BookSearchView
import
com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import
com.mints.enjoyboxjia.ui.activitys.base.BaseActivity
import
com.mints.enjoyboxjia.ui.adapter.SearchBookAdapter
import
com.mints.enjoyboxjia.ui.adapter.SearchHistoryAdapter
import
com.mints.enjoyboxjia.ui.adapter.SearchHotBookAdapter
import
com.mints.enjoyboxjia.utils.AppPreferencesManager
import
com.mints.enjoyboxjia.utils.LogUtil
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
kotlinx.android.synthetic.main.activity_book_search.*
import
kotlinx.android.synthetic.main.header_layout.*
import
kotlinx.android.synthetic.main.header_layout.*
class
BookSearchActivity
:
BaseActivity
(),
View
.
OnClickListener
,
BookSearchView
{
class
BookSearchActivity
:
BaseActivity
(),
View
.
OnClickListener
,
BookSearchView
,
OnRefreshListener
,
OnLoadMoreListener
{
companion
object
{
const
val
BOOK_SEARCH_HISTORY
=
"SEARCH_HISTORY"
}
private
val
searchPresenter
by
lazy
{
BookSearchPresenter
()
}
private
val
searchPresenter
by
lazy
{
BookSearchPresenter
()
}
private
var
searchBookAdapter
:
SearchBookAdapter
?
=
null
private
var
searchBookData
=
arrayListOf
<
BookBean
>()
private
var
searchPage
=
1
// 分页
private
var
searchPageSize
=
Constant
.
PAGE_SIZE
// 分页
private
var
searchHotBookAdapter
:
SearchHotBookAdapter
?
=
null
private
var
searchHotBookData
=
arrayListOf
<
BookBean
>()
private
var
searchHistoryAdapter
:
SearchHistoryAdapter
?
=
null
private
var
searchHistoryData
=
arrayListOf
<
String
>()
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_book_search
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_book_search
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
isApplyKitKatTranslucency
()
=
false
...
@@ -19,28 +54,188 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView
...
@@ -19,28 +54,188 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView
tv_title
.
text
=
"书库搜索"
tv_title
.
text
=
"书库搜索"
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
searchPresenter
.
attachView
(
this
)
searchPresenter
.
attachView
(
this
)
initListener
()
initListener
()
initSearchBookAdapter
()
initSearchHotBookAdapter
()
initSearchHistoryAdapter
()
searchPresenter
.
getHotBook
()
getSearchHistory
()
}
private
fun
initSearchHistoryAdapter
()
{
searchHistoryAdapter
=
SearchHistoryAdapter
(
this
)
searchHistoryAdapter
?.
setOnItemClickListener
{
_
,
_
,
position
->
et_search
.
setText
(
searchHistoryData
[
position
])
}
val
layoutManager
=
FlexboxLayoutManager
(
this
)
layoutManager
.
flexWrap
=
FlexWrap
.
WRAP
layoutManager
.
justifyContent
=
JustifyContent
.
FLEX_START
rv_search_history
.
layoutManager
=
layoutManager
rv_search_history
.
adapter
=
searchHistoryAdapter
}
private
fun
initSearchHotBookAdapter
()
{
searchHotBookAdapter
=
SearchHotBookAdapter
(
this
)
searchHotBookAdapter
?.
setOnItemClickListener
{
_
,
_
,
position
->
val
bundle
=
Bundle
()
bundle
.
putString
(
BookReadActivity
.
BOOK_ID
,
searchHotBookData
[
position
].
id
)
readyGo
(
BookReadActivity
::
class
.
java
,
bundle
)
}
rv_hot
.
layoutManager
=
LinearLayoutManager
(
this
)
rv_hot
.
adapter
=
searchHotBookAdapter
}
private
fun
initSearchBookAdapter
()
{
searchBookAdapter
=
SearchBookAdapter
(
this
)
searchBookAdapter
?.
setOnItemClickListener
{
_
,
_
,
position
->
val
bundle
=
Bundle
()
bundle
.
putString
(
BookReadActivity
.
BOOK_ID
,
searchBookData
[
position
].
id
)
readyGo
(
BookReadActivity
::
class
.
java
,
bundle
)
}
rv_search_show
.
layoutManager
=
LinearLayoutManager
(
this
)
rv_search_show
.
adapter
=
searchBookAdapter
}
}
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
when
(
v
?.
id
)
{
R
.
id
.
iv_left_icon
->
finish
()
R
.
id
.
iv_left_icon
->
finish
()
R
.
id
.
btn_search
->
{
searchBook
(
et_search
.
text
.
toString
())
}
R
.
id
.
iv_clear
->
{
clearSearchHistory
()
}
}
}
}
}
private
fun
initListener
()
{
private
fun
initListener
()
{
srl_show
.
setOnRefreshListener
(
this
)
srl_show
.
setOnLoadMoreListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
btn_search
.
setOnClickListener
(
this
)
iv_clear
.
setOnClickListener
(
this
)
et_search
.
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
beforeTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
count
:
Int
,
after
:
Int
)
{}
override
fun
onTextChanged
(
s
:
CharSequence
?,
start
:
Int
,
before
:
Int
,
count
:
Int
)
{
if
(
s
!=
null
&&
s
.
toString
()
!=
""
)
{
addSearchHistory
(
s
.
toString
())
searchBook
(
s
.
toString
())
fl_main
.
visibility
=
View
.
GONE
fl_search_show
.
visibility
=
View
.
VISIBLE
}
else
{
fl_main
.
visibility
=
View
.
VISIBLE
fl_search_show
.
visibility
=
View
.
GONE
}
}
override
fun
afterTextChanged
(
s
:
Editable
?)
{
}
})
}
}
override
fun
getHotBookSuc
(
data
:
Any
)
{
private
fun
searchBook
(
book
:
String
)
{
searchPresenter
.
searchBook
(
book
,
searchPage
,
searchPageSize
)
}
override
fun
getHotBookSuc
(
data
:
BookListBean
)
{
searchHotBookData
.
clear
()
searchHotBookData
.
addAll
(
data
.
records
)
searchHotBookAdapter
?.
setNewInstance
(
searchHotBookData
)
}
}
override
fun
getHotBookFail
()
{
override
fun
getHotBookFail
()
{
}
}
override
fun
getSearchBookSuc
(
data
:
BookListBean
)
{
if
(
searchPage
==
1
)
{
if
(
data
.
records
.
size
>
0
)
{
search_show_empty
.
visibility
=
View
.
GONE
srl_show
.
visibility
=
View
.
VISIBLE
}
else
{
search_show_empty
.
visibility
=
View
.
VISIBLE
srl_show
.
visibility
=
View
.
GONE
}
srl_show
.
finishRefresh
(
true
)
searchBookData
.
clear
()
searchBookData
.
addAll
(
data
.
records
)
searchBookAdapter
?.
setNewInstance
(
data
.
records
)
}
else
{
if
(
data
.
records
.
size
<
searchPageSize
)
{
srl_show
.
finishLoadMoreWithNoMoreData
()
}
else
{
srl_show
.
finishLoadMore
()
}
searchBookData
.
addAll
(
data
.
records
)
searchBookAdapter
?.
addData
(
data
.
records
)
}
}
override
fun
getSearchBookFail
()
{
search_show_empty
.
visibility
=
View
.
GONE
rv_search_show
.
visibility
=
View
.
VISIBLE
}
private
fun
addSearchHistory
(
str
:
String
)
{
LogUtil
.
d
(
"XXXXXXXXXX"
,
str
)
var
searchHistory
=
AppPreferencesManager
.
get
().
getString
(
BOOK_SEARCH_HISTORY
,
""
)
searchHistory
+=
",$str"
AppPreferencesManager
.
get
().
put
(
BOOK_SEARCH_HISTORY
,
searchHistory
)
rv_search_history
.
visibility
=
View
.
VISIBLE
search_empty
.
visibility
=
View
.
GONE
val
searchList
=
searchHistory
!!
.
split
(
","
)
searchHistoryData
.
clear
()
for
(
s
in
searchList
)
{
if
(
s
!=
""
)
{
searchHistoryData
.
add
(
s
)
}
}
searchHistoryAdapter
?.
notifyDataSetChanged
()
}
private
fun
getSearchHistory
()
{
val
searchHistory
=
AppPreferencesManager
.
get
().
getString
(
BOOK_SEARCH_HISTORY
,
""
)
if
(
searchHistory
==
""
)
{
rv_search_history
.
visibility
=
View
.
GONE
search_empty
.
visibility
=
View
.
VISIBLE
}
else
{
rv_search_history
.
visibility
=
View
.
VISIBLE
search_empty
.
visibility
=
View
.
GONE
val
searchList
=
searchHistory
!!
.
split
(
","
)
searchHistoryData
.
clear
()
for
(
s
in
searchList
)
{
if
(
s
!=
""
)
{
searchHistoryData
.
add
(
s
)
}
}
searchHistoryAdapter
?.
setNewInstance
(
searchHistoryData
)
}
}
private
fun
clearSearchHistory
()
{
AppPreferencesManager
.
get
().
put
(
BOOK_SEARCH_HISTORY
,
""
)
searchHistoryData
.
clear
()
searchHistoryAdapter
?.
notifyDataSetChanged
()
rv_search_history
.
visibility
=
View
.
GONE
search_empty
.
visibility
=
View
.
VISIBLE
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
searchPage
=
1
srl_show
.
resetNoMoreData
()
searchBook
(
et_search
.
text
.
toString
())
}
override
fun
onLoadMore
(
refreshLayout
:
RefreshLayout
)
{
++
searchPage
searchBook
(
et_search
.
text
.
toString
())
}
}
}
book/app/src/main/java/com/mints/enjoyboxjia/ui/adapter/BookShelfAdapter.kt
View file @
7f90e6c6
package
com.mints.enjoyboxjia.ui.adapter
package
com.mints.enjoyboxjia.ui.adapter
import
android.app.Activity
import
android.app.Activity
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.view.View
import
android.view.View
import
android.widget.CheckBox
import
android.widget.CheckBox
import
android.widget.ImageView
import
android.widget.ImageView.ScaleType
import
android.widget.TextView
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.GlideUtils
/**
/**
...
@@ -21,18 +28,42 @@ class BookShelfAdapter(var activity: Activity) :
...
@@ -21,18 +28,42 @@ class BookShelfAdapter(var activity: Activity) :
private
var
showEdit
=
false
private
var
showEdit
=
false
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
BookBean
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
BookBean
)
{
if
(
holder
.
adapterPosition
==
data
.
size
-
1
)
{
holder
.
getView
<
ImageView
>(
R
.
id
.
image_iv
).
scaleType
=
ScaleType
.
FIT_XY
return
}
holder
.
getView
<
CheckBox
>(
R
.
id
.
cb
).
isChecked
=
item
.
isChecked
holder
.
getView
<
CheckBox
>(
R
.
id
.
cb
).
isChecked
=
item
.
isChecked
holder
.
getView
<
CheckBox
>(
R
.
id
.
cb
).
setOnCheckedChangeListener
{
buttonView
,
isChecked
->
holder
.
getView
<
CheckBox
>(
R
.
id
.
cb
).
setOnCheckedChangeListener
{
_
,
isChecked
->
item
.
isChecked
=
isChecked
item
.
isChecked
=
isChecked
}
}
holder
.
getView
<
View
>(
R
.
id
.
fm_mask
).
visibility
=
if
(
showEdit
)
View
.
VISIBLE
else
View
.
GONE
holder
.
getView
<
View
>(
R
.
id
.
fm_mask
).
visibility
=
if
(
showEdit
)
View
.
VISIBLE
else
View
.
GONE
holder
.
getView
<
TextView
>(
R
.
id
.
title_tv
).
text
=
item
.
title
holder
.
getView
<
TextView
>(
R
.
id
.
title_tv
).
text
=
item
.
title
// holder.getView<TextView>(R.id.info_tv).text = "观看至第${item.seeIndex}集"
if
(
item
.
tagList
!=
null
&&
item
.
tagList
.
size
>
0
)
{
GlideUtils
.
loadImageView
(
context
,
item
.
avatar
,
holder
.
getView
(
R
.
id
.
image_iv
))
val
span
=
SpannableStringBuilder
()
for
(
i
in
0
until
item
.
tagList
.
size
)
{
val
labelText
=
SpannableString
(
" "
+
item
.
tagList
[
i
].
name
+
" "
)
val
start
=
0
val
end
=
item
.
tagList
[
i
].
name
.
length
+
4
labelText
.
setSpan
(
RoundBackgroundColorSpan
(
ContextCompat
.
getColor
(
activity
,
R
.
color
.
color_FEF3F3
),
ContextCompat
.
getColor
(
activity
,
R
.
color
.
color_F1413C
)
),
start
,
end
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
span
.
append
(
labelText
)
}
holder
.
getView
<
TextView
>(
R
.
id
.
label_tv
).
text
=
span
}
GlideUtils
.
loadImageViewNoAnim2
(
context
,
item
.
avatar
,
holder
.
getView
(
R
.
id
.
image_iv
))
}
}
// 设置编辑状态
// 设置编辑状态
fun
setEditStyle
(
showEdit
:
Boolean
)
{
fun
setEditStyle
(
showEdit
:
Boolean
)
{
this
.
showEdit
=
showEdit
// 清除选中状态
// 清除选中状态
if
(!
this
.
showEdit
)
{
if
(!
this
.
showEdit
)
{
for
(
datum
in
data
)
{
for
(
datum
in
data
)
{
...
@@ -42,16 +73,4 @@ class BookShelfAdapter(var activity: Activity) :
...
@@ -42,16 +73,4 @@ class BookShelfAdapter(var activity: Activity) :
notifyDataSetChanged
()
notifyDataSetChanged
()
}
}
// 设置编辑状态
fun
getEditStyle
():
Boolean
{
return
this
.
showEdit
}
// 全选
fun
fullChoice
()
{
for
(
datum
in
data
)
{
datum
.
isChecked
=
true
}
notifyDataSetChanged
()
}
}
}
\ No newline at end of file
book/app/src/main/java/com/mints/enjoyboxjia/ui/adapter/SearchBookAdapter.kt
0 → 100644
View file @
7f90e6c6
package
com.mints.enjoyboxjia.ui.adapter
import
android.app.Activity
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import
com.mints.library.utils.GlideUtils
class
SearchBookAdapter
(
var
activity
:
Activity
)
:
BaseQuickAdapter
<
BookBean
,
BaseViewHolder
>(
R
.
layout
.
item_hotbook
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
BookBean
)
{
holder
.
getView
<
TextView
>(
R
.
id
.
title_tv
).
text
=
item
.
title
holder
.
getView
<
TextView
>(
R
.
id
.
info_tv
).
text
=
item
.
summary
if
(
item
.
tagList
!=
null
&&
item
.
tagList
.
size
>
0
)
{
val
span
=
SpannableStringBuilder
()
for
(
i
in
0
until
item
.
tagList
.
size
)
{
val
labelText
=
SpannableString
(
" "
+
item
.
tagList
[
i
].
name
+
" "
)
val
start
=
0
val
end
=
item
.
tagList
[
i
].
name
.
length
+
4
labelText
.
setSpan
(
RoundBackgroundColorSpan
(
ContextCompat
.
getColor
(
activity
,
R
.
color
.
color_FEF3F3
),
ContextCompat
.
getColor
(
activity
,
R
.
color
.
color_F1413C
)
),
start
,
end
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
span
.
append
(
labelText
)
}
holder
.
getView
<
TextView
>(
R
.
id
.
label_tv
).
text
=
span
}
GlideUtils
.
loadImageViewNoAnim2
(
context
,
item
.
avatar
,
holder
.
getView
(
R
.
id
.
image_iv
))
}
}
\ No newline at end of file
book/app/src/main/java/com/mints/enjoyboxjia/ui/adapter/SearchHistoryAdapter.kt
0 → 100644
View file @
7f90e6c6
package
com.mints.enjoyboxjia.ui.adapter
import
android.app.Activity
import
android.widget.TextView
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.enjoyboxjia.R
class
SearchHistoryAdapter
(
var
activity
:
Activity
)
:
BaseQuickAdapter
<
String
,
BaseViewHolder
>(
R
.
layout
.
item_search_history
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
String
)
{
holder
.
getView
<
TextView
>(
R
.
id
.
title_tv
).
text
=
item
}
}
\ No newline at end of file
book/app/src/main/java/com/mints/enjoyboxjia/ui/adapter/SearchHotBookAdapter.kt
0 → 100644
View file @
7f90e6c6
package
com.mints.enjoyboxjia.ui.adapter
import
android.app.Activity
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
com.chad.library.adapter.base.BaseQuickAdapter
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.utils.RoundBackgroundColorSpan
import
com.mints.library.utils.GlideUtils
class
SearchHotBookAdapter
(
var
activity
:
Activity
)
:
BaseQuickAdapter
<
BookBean
,
BaseViewHolder
>(
R
.
layout
.
item_hotbook
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
BookBean
)
{
holder
.
getView
<
TextView
>(
R
.
id
.
title_tv
).
text
=
item
.
title
holder
.
getView
<
TextView
>(
R
.
id
.
info_tv
).
text
=
item
.
summary
if
(
item
.
tagList
!=
null
&&
item
.
tagList
.
size
>
0
)
{
val
span
=
SpannableStringBuilder
()
for
(
i
in
0
until
item
.
tagList
.
size
)
{
val
labelText
=
SpannableString
(
" "
+
item
.
tagList
[
i
].
name
+
" "
)
val
start
=
0
val
end
=
item
.
tagList
[
i
].
name
.
length
+
4
labelText
.
setSpan
(
RoundBackgroundColorSpan
(
ContextCompat
.
getColor
(
activity
,
R
.
color
.
color_FEF3F3
),
ContextCompat
.
getColor
(
activity
,
R
.
color
.
color_F1413C
)
),
start
,
end
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
span
.
append
(
labelText
)
}
holder
.
getView
<
TextView
>(
R
.
id
.
label_tv
).
text
=
span
}
GlideUtils
.
loadImageViewNoAnim2
(
context
,
item
.
avatar
,
holder
.
getView
(
R
.
id
.
image_iv
))
}
}
\ No newline at end of file
book/app/src/main/java/com/mints/enjoyboxjia/ui/fragment/BookCityFragment.kt
View file @
7f90e6c6
...
@@ -10,7 +10,6 @@ import android.view.View
...
@@ -10,7 +10,6 @@ import android.view.View
import
android.widget.TextView
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.ad.AdManager
import
com.mints.enjoyboxjia.ad.AdManager
import
com.mints.enjoyboxjia.common.AppConfig
import
com.mints.enjoyboxjia.common.AppConfig
...
@@ -21,6 +20,7 @@ import com.mints.enjoyboxjia.mvp.model.BookListBean
...
@@ -21,6 +20,7 @@ import com.mints.enjoyboxjia.mvp.model.BookListBean
import
com.mints.enjoyboxjia.mvp.presenters.BookCityPresenter
import
com.mints.enjoyboxjia.mvp.presenters.BookCityPresenter
import
com.mints.enjoyboxjia.mvp.views.BookCityView
import
com.mints.enjoyboxjia.mvp.views.BookCityView
import
com.mints.enjoyboxjia.ui.activitys.BookReadActivity
import
com.mints.enjoyboxjia.ui.activitys.BookReadActivity
import
com.mints.enjoyboxjia.ui.activitys.BookSearchActivity
import
com.mints.enjoyboxjia.ui.adapter.HotBookAdapter
import
com.mints.enjoyboxjia.ui.adapter.HotBookAdapter
import
com.mints.enjoyboxjia.ui.adapter.NewBookAdapter
import
com.mints.enjoyboxjia.ui.adapter.NewBookAdapter
import
com.mints.enjoyboxjia.ui.adapter.ImageTitleAdapter
import
com.mints.enjoyboxjia.ui.adapter.ImageTitleAdapter
...
@@ -40,9 +40,9 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
...
@@ -40,9 +40,9 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
var
hotBookAdapter
:
HotBookAdapter
?
=
null
private
var
hotBookAdapter
:
HotBookAdapter
?
=
null
private
var
hotBookData
:
MutableList
<
BookBean
>
=
mutableListOf
()
private
var
hotBookData
=
arrayListOf
<
BookBean
>
()
private
var
newBookAdapter
:
NewBookAdapter
?
=
null
private
var
newBookAdapter
:
NewBookAdapter
?
=
null
private
var
newBookData
:
MutableList
<
BookBean
>
=
mutableListOf
()
private
var
newBookData
=
arrayListOf
<
BookBean
>
()
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_bookcity
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_bookcity
...
@@ -162,11 +162,11 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
...
@@ -162,11 +162,11 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
}
}
override
fun
getHotBookSuc
(
data
:
BookListBean
)
{
override
fun
getHotBookSuc
(
data
:
BookListBean
)
{
//
hotBookData.clear()
hotBookData
.
clear
()
//
hotBookData.addAll(data.records)
hotBookData
.
addAll
(
data
.
records
)
//
hotBookData.removeAt(0)
hotBookData
.
removeAt
(
0
)
//
hotBookAdapter?.addHeaderView(getHotHeader(data.records[0]))
hotBookAdapter
?.
addHeaderView
(
getHotHeader
(
data
.
records
[
0
]))
//
hotBookAdapter?.setNewInstance(hotBookData)
hotBookAdapter
?.
setNewInstance
(
hotBookData
)
}
}
override
fun
getHotBookFail
()
{}
override
fun
getHotBookFail
()
{}
...
@@ -175,12 +175,6 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
...
@@ -175,12 +175,6 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
newBookData
.
clear
()
newBookData
.
clear
()
newBookData
.
addAll
(
data
.
records
)
newBookData
.
addAll
(
data
.
records
)
newBookAdapter
?.
setNewInstance
(
newBookData
)
newBookAdapter
?.
setNewInstance
(
newBookData
)
hotBookData
.
clear
()
hotBookData
.
addAll
(
data
.
records
)
hotBookData
.
removeAt
(
0
)
hotBookAdapter
?.
addHeaderView
(
getHotHeader
(
data
.
records
[
0
]))
hotBookAdapter
?.
setNewInstance
(
hotBookData
)
}
}
override
fun
getNewBookFail
()
{}
override
fun
getNewBookFail
()
{}
...
@@ -207,6 +201,7 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
...
@@ -207,6 +201,7 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
bookCityPresenter
.
getNewBook
()
bookCityPresenter
.
getNewBook
()
}
}
R
.
id
.
view_search
->
{
R
.
id
.
view_search
->
{
readyGo
(
BookSearchActivity
::
class
.
java
)
}
}
}
}
}
}
...
...
book/app/src/main/java/com/mints/enjoyboxjia/ui/fragment/BookShelfFragment.kt
View file @
7f90e6c6
...
@@ -6,6 +6,7 @@ import androidx.recyclerview.widget.GridLayoutManager
...
@@ -6,6 +6,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.common.AppConfig
import
com.mints.enjoyboxjia.common.AppConfig
import
com.mints.enjoyboxjia.common.Constant
import
com.mints.enjoyboxjia.common.Constant
import
com.mints.enjoyboxjia.manager.ReadTimeCount
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.mvp.model.BookBean
import
com.mints.enjoyboxjia.mvp.model.BookListBean
import
com.mints.enjoyboxjia.mvp.model.BookListBean
import
com.mints.enjoyboxjia.mvp.presenters.BookShelfPresenter
import
com.mints.enjoyboxjia.mvp.presenters.BookShelfPresenter
...
@@ -16,6 +17,7 @@ import com.mints.enjoyboxjia.ui.adapter.BookShelfAdapter
...
@@ -16,6 +17,7 @@ import com.mints.enjoyboxjia.ui.adapter.BookShelfAdapter
import
com.mints.enjoyboxjia.ui.adapter.LikeBookAdapter
import
com.mints.enjoyboxjia.ui.adapter.LikeBookAdapter
import
com.mints.enjoyboxjia.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.enjoyboxjia.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.enjoyboxjia.utils.GridSpacingItemDecoration
import
com.mints.enjoyboxjia.utils.GridSpacingItemDecoration
import
com.mints.enjoyboxjia.utils.SpanUtils
import
kotlinx.android.synthetic.main.fragment_main_bookshelf.*
import
kotlinx.android.synthetic.main.fragment_main_bookshelf.*
...
@@ -26,7 +28,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -26,7 +28,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
private
var
bookShelfAdapter
:
BookShelfAdapter
?
=
null
private
var
bookShelfAdapter
:
BookShelfAdapter
?
=
null
private
var
likeBookAdapter
:
LikeBookAdapter
?
=
null
private
var
likeBookAdapter
:
LikeBookAdapter
?
=
null
private
var
likeBookData
:
MutableList
<
BookBean
>
=
mutableListOf
()
private
var
likeBookData
=
arrayListOf
<
BookBean
>
()
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_bookshelf
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_bookshelf
...
@@ -35,6 +37,25 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -35,6 +37,25 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
initListener
()
initListener
()
initLikeAdapter
()
initLikeAdapter
()
initShelfAdapter
()
}
private
fun
initShelfAdapter
()
{
bookShelfAdapter
=
BookShelfAdapter
(
requireActivity
())
bookShelfAdapter
?.
setOnItemClickListener
{
_
,
_
,
position
->
if
(
position
>=
shelfBookData
.
size
-
1
)
{
(
requireActivity
()
as
MainActivity
).
clickTab2Layout
()
return
@setOnItemClickListener
}
val
bundle
=
Bundle
()
bundle
.
putString
(
BookReadActivity
.
BOOK_ID
,
shelfBookData
[
position
].
id
)
readyGo
(
BookReadActivity
::
class
.
java
,
bundle
)
}
rv_bookshelf
.
layoutManager
=
GridLayoutManager
(
requireContext
(),
3
)
val
itemDecoration
=
GridSpacingItemDecoration
(
3
,
10
,
false
)
rv_bookshelf
.
addItemDecoration
(
itemDecoration
)
rv_bookshelf
.
adapter
=
bookShelfAdapter
}
}
private
fun
initLikeAdapter
()
{
private
fun
initLikeAdapter
()
{
...
@@ -45,7 +66,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -45,7 +66,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
readyGo
(
BookReadActivity
::
class
.
java
,
bundle
)
readyGo
(
BookReadActivity
::
class
.
java
,
bundle
)
}
}
rv_booklike
.
layoutManager
=
GridLayoutManager
(
requireContext
(),
4
)
rv_booklike
.
layoutManager
=
GridLayoutManager
(
requireContext
(),
4
)
val
itemDecoration
=
GridSpacingItemDecoration
(
5
,
10
,
false
)
val
itemDecoration
=
GridSpacingItemDecoration
(
4
,
10
,
false
)
rv_booklike
.
addItemDecoration
(
itemDecoration
)
rv_booklike
.
addItemDecoration
(
itemDecoration
)
rv_booklike
.
adapter
=
likeBookAdapter
rv_booklike
.
adapter
=
likeBookAdapter
}
}
...
@@ -54,7 +75,34 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -54,7 +75,34 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_ONE
)
{
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_ONE
)
{
bookShelfPresenter
.
getCollectList
()
bookShelfPresenter
.
getCollectList
()
bookShelfPresenter
.
getArticleLike
()
bookShelfPresenter
.
getArticleLike
()
}
getReadTime
()
}
}
private
fun
getReadTime
()
{
val
time
=
ReadTimeCount
.
instance
.
getReadTime
()
tv_read_hour
.
text
=
SpanUtils
()
.
append
(
time
[
0
])
.
setFontSize
(
20
,
true
)
.
setBold
()
.
append
(
"\n小时"
)
.
setFontSize
(
10
,
true
)
.
create
()
tv_read_minute
.
text
=
SpanUtils
()
.
append
(
time
[
1
])
.
setFontSize
(
20
,
true
)
.
setBold
()
.
append
(
"\n分"
)
.
setFontSize
(
10
,
true
)
.
create
()
tv_read_second
.
text
=
SpanUtils
()
.
append
(
time
[
2
])
.
setFontSize
(
20
,
true
)
.
setBold
()
.
append
(
"\n秒"
)
.
setFontSize
(
10
,
true
)
.
create
()
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
...
@@ -75,13 +123,23 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -75,13 +123,23 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
iv_edit
.
setOnClickListener
(
this
)
iv_edit
.
setOnClickListener
(
this
)
iv_close
.
setOnClickListener
(
this
)
iv_close
.
setOnClickListener
(
this
)
iv_change
.
setOnClickListener
(
this
)
iv_change
.
setOnClickListener
(
this
)
btn_empty
.
setOnClickListener
(
this
)
}
}
override
fun
getCollectListSuc
(
data
:
BookListBean
)
{
override
fun
getCollectListSuc
(
data
:
BookListBean
)
{
if
(
data
.
records
.
size
>
0
)
{
bookshelf_empty
.
visibility
=
View
.
GONE
rv_bookshelf
.
visibility
=
View
.
VISIBLE
shelfBookData
.
clear
()
shelfBookData
.
clear
()
shelfBookData
.
addAll
(
data
.
records
)
shelfBookData
.
addAll
(
data
.
records
)
shelfBookData
.
add
(
BookBean
())
bookShelfAdapter
?.
setNewInstance
(
shelfBookData
)
bookShelfAdapter
?.
setNewInstance
(
shelfBookData
)
bookShelfAdapter
?.
setEditStyle
(
false
)
bookShelfAdapter
?.
setEditStyle
(
false
)
}
else
{
bookshelf_empty
.
visibility
=
View
.
VISIBLE
rv_bookshelf
.
visibility
=
View
.
GONE
}
}
}
override
fun
getCollectListFail
()
{
override
fun
getCollectListFail
()
{
...
@@ -99,10 +157,11 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -99,10 +157,11 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
override
fun
cancelCollectSuc
()
{
override
fun
cancelCollectSuc
()
{
bookShelfPresenter
.
getCollectList
()
bookShelfPresenter
.
getCollectList
()
(
requireActivity
()
as
MainActivity
).
showEdit
(
tru
e
)
handleEditStyle
(
fals
e
)
}
}
override
fun
cancelCollectFail
()
{
override
fun
cancelCollectFail
()
{
handleEditStyle
(
false
)
}
}
private
fun
handleEditStyle
(
isEdit
:
Boolean
)
{
private
fun
handleEditStyle
(
isEdit
:
Boolean
)
{
...
@@ -126,10 +185,10 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -126,10 +185,10 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
}
}
fun
delete
()
{
fun
delete
()
{
va
l
strArr
=
arrayListOf
<
String
>()
va
r
strArr
=
""
for
(
datum
in
shelfBookData
)
{
for
(
datum
in
shelfBookData
)
{
if
(
datum
.
isChecked
)
{
if
(
datum
.
isChecked
&&
datum
.
id
!=
null
)
{
strArr
.
add
(
""
+
datum
.
id
)
strArr
+=
(
datum
.
id
+
","
)
}
}
}
}
bookShelfPresenter
.
cancelCollect
(
strArr
)
bookShelfPresenter
.
cancelCollect
(
strArr
)
...
@@ -147,6 +206,9 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
...
@@ -147,6 +206,9 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
R
.
id
.
iv_change
->
{
R
.
id
.
iv_change
->
{
bookShelfPresenter
.
getArticleLike
()
bookShelfPresenter
.
getArticleLike
()
}
}
R
.
id
.
btn_empty
->
{
(
requireActivity
()
as
MainActivity
).
clickTab2Layout
()
}
}
}
}
}
}
}
...
...
book/app/src/main/java/com/mints/enjoyboxjia/ui/widgets/BookSettingDialog.kt
View file @
7f90e6c6
...
@@ -3,15 +3,17 @@ package com.mints.enjoyboxjia.ui.widgets
...
@@ -3,15 +3,17 @@ package com.mints.enjoyboxjia.ui.widgets
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Context
import
android.content.Context
import
android.view.Gravity
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.WindowManager
import
android.view.WindowManager
import
android.widget.RadioButton
import
android.widget.SeekBar
import
android.widget.SeekBar
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.R
import
com.mints.enjoyboxjia.common.BOOK_CONTENT_COLOR
import
com.mints.enjoyboxjia.common.BOOK_CONTENT_SIZE
import
com.mints.enjoyboxjia.common.BookConstant
import
com.mints.enjoyboxjia.common.BookConstant
import
com.mints.enjoyboxjia.utils.AppPreferencesManager
import
kotlinx.android.synthetic.main.dialog_book_setting.*
import
kotlinx.android.synthetic.main.dialog_book_setting.*
class
BookSettingDialog
(
context
:
Context
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
,
View
.
OnClickListener
{
class
BookSettingDialog
(
context
:
Context
)
:
Dialog
(
context
,
R
.
style
.
dialog
)
{
private
var
mOnBookSettingCallback
:
OnBookSettingCallback
?
=
null
private
var
mOnBookSettingCallback
:
OnBookSettingCallback
?
=
null
...
@@ -22,21 +24,16 @@ class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), Vie
...
@@ -22,21 +24,16 @@ class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), Vie
lp
.
gravity
=
Gravity
.
BOTTOM
lp
.
gravity
=
Gravity
.
BOTTOM
lp
.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
lp
.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
lp
.
windowAnimations
=
R
.
style
.
DialogAnimBottom
lp
.
windowAnimations
=
R
.
style
.
DialogAnimBottom
//
lp.dimAmount = 0f // 去背景遮盖
//
lp.dimAmount = 0f // 去背景遮盖
lp
.
alpha
=
1f
//透明效果
lp
.
alpha
=
1f
//透明效果
window
!!
.
attributes
=
lp
window
!!
.
attributes
=
lp
// 设置外部不可关闭
setCancelable
(
true
)
setCancelable
(
true
)
setCanceledOnTouchOutside
(
true
)
setCanceledOnTouchOutside
(
true
)
// setOnKeyListener { _, i, _ ->
// i == KeyEvent.KEYCODE_BACK
// }
(
seekbar
as
SeekBar
).
setOnSeekBarChangeListener
(
object
:
SeekBar
.
OnSeekBarChangeListener
{
(
seekbar
as
SeekBar
).
setOnSeekBarChangeListener
(
object
:
SeekBar
.
OnSeekBarChangeListener
{
override
fun
onProgressChanged
(
seekBar
:
SeekBar
?,
progress
:
Int
,
fromUser
:
Boolean
)
{
override
fun
onProgressChanged
(
seekBar
:
SeekBar
?,
progress
:
Int
,
fromUser
:
Boolean
)
{
mOnBookSettingCallback
?.
onFontSize
(
progress
)
tv_seek
.
text
=
"$progress"
tv_seek
.
text
=
"$progress"
mOnBookSettingCallback
?.
onFontSize
(
progress
)
}
}
override
fun
onStartTrackingTouch
(
seekBar
:
SeekBar
?)
{}
override
fun
onStartTrackingTouch
(
seekBar
:
SeekBar
?)
{}
...
@@ -44,17 +41,18 @@ class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), Vie
...
@@ -44,17 +41,18 @@ class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), Vie
override
fun
onStopTrackingTouch
(
seekBar
:
SeekBar
?)
{}
override
fun
onStopTrackingTouch
(
seekBar
:
SeekBar
?)
{}
})
})
rg_color
.
setOnCheckedChangeListener
{
group
,
checkedId
->
rb_color1
.
setOnClickListener
(
this
)
for
(
i
in
0
until
group
.
childCount
)
{
rb_color2
.
setOnClickListener
(
this
)
val
rb
=
group
.
getChildAt
(
i
)
as
RadioButton
rb_color3
.
setOnClickListener
(
this
)
if
(
rb
.
id
==
checkedId
)
{
rb_color4
.
setOnClickListener
(
this
)
rb
.
scaleX
=
1.2f
rb_color5
.
setOnClickListener
(
this
)
rb
.
scaleY
=
1.2f
rb_color6
.
setOnClickListener
(
this
)
}
else
{
rb
.
scaleX
=
1f
rb
.
scaleY
=
1f
}
}
}
override
fun
onClick
(
v
:
View
?)
{
when
(
checkedId
)
{
when
(
v
?.
id
)
{
R
.
id
.
rb_color1
->
{
R
.
id
.
rb_color1
->
{
mOnBookSettingCallback
?.
onBgColor
(
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
)
mOnBookSettingCallback
?.
onBgColor
(
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
)
}
}
...
@@ -73,6 +71,53 @@ class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), Vie
...
@@ -73,6 +71,53 @@ class BookSettingDialog(context: Context) : Dialog(context, R.style.dialog), Vie
R
.
id
.
rb_color6
->
{
R
.
id
.
rb_color6
->
{
mOnBookSettingCallback
?.
onBgColor
(
BookConstant
.
BOOK_CONTENT_COLOR_6
.
color
)
mOnBookSettingCallback
?.
onBgColor
(
BookConstant
.
BOOK_CONTENT_COLOR_6
.
color
)
}
}
else
->
{}
}
}
}
fun
loadSetting
()
{
val
color
=
AppPreferencesManager
.
get
()
.
getInt
(
BOOK_CONTENT_COLOR
,
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
)
val
size
=
AppPreferencesManager
.
get
()
.
getInt
(
BOOK_CONTENT_SIZE
,
17
)
tv_seek
.
text
=
"$size"
seekbar
.
progress
=
size
mOnBookSettingCallback
?.
onBgColor
(
color
)
mOnBookSettingCallback
?.
onFontSize
(
size
)
when
(
color
)
{
BookConstant
.
BOOK_CONTENT_COLOR_1
.
color
->
{
rb_color1
.
scaleX
=
1.2f
rb_color1
.
scaleY
=
1.2f
rb_color1
.
isChecked
=
true
}
BookConstant
.
BOOK_CONTENT_COLOR_2
.
color
->
{
rb_color2
.
scaleX
=
1.2f
rb_color2
.
scaleY
=
1.2f
rb_color2
.
isChecked
=
true
}
BookConstant
.
BOOK_CONTENT_COLOR_3
.
color
->
{
rb_color3
.
scaleX
=
1.2f
rb_color3
.
scaleY
=
1.2f
rb_color3
.
isChecked
=
true
}
BookConstant
.
BOOK_CONTENT_COLOR_4
.
color
->
{
rb_color4
.
scaleX
=
1.2f
rb_color4
.
scaleY
=
1.2f
rb_color4
.
isChecked
=
true
}
BookConstant
.
BOOK_CONTENT_COLOR_5
.
color
->
{
rb_color5
.
scaleX
=
1.2f
rb_color5
.
scaleY
=
1.2f
rb_color5
.
isChecked
=
true
}
BookConstant
.
BOOK_CONTENT_COLOR_6
.
color
->
{
rb_color6
.
scaleX
=
1.2f
rb_color6
.
scaleY
=
1.2f
rb_color6
.
isChecked
=
true
}
}
}
}
}
...
...
book/app/src/main/java/com/mints/enjoyboxjia/utils/TimeRender.kt
View file @
7f90e6c6
...
@@ -193,7 +193,8 @@ object TimeRender {
...
@@ -193,7 +193,8 @@ object TimeRender {
val
yearZ
=
split
[
0
].
toInt
()
val
yearZ
=
split
[
0
].
toInt
()
val
monthZ
=
split
[
1
].
toInt
()
-
1
val
monthZ
=
split
[
1
].
toInt
()
-
1
val
dayZ
=
split
[
2
].
toInt
()
val
dayZ
=
split
[
2
].
toInt
()
val
datePickerDialog
=
DatePickerDialog
(
context
!!
,
OnDateSetListener
{
view
,
year
,
monthOfYear
,
dayOfMonth
->
val
datePickerDialog
=
DatePickerDialog
(
context
!!
,
OnDateSetListener
{
view
,
year
,
monthOfYear
,
dayOfMonth
->
nqMonth
=
if
(
monthOfYear
+
1
<
10
)
{
nqMonth
=
if
(
monthOfYear
+
1
<
10
)
{
"0"
+
(
monthOfYear
+
1
)
"0"
+
(
monthOfYear
+
1
)
}
else
{
}
else
{
...
@@ -257,6 +258,27 @@ object TimeRender {
...
@@ -257,6 +258,27 @@ object TimeRender {
return
HMStime
return
HMStime
}
}
fun
ms2HMS_S
(
ms
:
Int
):
Array
<
String
>
{
var
_ms
=
ms
_ms
/=
1000
val
hour
=
_ms
/
3600
val
mint
=
_ms
%
3600
/
60
val
sed
=
_ms
%
60
var
hourStr
=
hour
.
toString
()
if
(
hour
<
10
)
{
hourStr
=
"0$hourStr"
}
var
mintStr
=
mint
.
toString
()
if
(
mint
<
10
)
{
mintStr
=
"0$mintStr"
}
var
sedStr
=
sed
.
toString
()
if
(
sed
<
10
)
{
sedStr
=
"0$sedStr"
}
return
arrayOf
(
hourStr
,
mintStr
,
sedStr
)
}
/**
/**
* 时间戳转换成时间格式
* 时间戳转换成时间格式
*
*
...
@@ -291,6 +313,7 @@ object TimeRender {
...
@@ -291,6 +313,7 @@ object TimeRender {
now
[
Calendar
.
DATE
]
=
now
[
Calendar
.
DATE
]
+
day
now
[
Calendar
.
DATE
]
=
now
[
Calendar
.
DATE
]
+
day
return
formatDateDot
(
now
.
time
)
return
formatDateDot
(
now
.
time
)
}
}
fun
formatDateDot
(
date
:
Date
?):
String
{
fun
formatDateDot
(
date
:
Date
?):
String
{
val
f
=
SimpleDateFormat
(
DEFAULT_FORMAT_DOT
)
val
f
=
SimpleDateFormat
(
DEFAULT_FORMAT_DOT
)
return
f
.
format
(
date
)
return
f
.
format
(
date
)
...
...
book/app/src/main/res/drawable/selector_book_content_1.xml
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_book_content_color1_s"
android:state_check
able=
"true"
android:state_select
ed=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color1_s"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color1"
android:state_check
able=
"false"
android:state_select
ed=
"false"
/>
<item
android:drawable=
"@drawable/shape_book_content_color1"
android:state_checked=
"false"
/>
</selector>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/selector_book_content_2.xml
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_book_content_color2_s"
android:state_check
able=
"true"
android:state_select
ed=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color2_s"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color2"
android:state_check
able=
"false"
android:state_select
ed=
"false"
/>
<item
android:drawable=
"@drawable/shape_book_content_color2"
android:state_checked=
"false"
/>
</selector>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/selector_book_content_3.xml
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_book_content_color3_s"
android:state_check
able=
"true"
android:state_select
ed=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color3_s"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color3"
android:state_check
able=
"false"
android:state_select
ed=
"false"
/>
<item
android:drawable=
"@drawable/shape_book_content_color3"
android:state_checked=
"false"
/>
</selector>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/selector_book_content_4.xml
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_book_content_color4_s"
android:state_check
able=
"true"
android:state_select
ed=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color4_s"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color4"
android:state_check
able=
"false"
android:state_select
ed=
"false"
/>
<item
android:drawable=
"@drawable/shape_book_content_color4"
android:state_checked=
"false"
/>
</selector>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/selector_book_content_5.xml
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_book_content_color5_s"
android:state_check
able=
"true"
android:state_select
ed=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color5_s"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color5"
android:state_check
able=
"false"
android:state_select
ed=
"false"
/>
<item
android:drawable=
"@drawable/shape_book_content_color5"
android:state_checked=
"false"
/>
</selector>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/selector_book_content_6.xml
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_book_content_color6_s"
android:state_check
able=
"true"
android:state_select
ed=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color6_s"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/shape_book_content_color6"
android:state_check
able=
"false"
android:state_select
ed=
"false"
/>
<item
android:drawable=
"@drawable/shape_book_content_color6"
android:state_checked=
"false"
/>
</selector>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/selector_search_edit.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/shape_round_blue"
android:state_focused=
"true"
/>
<item
android:drawable=
"@drawable/shape_round_gray"
android:state_focused=
"false"
/>
</selector>
\ No newline at end of file
book/app/src/main/res/drawable/shape_bg_time.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#FEF3F3"
/>
<corners
android:radius=
"5dip"
/>
</shape>
\ No newline at end of file
book/app/src/main/res/drawable/shape_full_blue.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/gmts_blue"
/>
<corners
android:radius=
"4dip"
/>
</shape>
\ No newline at end of file
book/app/src/main/res/drawable/shape_half_trans.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<solid
android:color=
"@color/half_transparent"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"10dp"
/>
</shape>
\ No newline at end of file
book/app/src/main/res/drawable/shape_round_gray.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<solid
android:color=
"@color/full_transparent"
/>
<stroke
android:width=
"1dp"
android:color=
"@color/id_photo_gray"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"4dip"
/>
</shape>
\ No newline at end of file
book/app/src/main/res/drawable/shape_search_gary.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<solid
android:color=
"@color/id_photo_gray"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"10dp"
/>
</shape>
\ No newline at end of file
book/app/src/main/res/layout/activity_book_search.xml
View file @
7f90e6c6
...
@@ -3,12 +3,57 @@
...
@@ -3,12 +3,57 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/
white
"
android:background=
"@color/
color_FFF7F7
"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<include
layout=
"@layout/header_layout"
/>
<include
layout=
"@layout/header_layout"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:padding=
"15dp"
>
<com.mints.enjoyboxjia.ui.widgets.ClearEditText
android:id=
"@+id/et_search"
android:layout_width=
"0dp"
android:layout_height=
"36dp"
android:layout_weight=
"1"
android:background=
"@drawable/selector_search_edit"
android:gravity=
"center_vertical"
android:hint=
"请输入书名或者作者名"
android:inputType=
"text"
android:maxLength=
"13"
android:maxLines=
"1"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
android:textColor=
"#172B54"
android:textColorHint=
"#BEC2CC"
android:textSize=
"12sp"
/>
<Button
android:id=
"@+id/btn_search"
android:layout_width=
"66dp"
android:layout_height=
"30dp"
android:layout_marginStart=
"10dp"
android:background=
"@drawable/shape_full_blue"
android:text=
"搜索"
android:textColor=
"@color/white"
/>
</LinearLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.mints.enjoyboxjia.ui.widgets.ElasticScrollView
<com.mints.enjoyboxjia.ui.widgets.ElasticScrollView
android:id=
"@+id/fl_main"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:fillViewport=
"true"
android:fillViewport=
"true"
...
@@ -19,6 +64,62 @@
...
@@ -19,6 +64,62 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"20dp"
android:layout_marginEnd=
"20dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:text=
"搜索历史"
android:textColor=
"@color/black"
android:textSize=
"16sp"
/>
<ImageView
android:id=
"@+id/iv_clear"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/ic_text_clear"
/>
</LinearLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"20dp"
android:layout_marginTop=
"10dp"
android:layout_marginEnd=
"20dp"
android:background=
"#ededed"
>
<FrameLayout
android:id=
"@+id/search_empty"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"40dp"
android:layout_marginBottom=
"40dp"
android:src=
"@mipmap/bg_search_data"
/>
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_search_history"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"10dp"
/>
</FrameLayout>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
@@ -56,8 +157,59 @@
...
@@ -56,8 +157,59 @@
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.mints.enjoyboxjia.ui.widgets.ElasticScrollView>
</com.mints.enjoyboxjia.ui.widgets.ElasticScrollView>
<FrameLayout
android:id=
"@+id/fl_search_show"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
>
<FrameLayout
android:id=
"@+id/search_show_empty"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"40dp"
android:layout_marginBottom=
"40dp"
android:src=
"@mipmap/bg_search_data"
/>
</FrameLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id=
"@+id/srl_show"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:srlAccentColor=
"@color/black"
app:srlPrimaryColor=
"#fef3f3"
>
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_search_show"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"10dp"
/>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:srlAccentColor=
"@color/black"
app:srlPrimaryColor=
"#F8F8F8"
/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout>
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
book/app/src/main/res/layout/dialog_book_setting.xml
View file @
7f90e6c6
...
@@ -2,13 +2,14 @@
...
@@ -2,13 +2,14 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@
color/white
"
android:background=
"@
drawable/shape_tab_friends
"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:padding=
"20dp"
>
android:padding=
"20dp"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:text=
"字体大小"
android:text=
"字体大小"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
android:textSize=
"14sp"
android:textSize=
"14sp"
...
@@ -26,6 +27,7 @@
...
@@ -26,6 +27,7 @@
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:background=
"@color/full_transparent"
android:max=
"24"
android:max=
"24"
android:maxHeight=
"5dp"
android:maxHeight=
"5dp"
android:min=
"14"
android:min=
"14"
...
@@ -51,14 +53,15 @@
...
@@ -51,14 +53,15 @@
android:textSize=
"14sp"
android:textSize=
"14sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<LinearLayout
<RadioGroup
android:id=
"@+id/rg_color"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
60dp
"
android:layout_marginTop=
"15dp"
android:layout_marginTop=
"15dp"
android:gravity=
"center
_horizontal
"
android:gravity=
"center"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<
CheckBox
<
RadioButton
android:id=
"@+id/rb_color1"
android:id=
"@+id/rb_color1"
android:layout_width=
"42dp"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_height=
"42dp"
...
@@ -67,7 +70,7 @@
...
@@ -67,7 +70,7 @@
android:button=
"@null"
android:button=
"@null"
android:checked=
"true"
/>
android:checked=
"true"
/>
<
CheckBox
<
RadioButton
android:id=
"@+id/rb_color2"
android:id=
"@+id/rb_color2"
android:layout_width=
"42dp"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_height=
"42dp"
...
@@ -76,7 +79,7 @@
...
@@ -76,7 +79,7 @@
android:button=
"@null"
android:button=
"@null"
android:checked=
"false"
/>
android:checked=
"false"
/>
<
CheckBox
<
RadioButton
android:id=
"@+id/rb_color3"
android:id=
"@+id/rb_color3"
android:layout_width=
"42dp"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_height=
"42dp"
...
@@ -85,7 +88,7 @@
...
@@ -85,7 +88,7 @@
android:button=
"@null"
android:button=
"@null"
android:checked=
"false"
/>
android:checked=
"false"
/>
<
CheckBox
<
RadioButton
android:id=
"@+id/rb_color4"
android:id=
"@+id/rb_color4"
android:layout_width=
"42dp"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_height=
"42dp"
...
@@ -94,7 +97,7 @@
...
@@ -94,7 +97,7 @@
android:button=
"@null"
android:button=
"@null"
android:checked=
"false"
/>
android:checked=
"false"
/>
<
CheckBox
<
RadioButton
android:id=
"@+id/rb_color5"
android:id=
"@+id/rb_color5"
android:layout_width=
"42dp"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_height=
"42dp"
...
@@ -103,7 +106,7 @@
...
@@ -103,7 +106,7 @@
android:button=
"@null"
android:button=
"@null"
android:checked=
"false"
/>
android:checked=
"false"
/>
<
CheckBox
<
RadioButton
android:id=
"@+id/rb_color6"
android:id=
"@+id/rb_color6"
android:layout_width=
"42dp"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_height=
"42dp"
...
@@ -111,6 +114,6 @@
...
@@ -111,6 +114,6 @@
android:button=
"@null"
android:button=
"@null"
android:checked=
"false"
/>
android:checked=
"false"
/>
</
LinearLayout
>
</
RadioGroup
>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
book/app/src/main/res/layout/fragment_main_bookcity.xml
View file @
7f90e6c6
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:text=
"搜索"
android:text=
"搜索
书名或者作者名
"
android:textColor=
"#A5A5AD"
android:textColor=
"#A5A5AD"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
...
...
book/app/src/main/res/layout/fragment_main_bookshelf.xml
View file @
7f90e6c6
...
@@ -28,15 +28,47 @@
...
@@ -28,15 +28,47 @@
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:src=
"@mipmap/readtext"
/>
android:src=
"@mipmap/readtext"
/>
<
View
<
LinearLayout
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"40dp"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
>
<TextView
android:id=
"@+id/tv_read_hour"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"10dp"
android:background=
"@drawable/shape_bg_time"
android:gravity=
"center"
android:lineSpacingMultiplier=
"0.8"
android:textColor=
"@color/black"
/>
<TextView
android:id=
"@+id/tv_read_minute"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"10dp"
android:background=
"@drawable/shape_bg_time"
android:gravity=
"center"
android:lineSpacingMultiplier=
"0.8"
android:textColor=
"@color/black"
/>
<TextView
android:id=
"@+id/tv_read_second"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"10dp"
android:background=
"@drawable/shape_bg_time"
android:gravity=
"center"
android:lineSpacingMultiplier=
"0.8"
android:textColor=
"@color/black"
/>
</LinearLayout>
<ImageView
<ImageView
android:id=
"@+id/iv_edit"
android:id=
"@+id/iv_edit"
android:layout_width=
"
30
dp"
android:layout_width=
"
26
dp"
android:layout_height=
"
30
dp"
android:layout_height=
"
26
dp"
android:src=
"@mipmap/edit"
/>
android:src=
"@mipmap/edit"
/>
<ImageView
<ImageView
...
@@ -51,7 +83,33 @@
...
@@ -51,7 +83,33 @@
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_bookshelf"
android:id=
"@+id/rv_bookshelf"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:visibility=
"gone"
/>
<LinearLayout
android:id=
"@+id/bookshelf_empty"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"10dp"
android:src=
"@mipmap/bg_book_data"
/>
<Button
android:id=
"@+id/btn_empty"
android:layout_width=
"130dp"
android:layout_height=
"36dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/shape_red"
android:text=
"去书城看看"
android:textColor=
"@color/white"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
...
book/app/src/main/res/layout/item_bookshelf.xml
View file @
7f90e6c6
...
@@ -2,19 +2,17 @@
...
@@ -2,19 +2,17 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"20
6
dp"
android:layout_height=
"20
2
dp"
android:layout_marginTop=
"4dp"
android:layout_marginTop=
"4dp"
android:layout_marginBottom=
"6dp"
android:layout_marginBottom=
"6dp"
android:orientation=
"vertical"
android:orientation=
"vertical"
>
android:paddingLeft=
"5dp"
android:paddingRight=
"5dp"
>
<ImageView
<ImageView
android:id=
"@+id/image_iv"
android:id=
"@+id/image_iv"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"150dp"
android:layout_height=
"150dp"
android:scaleType=
"centerCrop"
android:scaleType=
"centerCrop"
android:src=
"@mipmap/
ic_launcher_main
"
android:src=
"@mipmap/
bg_book_more
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
...
@@ -26,19 +24,17 @@
...
@@ -26,19 +24,17 @@
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxLines=
"1"
android:text=
"重回80年代"
android:textColor=
"@color/black"
android:textColor=
"@color/black"
app:layout_constraintStart_toStartOf=
"@id/image_iv"
app:layout_constraintStart_toStartOf=
"@id/image_iv"
app:layout_constraintTop_toBottomOf=
"@id/image_iv"
/>
app:layout_constraintTop_toBottomOf=
"@id/image_iv"
/>
<TextView
<TextView
android:id=
"@+id/
info
_tv"
android:id=
"@+id/
label
_tv"
android:layout_width=
"106dp"
android:layout_width=
"106dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"4dp"
android:layout_marginTop=
"4dp"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxLines=
"1"
android:text=
"重回80年代"
android:textColor=
"@color/gray"
android:textColor=
"@color/gray"
android:textSize=
"12sp"
android:textSize=
"12sp"
app:layout_constraintStart_toStartOf=
"@id/image_iv"
app:layout_constraintStart_toStartOf=
"@id/image_iv"
...
@@ -48,7 +44,8 @@
...
@@ -48,7 +44,8 @@
android:id=
"@+id/fm_mask"
android:id=
"@+id/fm_mask"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
android:background=
"@drawable/shape_half_trans"
android:visibility=
"gone"
>
<CheckBox
<CheckBox
android:id=
"@+id/cb"
android:id=
"@+id/cb"
...
...
book/app/src/main/res/layout/item_search_history.xml
0 → 100644
View file @
7f90e6c6
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"6dp"
android:layout_marginBottom=
"6dp"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/title_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_search_gary"
android:gravity=
"center"
android:paddingStart=
"8dp"
android:paddingTop=
"6dp"
android:paddingEnd=
"8dp"
android:paddingBottom=
"6dp"
android:text=
"我去平行时空"
android:textColor=
"@color/gray"
android:textSize=
"12sp"
/>
</FrameLayout>
\ No newline at end of file
book/app/src/main/res/mipmap-xhdpi/bg_book_data.png
0 → 100644
View file @
7f90e6c6
6.26 KB
book/app/src/main/res/mipmap-xhdpi/bg_book_more.png
0 → 100644
View file @
7f90e6c6
2.19 KB
book/app/src/main/res/mipmap-xhdpi/bg_search_data.png
0 → 100644
View file @
7f90e6c6
4.45 KB
book/app/src/main/res/values/colors.xml
View file @
7f90e6c6
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
<color
name=
"color_goldenrod"
>
#daa520
</color>
<color
name=
"color_goldenrod"
>
#daa520
</color>
<color
name=
"color_956244"
>
#956244
</color>
<color
name=
"color_956244"
>
#956244
</color>
<color
name=
"color_FFF7F7"
>
#FFF7F7
</color>
<color
name=
"book_content_color1"
>
#fff
</color>
<color
name=
"book_content_color1"
>
#fff
</color>
...
...
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