Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
903a8813
Commit
903a8813
authored
Mar 23, 2020
by
konghaorui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
晚上首页Fragment逻辑、补充分隔符、更新json缓存文件
parent
1b107bf5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
30 deletions
+78
-30
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+1
-0
config.gradle
config.gradle
+2
-2
home_data.json
m-home/src/main/assets/home_data.json
+0
-0
YdlHomeFragment.kt
m-home/src/ydl/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
+21
-22
HomeSpaceItemDecoration.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeSpaceItemDecoration.kt
+44
-0
home_common_title_view.xml
m-home/src/ydl/res/layout/home_common_title_view.xml
+0
-1
GlobalConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/GlobalConfig.kt
+1
-1
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+9
-4
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
903a8813
...
...
@@ -34,6 +34,7 @@ public final class DemoGlobalConfig implements IConfigModule {
builder
.
setFrom
(
"ydl"
.
equals
(
BuildConfig
.
FLAVOR
)
?
YDLConstants
.
FROM_YDL
:
YDLConstants
.
FROM_XLZX
)
.
addUrl
(
"github"
,
APP_DOMAIN
)
.
setEnv
(
appEnv
)
.
setName
(
"yidianling"
)
.
setDebug
(
BuildConfig
.
DEBUG
);
}
}
config.gradle
View file @
903a8813
...
...
@@ -5,8 +5,8 @@ ext {
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
applicationId:
"com.cxzapp.yidianling"
,
versionName
:
"4.0.
3
1"
,
versionCode
:
40
3
1
,
versionName
:
"4.0.
8
1"
,
versionCode
:
40
8
1
,
]
xlzx_app
=
[
...
...
m-home/src/main/assets/home_data.json
View file @
903a8813
This source diff could not be displayed because it is too large. You can
view the blob
instead.
m-home/src/ydl/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
View file @
903a8813
...
...
@@ -37,6 +37,7 @@ import com.yidianling.home.listener.HomeConfideRecyleSuspendListener
import
com.yidianling.home.model.bean.*
import
com.yidianling.home.presenter.HomePresenterImpl
import
com.yidianling.home.ui.view.CouponDialog
import
com.yidianling.home.ui.view.HomeSpaceItemDecoration
import
com.yidianling.home.utils.HomeAnimUtils
import
com.yidianling.user.api.service.IUserService
import
kotlinx.android.synthetic.ydl.home_fragment.*
...
...
@@ -96,22 +97,22 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
}
override
fun
initDataAndEvent
()
{
val
homeViewOrder
=
HomeViewConfig
.
HomeViewOrder
()
homeViewOrder
.
bannerIndex
=
-
1
homeViewOrder
.
testIndex
=
1
homeViewOrder
.
consultIndex
=
2
homeViewOrder
.
footerIndex
=
3
homeViewOrder
.
fmIndex
=
null
homeViewOrder
.
articleIndex
=
null
homeViewOrder
.
dynamicIndex
=
null
homeViewOrder
.
museIndex
=
null
homeViewOrder
.
confideIndex
=
null
homeViewOrder
.
courseIndex
=
null
homeViewOrder
.
buttonIndex
=
null
HomeViewConfig
.
setOrder
(
homeViewOrder
)
//
val homeViewOrder = HomeViewConfig.HomeViewOrder()
//
//
homeViewOrder.bannerIndex = -1
//
homeViewOrder.testIndex = 1
//
homeViewOrder.consultIndex = 2
//
homeViewOrder.footerIndex = 3
//
//
homeViewOrder.fmIndex = null
//
homeViewOrder.articleIndex = null
//
homeViewOrder.dynamicIndex = null
//
homeViewOrder.museIndex = null
//
homeViewOrder.confideIndex = null
//
homeViewOrder.courseIndex = null
//
homeViewOrder.buttonIndex = null
//
//
HomeViewConfig.setOrder(homeViewOrder)
initHomeEvent
()
initView
()
...
...
@@ -124,16 +125,18 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
}
private
fun
initAdapter
()
{
//
mPresenter?.localHomeData(this.context, "home_data.json")
mPresenter
?.
localHomeData
(
this
.
context
,
"home_data.json"
)
adapter
=
YdlHomeAdapter
(
context
,
homeEvent
!!
,
ArrayList
())
val
layoutManager
=
LinearLayoutManager
(
context
)
home_module_fragment_recycler
.
layoutManager
=
layoutManager
home_module_fragment_recycler
.
adapter
=
adapter
val
space
=
resources
.
getDimension
(
R
.
dimen
.
platform_dp_24
).
toInt
()
home_module_fragment_recycler
.
addItemDecoration
(
HomeSpaceItemDecoration
(
space
))
initRvListener
()
}
open
fun
initRvListener
()
{
//
home_module_fragment_recycler.addOnScrollListener(homeEvent?.onPageScroll(view_rl_top_bg))
home_module_fragment_recycler
.
addOnScrollListener
(
homeEvent
?.
onPageScroll
(
view_rl_top_bg
))
scrollListner
=
HomeConfideRecyleSuspendListener
()
home_module_fragment_recycler
.
addOnScrollListener
(
scrollListner
)
setSuspendListener
()
...
...
@@ -141,18 +144,14 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
private
fun
initView
()
{
if
(
HomeViewConfig
.
getOrder
().
bannerIndex
==
null
||
HomeViewConfig
.
getOrder
().
bannerIndex
==-
1
){
var
marginTop
=
this
.
resources
.
getDimension
(
R
.
dimen
.
home_home_title_bar_height
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//4.4以下不支持状态栏变色
val
statusBarHeight
=
StatusBarUtils
.
getStatusBarHeight
(
activity
)
marginTop
+=
statusBarHeight
}
val
lp
=
home_swipe_refresh_layout
.
layoutParams
as
FrameLayout
.
LayoutParams
lp
.
topMargin
=
marginTop
.
toInt
()
home_swipe_refresh_layout
.
layoutParams
=
lp
}
searchText
=
this
.
resources
.
getText
(
R
.
string
.
home_search_hint
).
toString
()
home_swipe_refresh_layout
?.
setOnRefreshListener
(
this
)
...
...
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeSpaceItemDecoration.kt
0 → 100644
View file @
903a8813
package
com.yidianling.home.ui.view
import
android.graphics.Rect
import
android.support.v7.widget.RecyclerView
import
android.support.v7.widget.RecyclerView.ItemDecoration
import
android.view.View
import
com.yidianling.home.constract.HomeViewConfig
/**
* Created by haorui on 2020/3/23.
* Des:
*/
class
HomeSpaceItemDecoration
(
var
mSpace
:
Int
)
:
ItemDecoration
()
{
override
fun
getItemOffsets
(
outRect
:
Rect
,
view
:
View
,
parent
:
RecyclerView
,
state
:
RecyclerView
.
State
)
{
super
.
getItemOffsets
(
outRect
,
view
,
parent
,
state
)
val
position
=
parent
.
getChildAdapterPosition
(
view
)
when
(
val
viewType
=
parent
.
adapter
.
getItemViewType
(
position
)){
HomeViewConfig
.
getOrder
().
bannerIndex
->{
//空banner时不设置间距
if
(
viewType
!=-
1
&&
HomeViewConfig
.
getOrder
().
buttonIndex
==
null
){
outRect
.
bottom
=
mSpace
}
}
else
->{
if
(
HomeViewConfig
.
getOrder
().
footerIndex
!=
null
){
//底部footer显示时,倒数第一、二个View不设置间距
if
(
position
!=
parent
.
adapter
.
itemCount
-
1
&&
position
!=
parent
.
adapter
.
itemCount
-
2
){
outRect
.
bottom
=
mSpace
}
}
else
{
outRect
.
bottom
=
mSpace
}
}
}
}
}
\ No newline at end of file
m-home/src/ydl/res/layout/home_common_title_view.xml
View file @
903a8813
...
...
@@ -4,7 +4,6 @@
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:paddingTop=
"@dimen/platform_dp_24"
android:paddingBottom=
"@dimen/platform_dp_14"
>
<View
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/GlobalConfig.kt
View file @
903a8813
...
...
@@ -114,7 +114,7 @@ class GlobalConfig private constructor(var builder: Builder) {
.
setMultipleUrlMap
(
multipleUrl
)
if
(
okHttpClient
==
null
)
{
okHttpClient
=
HttpConfig
.
getInstance
().
createOkHttp
(
context
,
appFrom
,
appDebug
)
okHttpClient
=
HttpConfig
.
getInstance
().
createOkHttp
()
}
apiFactory
.
setOkClient
(
okHttpClient
)
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
903a8813
...
...
@@ -104,7 +104,12 @@ class HttpConfig {
}
}
fun
createOkHttp
(
context
:
Context
,
appFrom
:
String
,
appDebug
:
Boolean
):
OkHttpClient
{
fun
createOkHttp
():
OkHttpClient
{
val
globalConfig
=
BaseApp
.
instance
.
getGlobalConfig
()
val
context
=
BaseApp
.
getApp
()
val
appDebug
=
globalConfig
.
appDebug
val
appName
=
globalConfig
.
appName
//获取证书
val
cerInputStream
=
context
.
resources
.
openRawResource
(
com
.
ydl
.
ydlcommon
.
R
.
raw
.
ydl_trust
);
val
builder
=
OkHttpConfig
.
Builder
(
context
);
...
...
@@ -116,7 +121,7 @@ class HttpConfig {
}
return
builder
.
setInterceptor
(
commonParams
(),
requestHead
(
app
From
))
.
setInterceptor
(
commonParams
(),
requestHead
(
app
Name
))
.
setRequestHandler
(
getRequestHandler
())
.
setReadTimeout
(
15
)
.
setWriteTimeout
(
15
)
...
...
@@ -251,7 +256,7 @@ class HttpConfig {
private
data class
Param
(
val
name
:
String
,
val
value
:
String
)
// 添加请求头
private
fun
requestHead
(
app
From
:
String
):
Interceptor
{
private
fun
requestHead
(
app
Name
:
String
):
Interceptor
{
return
Interceptor
{
val
request
=
it
.
request
()
val
paramsString
=
StringBuilder
()
...
...
@@ -318,7 +323,7 @@ class HttpConfig {
)
)
.
addHeader
(
OS_TYPE
,
"2"
)
.
addHeader
(
APP_NAME
,
app
From
)
.
addHeader
(
APP_NAME
,
app
Name
)
val
loginBean
=
ModularServiceManager
.
getPlatformUserService
()
?.
getUser
()
if
(
loginBean
!=
null
)
{
builder
.
addHeader
(
TOKEN
,
loginBean
.
token
)
...
...
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