Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
080fb24a
authored
Jan 09, 2020
by
mReturn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
留言
parent
bd75dedd
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
858 additions
and
57 deletions
baseSDK/build.gradle
baseSDK/src/main/java/com/dayu/utils/CommonUtils.java
baseSDK/src/main/java/com/dayu/utils/GlideImageLoader.java
baseSDK/src/main/java/com/dayu/widgets/KeyboardStateObserver.java
baseSDK/src/main/res/drawable-hdpi/icon_user_default.png
baseSDK/src/main/res/drawable-xhdpi/icon_comment.png
baseSDK/src/main/res/drawable-xhdpi/icon_dayu_logo.jpg
baseSDK/src/main/res/drawable-xxhdpi/icon_app_logo.png
baseSDK/src/main/res/drawable-xxhdpi/icon_dayu_logo.jpg
baseSDK/src/main/res/drawable-xxxhdpi/icon_dayu_logo.jpg
baseSDK/src/main/res/values/strings.xml
orderCenter/src/main/java/com/dayu/order/api/OrderApiFactory.java
orderCenter/src/main/java/com/dayu/order/api/OrderService.java
orderCenter/src/main/java/com/dayu/order/api/protocol/CommentBean.java
orderCenter/src/main/java/com/dayu/order/api/protocol/CommentPostData.java
orderCenter/src/main/java/com/dayu/order/common/OrderConstant.java
orderCenter/src/main/java/com/dayu/order/ui/activity/OrderDetailsActivity.java
orderCenter/src/main/java/com/dayu/order/ui/adapter/CommentAdapter.java
orderCenter/src/main/java/com/dayu/order/ui/fragment/OperateDetailFragment.java
orderCenter/src/main/release/AndroidManifest.xml
orderCenter/src/main/res/layout/fragment_operate_detail.xml
orderCenter/src/main/res/layout/item_comment.xml
baseSDK/build.gradle
View file @
080fb24a
...
...
@@ -73,4 +73,5 @@ dependencies {
api
'cn.jzvd:jiaozivideoplayer:7.1.0'
api
'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.35'
api
'com.badoo.mobile:android-weak-handler:1.1'
}
baseSDK/src/main/java/com/dayu/utils/CommonUtils.java
View file @
080fb24a
...
...
@@ -4,8 +4,15 @@ import android.app.Activity;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.TextView
;
import
com.dayu.baselibrary.R
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* Created by mReturn
...
...
@@ -54,4 +61,45 @@ public class CommonUtils {
context
.
startActivity
(
intent
);
}
//计算并设置时间
public
static
String
getTimeDesc
(
Context
context
,
String
time
)
{
if
(
TextUtils
.
isEmpty
(
time
)
)
{
return
""
;
}
try
{
long
nowTime
=
System
.
currentTimeMillis
();
Date
nowData
=
new
Date
(
nowTime
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
nowDate
=
df
.
parse
(
df
.
format
(
nowData
));
Date
pubData
=
df
.
parse
(
time
);
// 计算时间差
long
dTime
=
nowDate
.
getTime
()
-
pubData
.
getTime
();
//时间差
long
day
=
dTime
/
(
24
*
60
*
60
*
1000
);
long
hour
=
(
dTime
/
(
60
*
60
*
1000
)
-
day
*
24
);
long
min
=
((
dTime
/
(
60
*
1000
))
-
day
*
24
*
60
-
hour
*
60
);
long
sec
=
(
dTime
/
1000
-
day
*
24
*
60
*
60
-
hour
*
60
*
60
-
min
*
60
);
if
(
day
>
0
)
{
if
(
day
>
365
)
{
return
(
context
.
getString
(
R
.
string
.
one_year_ago
));
}
else
{
return
(
day
+
context
.
getString
(
R
.
string
.
day_ago
));
}
}
else
if
(
hour
>
0
)
{
return
(
hour
+
context
.
getString
(
R
.
string
.
hour_ago
));
}
else
if
(
min
>
0
)
{
if
(
min
>
5
)
{
return
(
min
+
context
.
getString
(
R
.
string
.
min_ago
));
}
else
{
return
context
.
getString
(
R
.
string
.
just_before
);
}
}
else
{
return
context
.
getString
(
R
.
string
.
just_before
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
}
baseSDK/src/main/java/com/dayu/utils/GlideImageLoader.java
View file @
080fb24a
...
...
@@ -48,7 +48,7 @@ public class GlideImageLoader {
.
into
(
view
);
}
public
static
void
load
(
Context
context
,
@DrawableRes
int
defaultRes
,
String
imageRes
,
ImageView
view
)
{
public
static
void
load
(
Context
context
,
ImageView
view
,
String
imageRes
,
int
defaultRes
)
{
RequestOptions
options
=
new
RequestOptions
()
.
centerCrop
()
.
placeholder
(
defaultRes
)
...
...
baseSDK/src/main/java/com/dayu/widgets/KeyboardStateObserver.java
0 → 100644
View file @
080fb24a
package
com
.
dayu
.
widgets
;
import
android.app.Activity
;
import
android.graphics.Rect
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewTreeObserver
;
import
android.widget.FrameLayout
;
public
class
KeyboardStateObserver
{
private
static
final
String
TAG
=
KeyboardStateObserver
.
class
.
getSimpleName
();
public
static
KeyboardStateObserver
getKeyboardStateObserver
(
Activity
activity
)
{
return
new
KeyboardStateObserver
(
activity
);
}
private
View
mChildOfContent
;
private
int
usableHeightPrevious
;
private
OnKeyboardVisibilityListener
listener
;
public
void
setKeyboardVisibilityListener
(
OnKeyboardVisibilityListener
listener
)
{
this
.
listener
=
listener
;
}
private
KeyboardStateObserver
(
Activity
activity
)
{
FrameLayout
content
=
(
FrameLayout
)
activity
.
findViewById
(
android
.
R
.
id
.
content
);
mChildOfContent
=
content
.
getChildAt
(
0
);
mChildOfContent
.
getViewTreeObserver
().
addOnGlobalLayoutListener
(
new
ViewTreeObserver
.
OnGlobalLayoutListener
()
{
public
void
onGlobalLayout
()
{
possiblyResizeChildOfContent
();
}
});
}
private
void
possiblyResizeChildOfContent
()
{
int
usableHeightNow
=
computeUsableHeight
();
if
(
usableHeightNow
!=
usableHeightPrevious
)
{
int
usableHeightSansKeyboard
=
mChildOfContent
.
getRootView
().
getHeight
();
int
heightDifference
=
usableHeightSansKeyboard
-
usableHeightNow
;
if
(
heightDifference
>
(
usableHeightSansKeyboard
/
4
))
{
if
(
listener
!=
null
)
{
listener
.
onKeyboardShow
();
}
}
else
{
if
(
listener
!=
null
)
{
listener
.
onKeyboardHide
();
}
}
usableHeightPrevious
=
usableHeightNow
;
Log
.
d
(
TAG
,
"usableHeightNow: "
+
usableHeightNow
+
" | usableHeightSansKeyboard:"
+
usableHeightSansKeyboard
+
" | heightDifference:"
+
heightDifference
);
}
}
private
int
computeUsableHeight
()
{
Rect
r
=
new
Rect
();
mChildOfContent
.
getWindowVisibleDisplayFrame
(
r
);
Log
.
d
(
TAG
,
"rec bottom>"
+
r
.
bottom
+
" | rec top>"
+
r
.
top
);
return
(
r
.
bottom
-
r
.
top
);
// 全屏模式下: return r.bottom
}
public
interface
OnKeyboardVisibilityListener
{
void
onKeyboardShow
();
void
onKeyboardHide
();
}
}
\ No newline at end of file
baseSDK/src/main/res/drawable-hdpi/icon_user_default.png
0 → 100644
View file @
080fb24a
7.33 KB
baseSDK/src/main/res/drawable-xhdpi/icon_comment.png
0 → 100644
View file @
080fb24a
984 Bytes
baseSDK/src/main/res/drawable-xhdpi/icon_dayu_logo.jpg
0 → 100644
View file @
080fb24a
29.4 KB
baseSDK/src/main/res/drawable-xxhdpi/icon_app_logo.png
0 → 100644
View file @
080fb24a
24.5 KB
baseSDK/src/main/res/drawable-xxhdpi/icon_dayu_logo.jpg
0 → 100644
View file @
080fb24a
47.4 KB
baseSDK/src/main/res/drawable-xxxhdpi/icon_dayu_logo.jpg
0 → 100644
View file @
080fb24a
69.2 KB
baseSDK/src/main/res/values/strings.xml
View file @
080fb24a
...
...
@@ -773,5 +773,11 @@ C) 在甲方使用大鱼平å°æœåŠ¡è¿‡ç¨‹ä¸äº§ç”Ÿçš„业务数æ®ï¼Œå®¢æˆ·æ•°æ
<string
name=
"no_mobile"
>
暂无联系方式
</string>
<string
name=
"send_str"
>
发送
</string>
<string
name=
"ask_detail"
>
问问更多细节吧~
</string>
<string
name=
"reply_str"
>
回复
</string>
<string
name=
"one_year_ago"
>
一年前
</string>
<string
name=
"day_ago"
>
天前
</string>
<string
name=
"hour_ago"
>
小时前
</string>
<string
name=
"min_ago"
>
分钟前
</string>
<string
name=
"just_before"
>
刚刚
</string>
</resources>
orderCenter/src/main/java/com/dayu/order/api/OrderApiFactory.java
View file @
080fb24a
...
...
@@ -3,6 +3,8 @@ package com.dayu.order.api;
import
com.dayu.base.api.Api
;
import
com.dayu.base.api.protocol.BasePageBean
;
import
com.dayu.base.api.protocol.BaseResponse
;
import
com.dayu.order.api.protocol.CommentBean
;
import
com.dayu.order.api.protocol.CommentPostData
;
import
com.dayu.order.api.protocol.ErrorOrder
;
import
com.dayu.order.api.protocol.KaAddress
;
import
com.dayu.order.api.protocol.LogsticsInfo
;
...
...
@@ -169,4 +171,11 @@ public class OrderApiFactory {
public
static
Observable
<
BasePageBean
<
Order
>>
searchOrder
(
String
key
,
int
siteId
,
int
userAccount
,
int
status
,
int
page
,
int
pageSize
)
{
return
Api
.
getService
(
OrderService
.
class
).
searchOrder
(
key
,
userAccount
,
status
,
page
,
pageSize
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
BasePageBean
<
CommentBean
>>
getComment
(
int
targetId
,
int
status
,
int
targetType
,
int
page
,
int
pageSize
)
{
return
Api
.
getService
(
OrderService
.
class
).
getComment
(
targetId
,
status
,
targetType
,
page
,
pageSize
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
Boolean
>
addComment
(
CommentPostData
data
)
{
return
Api
.
getService
(
OrderService
.
class
).
addComment
(
data
).
compose
(
Api
.
applySchedulers
());
}
}
orderCenter/src/main/java/com/dayu/order/api/OrderService.java
View file @
080fb24a
...
...
@@ -2,11 +2,12 @@ package com.dayu.order.api;
import
com.dayu.base.api.protocol.BasePageBean
;
import
com.dayu.base.api.protocol.BaseResponse
;
import
com.dayu.order.api.protocol.CommentBean
;
import
com.dayu.order.api.protocol.CommentPostData
;
import
com.dayu.order.api.protocol.ErrorOrder
;
import
com.dayu.order.api.protocol.KaAddress
;
import
com.dayu.order.api.protocol.LogsticsInfo
;
import
com.dayu.order.api.protocol.OperateInfo
;
import
com.dayu.order.api.protocol.OperatePostData
;
import
com.dayu.order.api.protocol.Order
;
import
com.dayu.order.api.protocol.OrderDetail
;
import
com.dayu.order.api.protocol.OrderPart
;
...
...
@@ -153,9 +154,9 @@ interface OrderService {
@GET
(
OrderConstant
.
ORDER_INSTRUCTION
)
Observable
<
BaseResponse
<
BasePageBean
<
ServerInstruction
>>>
getInstruction
(
@Query
(
"kaSpuId"
)
long
id
,
@Query
(
"page"
)
int
page
,
@Query
(
"pageSize"
)
int
pageSize
);
/**
* 获取操作指南.
*
*/
@POST
(
OrderConstant
.
ORDER_OPERATE
)
Observable
<
BaseResponse
<
List
<
OperateInfo
>>>
getOperateInfo
(
@Body
int
[]
data
);
...
...
@@ -383,9 +384,29 @@ interface OrderService {
@Query
(
"page"
)
int
page
,
@Query
(
"pageSize"
)
int
pageSize
);
// Observable<BaseResponse<BasePageBean<Order>>> searchOrder(@Query("key") String key,
// @Query("siteId") int siteId,
// @Query("engineerId") int engineerId,
// @Query("status") int status,
// @Query("page") int page,
// @Query("pageSize") int pageSize);
// @Query("page") int page,
// @Query("status") int status,
// @Query("engineerId") int engineerId,
// @Query("siteId") int siteId,
/**
* 获取留言
* @param targetId
* @param status
* @param targetType
* @return
*/
@GET
(
OrderConstant
.
COMMENT_URL
)
Observable
<
BaseResponse
<
BasePageBean
<
CommentBean
>>>
getComment
(
@Query
(
"targetId"
)
int
targetId
,
@Query
(
"status"
)
int
status
,
@Query
(
"targetType"
)
int
targetType
,
@Query
(
"page"
)
int
page
,
@Query
(
"pageSize"
)
int
pageSize
);
/**
* 留言/回复
*/
@POST
(
OrderConstant
.
COMMENT_URL
)
Observable
<
BaseResponse
<
Boolean
>>
addComment
(
@Body
CommentPostData
data
);
}
orderCenter/src/main/java/com/dayu/order/api/protocol/CommentBean.java
0 → 100644
View file @
080fb24a
package
com
.
dayu
.
order
.
api
.
protocol
;
/**
* Created by mReturn
* on 2020\1\9 0009.
*/
public
class
CommentBean
{
private
int
id
;
private
int
targetId
;
private
int
targetType
;
private
String
targetName
;
private
int
accountId
;
private
String
accountName
;
private
int
accountType
;
private
Object
name
;
private
String
messageAvatarUrl
;
private
int
beAccountId
;
private
Object
beName
;
private
int
beMessageId
;
private
String
content
;
private
Object
reContent
;
private
String
createTime
;
private
int
messageType
;
private
int
parentId
;
private
String
orderNum
;
private
int
status
;
private
int
isRead
;
private
Object
updateTime
;
private
String
updated
;
private
Object
companyId
;
private
Object
keyword
;
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getTargetId
()
{
return
targetId
;
}
public
void
setTargetId
(
int
targetId
)
{
this
.
targetId
=
targetId
;
}
public
int
getTargetType
()
{
return
targetType
;
}
public
void
setTargetType
(
int
targetType
)
{
this
.
targetType
=
targetType
;
}
public
String
getTargetName
()
{
return
targetName
;
}
public
void
setTargetName
(
String
targetName
)
{
this
.
targetName
=
targetName
;
}
public
int
getAccountId
()
{
return
accountId
;
}
public
void
setAccountId
(
int
accountId
)
{
this
.
accountId
=
accountId
;
}
public
String
getAccountName
()
{
return
accountName
;
}
public
void
setAccountName
(
String
accountName
)
{
this
.
accountName
=
accountName
;
}
public
int
getAccountType
()
{
return
accountType
;
}
public
void
setAccountType
(
int
accountType
)
{
this
.
accountType
=
accountType
;
}
public
Object
getName
()
{
return
name
;
}
public
void
setName
(
Object
name
)
{
this
.
name
=
name
;
}
public
String
getMessageAvatarUrl
()
{
return
messageAvatarUrl
;
}
public
void
setMessageAvatarUrl
(
String
messageAvatarUrl
)
{
this
.
messageAvatarUrl
=
messageAvatarUrl
;
}
public
int
getBeAccountId
()
{
return
beAccountId
;
}
public
void
setBeAccountId
(
int
beAccountId
)
{
this
.
beAccountId
=
beAccountId
;
}
public
Object
getBeName
()
{
return
beName
;
}
public
void
setBeName
(
Object
beName
)
{
this
.
beName
=
beName
;
}
public
int
getBeMessageId
()
{
return
beMessageId
;
}
public
void
setBeMessageId
(
int
beMessageId
)
{
this
.
beMessageId
=
beMessageId
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
Object
getReContent
()
{
return
reContent
;
}
public
void
setReContent
(
Object
reContent
)
{
this
.
reContent
=
reContent
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
int
getMessageType
()
{
return
messageType
;
}
public
void
setMessageType
(
int
messageType
)
{
this
.
messageType
=
messageType
;
}
public
int
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
int
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
int
getIsRead
()
{
return
isRead
;
}
public
void
setIsRead
(
int
isRead
)
{
this
.
isRead
=
isRead
;
}
public
Object
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Object
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getUpdated
()
{
return
updated
;
}
public
void
setUpdated
(
String
updated
)
{
this
.
updated
=
updated
;
}
public
Object
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
Object
companyId
)
{
this
.
companyId
=
companyId
;
}
public
Object
getKeyword
()
{
return
keyword
;
}
public
void
setKeyword
(
Object
keyword
)
{
this
.
keyword
=
keyword
;
}
}
orderCenter/src/main/java/com/dayu/order/api/protocol/CommentPostData.java
0 → 100644
View file @
080fb24a
package
com
.
dayu
.
order
.
api
.
protocol
;
/**
* Created by mReturn
* on 2020\1\9 0009.
*/
public
class
CommentPostData
{
public
int
accountId
;
//留言人或回复人ID
public
String
accountName
;
//账号名称
public
int
accountType
;
public
int
companyId
;
//ka companyId
public
String
content
;
//留言
public
String
messageAvatarUrl
;
//头像
public
int
messageType
;
//留言类型 1留言 2回复
public
String
name
;
//SP名称或KA名称
public
int
status
=
1
;
//状态 1显示 2屏蔽
public
int
targetId
;
//招标、授权、SPM服务ID
public
int
targetName
;
//招标授权名称
public
int
targetType
=
3
;
//类型:1:招标 2:授权 3:SPM服务
public
String
updated
;
//更新人名称
public
int
beMessageId
;
//被回复的留言ID
public
String
beName
;
//被回复人昵称
public
int
parentId
;
//父节点
public
int
beAccountId
;
//被回复人ID
}
orderCenter/src/main/java/com/dayu/order/common/OrderConstant.java
View file @
080fb24a
...
...
@@ -190,4 +190,9 @@ public class OrderConstant {
*/
public
static
final
String
QUEY_PAY_STATUS
=
"/api-base/"
+
"shouqianbaMerchant/status/siteId/{siteId}"
;
/**
* 留言
*/
public
static
final
String
COMMENT_URL
=
"/api-message/"
+
"leaveMessage"
;
}
orderCenter/src/main/java/com/dayu/order/ui/activity/OrderDetailsActivity.java
View file @
080fb24a
...
...
@@ -72,11 +72,11 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act
mOrderPartFragment
=
OrderPartFragment
.
newInstance
(
detail
);
if
(
detail
.
getSpus
().
size
()>
0
){
mBind
.
btnOperate
.
setVisibility
(
View
.
VISIBLE
);
int
[]
ids
=
new
int
[
detail
.
getSpus
().
size
()
+
1
];
int
[]
ids
=
new
int
[
detail
.
getSpus
().
size
()];
for
(
int
i
=
0
;
i
<
detail
.
getSpus
().
size
();
i
++){
ids
[
i
]
=
detail
.
getSpus
().
get
(
i
).
getKaSpuId
();
}
ids
[
1
]
=
344
;
//
ids[1] = 344;
mOperateFragment
=
OrderOperateFragment
.
newInstance
(
ids
);
}
else
{
int
[]
ids
={-
1
};
...
...
orderCenter/src/main/java/com/dayu/order/ui/adapter/CommentAdapter.java
0 → 100644
View file @
080fb24a
package
com
.
dayu
.
order
.
ui
.
adapter
;
import
android.view.View
;
import
com.dayu.base.ui.adapter.CoreAdapter
;
import
com.dayu.order.R
;
import
com.dayu.order.api.protocol.CommentBean
;
import
com.dayu.order.databinding.ItemCommentBinding
;
import
com.dayu.utils.CommonUtils
;
import
com.dayu.utils.GlideImageLoader
;
/**
* Created by mReturn
* on 2020\1\9 0009.
*/
public
class
CommentAdapter
extends
CoreAdapter
<
CommentBean
,
ItemCommentBinding
>
{
public
CommentAdapter
(
boolean
needFoot
)
{
super
(
needFoot
);
}
public
CommentAdapter
(
boolean
needFoot
,
int
viewType
)
{
super
(
needFoot
,
viewType
);
}
@Override
protected
void
onBind
(
ItemCommentBinding
holder
,
CommentBean
item
,
int
position
)
{
super
.
onBind
(
holder
,
item
,
position
);
holder
.
rlComponent
.
setVisibility
(
item
.
getMessageType
()
==
1
?
View
.
VISIBLE
:
View
.
GONE
);
holder
.
rlReply
.
setVisibility
(
item
.
getMessageType
()
==
1
?
View
.
GONE
:
View
.
VISIBLE
);
GlideImageLoader
.
load
(
mContext
,
holder
.
ivAvatar
,
item
.
getMessageAvatarUrl
(),
R
.
drawable
.
icon_user_default
);
GlideImageLoader
.
load
(
mContext
,
holder
.
ivAvatar2
,
item
.
getMessageAvatarUrl
(),
R
.
drawable
.
icon_user_default
);
holder
.
tvTime
.
setText
(
CommonUtils
.
getTimeDesc
(
mContext
,
item
.
getCreateTime
()));
holder
.
tvTime2
.
setText
(
CommonUtils
.
getTimeDesc
(
mContext
,
item
.
getCreateTime
()));
}
}
orderCenter/src/main/java/com/dayu/order/ui/fragment/OperateDetailFragment.java
View file @
080fb24a
package
com
.
dayu
.
order
.
ui
.
fragment
;
import
android.
content.Contex
t
;
import
android.
annotation.SuppressLin
t
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.badoo.mobile.util.WeakHandler
;
import
com.dayu.base.api.protocol.BasePageBean
;
import
com.dayu.base.ui.adapter.CoreAdapter
;
import
com.dayu.base.ui.fragment.DataBindingFragment
;
import
com.dayu.base.ui.fragment.BaseFragment
;
import
com.dayu.base.ui.presenter.SImplePresenter
;
import
com.dayu.common.Constants
;
import
com.dayu.event.UserInfo
;
import
com.dayu.order.R
;
import
com.dayu.order.api.OrderApiFactory
;
import
com.dayu.order.api.protocol.CommentBean
;
import
com.dayu.order.api.protocol.CommentPostData
;
import
com.dayu.order.api.protocol.OperateInfo
;
import
com.dayu.order.api.protocol.OrderDetail
;
import
com.dayu.order.databinding.FragmentOperateDetailBinding
;
import
com.dayu.order.
databinding.ItemDetailServerInfoBinding
;
import
com.dayu.order.
ui.adapter.CommentAdapter
;
import
com.dayu.utils.CommonUtils
;
import
com.dayu.utils.GlideImageLoader
;
import
com.dayu.utils.ProgressUtil
;
import
com.dayu.utils.ToastUtils
;
import
com.dayu.utils.UserManager
;
import
com.dayu.widgets.KeyboardStateObserver
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by mReturn
* on 2020\1\8 0008.
*/
public
class
OperateDetailFragment
extends
DataBindingFragment
<
FragmentOperateDetailBinding
>
{
public
class
OperateDetailFragment
extends
BaseFragment
<
SImplePresenter
,
FragmentOperateDetailBinding
>
{
private
CoreAdapter
<
OperateInfo
.
SopsBean
,
FragmentOperateDetailBinding
>
mSopAdapter
;
private
CommentAdapter
mCommentAdapter
;
private
String
phone
;
private
UserInfo
userInfo
;
OperateInfo
operateInfo
;
private
List
<
CommentBean
>
commentList
=
new
ArrayList
<>();
private
CommentBean
selectedItem
;
private
int
page
=
1
;
private
int
pageSize
=
2000
;
private
WeakHandler
weakHandler
=
new
WeakHandler
();
public
static
OperateDetailFragment
newInstance
(
OperateInfo
info
)
{
Bundle
args
=
new
Bundle
();
...
...
@@ -40,20 +57,61 @@ public class OperateDetailFragment extends DataBindingFragment<FragmentOperateDe
@Override
public
void
initView
()
{
OperateInfo
detail
=
(
OperateInfo
)
getArguments
().
getSerializable
(
Constants
.
OPERATE_DETAIL
);
phone
=
detail
.
getHotline
();
userInfo
=
UserManager
.
getInstance
().
getUser
();
GlideImageLoader
.
load
(
mActivity
,
mBind
.
ivAvatar
,
userInfo
.
getHeaderImg
(),
R
.
drawable
.
icon_user_default
);
operateInfo
=
(
OperateInfo
)
getArguments
().
getSerializable
(
Constants
.
OPERATE_DETAIL
);
getCommentData
();
phone
=
operateInfo
.
getHotline
();
mSopAdapter
=
new
CoreAdapter
<>(
false
);
mSopAdapter
.
setViewType
(
R
.
layout
.
item_operate_sop
);
mSopAdapter
.
setData
(
detail
.
getSops
());
mSopAdapter
.
setData
(
operateInfo
.
getSops
());
mBind
.
rlSop
.
setLayoutManager
(
new
LinearLayoutManager
(
mActivity
));
mBind
.
rlSop
.
setAdapter
(
mSopAdapter
);
mBind
.
llVideo
.
setVisibility
(
TextUtils
.
isEmpty
(
detail
.
getVideoUrl
())?
View
.
GONE
:
View
.
VISIBLE
);
mCommentAdapter
=
new
CommentAdapter
(
false
);
mCommentAdapter
.
setViewType
(
R
.
layout
.
item_comment
);
mCommentAdapter
.
setData
(
commentList
);
mBind
.
rlComponent
.
setLayoutManager
(
new
LinearLayoutManager
(
mActivity
));
mBind
.
rlComponent
.
setAdapter
(
mCommentAdapter
);
mCommentAdapter
.
setLoadMore
(
true
);
mBind
.
rlSop
.
setNestedScrollingEnabled
(
false
);
mBind
.
rlComponent
.
setNestedScrollingEnabled
(
false
);
mBind
.
llVideo
.
setVisibility
(
TextUtils
.
isEmpty
(
operateInfo
.
getVideoUrl
())
?
View
.
GONE
:
View
.
VISIBLE
);
// String url = "http://jzvd.nathen.cn/c6e3dc12a1154626b3476d9bf3bd7266/6b56c5f0dc31428083757a45764763b0-5287d2089db37e62345123a1be272f8b.mp4";
String
url
=
detail
.
getVideoUrl
();
String
url
=
operateInfo
.
getVideoUrl
();
mBind
.
jzVideo
.
setUp
(
url
,
""
);
GlideImageLoader
.
load
(
mActivity
,
-
1
,
url
,
mBind
.
jzVideo
.
thumbImageView
);
GlideImageLoader
.
load
(
mActivity
,
mBind
.
jzVideo
.
thumbImageView
,
url
,
R
.
drawable
.
icon_app_logo
);
setListener
();
}
@SuppressLint
(
"ClickableViewAccessibility"
)
private
void
setListener
()
{
KeyboardStateObserver
.
getKeyboardStateObserver
(
mActivity
).
setKeyboardVisibilityListener
(
new
KeyboardStateObserver
.
OnKeyboardVisibilityListener
()
{
@Override
public
void
onKeyboardShow
()
{
mBind
.
btnComment
.
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onKeyboardHide
()
{
weakHandler
.
postDelayed
(()
->
{
mBind
.
btnComment
.
setVisibility
(
View
.
VISIBLE
);
},
100
);
}
});
mBind
.
nsvOperate
.
setOnTouchListener
((
view
,
motionEvent
)
->
{
CommonUtils
.
hideSoftInput
(
mActivity
,
mBind
.
edtComment
);
return
false
;
});
//联系电话
mBind
.
tvContactSeller
.
setOnClickListener
(
v
->
{
if
(
TextUtils
.
isEmpty
(
phone
))
{
ToastUtils
.
showShortToast
(
R
.
string
.
no_mobile
);
...
...
@@ -61,6 +119,98 @@ public class OperateDetailFragment extends DataBindingFragment<FragmentOperateDe
CommonUtils
.
dialPhone
(
mActivity
,
phone
);
}
});
//发送
mBind
.
btnSend
.
setOnClickListener
(
v
->
{
String
content
=
mBind
.
edtComment
.
getText
().
toString
();
if
(
TextUtils
.
isEmpty
(
content
))
return
;
ProgressUtil
.
startLoad
(
mActivity
);
CommentPostData
commentData
=
new
CommentPostData
();
commentData
.
targetId
=
operateInfo
.
getId
();
commentData
.
accountId
=
Integer
.
parseInt
(
userInfo
.
getAccountId
());
commentData
.
accountName
=
userInfo
.
getAccountName
();
commentData
.
messageAvatarUrl
=
userInfo
.
getHeaderImg
();
commentData
.
content
=
content
;
commentData
.
updated
=
userInfo
.
getAccountName
();
commentData
.
messageType
=
2
;
if
(
selectedItem
==
null
)
{
commentData
.
messageType
=
1
;
}
else
{
commentData
.
messageType
=
2
;
commentData
.
beAccountId
=
selectedItem
.
getAccountId
();
commentData
.
beName
=
selectedItem
.
getAccountName
();
commentData
.
beMessageId
=
selectedItem
.
getId
();
if
(
commentData
.
parentId
>
0
)
{
commentData
.
parentId
=
selectedItem
.
getParentId
();
}
else
{
commentData
.
parentId
=
selectedItem
.
getId
();
}
}
OrderApiFactory
.
addComment
(
commentData
).
subscribe
(
mPresenter
.
baseObserver
(
result
->
{
if
(
result
)
getCommentData
();
}));
selectedItem
=
null
;
mBind
.
edtComment
.
setText
(
""
);
CommonUtils
.
hideSoftInput
(
mActivity
,
mBind
.
edtComment
);
});
mBind
.
btnComment
.
setOnClickListener
(
v
->
{
selectedItem
=
null
;
mBind
.
edtComment
.
setText
(
""
);
mBind
.
edtComment
.
requestFocus
();
CommonUtils
.
ShowSoftInput
(
mActivity
,
mBind
.
edtComment
);
});
mCommentAdapter
.
setOnItemClickListener
((
item
,
bind
)
->
{
selectedItem
=
item
;
mBind
.
edtComment
.
setText
(
""
);
mBind
.
edtComment
.
requestFocus
();
CommonUtils
.
ShowSoftInput
(
mActivity
,
mBind
.
edtComment
);
});
}
private
void
getCommentData
()
{
ProgressUtil
.
startLoad
(
mActivity
);
OrderApiFactory
.
getComment
(
operateInfo
.
getId
(),
1
,
3
,
page
,
pageSize
)
.
subscribe
(
mPresenter
.
baseObserver
(
data
->
{
if
(
page
==
1
)
{
commentList
.
clear
();
}
commentList
=
transData
(
data
.
getData
());
mBind
.
tvComponent
.
setText
(
"留言. "
+
commentList
.
size
());
mCommentAdapter
.
setData
(
commentList
);
}));
}
private
List
<
CommentBean
>
transData
(
List
<
CommentBean
>
datas
)
{
List
<
CommentBean
>
tempList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
datas
.
size
();
i
++)
{
CommentBean
cData
=
datas
.
get
(
i
);
if
(
cData
.
getMessageType
()
==
1
)
{
if
(!
tempList
.
contains
(
cData
))
tempList
.
add
(
cData
);
}
else
{
int
parentId
=
cData
.
getParentId
();
for
(
int
j
=
0
;
j
<
datas
.
size
();
j
++)
{
CommentBean
cData2
=
datas
.
get
(
j
);
if
(
cData2
.
getId
()
==
parentId
)
{
if
(!
tempList
.
contains
(
cData2
))
{
tempList
.
add
(
cData2
);
if
(!
tempList
.
contains
(
cData
))
if
(!
tempList
.
contains
(
cData
))
tempList
.
add
(
tempList
.
indexOf
(
cData2
)
+
1
,
cData
);
}
else
if
(!
tempList
.
contains
(
cData
))
{
tempList
.
add
(
tempList
.
indexOf
(
cData2
)
+
1
,
cData
);
}
}
else
if
(!
tempList
.
contains
(
cData2
))
{
tempList
.
add
(
cData2
);
}
}
}
}
return
tempList
;
}
...
...
@@ -68,4 +218,10 @@ public class OperateDetailFragment extends DataBindingFragment<FragmentOperateDe
public
int
getLayoutId
()
{
return
R
.
layout
.
fragment_operate_detail
;
}
@Override
public
void
setPresenter
()
{
}
}
orderCenter/src/main/release/AndroidManifest.xml
View file @
080fb24a
...
...
@@ -44,6 +44,7 @@
<activity
android:name=
".ui.activity.OrderDetailsActivity"
android:configChanges=
"orientation|screenSize|keyboardHidden"
android:windowSoftInputMode=
"adjustResize"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activity.ReturnPartActivity"
...
...
orderCenter/src/main/res/layout/fragment_operate_detail.xml
View file @
080fb24a
...
...
@@ -2,15 +2,18 @@
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<
Relative
Layout
<
Linear
Layout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<android.support.v4.widget.NestedScrollView
android:id=
"@+id/nsv_operate"
android:layout_width=
"match_parent"
android:layout_marginBottom=
"40dp"
android:layout_height=
"match_parent"
>
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_marginBottom=
"3dp"
>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -76,43 +79,72 @@
android:textSize=
"14sp"
android:textStyle=
"bold"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:background=
"@color/white"
android:layout_margin=
"10dp"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_avatar"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_marginRight=
"10dp"
/>
<EditText
android:id=
"@+id/edt_comment"
android:layout_width=
"0dp"
android:layout_height=
"35dp"
android:layout_weight=
"1"
android:background=
"#f5f5f5"
android:hint=
"@string/ask_detail"
android:padding=
"5dp"
android:paddingLeft=
"5dp"
android:singleLine=
"true"
android:textSize=
"13sp"
/>
<Button
android:id=
"@+id/btn_send"
android:layout_width=
"80dp"
android:layout_height=
"35dp"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_gravity=
"center_vertical"
android:background=
"@color/cl_home_button"
android:gravity=
"center"
android:text=
"@string/send_str"
android:textColor=
"@color/white"
android:textSize=
"13sp"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/rl_component"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<!--<com.dayu.widgets.LRecyclerView-->
<!--android:id="@+id/lrv_component"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:background="#f5f5f5" />-->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<LinearLayout
<Button
android:id=
"@+id/btn_comment"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"35dp"
android:layout_alignParentRight=
"true"
android:layout_alignParentBottom=
"true"
android:background=
"@color/white"
android:orientation=
"horizontal"
>
<EditText
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:height=
"35dp"
android:paddingLeft=
"5dp"
android:padding=
"5dp"
android:maxLines=
"1"
android:textSize=
"13sp"
android:hint=
"@string/ask_detail"
android:background=
"#f5f5f5"
/>
<Button
android:id=
"@+id/btn_send"
android:layout_width=
"80dp"
android:layout_height=
"35dp"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_gravity=
"center_vertical"
android:background=
"@color/cl_home_button"
android:gravity=
"center"
android:text=
"@string/send_str"
android:textColor=
"@color/white"
android:textSize=
"13sp"
/>
</LinearLayout>
</RelativeLayout>
android:layout_centerVertical=
"true"
android:layout_gravity=
"center_vertical"
android:background=
"@color/cl_home_button"
android:gravity=
"center"
android:text=
"@string/ask_detail"
android:textColor=
"@color/white"
android:textSize=
"13sp"
/>
</LinearLayout>
</layout>
\ No newline at end of file
orderCenter/src/main/res/layout/item_comment.xml
0 → 100644
View file @
080fb24a
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"item"
type=
"com.dayu.order.api.protocol.CommentBean"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<RelativeLayout
android:id=
"@+id/rl_component"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
>
<ImageView
android:id=
"@+id/iv_avatar"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_marginLeft=
"10dp"
/>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"5dp"
android:layout_toRightOf=
"@id/iv_avatar"
android:text=
"@{item.accountName}"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/tv_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignBottom=
"@id/tv_name"
android:layout_marginLeft=
"5dp"
android:layout_toRightOf=
"@id/tv_name"
android:text=
"time"
android:textColor=
"@color/tv_cl"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/tv_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_name"
android:layout_alignLeft=
"@id/tv_name"
android:layout_marginTop=
"3dp"
android:layout_marginRight=
"10dp"
android:text=
"@{item.content}"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"13sp"
/>
<ImageView
android:layout_width=
"22dp"
android:layout_height=
"22dp"
android:layout_alignParentRight=
"true"
android:layout_marginRight=
"10dp"
android:src=
"@drawable/icon_comment"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_below=
"@id/tv_content"
android:layout_marginTop=
"10dp"
android:background=
"@color/color_ee"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/rl_reply"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"55dp"
android:layout_marginTop=
"10dp"
>
<ImageView
android:id=
"@+id/iv_avatar2"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:src=
"@drawable/icon_user_default"
/>
<TextView
android:id=
"@+id/tv_name2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"5dp"
android:layout_toRightOf=
"@id/iv_avatar2"
android:text=
"@{item.accountName}"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/tv_time2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignBottom=
"@id/tv_name2"
android:layout_marginLeft=
"5dp"
android:layout_toRightOf=
"@id/tv_name2"
android:text=
"time"
android:textColor=
"@color/tv_cl"
android:textSize=
"13sp"
/>
<LinearLayout
android:id=
"@+id/ll_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_name2"
android:layout_alignLeft=
"@id/tv_name2"
android:layout_marginTop=
"5dp"
android:layout_marginRight=
"10dp"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_reply_"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/reply_str"
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/tv_reply_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
'@{"@"+item.beName}'
android:textColor=
"@color/cl_home_button"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/tv_content2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
'@{": "+item.content}'
android:textColor=
"@color/cl_home_title_text_color"
android:textSize=
"13sp"
/>
</LinearLayout>
<ImageView
android:layout_width=
"22dp"
android:layout_height=
"22dp"
android:layout_alignParentRight=
"true"
android:layout_marginRight=
"10dp"
android:src=
"@drawable/icon_comment"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_below=
"@id/ll_content"
android:layout_marginTop=
"10dp"
android:background=
"@color/color_ee"
/>
</RelativeLayout>
</LinearLayout>
</layout>
\ No newline at end of file
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