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
ea852fdd
Commit
ea852fdd
authored
Sep 26, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
86e8ec62
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
120 additions
and
44 deletions
+120
-44
Constant.kt
...src/main/java/com/duben/infinitefunjia/common/Constant.kt
+1
-0
FirstBookBean.java
...ava/com/duben/infinitefunjia/mvp/model/FirstBookBean.java
+15
-0
BookCityPresenter.kt
.../duben/infinitefunjia/mvp/presenters/BookCityPresenter.kt
+28
-3
VipPresenter.kt
...a/com/duben/infinitefunjia/mvp/presenters/VipPresenter.kt
+4
-2
BookCityView.kt
...n/java/com/duben/infinitefunjia/mvp/views/BookCityView.kt
+3
-0
LoanService.java
...c/main/java/com/duben/infinitefunjia/net/LoanService.java
+10
-0
GuideActivity.kt
...va/com/duben/infinitefunjia/ui/activitys/GuideActivity.kt
+1
-7
SplashAdActivity.kt
...com/duben/infinitefunjia/ui/activitys/SplashAdActivity.kt
+1
-5
VipActivity.kt
...java/com/duben/infinitefunjia/ui/activitys/VipActivity.kt
+26
-23
BookCityFragment.kt
.../com/duben/infinitefunjia/ui/fragment/BookCityFragment.kt
+27
-0
MyFragment.kt
...n/java/com/duben/infinitefunjia/ui/fragment/MyFragment.kt
+4
-4
No files found.
book/app/src/main/java/com/duben/infinitefunjia/common/Constant.kt
View file @
ea852fdd
...
...
@@ -19,6 +19,7 @@ object Constant {
const
val
PAGE_SIZE
=
10
const
val
ROUTE_BOOK_ID
=
"BOOK_ID"
const
val
IS_FIRST_VEDIO
=
"is_first_vedio"
// 协议地址
var
REGISTER_URL
=
...
...
book/app/src/main/java/com/duben/infinitefunjia/mvp/model/FirstBookBean.java
0 → 100644
View file @
ea852fdd
package
com
.
duben
.
infinitefunjia
.
mvp
.
model
;
import
java.io.Serializable
;
public
class
FirstBookBean
implements
Serializable
{
private
BookBean
articleMsg
;
public
BookBean
getArticleMsg
()
{
return
articleMsg
;
}
public
void
setArticleMsg
(
BookBean
articleMsg
)
{
this
.
articleMsg
=
articleMsg
;
}
}
book/app/src/main/java/com/duben/infinitefunjia/mvp/presenters/BookCityPresenter.kt
View file @
ea852fdd
...
...
@@ -5,9 +5,7 @@ import com.duben.infinitefunjia.common.DeviceInfo
import
com.duben.library.net.neterror.Throwable
import
com.duben.infinitefunjia.manager.AppHttpManager
import
com.duben.infinitefunjia.manager.UserManager
import
com.duben.infinitefunjia.mvp.model.BaseResponse
import
com.duben.infinitefunjia.mvp.model.BookListBean
import
com.duben.infinitefunjia.mvp.model.UserBean
import
com.duben.infinitefunjia.mvp.model.*
import
com.duben.infinitefunjia.mvp.views.BookCityView
import
com.duben.infinitefunjia.utils.DeviceUuidFactory
import
com.duben.library.net.neterror.BaseSubscriber
...
...
@@ -207,4 +205,31 @@ class BookCityPresenter : BasePresenter<BookCityView>() {
}
fun
getSoltVedio
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
firstArticle
(),
object
:
BaseSubscriber
<
BaseResponse
<
FirstBookBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
FirstBookBean
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
when
(
code
)
{
200
->
{
view
.
getSoltVedioSuc
(
baseResponse
.
data
)
}
}
}
})
}
}
\ No newline at end of file
book/app/src/main/java/com/duben/infinitefunjia/mvp/presenters/VipPresenter.kt
View file @
ea852fdd
...
...
@@ -184,7 +184,8 @@ class VipPresenter : BasePresenter<VipView>() {
fun
getVipPayParams
(
payChannel
:
String
,
pid
:
String
,
isInstallAlipay
:
Boolean
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"payChannel"
]
=
payChannel
// vo["payChannel"] = payChannel
vo
[
"payChannel"
]
=
"ALIPAY"
vo
[
"pid"
]
=
pid
vo
[
"isInstallAlipay"
]
=
isInstallAlipay
AppHttpManager
.
getInstance
(
loanApplication
)
...
...
@@ -206,7 +207,8 @@ class VipPresenter : BasePresenter<VipView>() {
val
code
:
Int
=
baseResponse
.
getStatus
()
when
(
code
)
{
200
->
{
view
.
getVipPayParamsSuc
(
payChannel
,
baseResponse
.
data
)
// view.getVipPayParamsSuc(payChannel, baseResponse.data)
view
.
getVipPayParamsSuc
(
"ALIPAY"
,
baseResponse
.
data
)
}
else
->
{
view
.
showToast
(
baseResponse
.
getMessage
())
...
...
book/app/src/main/java/com/duben/infinitefunjia/mvp/views/BookCityView.kt
View file @
ea852fdd
package
com.duben.infinitefunjia.mvp.views
import
com.duben.infinitefunjia.mvp.model.BookBean
import
com.duben.infinitefunjia.mvp.model.BookListBean
import
com.duben.infinitefunjia.mvp.model.FirstBookBean
interface
BookCityView
:
BaseView
{
fun
getHotBookSuc
(
data
:
BookListBean
)
...
...
@@ -11,4 +13,5 @@ interface BookCityView : BaseView {
fun
getBannerBookSuc
(
data
:
BookListBean
)
fun
getBannerBookFail
()
fun
getSoltVedioSuc
(
data
:
FirstBookBean
)
}
book/app/src/main/java/com/duben/infinitefunjia/net/LoanService.java
View file @
ea852fdd
...
...
@@ -2,6 +2,8 @@ package com.duben.infinitefunjia.net;
import
android.text.TextUtils
;
import
com.duben.infinitefunjia.mvp.model.BookBean
;
import
com.duben.infinitefunjia.mvp.model.FirstBookBean
;
import
com.google.gson.JsonObject
;
import
com.duben.infinitefunjia.BuildConfig
;
import
com.duben.infinitefunjia.mvp.model.BannerList
;
...
...
@@ -245,6 +247,14 @@ public interface LoanService {
@POST
(
"api/book/articleList"
)
Observable
<
BaseResponse
<
BookListBean
>>
getArticleList
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 书库分类
*
* @return
*/
@POST
(
"api/book/firstArticle"
)
Observable
<
BaseResponse
<
FirstBookBean
>>
firstArticle
();
/**
* 默认http工厂
*/
...
...
book/app/src/main/java/com/duben/infinitefunjia/ui/activitys/GuideActivity.kt
View file @
ea852fdd
...
...
@@ -62,13 +62,7 @@ class GuideActivity : BaseActivity(), GuideView {
btn_guide_start
.
setOnClickListener
{
vp_guide_viewpager
.
currentItem
=
++
count
if
(
count
==
layouts
.
size
)
{
if
(
TextUtils
.
isEmpty
(
UserManager
.
getInstance
().
userID
))
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
else
{
val
bundle
=
Bundle
()
// bundle.putBoolean(VipActivity.IS_GUIDE, true)
readyGoThenKill
(
VipActivity
::
class
.
java
,
bundle
)
}
//带点渐变动画
overridePendingTransition
(
android
.
R
.
anim
.
fade_in
,
android
.
R
.
anim
.
fade_out
)
}
...
...
book/app/src/main/java/com/duben/infinitefunjia/ui/activitys/SplashAdActivity.kt
View file @
ea852fdd
...
...
@@ -94,11 +94,7 @@ class SplashAdActivity : BaseActivity() {
* 跳转到主页面
*/
private
fun
goToMainActivity
()
{
if
(
UserManager
.
getInstance
().
vipFlag
)
{
readyGoThenKill
(
MainActivity
::
class
.
java
)
}
else
{
readyGoThenKill
(
VipActivity
::
class
.
java
)
}
}
/**
...
...
book/app/src/main/java/com/duben/infinitefunjia/ui/activitys/VipActivity.kt
View file @
ea852fdd
...
...
@@ -160,25 +160,30 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
* 设置content样式
*/
private
fun
setVipContent
(
bean
:
VipBean
.
ListBean
)
{
if
(
bean
.
isAlipay
&&
bean
.
isWeixin
)
{
ll_vip_alipay
.
visibility
=
View
.
VISIBLE
ll_vip_wx
.
visibility
=
View
.
VISIBLE
payType
=
WEIXIN_PAY
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
else
if
(
bean
.
isAlipay
&&
!
bean
.
isWeixin
)
{
// if (bean.isAlipay && bean.isWeixin) {
// ll_vip_alipay.visibility = View.VISIBLE
// ll_vip_wx.visibility = View.VISIBLE
// payType = WEIXIN_PAY
// iv_vip_wx.setImageResource(R.mipmap.ic_vip_enable_blue)
// iv_vip_alipay.setImageResource(R.mipmap.ic_vip_none)
// } else if (bean.isAlipay && !bean.isWeixin) {
// ll_vip_alipay.visibility = View.VISIBLE
// ll_vip_wx.visibility = View.GONE
// payType = ALIPAY
// iv_vip_alipay.setImageResource(R.mipmap.ic_vip_enable_blue)
// iv_vip_wx.setImageResource(R.mipmap.ic_vip_none)
// } else if (!bean.isAlipay && bean.isWeixin) {
// ll_vip_alipay.visibility = View.GONE
// ll_vip_wx.visibility = View.VISIBLE
// payType = WEIXIN_PAY
// iv_vip_wx.setImageResource(R.mipmap.ic_vip_enable_blue)
// iv_vip_alipay.setImageResource(R.mipmap.ic_vip_none)
// }
ll_vip_alipay
.
visibility
=
View
.
VISIBLE
ll_vip_wx
.
visibility
=
View
.
GONE
payType
=
ALIPAY
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
else
if
(!
bean
.
isAlipay
&&
bean
.
isWeixin
)
{
ll_vip_alipay
.
visibility
=
View
.
GONE
ll_vip_wx
.
visibility
=
View
.
VISIBLE
payType
=
WEIXIN_PAY
iv_vip_wx
.
setImageResource
(
R
.
mipmap
.
ic_vip_enable_blue
)
iv_vip_alipay
.
setImageResource
(
R
.
mipmap
.
ic_vip_none
)
}
if
(!
TextUtils
.
isEmpty
(
bean
.
remarks
))
{
...
...
@@ -264,8 +269,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
?):
Boolean
{
when
(
keyCode
)
{
KeyEvent
.
KEYCODE_BACK
->
{
if
(
UserManager
.
getInstance
().
newFlag
&&
vipList
!=
null
&&
vipList
!!
.
size
>
0
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
vipAdapter
.
setPosition
(
0
)
...
...
@@ -293,8 +297,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
when
(
v
?.
id
)
{
R
.
id
.
ic_vip_quit
->
{
if
(
UserManager
.
getInstance
().
newFlag
&&
vipList
!=
null
&&
vipList
!!
.
size
>
0
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
vipAdapter
.
setPosition
(
0
)
vipAdapter
.
notifyDataSetChanged
()
...
...
book/app/src/main/java/com/duben/infinitefunjia/ui/fragment/BookCityFragment.kt
View file @
ea852fdd
package
com.duben.infinitefunjia.ui.fragment
import
android.os.Bundle
import
android.os.Handler
import
android.os.Looper
import
android.text.SpannableString
import
android.text.SpannableStringBuilder
import
android.text.Spanned
...
...
@@ -17,14 +19,17 @@ import com.duben.infinitefunjia.common.Constant
import
com.duben.infinitefunjia.manager.UserManager
import
com.duben.infinitefunjia.mvp.model.BookBean
import
com.duben.infinitefunjia.mvp.model.BookListBean
import
com.duben.infinitefunjia.mvp.model.FirstBookBean
import
com.duben.infinitefunjia.mvp.presenters.BookCityPresenter
import
com.duben.infinitefunjia.mvp.views.BookCityView
import
com.duben.infinitefunjia.ui.activitys.BookReadActivity
import
com.duben.infinitefunjia.ui.activitys.BookSearchActivity
import
com.duben.infinitefunjia.ui.activitys.VipActivity
import
com.duben.infinitefunjia.ui.adapter.HotBookAdapter
import
com.duben.infinitefunjia.ui.adapter.NewBookAdapter
import
com.duben.infinitefunjia.ui.adapter.ImageTitleAdapter
import
com.duben.infinitefunjia.ui.fragment.base.LazyLoadBaseFragment
import
com.duben.infinitefunjia.utils.AppPreferencesManager
import
com.duben.infinitefunjia.utils.GridSpacingItemDecoration
import
com.duben.infinitefunjia.utils.RoundBackgroundColorSpan
import
com.duben.library.utils.GlideUtils
...
...
@@ -55,6 +60,10 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
initView
()
initListener
()
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
goToMainActivity
()
},
300
)
}
private
fun
initView
()
{
...
...
@@ -121,6 +130,10 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
rv_newbook
.
adapter
=
newBookAdapter
}
private
fun
goToMainActivity
()
{
bookCityPresenter
.
getSoltVedio
()
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
if
(
hidden
)
{
// 不在最前端界面显示
onPause
()
...
...
@@ -178,6 +191,20 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
}
override
fun
getBannerBookFail
()
{}
override
fun
getSoltVedioSuc
(
data
:
FirstBookBean
)
{
val
firstVedio
=
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
IS_FIRST_VEDIO
,
true
)
if
(
data
.
articleMsg
!=
null
&&
firstVedio
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
ROUTE_BOOK_ID
,
data
.
articleMsg
.
id
)
readyGo
(
BookReadActivity
::
class
.
java
,
bundle
)
}
else
{
if
(!
UserManager
.
getInstance
().
vipFlag
)
{
val
bundle
=
Bundle
()
bundle
.
putBoolean
(
VipActivity
.
IS_MAIN
,
true
)
readyGo
(
VipActivity
::
class
.
java
,
bundle
)
}
}
}
override
fun
onClick
(
v
:
View
?)
{
v
?.
let
{
...
...
book/app/src/main/java/com/duben/infinitefunjia/ui/fragment/MyFragment.kt
View file @
ea852fdd
...
...
@@ -103,10 +103,10 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
backPhoneDialog
()
}
R
.
id
.
ll_my_set
->
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
ROUTE_BOOK_ID
,
"80670"
)
readyGo
(
LongBookReadActivity
::
class
.
java
,
bundle
)
//
readyGo(SettingsActivity::class.java)
//
val bundle = Bundle()
//
bundle.putString(Constant.ROUTE_BOOK_ID, "80670")
//
readyGo(LongBookReadActivity::class.java, bundle)
readyGo
(
SettingsActivity
::
class
.
java
)
}
}
...
...
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