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
e06a3bed
Commit
e06a3bed
authored
Aug 13, 2022
by
王佳洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改昵称
2.修改简介 3.修改头像
parent
e94cf267
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
530 additions
and
1169 deletions
+530
-1169
ChatAdapter.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
+1
-6
AndroidManifest.xml
m-user/src/main/AndroidManifest.xml
+4
-8
UserApi.kt
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
+14
-11
UserHttp.kt
m-user/src/main/java/com/yidianling/user/http/UserHttp.kt
+7
-11
UserHttpImpl.kt
m-user/src/main/java/com/yidianling/user/http/UserHttpImpl.kt
+37
-54
UserModifyAuditRespDto.kt
m-user/src/main/java/com/yidianling/user/http/request/UserModifyAuditRespDto.kt
+1
-1
ChooseAccountActivity.kt
m-user/src/main/java/com/yidianling/user/mine/ChooseAccountActivity.kt
+1
-1
MineFragment.kt
m-user/src/main/java/com/yidianling/user/mine/MineFragment.kt
+2
-20
ModifyAvatarActivity.kt
m-user/src/main/java/com/yidianling/user/mine/ModifyAvatarActivity.kt
+302
-0
ModifyInfoActivity.kt
m-user/src/main/java/com/yidianling/user/mine/ModifyInfoActivity.kt
+16
-11
PersonalDesActivity.java
m-user/src/main/java/com/yidianling/user/mine/PersonalDesActivity.java
+0
-95
PersonalInfoActivity.java
m-user/src/main/java/com/yidianling/user/mine/PersonalInfoActivity.java
+21
-278
FillInfoActivity.java
m-user/src/main/java/com/yidianling/user/ui/FillInfoActivity.java
+0
-498
user_loading2.gif
m-user/src/main/res/drawable-xhdpi/user_loading2.gif
+0
-0
user_regist_photo.png
m-user/src/main/res/drawable-xhdpi/user_regist_photo.png
+0
-0
bg_1da1f2_corner_8.xml
m-user/src/main/res/drawable/bg_1da1f2_corner_8.xml
+6
-0
bg_c3c4ca_corner_8.xml
m-user/src/main/res/drawable/bg_c3c4ca_corner_8.xml
+6
-0
activity_modify_avatar.xml
m-user/src/main/res/layout/activity_modify_avatar.xml
+80
-0
activity_modify_info.xml
m-user/src/main/res/layout/activity_modify_info.xml
+0
-0
user_activity_fill_info.xml
m-user/src/main/res/layout/user_activity_fill_info.xml
+0
-78
user_mine_activity_personal_des.xml
m-user/src/main/res/layout/user_mine_activity_personal_des.xml
+0
-65
FileUtils.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/FileUtils.java
+10
-13
ListNoCancelDialog.java
ydl-platform/src/main/java/com/ydl/ydlcommon/view/ListNoCancelDialog.java
+1
-5
TitleBar.java
ydl-platform/src/main/java/com/ydl/ydlcommon/view/TitleBar.java
+17
-13
attrs.xml
ydl-platform/src/main/res/values/attrs.xml
+2
-1
colors.xml
ydl-platform/src/main/res/values/colors.xml
+2
-0
No files found.
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
View file @
e06a3bed
...
...
@@ -15,7 +15,6 @@ import com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlcommon.view.ListNoCancelDialog
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.param.RmHistoryParam
import
com.yidianling.im.api.param.RmTalkParam
import
com.yidianling.im.api.param.TopMessageParam
...
...
@@ -24,15 +23,11 @@ import com.yidianling.im.event.UpdateTabUnreadNumEvent
import
com.yidianling.im.helper.IMChatUtil
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.http.ImHttpImpl
import
com.yidianling.im.router.ImIn
import
com.yidianling.im.session.SessionHelper
import
com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import
com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import
com.yidianling.im.ui.page.fragment.view.ChatItemView
import
com.yidianling.im.ui.page.fragment.view.ChatTimeItemView
import
com.yidianling.im.ui.param.ChatParam
import
de.greenrobot.event.EventBus
import
kotlinx.android.synthetic.main.im_chat_fragment_layout.*
/**
* 互动列表适配器
...
...
@@ -94,7 +89,7 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
name
.
add
(
"标记为已读"
)
}
val
builder
=
ListNoCancelDialog
.
Builder
(
context
,
name
,
0
)
builder
.
S
etOnItemClickLister
(
object
:
ListNoCancelDialog
.
Builder
.
OnItemClickLister
{
builder
.
s
etOnItemClickLister
(
object
:
ListNoCancelDialog
.
Builder
.
OnItemClickLister
{
override
fun
onItemClick
(
dialog
:
Dialog
,
view
:
View
,
position1
:
Int
)
{
val
tag
=
name
[
position1
]
when
(
tag
)
{
...
...
m-user/src/main/AndroidManifest.xml
View file @
e06a3bed
...
...
@@ -32,10 +32,6 @@
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
android:name=
".ui.FillInfoActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
android:name=
".safePrivate.CheckPasswordActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
...
...
@@ -126,10 +122,6 @@
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
android:name=
".mine.PersonalDesActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
android:name=
".mine.PersonalInfoActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
...
...
@@ -142,6 +134,10 @@
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
android:name=
".mine.ModifyAvatarActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
android:name=
".mine.WithDrawActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/platform_NoTitleTheme"
/>
...
...
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
View file @
e06a3bed
package
com.yidianling.user.http
import
com.google.gson.internal.LinkedTreeMap
import
com.ydl.ydlcommon.base.config.*
import
com.ydl.ydlcommon.base.config.YDLConstants
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_LOGIN_BASE_URL
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.yidianling.user.api.bean.UserResponseBean
...
...
@@ -11,6 +14,7 @@ import com.yidianling.user.http.request.UserModifyAuditRespDto
import
com.yidianling.user.http.response.*
import
com.yidianling.user.mine.bean.RedPacketId
import
io.reactivex.Observable
import
okhttp3.MultipartBody
import
okhttp3.RequestBody
import
retrofit2.http.*
...
...
@@ -68,16 +72,6 @@ interface UserApi {
@POST
(
"user/set-info"
)
fun
setUserInfo
(
@FieldMap
params
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
Any
>>
//上传头像
@Multipart
@POST
(
"user/set-info"
)
fun
uploadHeadImg
(
@PartMap
params
:
MutableMap
<
String
,
RequestBody
>):
Observable
<
BaseResponse
<
Any
>>
//上传头像
@Multipart
@POST
(
"user/set-info"
)
fun
uploadHeadImg
(
@Part
(
"type"
)
param
:
RequestBody
):
Observable
<
BaseResponse
<
Any
>>
//验证账号密码
@FormUrlEncoded
@POST
(
"user/chkin-pass"
)
...
...
@@ -264,4 +258,12 @@ interface UserApi {
*/
@POST
(
"user/v1/getUserAuditInfo"
)
fun
getUserAuditInfo
(
@Body
map
:
Map
<
String
,
String
>):
Observable
<
BaseAPIResponse
<
UserModifyAuditRespDto
>>
/**
* 上传图片
*/
@Multipart
@POST
(
"file/upload"
)
fun
uploadFile
(
@Query
(
"uid"
)
uid
:
String
,
@Query
(
"token"
)
token
:
String
,
@Part
file
:
MultipartBody
.
Part
):
Observable
<
BaseAPIResponse
<
String
>>
}
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/http/UserHttp.kt
View file @
e06a3bed
...
...
@@ -9,16 +9,11 @@ import com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.bean.CheckPhonePassBean
import
com.yidianling.user.bean.CollectFocusItemBean
import
com.yidianling.user.http.request.*
import
com.yidianling.user.http.response.CheckPassword
import
com.yidianling.user.http.response.CountryResponse
import
com.yidianling.user.http.response.ExistResponse
import
com.yidianling.user.http.response.SecretResponse
import
com.yidianling.user.mine.bean.RedPackDataForRegister
import
com.yidianling.user.http.response.*
import
com.yidianling.user.mine.bean.RedPacketId
import
com.yidianling.user.mine.bean.RedPacketIdCmd
import
com.yidianling.user.http.response.*
import
io.reactivex.Observable
import
retrofit2.http.Body
import
java.io.File
/**
* author : Zhangwenchao
...
...
@@ -47,8 +42,6 @@ interface UserHttp {
fun
setUserInfo
(
param
:
UserInfoParam
):
Observable
<
BaseResponse
<
Any
>>
fun
uploadHead
(
param
:
HeadParam
):
Observable
<
BaseResponse
<
Any
>>
fun
checkPhonePass
(
cmd
:
CheckPhonePassBean
):
Observable
<
BaseResponse
<
CheckPassword
>>
fun
bindQQ
(
param
:
BindQQ
):
Observable
<
BaseResponse
<
Any
>>
...
...
@@ -86,7 +79,9 @@ interface UserHttp {
/**用户注销账号*/
fun
accountLogOff
(
param
:
UserForbidLoginParam
):
Observable
<
BaseAPIResponse
<
Boolean
>>
fun
modifyUserBaseInfo
(
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
Boolean
>>
fun
modifyUserBaseInfo
(
uid
:
String
,
token
:
String
,
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
Boolean
>>
fun
getUserAuditInfo
(
uid
:
String
,
token
:
String
,
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
UserModifyAuditRespDto
>>
fun
getUserAuditInfo
(
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
UserModifyAuditRespDto
>>
fun
uploadFile
(
uid
:
String
,
token
:
String
,
file
:
File
):
Observable
<
BaseAPIResponse
<
Boolean
>>
}
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/http/UserHttpImpl.kt
View file @
e06a3bed
...
...
@@ -4,16 +4,11 @@ import android.app.Activity
import
com.google.gson.Gson
import
com.google.gson.internal.LinkedTreeMap
import
com.umeng.socialize.bean.SHARE_MEDIA
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseCommand
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.router.YdlCommonOut
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.common.tools.RxAppTool
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.user.UserHelper
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.bean.CheckPhonePassBean
import
com.yidianling.user.bean.CollectFocusItemBean
...
...
@@ -21,14 +16,14 @@ import com.yidianling.user.http.request.*
import
com.yidianling.user.http.response.CheckPassword
import
com.yidianling.user.http.response.CountryResponse
import
com.yidianling.user.http.response.ExistResponse
import
com.yidianling.user.http.response.SecretResponse
import
com.yidianling.user.mine.bean.RedPacketId
import
com.yidianling.user.mine.bean.RedPacketIdCmd
import
com.yidianling.user.rxlogin.LoginObservable
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
okhttp3.MediaType
import
okhttp3.MultipartBody
import
okhttp3.RequestBody
import
java.io.File
/**
* author : Zhangwenchao
...
...
@@ -117,66 +112,54 @@ class UserHttpImpl private constructor() : UserHttp {
.
flatMap
{
getUserApi
().
setUserInfo
(
it
)
}
}
override
fun
modifyUserBaseInfo
(
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
Boolean
>>
{
UserHelper
.
getUserInfo
()
?.
let
{
param
.
uid
=
it
.
uid
.
orEmpty
()
param
.
accessToken
=
it
.
accessToken
.
orEmpty
()
}
override
fun
modifyUserBaseInfo
(
uid
:
String
,
token
:
String
,
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
Boolean
>>
{
param
.
uid
=
uid
param
.
accessToken
=
token
return
RxUtils
.
mapObservable
(
param
)
.
flatMap
{
getUserApi
().
modifyUserBaseInfo
(
it
)
}
}
override
fun
getUserAuditInfo
(
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
UserModifyAuditRespDto
>>
{
UserHelper
.
getUserInfo
()
?.
let
{
param
.
uid
=
it
.
uid
.
orEmpty
()
param
.
accessToken
=
it
.
accessToken
.
orEmpty
()
}
override
fun
getUserAuditInfo
(
uid
:
String
,
token
:
String
,
param
:
ModifyBaseInfo
):
Observable
<
BaseAPIResponse
<
UserModifyAuditRespDto
>>
{
param
.
uid
=
uid
param
.
accessToken
=
token
return
RxUtils
.
mapObservable
(
param
)
.
flatMap
{
getUserApi
().
getUserAuditInfo
(
it
)
}
}
//验证账号密码
override
fun
checkPhonePass
(
cmd
:
CheckPhonePassBean
):
Observable
<
BaseResponse
<
CheckPassword
>>
{
return
RxUtils
.
mapObservable
(
cmd
)
.
flatMap
{
getUserApi
().
checkPhonePass
(
it
)
}
}
override
fun
uploadHead
(
param
:
HeadParam
):
Observable
<
BaseResponse
<
Any
>>
{
return
Observable
.
just
(
param
)
override
fun
uploadFile
(
uid
:
String
,
token
:
String
,
file
:
File
):
Observable
<
BaseAPIResponse
<
Boolean
>>
{
return
Observable
.
empty
<
Boolean
>()
.
compose
(
RxUtils
.
netCheck
())
.
subscribeOn
(
Schedulers
.
io
())
.
map
{
val
map
=
HashMap
<
String
,
RequestBody
>()
val
mediaType
=
MediaType
.
parse
(
"text/plain"
)
map
[
"type"
]
=
RequestBody
.
create
(
mediaType
,
it
.
type
)
map
[
"value"
]
=
RequestBody
.
create
(
mediaType
,
it
.
value
)
map
[
"ffrom"
]
=
RequestBody
.
create
(
mediaType
,
YdlCommonOut
.
getChannelName
())
map
[
"isFromApp"
]
=
RequestBody
.
create
(
mediaType
,
"1"
)
map
[
"osBuild"
]
=
RequestBody
.
create
(
mediaType
,
"""${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${
RxAppTool.getAppVersionName(
BaseApp.getApp()
.
flatMap
{
getUserApi
().
uploadFile
(
uid
,
token
,
MultipartBody
.
Part
.
createFormData
(
"file"
,
null
,
RequestBody
.
create
(
MediaType
.
parse
(
"multipart/form-data"
),
file
)
)
}"""
)
map
[
"ts"
]
=
RequestBody
.
create
(
mediaType
,
(
System
.
currentTimeMillis
()
/
1000
).
toString
())
map
[
"version"
]
=
RequestBody
.
create
(
mediaType
,
RxAppTool
.
getAppVersionName
(
BaseApp
.
getApp
()))
val
userInfo
=
UserHelper
.
getUserInfo
()
if
(
userInfo
!=
null
)
{
map
[
"uid"
]
=
RequestBody
.
create
(
mediaType
,
userInfo
.
uid
)
map
[
"accessToken"
]
=
RequestBody
.
create
(
mediaType
,
userInfo
.
accessToken
)
}
val
fileBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"multipart/form-data"
),
it
.
file
)
map
.
put
(
"""head"; filename="${it.file.name}"""
,
fileBody
)
map
}.
flatMap
{
if
(
it
.
code
==
"200"
)
modifyUserBaseInfo
(
uid
,
token
,
ModifyBaseInfo
(
it
.
data
,
102
))
else
Observable
.
empty
()
}
.
flatMap
{
getUserApi
().
uploadHeadImg
(
it
)
}
//验证账号密码
override
fun
checkPhonePass
(
cmd
:
CheckPhonePassBean
):
Observable
<
BaseResponse
<
CheckPassword
>>
{
return
RxUtils
.
mapObservable
(
cmd
)
.
flatMap
{
getUserApi
().
checkPhonePass
(
it
)
}
}
override
fun
bindQQ
(
param
:
BindQQ
):
Observable
<
BaseResponse
<
Any
>>
{
...
...
m-user/src/main/java/com/yidianling/user/http/request/UserModifyAuditRespDto.kt
View file @
e06a3bed
...
...
@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseCommand
data class
UserModifyAuditRespDto
(
val
auditReason
:
String
?,
// 审核原因
val
auditStatus
:
Int
,
// 审核状态 1
审核中,2审核失败,3已
审核
val
auditStatus
:
Int
,
// 审核状态 1
:审核中,2:审核失败,3:已审核 || 提交
审核
val
auditTime
:
String
?,
// 审核时间
val
auditor
:
String
?,
// 审核人
val
auditorId
:
String
?,
// 审核人id
...
...
m-user/src/main/java/com/yidianling/user/mine/ChooseAccountActivity.kt
View file @
e06a3bed
...
...
@@ -63,7 +63,7 @@ class ChooseAccountActivity : BaseActivity() {
list
.
add
(
"编辑"
)
list
.
add
(
"删除"
)
val
builder
=
ListNoCancelDialog
.
Builder
(
this
,
list
,
0
)
builder
.
S
etOnItemClickLister
(
object
:
ListNoCancelDialog
.
Builder
.
OnItemClickLister
{
builder
.
s
etOnItemClickLister
(
object
:
ListNoCancelDialog
.
Builder
.
OnItemClickLister
{
override
fun
onItemClick
(
dialog
:
Dialog
?,
view
:
View
?,
index
:
Int
)
{
val
name
=
list
[
index
]
when
(
name
)
{
...
...
m-user/src/main/java/com/yidianling/user/mine/MineFragment.kt
View file @
e06a3bed
...
...
@@ -30,7 +30,6 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils.Companion.count
import
com.ydl.ydlcommon.view.dialog.YDLShareDialog
import
com.ydl.ydlcommon.view.dialog.YDLShareDialog.Companion.style4
import
com.yidianling.dynamic.api.IDynamicService
import
com.yidianling.im.api.service.IImService
import
com.yidianling.im.message.param.MsgListParam
import
com.yidianling.user.BuildConfig
import
com.yidianling.user.R
...
...
@@ -326,7 +325,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
.
compose
(
resultJavaData
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
Consumer
{
response
:
UserResponseBean
->
.
subscribe
({
response
:
UserResponseBean
->
swipe_refresh_layout
.
isRefreshing
=
false
try
{
//此处后端返回信息,只有userinfo,其它数据为空,切勿整体赋值
...
...
@@ -631,30 +630,14 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
mShareDialog
?.
show
(
activity
?.
fragmentManager
,
"lose"
)
}
/**
* 收到照片选取事件
*/
fun
onEventBackgroundThread
(
event
:
UserResponseBean
?)
{
if
(
event
?.
userInfo
!=
null
)
{
userInfoData
=
event
.
userInfo
}
}
fun
onEvent
(
event
:
RefreshRecentContactListEvent
?)
{
refreshCouponData
()
}
fun
onEvent
(
event
:
UserChangeEvent
)
{
val
changeFlag
=
event
.
isChange_flag
if
(
changeFlag
)
{
if
(
event
.
isChange_flag
)
{
initdata
()
refreshCouponData
()
try
{
provide
(
IImService
::
class
.
java
).
updateUserHead
(
getUserInfo
()
?.
userInfo
?.
head
)
}
catch
(
e
:
Exception
)
{
}
}
}
}
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/mine/ModifyAvatarActivity.kt
0 → 100644
View file @
e06a3bed
package
com.yidianling.user.mine
import
android.annotation.SuppressLint
import
android.app.Dialog
import
android.content.Intent
import
android.graphics.Bitmap
import
android.graphics.BitmapFactory
import
android.hardware.Camera
import
android.net.Uri
import
android.os.Build
import
android.provider.MediaStore
import
android.text.Spannable
import
android.text.SpannableString
import
android.text.style.ForegroundColorSpan
import
android.view.View
import
android.widget.ImageView
import
android.widget.TextView
import
com.alibaba.android.arouter.launcher.ARouter
import
com.bumptech.glide.Glide
import
com.hjq.permissions.OnPermissionCallback
import
com.hjq.permissions.Permission
import
com.hjq.permissions.XXPermissions
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.utils.FileUtils
import
com.ydl.ydlcommon.utils.extend.visible
import
com.ydl.ydlcommon.view.ListNoCancelDialog
import
com.ydl.ydlcommon.view.TitleBar
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.service.IImService
import
com.yidianling.user.R
import
com.yidianling.user.api.service.IUserService
import
com.yidianling.user.http.UserHttpImpl
import
com.yidianling.user.http.request.ModifyBaseInfo
import
com.yidianling.user.http.request.UserModifyAuditRespDto
import
de.greenrobot.event.EventBus
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
java.io.File
import
java.io.IOException
class
ModifyAvatarActivity
:
BaseActivity
()
{
private
val
ALBUM
=
0
x0
// 相册
private
val
CAMERA
=
0
x1
// 照相
private
val
CROP
=
0
x2
// 裁剪
private
val
mAvatarDir
=
"${FileUtils.getStorageDirectory()}/img/head_img/"
// 头像目录
private
val
mAvatarPath
=
"${mAvatarDir}avatar_camera.jpg"
// 头像
private
val
mAvatarFile
=
File
(
mAvatarPath
)
// 头像文件
private
val
mUserInfo
=
findRouteService
(
IUserService
::
class
.
java
).
getUserInfo
()
override
fun
layoutResId
():
Int
=
R
.
layout
.
activity_modify_avatar
private
lateinit
var
tip_bar
:
TitleBar
private
lateinit
var
tv_tip1
:
TextView
private
lateinit
var
iv_avatar
:
ImageView
private
lateinit
var
iv_warn
:
ImageView
private
lateinit
var
tv_tip2
:
TextView
private
lateinit
var
tv_modify
:
TextView
private
fun
findView
()
{
tip_bar
=
findViewById
(
R
.
id
.
tip_bar
)
tv_tip1
=
findViewById
(
R
.
id
.
tv_tip1
)
iv_avatar
=
findViewById
(
R
.
id
.
iv_avatar
)
iv_warn
=
findViewById
(
R
.
id
.
iv_warn
)
tv_tip2
=
findViewById
(
R
.
id
.
tv_tip2
)
tv_modify
=
findViewById
(
R
.
id
.
tv_modify
)
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
initDataAndEvent
()
{
findView
()
mUserInfo
?:
return
mDisposable
.
add
(
UserHttpImpl
.
getInstance
()
.
getUserAuditInfo
(
mUserInfo
.
uid
,
mUserInfo
.
accessToken
.
orEmpty
(),
ModifyBaseInfo
(
null
,
102
)
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
response
:
BaseAPIResponse
<
UserModifyAuditRespDto
>
->
if
(
response
.
code
!=
"200"
)
return
@subscribe
val
(
_
,
auditStatus
,
_
,
_
,
_
,
_
,
_
,
last7Day
,
modifyAfter
)
=
response
.
data
when
(
auditStatus
)
{
1
->
{
// 审核中
underReview
()
Glide
.
with
(
this
)
.
load
(
modifyAfter
)
.
into
(
iv_avatar
)
}
2
->
{
// 审核失败
tv_tip1
.
text
=
"七天内可修改一次头像"
Glide
.
with
(
this
)
.
load
(
mUserInfo
.
head
)
.
into
(
iv_avatar
)
iv_warn
.
visible
()
tv_tip2
.
text
=
SpannableString
(
"审核失败,该头像提交不规范,请修改后重新提交审核。如有疑问联系客服小壹"
).
also
{
it
.
setSpan
(
ForegroundColorSpan
(
resources
.
getColor
(
R
.
color
.
color_1DA1F2
)),
it
.
indexOf
(
"客服"
),
it
.
length
,
Spannable
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
}
tv_tip2
.
setOnClickListener
{
// 客服
ARouter
.
getInstance
().
navigation
(
IImService
::
class
.
java
).
startKefuChat
(
this
,
""
,
0
,
0
)
}
setModifyAvatar
()
}
3
->
{
// 审核成功 || 提交审核
mUserInfo
.
head
=
modifyAfter
findRouteService
(
IImService
::
class
.
java
).
updateUserHead
(
modifyAfter
)
// 更新用户头像到云信
EventBus
.
getDefault
().
post
(
UserChangeEvent
(
true
))
// 更新MineFragment
if
(
last7Day
)
{
tv_tip1
.
text
=
"抱歉,七天内只能修改一次头像"
tv_modify
.
isEnabled
=
false
tv_modify
.
setBackgroundResource
(
R
.
drawable
.
bg_c3c4ca_corner_8
)
}
else
{
tv_tip1
.
text
=
"七天内可修改一次头像"
setModifyAvatar
()
}
}
}
})
}
private
fun
setModifyAvatar
()
{
tv_modify
.
setOnClickListener
{
requestPermissions
{
optionDialog
()
}
}
}
private
fun
requestPermissions
(
block
:
()
->
Unit
)
{
if
(
XXPermissions
.
isGrantedPermission
(
this
,
Permission
.
CAMERA
))
{
block
.
invoke
()
}
else
{
XXPermissions
.
with
(
this
)
.
permission
(
Permission
.
CAMERA
)
.
request
(
object
:
OnPermissionCallback
{
override
fun
onGranted
(
permissions
:
MutableList
<
String
>?,
all
:
Boolean
)
{
block
.
invoke
()
}
override
fun
onDenied
(
permissions
:
MutableList
<
String
>?,
never
:
Boolean
)
{
ToastUtil
.
toastLong
(
this
@ModifyAvatarActivity
,
"缺少使用相机和读取存储权限,无法获取图片"
)
}
})
}
}
private
fun
optionDialog
()
{
ListNoCancelDialog
.
Builder
(
this
,
listOf
(
"相册"
,
"拍照"
),
0
).
setOnItemClickLister
(
object
:
ListNoCancelDialog
.
Builder
.
OnItemClickLister
{
override
fun
onItemClick
(
dialog
:
Dialog
,
view
:
View
?,
position
:
Int
)
{
val
file
=
File
(
mAvatarDir
)
if
(!
file
.
exists
())
file
.
mkdirs
()
when
(
position
)
{
0
->
{
// 相册
val
intent
=
Intent
(
Intent
.
ACTION_PICK
,
null
)
intent
.
setDataAndType
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
"image/*"
)
startActivityForResult
(
intent
,
ALBUM
)
}
1
->
{
// 拍照
callCamera
()
}
}
dialog
.
dismiss
()
}
override
fun
onItemLongClick
(
dialog
:
Dialog
?,
view
:
View
?,
position
:
Int
)
{}
}).
create
().
show
()
}
/**
* 调用相机
*/
private
fun
callCamera
()
{
val
intent
=
Intent
()
packageManager
.
getLaunchIntentForPackage
(
"com.android.camera"
)
?.
run
{
intent
.
setPackage
(
"com.android.camera"
)
}
intent
.
action
=
MediaStore
.
ACTION_IMAGE_CAPTURE
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
// api 24
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
)
// 调用前置摄像头
intent
.
putExtra
(
"autofocus"
,
true
)
// 自动对焦
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
mAvatarFile
))
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
())
startActivityForResult
(
intent
,
CAMERA
)
}
else
{
try
{
mAvatarFile
.
createNewFile
()
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
}
val
uri
:
Uri
=
FileUtils
.
getImageContentUri
(
this
,
mAvatarFile
)
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
)
// 调用前置摄像头
intent
.
putExtra
(
"autofocus"
,
true
)
// 自动对焦
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uri
)
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
())
startActivityForResult
(
intent
,
CAMERA
)
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
==
RESULT_OK
)
{
when
(
requestCode
)
{
ALBUM
->
{
// 相册
data
?.
let
{
startPhotoZoom
(
it
.
data
)
}
}
CAMERA
->
{
// 拍照
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
// api 24
if
(
mAvatarFile
.
exists
())
{
startPhotoZoom
(
Uri
.
fromFile
(
mAvatarFile
))
}
}
else
{
startPhotoZoom
(
FileUtils
.
getImageContentUri
(
this
,
mAvatarFile
))
}
}
CROP
->
{
mUserInfo
?:
return
showProgressDialog
(
"保存中..."
)
val
path
=
FileUtils
.
getPathByUri4kitkat
(
this
,
Uri
.
fromFile
(
mAvatarFile
))
var
bitmap
=
BitmapFactory
.
decodeFile
(
path
)
bitmap
=
FileUtils
.
getZoomImage
(
bitmap
,
200.0
)
try
{
val
outPutFile
=
FileUtils
.
saveBitmap
(
bitmap
,
path
)
mDisposable
.
add
(
UserHttpImpl
.
getInstance
().
uploadFile
(
mUserInfo
.
uid
,
mUserInfo
.
accessToken
.
orEmpty
(),
outPutFile
).
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({},
{})
{
dismissProgressDialog
()
ToastUtil
.
toastShort
(
"头像审核中,预计24小时内审核完成"
)
underReview
()
iv_avatar
.
setImageBitmap
(
bitmap
)
}
)
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
}
}
}
}
}
/**
* 审核中
*/
@SuppressLint
(
"SetTextI18n"
)
private
fun
underReview
()
{
tv_tip1
.
text
=
"抱歉,七天内只能修改一次头像"
tv_tip2
.
text
=
"审核中,预计24小时内审核完成,暂无法修改。"
tv_modify
.
setBackgroundResource
(
R
.
drawable
.
bg_c3c4ca_corner_8
)
tv_modify
.
isEnabled
=
false
}
/**
* 裁剪图片方法实现
*/
private
fun
startPhotoZoom
(
uri
:
Uri
?)
{
val
intent
=
Intent
(
"com.android.camera.action.CROP"
).
apply
{
setDataAndType
(
uri
,
"image/*"
)
putExtra
(
"crop"
,
"true"
)
// 设置裁剪
putExtra
(
"scaleUpIfNeeded"
,
true
)
// 图片拉伸,就不会出现黑框了
//宽高的比例
putExtra
(
"aspectX"
,
1
)
putExtra
(
"aspectY"
,
1
)
//裁剪图片宽高
putExtra
(
"outputX"
,
200
)
putExtra
(
"outputY"
,
200
)
}
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
mAvatarFile
))
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
PNG
.
toString
())
// return-data=true传递的为缩略图,小米手机默认传递大图,所以会导致onActivityResult调用失败
intent
.
putExtra
(
"return-data"
,
false
)
// intent.putExtra("noFaceDetection", false) // 是否需要人脸识别
startActivityForResult
(
intent
,
CROP
)
}
}
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/mine/ModifyInfoActivity.kt
View file @
e06a3bed
...
...
@@ -13,6 +13,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.modular.ModularServiceManager.provide
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.utils.extend.visible
import
com.ydl.ydlcommon.view.DeleteEditTextView
...
...
@@ -50,7 +51,7 @@ class ModifyInfoActivity : BaseActivity() {
private
lateinit
var
tb_title_bar
:
TitleBar
private
lateinit
var
iv_warn
:
ImageView
override
fun
layoutResId
():
Int
=
R
.
layout
.
user_mine_activity_set
_info
override
fun
layoutResId
():
Int
=
R
.
layout
.
activity_modify
_info
private
fun
findView
()
{
det_set_info
=
findViewById
(
R
.
id
.
det_set_info
)
...
...
@@ -70,9 +71,11 @@ class ModifyInfoActivity : BaseActivity() {
det_set_info
.
hint
=
"一句话介绍下自己"
}
val
userInfo
=
findRouteService
(
IUserService
::
class
.
java
).
getUserInfo
()
det_set_info
.
setText
(
userInfo
?.
nick_name
)
userInfo
?:
return
det_set_info
.
setText
(
userInfo
.
nick_name
)
mDisposable
.
add
(
getInstance
().
getUserAuditInfo
(
ModifyBaseInfo
(
null
,
if
(
NICKNAME
==
from
)
101
else
103
))
getInstance
().
getUserAuditInfo
(
userInfo
.
uid
,
userInfo
.
accessToken
.
orEmpty
(),
ModifyBaseInfo
(
null
,
if
(
NICKNAME
==
from
)
101
else
103
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
response
:
BaseAPIResponse
<
UserModifyAuditRespDto
>
->
...
...
@@ -103,6 +106,11 @@ class ModifyInfoActivity : BaseActivity() {
customerService
(
"审核失败 ,昵称中含有违规文字。如有疑问联系客服小壹"
)
}
3
->
{
// 审核成功 || 提交审核
modifyAfter
?.
let
{
nick
->
det_set_info
.
setText
(
nick
)
userInfo
.
nick_name
=
nick
findRouteService
(
IImService
::
class
.
java
).
updateUserName
(
nick
)
// 更新用户昵称到云信
}
if
(
last7Day
)
{
tv_tip1
.
visible
()
tv_tip1
.
text
=
"抱歉,七天内只能修改一次昵称"
...
...
@@ -115,17 +123,13 @@ class ModifyInfoActivity : BaseActivity() {
"抱歉,七天内只能修改一次"
)
}
modifyAfter
?.
let
{
det_set_info
.
setText
(
it
)
userInfo
?.
nick_name
=
it
}
}
else
{
tv_tip1
.
visible
()
tv_tip1
.
text
=
"七天内可修改一次昵称"
tb_title_bar
.
setRightTextColor
(
resources
.
getColor
(
R
.
color
.
color_1DA1F2
))
tb_title_bar
.
setOnRightTextClick
{
_
:
View
?,
_
:
Boolean
->
if
(
checkInput
())
{
modifyUserBaseInfo
(
101
)
{
modifyUserBaseInfo
(
userInfo
.
uid
,
userInfo
.
accessToken
.
orEmpty
(),
101
)
{
ToastUtil
.
toastShort
(
"提交成功,昵称审核中,预计24小时内审核完成"
)
setResult
(
RESULT_OK
,
intent
)
finish
()
...
...
@@ -159,11 +163,11 @@ class ModifyInfoActivity : BaseActivity() {
3
->
{
// 审核成功 || 提交审核
modifyAfter
?.
let
{
det_set_info
.
setText
(
it
)
userInfo
?
.
description
=
it
userInfo
.
description
=
it
}
tb_title_bar
.
setRightTextColor
(
resources
.
getColor
(
R
.
color
.
color_1DA1F2
))
tb_title_bar
.
setOnClickListener
{
modifyUserBaseInfo
(
103
)
{
modifyUserBaseInfo
(
userInfo
.
uid
,
userInfo
.
accessToken
.
orEmpty
(),
103
)
{
ToastUtil
.
toastShort
(
"提交成功,简介审核中,预计24小时内审核完成"
)
finish
()
}
...
...
@@ -208,9 +212,10 @@ class ModifyInfoActivity : BaseActivity() {
return
true
}
private
fun
modifyUserBaseInfo
(
type
:
Int
,
block
:
()
->
Unit
)
{
private
fun
modifyUserBaseInfo
(
uid
:
String
,
token
:
String
,
type
:
Int
,
block
:
()
->
Unit
)
{
mDisposable
.
add
(
getInstance
().
modifyUserBaseInfo
(
uid
,
token
,
ModifyBaseInfo
(
det_set_info
.
text
.
toString
(),
type
...
...
m-user/src/main/java/com/yidianling/user/mine/PersonalDesActivity.java
deleted
100644 → 0
View file @
e94cf267
package
com
.
yidianling
.
user
.
mine
;
import
android.annotation.SuppressLint
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.utils.remind.ToastHelper
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.api.service.IImService
;
import
com.yidianling.user.R
;
import
com.yidianling.user.UserHelper
;
import
com.yidianling.user.http.UserHttp
;
import
com.yidianling.user.http.UserHttpImpl
;
import
com.yidianling.user.http.request.UserInfoParam
;
import
org.jetbrains.annotations.NotNull
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
/**
* 个人资料--个人简介
* Created by hgw on 2017/3/24.
*/
public
class
PersonalDesActivity
extends
BaseActivity
{
ImageView
imageBack
;
TextView
tvCenterTitle
;
TextView
textSave
;
RelativeLayout
relaToolBar
;
EditText
editDes
;
@NotNull
@Override
public
StatusBarOptions
getStatusViewOptions
()
{
return
new
StatusBarOptions
(
true
,
true
);
}
@Override
protected
int
layoutResId
()
{
return
R
.
layout
.
user_mine_activity_personal_des
;
}
@Override
protected
void
initDataAndEvent
()
{
imageBack
=
findViewById
(
R
.
id
.
image_back
);
tvCenterTitle
=
findViewById
(
R
.
id
.
tv_center_title
);
editDes
=
findViewById
(
R
.
id
.
edit_des
);
textSave
=
findViewById
(
R
.
id
.
text_save
);
imageBack
.
setOnClickListener
(
v
->
{
finish
();
});
textSave
.
setOnClickListener
(
v
->
{
updateInfo
(
"home_desc"
,
editDes
.
getText
().
toString
());
});
init
();
}
private
void
init
()
{
String
desc
=
""
;
try
{
desc
=
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
getUserInfoDescription
();
}
catch
(
Exception
e
)
{}
editDes
.
setText
(
desc
);
}
@SuppressLint
(
"CheckResult"
)
private
void
updateInfo
(
final
String
changType
,
final
String
value
)
{
showProgressDialog
(
"保存中"
);
UserHttp
userHttp
=
UserHttpImpl
.
Companion
.
getInstance
();
userHttp
.
setUserInfo
(
new
UserInfoParam
(
changType
,
value
))
.
filter
(
objectBaseResponse
->
changType
.
equals
(
"home_desc"
))
.
compose
(
RxUtils
.
resultData
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
o
->
{
dismissProgressDialog
();
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
().
setDescription
(
value
);
ToastUtil
.
toastShort
(
"保存成功"
);
finish
();
},
new
ThrowableConsumer
()
{
@Override
public
void
accept
(
@NotNull
String
msg
)
{
dismissProgressDialog
();
ToastHelper
.
Companion
.
show
(
msg
);
}
});
}
}
m-user/src/main/java/com/yidianling/user/mine/PersonalInfoActivity.java
View file @
e06a3bed
package
com
.
yidianling
.
user
.
mine
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.hardware.Camera
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.provider.MediaStore
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.DatePicker
;
import
android.widget.ImageView
;
import
android.widget.PopupWindow
;
import
android.widget.RelativeLayout
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.
tbruyelle.rxpermissions2.RxPermissions
;
import
com.
bumptech.glide.Glide
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.transform.GlideCircleTransform
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.utils.FileUtils
;
import
com.ydl.ydlcommon.utils.PopUtils
;
import
com.ydl.ydlcommon.utils.remind.ToastHelper
;
import
com.ydl.ydlcommon.view.JumpTextView
;
...
...
@@ -36,22 +24,17 @@ import com.ydl.ydlcommon.view.ListNoCancelDialog;
import
com.ydl.ydlcommon.view.TitleBar
;
import
com.ydl.ydlcommon.view.dialog.ListDialog
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.api.service.IImService
;
import
com.yidianling.user.R
;
import
com.yidianling.user.UserHelper
;
import
com.yidianling.user.api.bean.UserResponseBean
;
import
com.yidianling.user.http.UserHttp
;
import
com.yidianling.user.http.UserHttpImpl
;
import
com.yidianling.user.http.request.HeadParam
;
import
com.yidianling.user.http.request.UserInfoParam
;
import
org.jetbrains.annotations.NotNull
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
de.greenrobot.event.EventBus
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
...
...
@@ -64,6 +47,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
@Route
(
path
=
"/user/personInfo"
)
public
class
PersonalInfoActivity
extends
BaseActivity
implements
View
.
OnClickListener
{
private
final
int
AVATAR
=
0x0
;
// 头像
private
final
int
NICK
=
0x1
;
// 昵称
UserResponseBean
.
UserInfo
userInfoData
;
TitleBar
tb_title
;
...
...
@@ -77,23 +63,8 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
JumpTextView
jtv_career
;
JumpTextView
jtv_jianjie
;
private
ArrayList
<
String
>
mSelectPath
=
new
ArrayList
<>();
List
<
String
>
name
=
new
ArrayList
<
String
>();
DatePickerDialogFragment
datePickerDialogFragment
=
new
DatePickerDialogFragment
();
private
PopupWindow
popupWindow
;
private
Uri
imgUri
;
FileUtils
fileUtils
;
private
String
head_dir
;
//目录
private
String
head_path
;
//路径
File
head_filec
;
private
final
DatePickerDialogFragment
datePickerDialogFragment
=
new
DatePickerDialogFragment
();
private
RxPermissions
rxPermissions
;
public
static
Intent
newIntent
(
Activity
activity
)
{
return
new
Intent
(
activity
,
PersonalInfoActivity
.
class
);
}
@NotNull
@Override
public
StatusBarOptions
getStatusViewOptions
()
{
...
...
@@ -130,11 +101,10 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
void
init
()
{
rxPermissions
=
new
RxPermissions
(
this
);
tb_title
.
setRightImageListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
popupWindow
=
PopUtils
.
showMoreItem
(
PersonalInfoActivity
.
this
,
PopUtils
.
showMoreItem
(
PersonalInfoActivity
.
this
,
tb_title
.
getRootView
(),
0
,
0
);
...
...
@@ -152,13 +122,10 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
}
});
fileUtils
=
new
FileUtils
(
this
);
head_dir
=
fileUtils
.
getStorageDirectory
()
+
"/img/head_img/"
;
}
private
void
setData
()
{
if
(
userInfoData
==
null
||
userInfoData
==
null
)
return
;
if
(
userInfoData
==
null
)
return
;
String
head_url
=
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
().
getHead
();
GlideApp
.
with
(
PersonalInfoActivity
.
this
)
...
...
@@ -191,58 +158,16 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
@Override
public
void
onClick
(
View
v
)
{
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
persion_head_rel
)
{
rxPermissions
.
request
(
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
subscribe
(
granted
->
{
if
(
granted
)
{
List
<
String
>
name
=
new
ArrayList
<>();
name
.
add
(
"相册"
);
name
.
add
(
"拍照"
);
ListNoCancelDialog
.
Builder
builders
=
new
ListNoCancelDialog
.
Builder
(
PersonalInfoActivity
.
this
,
name
,
0
);
builders
.
SetOnItemClickLister
(
new
ListNoCancelDialog
.
Builder
.
OnItemClickLister
()
{
@Override
public
void
onItemClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
File
file_dir
=
new
File
(
head_dir
);
if
(
file_dir
.
exists
())
{
fileUtils
.
deleteAllFiles
(
file_dir
);
file_dir
.
mkdirs
();
}
switch
(
position
)
{
case
0
:
//相册
Intent
intent1
=
new
Intent
(
Intent
.
ACTION_PICK
,
null
);
intent1
.
setDataAndType
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
"image/*"
);
startActivityForResult
(
intent1
,
21001
);
dialog
.
dismiss
();
break
;
case
1
:
//拍照
head_path
=
head_dir
+
System
.
currentTimeMillis
()
+
"hand_carmer.jpg"
;
showCameraAction
(
21002
,
head_path
);
dialog
.
dismiss
();
break
;
}
}
@Override
public
void
onItemLongClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
}
});
if
(!
PersonalInfoActivity
.
this
.
isFinishing
())
{
builders
.
create
().
show
();
}
}
else
{
ToastUtil
.
toastLong
(
this
,
"缺少使用相机和读取存储权限,无法获取图片"
);
}
});
if
(
id
==
R
.
id
.
persion_head_rel
)
{
// 头像
startActivityForResult
(
new
Intent
(
this
,
ModifyAvatarActivity
.
class
),
AVATAR
);
}
else
if
(
id
==
R
.
id
.
jtv_nick
)
{
//昵称
Intent
intent
=
new
Intent
(
this
,
ModifyInfoActivity
.
class
);
startActivityForResult
(
intent
,
REQUEST_NAME
);
startActivityForResult
(
new
Intent
(
this
,
ModifyInfoActivity
.
class
),
NICK
);
}
else
if
(
id
==
R
.
id
.
jtv_sex
)
{
//性别
List
<
String
>
sexs
=
new
ArrayList
<
String
>();
sexs
.
add
(
"男"
);
sexs
.
add
(
"女"
);
ListNoCancelDialog
.
Builder
builder1
=
new
ListNoCancelDialog
.
Builder
(
PersonalInfoActivity
.
this
,
sexs
,
0
);
builder1
.
S
etOnItemClickLister
(
new
ListNoCancelDialog
.
Builder
.
OnItemClickLister
()
{
builder1
.
s
etOnItemClickLister
(
new
ListNoCancelDialog
.
Builder
.
OnItemClickLister
()
{
@Override
public
void
onItemClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
switch
(
position
)
{
...
...
@@ -340,61 +265,8 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
});
builderm
.
create
().
show
();
}
else
if
(
id
==
R
.
id
.
jtv_jianjie
)
{
//个人简介
Intent
intent1
=
new
Intent
(
this
,
ModifyInfoActivity
.
class
);
startActivity
(
intent1
);
}
}
/**
* 调用系统拍照
*/
private
void
showCameraAction
(
int
type_code
,
String
file_path
)
{
File
file_dir
=
new
File
(
head_dir
);
if
(
file_dir
.
exists
())
{
fileUtils
.
deleteAllFiles
(
file_dir
);
}
file_dir
.
mkdirs
();
head_filec
=
new
File
(
file_path
);
// fileUtils.isFilleExit(head_dir);
// BigHeadFile = new File(file_path);
// try {
// if (BigHeadFile.exists()) {
// BigHeadFile.delete();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
final
Intent
intent
=
new
Intent
();
final
Intent
intent_camera
=
getPackageManager
()
.
getLaunchIntentForPackage
(
"com.android.camera"
);
if
(
intent_camera
!=
null
)
{
intent
.
setPackage
(
"com.android.camera"
);
}
intent
.
setAction
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
// Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
/*获取当前系统的android版本号*/
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
// 调用前置摄像头
intent
.
putExtra
(
"autofocus"
,
true
);
// 自动对焦
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
head_filec
));
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
());
startActivityForResult
(
intent
,
type_code
);
}
else
{
try
{
head_filec
.
createNewFile
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
Uri
uri
=
fileUtils
.
getImageContentUri
(
PersonalInfoActivity
.
this
,
new
File
(
file_path
));
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
// 调用前置摄像头
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uri
);
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
());
intent
.
putExtra
(
"autofocus"
,
true
);
// 自动对焦
startActivityForResult
(
intent
,
type_code
);
startActivity
(
new
Intent
(
this
,
ModifyInfoActivity
.
class
));
}
}
@Override
...
...
@@ -402,97 +274,22 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
resultCode
==
RESULT_OK
)
{
switch
(
requestCode
)
{
case
21001
:
if
(
data
!=
null
)
{
imgUri
=
data
.
getData
();
startPhotoZoom
(
data
.
getData
());
}
break
;
case
21002
:
imgUri
=
null
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
if
(
head_filec
.
exists
())
{
startPhotoZoom
(
Uri
.
fromFile
(
head_filec
));
}
}
else
{
Uri
uri
=
fileUtils
.
getImageContentUri
(
PersonalInfoActivity
.
this
,
head_filec
);
if
(
uri
!=
null
)
{
startPhotoZoom
(
uri
);
}
}
break
;
case
21003
:
if
(
imgUri
!=
null
)
{
showProgressDialog
(
"保存中..."
);
String
path
=
fileUtils
.
getPathByUri4kitkat
(
this
,
imgUri
);
Bitmap
bitmap
=
BitmapFactory
.
decodeFile
(
path
);
bitmap
=
fileUtils
.
getZoomImage
(
bitmap
,
200
);
try
{
File
out_file
=
fileUtils
.
SaveBitmap
(
bitmap
,
path
);
uploadImage
(
out_file
.
getAbsolutePath
(),
1001
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
imgUri
=
null
;
case
AVATAR:
{
Glide
.
with
(
PersonalInfoActivity
.
this
)
.
load
(
userInfoData
.
getHead
())
.
override
(
100
,
100
)
.
transform
(
new
GlideCircleTransform
(
PersonalInfoActivity
.
this
))
.
error
(
R
.
drawable
.
platform_head_place_hold_pic
)
.
into
(
persion_head_iv
);
}
case
NICK:
{
jtv_nick
.
setRightText
(
userInfoData
.
getNick_name
());
break
;
case
REQUEST_NAME:
{
jtv_nick
.
setRightText
(
value
);
userInfo
.
setNick_name
(
value
);
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
updateUserName
(
value
);
// 更新用户昵称到云信
break
;
}
}
}
}
/**
* 裁剪图片方法实现
*/
public
void
startPhotoZoom
(
Uri
uri
)
{
Intent
intent
=
new
Intent
(
"com.android.camera.action.CROP"
);
intent
.
setDataAndType
(
uri
,
"image/*"
);
// 设置裁剪
intent
.
putExtra
(
"crop"
,
"true"
);
// 图片拉伸,就不会出现黑框了
intent
.
putExtra
(
"scaleUpIfNeeded"
,
true
);
//宽高的比例
intent
.
putExtra
(
"aspectX"
,
1
);
intent
.
putExtra
(
"aspectY"
,
1
);
//裁剪图片宽高
intent
.
putExtra
(
"outputX"
,
200
);
intent
.
putExtra
(
"outputY"
,
200
);
if
(
imgUri
!=
null
)
{
// 输出路径
fileUtils
.
isFilleExit
(
head_dir
);
imgUri
=
Uri
.
fromFile
(
new
File
(
head_dir
+
System
.
currentTimeMillis
()
+
"my_head1.jpg"
));
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
imgUri
);
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
PNG
.
toString
());
// return-data=true传递的为缩略图,小米手机默认传递大图,所以会导致onActivityResult调用失败
intent
.
putExtra
(
"return-data"
,
false
);
// 是否需要人脸识别
// intent.putExtra("noFaceDetection", false);
startActivityForResult
(
intent
,
21003
);
}
else
{
File
bigfile
=
new
File
(
head_path
);
imgUri
=
Uri
.
fromFile
(
bigfile
);
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
imgUri
);
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
PNG
.
toString
());
// return-data=true传递的为缩略图,小米手机默认传递大图,所以会导致onActivityResult调用失败
intent
.
putExtra
(
"return-data"
,
false
);
// 是否需要人脸识别
intent
.
putExtra
(
"noFaceDetection"
,
false
);
startActivityForResult
(
intent
,
21003
);
}
}
@SuppressLint
(
"CheckResult"
)
void
updateInfo
(
final
String
changType
,
final
String
value
)
{
showProgressDialog
(
"保存中..."
);
...
...
@@ -551,60 +348,6 @@ public class PersonalInfoActivity extends BaseActivity implements View.OnClickLi
}
/**
* 上传图片
*/
@SuppressLint
(
"CheckResult"
)
void
uploadImage
(
final
String
path
,
final
int
requestCode
)
{
UserHttp
userHttp
=
UserHttpImpl
.
Companion
.
getInstance
();
userHttp
.
uploadHead
(
new
HeadParam
(
new
File
(
path
)))
.
compose
(
RxUtils
.
resultData
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
o
->
{
Map
map
=
(
Map
)
o
;
String
head_url
=
(
String
)
map
.
get
(
"url"
);
userInfoData
.
setHead
(
head_url
);
// 跟新本地云信数据库信息
try
{
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
updateUserHead
(
userInfoData
.
getHead
());
}
catch
(
Exception
e
)
{}
UserResponseBean
.
UserInfo
userInfo
=
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
();
if
(
userInfo
!=
null
)
{
userInfo
.
setHead
(
head_url
);
}
UserChangeEvent
changeEvent
=
new
UserChangeEvent
(
true
);
EventBus
.
getDefault
().
post
(
changeEvent
);
EventBus
.
getDefault
().
post
(
userInfoData
);
if
(
head_url
!=
null
&&
!
""
.
equals
(
head_url
))
{
GlideApp
.
with
(
PersonalInfoActivity
.
this
)
.
load
(
userInfoData
.
getHead
())
.
override
(
100
,
100
)
.
transform
(
new
GlideCircleTransform
(
PersonalInfoActivity
.
this
))
.
error
(
R
.
drawable
.
platform_head_place_hold_pic
)
.
into
(
persion_head_iv
);
}
else
{
GlideApp
.
with
(
PersonalInfoActivity
.
this
)
.
load
(
R
.
drawable
.
platform_head_place_hold_pic
)
.
transform
(
new
GlideCircleTransform
(
PersonalInfoActivity
.
this
))
.
into
(
persion_head_iv
);
}
dismissProgressDialog
();
},
new
ThrowableConsumer
()
{
@Override
public
void
accept
(
@NotNull
String
msg
)
{
ToastHelper
.
Companion
.
show
(
msg
);
dismissProgressDialog
();
}
});
}
private
void
setCareer
(
int
select
)
{
switch
(
select
)
{
case
0
:
...
...
m-user/src/main/java/com/yidianling/user/ui/FillInfoActivity.java
deleted
100644 → 0
View file @
e94cf267
package
com
.
yidianling
.
user
.
ui
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.hardware.Camera
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.provider.MediaStore
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
com.luck.picture.lib.entity.LocalMedia
;
import
com.luck.picture.lib.listener.OnResultCallbackListener
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.ydl.webview.RefreshWebEvent
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
;
import
com.ydl.ydlcommon.utils.ActivityManager
;
import
com.ydl.ydlcommon.utils.log.LogHelper
;
import
com.ydl.ydlcommon.utils.remind.ToastHelper
;
import
com.ydl.ydlcommon.view.CircleImageView
;
import
com.ydl.ydlcommon.view.ListNoCancelDialog
;
import
com.ydl.ydlcommon.view.RoundCornerButton
;
import
com.ydl.ydlcommon.view.TitleBar
;
import
com.ydl.ydlcommon.view.dialog.CommonDialog
;
import
com.yidianling.common.tools.RxFileTool
;
import
com.yidianling.common.tools.RxImageTool
;
import
com.yidianling.user.LoginHelper
;
import
com.yidianling.user.R
;
import
com.yidianling.user.UserConstants
;
import
com.yidianling.user.UserHelper
;
import
com.yidianling.user.api.bean.UserResponseBean
;
import
com.yidianling.user.http.UserHttp
;
import
com.yidianling.user.http.UserHttpImpl
;
import
com.yidianling.user.http.request.HeadParam
;
import
com.yidianling.user.http.request.UserInfoParam
;
import
com.yidianling.user.route.UserIn
;
import
org.jetbrains.annotations.NotNull
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
de.greenrobot.event.EventBus
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
/**
* 完善信息
* Created by softrice on 15/12/9.
*/
public
class
FillInfoActivity
extends
BaseActivity
implements
View
.
OnClickListener
{
String
icon
;
String
name
;
String
sex
;
int
type
=
0
;
//0 normal 1 第三方登录模式
boolean
isSelected
;
//是否上传了头像
TitleBar
tb_title
;
CircleImageView
sdv_head
;
TextView
tv_sex
;
EditText
et_nick
;
RoundCornerButton
rcb_submit
;
String
head
=
""
;
private
int
finishNum
=
0
;
private
int
gender
=
-
1
;
String
path
;
private
Uri
imgUri
;
// FileUtils fileUtils;
private
String
head_dir
;
//目录
private
String
head_path
;
//路径
File
head_filec
;
private
RxPermissions
rxPermissions
;
private
boolean
isFromSplash
;
private
boolean
isRegisterFromRedPacket
;
@Override
protected
int
layoutResId
()
{
return
R
.
layout
.
user_activity_fill_info
;
}
@NotNull
@Override
public
StatusBarOptions
getStatusViewOptions
()
{
return
new
StatusBarOptions
(
true
,
true
);
}
@Override
protected
void
initDataAndEvent
()
{
tb_title
=
findViewById
(
R
.
id
.
tb_title
);
sdv_head
=
findViewById
(
R
.
id
.
sdv_head
);
tv_sex
=
findViewById
(
R
.
id
.
tv_sex
);
et_nick
=
findViewById
(
R
.
id
.
et_nick
);
rcb_submit
=
findViewById
(
R
.
id
.
rcb_submit
);
sdv_head
.
setOnClickListener
(
this
);
tv_sex
.
setOnClickListener
(
this
);
rcb_submit
.
setOnClickListener
(
this
);
icon
=
getIntent
().
getStringExtra
(
"icon"
);
name
=
getIntent
().
getStringExtra
(
"name"
);
sex
=
getIntent
().
getStringExtra
(
"sex"
);
type
=
getIntent
().
getIntExtra
(
"type"
,
0
);
isFromSplash
=
getIntent
().
getBooleanExtra
(
"isFromSplash"
,
false
);
isRegisterFromRedPacket
=
getIntent
().
getBooleanExtra
(
UserConstants
.
IS_REGISTER_FROM_PACKET
,
false
);
init
();
}
void
init
()
{
rxPermissions
=
new
RxPermissions
(
this
);
head_dir
=
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
()
+
"/yidianling/img/head_img/"
;
if
(!
TextUtils
.
isEmpty
(
icon
))
{
GlideApp
.
with
(
FillInfoActivity
.
this
)
.
load
(
icon
)
.
fitCenter
()
.
error
(
R
.
drawable
.
user_regist_photo
)
.
into
(
sdv_head
);
}
if
(!
TextUtils
.
isEmpty
(
name
))
{
et_nick
.
setText
(
name
);
}
if
(!
TextUtils
.
isEmpty
(
sex
))
{
if
(
sex
.
equals
(
"1"
))
{
tv_sex
.
setText
(
"男"
);
gender
=
1
;
}
else
{
tv_sex
.
setText
(
"女"
);
gender
=
2
;
}
}
tb_title
.
setOnLeftTextClick
((
view
,
isActive
)
->
{
showExitDialog
();
});
}
@Override
public
void
onBackPressed
()
{
showExitDialog
();
}
private
void
showExitDialog
()
{
CommonDialog
.
create
(
this
)
.
setTitle
(
"提示"
)
.
setMessage
(
"确定退出完善资料?"
)
.
setLeftOnclick
(
"退出"
,
(
view1
)
->
{
if
(
isFromSplash
)
{
UserIn
.
INSTANCE
.
mainIntent
(
this
);
ActivityManager
.
Companion
.
finishActivity
(
InputPhoneActivity
.
class
);
ActivityManager
.
Companion
.
finishActivity
(
LoginActivity
.
class
);
finish
();
}
else
if
(
isRegisterFromRedPacket
)
{
EventBus
.
getDefault
().
post
(
new
RefreshWebEvent
());
UserIn
.
INSTANCE
.
mainIntent
(
this
);
finish
();
}
else
{
EventBus
.
getDefault
().
post
(
new
RefreshWebEvent
());
ActivityManager
.
Companion
.
finishActivity
(
InputPhoneActivity
.
class
);
ActivityManager
.
Companion
.
finishActivity
(
LoginActivity
.
class
);
finish
();
}
ToastHelper
.
Companion
.
show
(
R
.
string
.
platform_register_success
);
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
"完善资料页退出"
);
})
.
setRightClick
(
"继续"
,
(
view1
->
{
}))
.
show
();
}
private
static
final
int
REQUEST_CODE_FILL_CAMER_HEAD
=
21012
;
private
static
final
int
IMAGE_PICKER
=
32001
;
@Override
public
void
onClick
(
View
v
)
{
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
sdv_head
)
{
YDLImagePicker
.
INSTANCE
.
startPicker
(
FillInfoActivity
.
this
,
new
OnResultCallbackListener
()
{
@Override
public
void
onResult
(
List
<
LocalMedia
>
list
)
{
if
(
list
.
isEmpty
())
{
return
;
}
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
uploadImage
(
list
.
get
(
0
).
getPath
(),
1002
);
}
}
@Override
public
void
onCancel
()
{
}
});
}
else
if
(
id
==
R
.
id
.
tv_sex
)
{
List
<
String
>
name
=
new
ArrayList
<
String
>();
name
.
add
(
"男"
);
name
.
add
(
"女"
);
ListNoCancelDialog
.
Builder
builders
=
new
ListNoCancelDialog
.
Builder
(
FillInfoActivity
.
this
,
name
,
0
);
builders
.
SetOnItemClickLister
(
new
ListNoCancelDialog
.
Builder
.
OnItemClickLister
()
{
@Override
public
void
onItemClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
switch
(
position
)
{
case
0
:
tv_sex
.
setText
(
"男"
);
gender
=
1
;
dialog
.
dismiss
();
break
;
case
1
:
tv_sex
.
setText
(
"女"
);
gender
=
2
;
dialog
.
dismiss
();
break
;
}
}
@Override
public
void
onItemLongClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
}
});
builders
.
create
().
show
();
}
else
if
(
id
==
R
.
id
.
rcb_submit
)
{
if
(
judge
())
{
setInfo
();
}
}
}
/**
* 调用系统拍照
*/
private
void
showCameraAction
(
int
type_code
,
String
file_path
)
{
File
file_dir
=
new
File
(
head_dir
);
if
(
file_dir
.
exists
())
{
RxFileTool
.
deleteFilesInDir
(
file_dir
);
}
file_dir
.
mkdirs
();
head_filec
=
new
File
(
file_path
);
final
Intent
intent
=
new
Intent
();
final
Intent
intent_camera
=
getPackageManager
()
.
getLaunchIntentForPackage
(
"com.android.camera"
);
if
(
intent_camera
!=
null
)
{
intent
.
setPackage
(
"com.android.camera"
);
}
intent
.
setAction
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
// 调用前置摄像头
intent
.
putExtra
(
"autofocus"
,
true
);
// 自动对焦
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
head_filec
));
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
());
startActivityForResult
(
intent
,
type_code
);
}
else
{
try
{
head_filec
.
createNewFile
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
Uri
uri
=
RxFileTool
.
getImageContentUri
(
FillInfoActivity
.
this
,
new
File
(
file_path
));
intent
.
putExtra
(
"android.intent.extras.CAMERA_FACING"
,
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
// 调用前置摄像头
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uri
);
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
JPEG
.
toString
());
intent
.
putExtra
(
"autofocus"
,
true
);
// 自动对焦
startActivityForResult
(
intent
,
type_code
);
}
}
private
void
setInfo
()
{
showProgressDialog
(
""
);
updateInfo
(
"gender"
,
gender
+
""
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(
LoginHelper
.
isRegister
)
{
UserIn
.
INSTANCE
.
setChattingAccountAll
();
}
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
if
(
LoginHelper
.
isRegister
)
{
UserIn
.
INSTANCE
.
setChattingAccountNone
();
}
}
private
void
updateInfo
(
String
changType
,
String
value
)
{
UserHttp
userHttp
=
UserHttpImpl
.
Companion
.
getInstance
();
userHttp
.
setUserInfo
(
new
UserInfoParam
(
changType
,
value
))
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RxUtils
.
resultData
())
.
flatMap
(
o
->{
return
userHttp
.
setUserInfo
(
new
UserInfoParam
(
"nickName"
,
et_nick
.
getText
().
toString
()))
.
compose
(
RxUtils
.
resultData
());
})
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doAfterTerminate
(
this
::
dismissProgressDialog
)
.
subscribe
(
o
->
{
UserResponseBean
userInfo
=
UserHelper
.
INSTANCE
.
getUserInfo
();
if
(
userInfo
!=
null
)
{
userInfo
.
getUserInfo
().
setHead
(
head
);
userInfo
.
getUserInfo
().
setGender
(
gender
);
userInfo
.
getUserInfo
().
setNick_name
(
et_nick
.
getText
().
toString
());
}
if
(
isFromSplash
)
{
UserIn
.
INSTANCE
.
mainIntent
(
this
);
ActivityManager
.
Companion
.
finishActivity
(
InputPhoneActivity
.
class
);
ActivityManager
.
Companion
.
finishActivity
(
LoginActivity
.
class
);
finish
();
}
else
if
(
isRegisterFromRedPacket
)
{
EventBus
.
getDefault
().
post
(
new
RefreshWebEvent
());
UserIn
.
INSTANCE
.
mainIntent
(
this
);
finish
();
}
else
{
EventBus
.
getDefault
().
post
(
new
RefreshWebEvent
());
ActivityManager
.
Companion
.
finishActivity
(
InputPhoneActivity
.
class
);
ActivityManager
.
Companion
.
finishActivity
(
LoginActivity
.
class
);
finish
();
}
ToastHelper
.
Companion
.
show
(
R
.
string
.
platform_register_success
);
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
"完善资料成功"
);
},
new
ThrowableConsumer
()
{
@Override
public
void
accept
(
@NotNull
String
msg
)
{
ToastHelper
.
Companion
.
show
(
msg
);
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
String
.
format
(
"完善资料失败%s"
,
msg
));
}
});
}
private
boolean
judge
()
{
if
(!
isSelected
&&
TextUtils
.
isEmpty
(
icon
))
{
ToastHelper
.
Companion
.
show
(
"选个头像吧"
);
return
false
;
}
if
(
gender
==
-
1
)
{
ToastHelper
.
Companion
.
show
(
"设置下性别哦"
);
return
false
;
}
if
(
TextUtils
.
isEmpty
(
et_nick
.
getText
().
toString
()))
{
ToastHelper
.
Companion
.
show
(
"大侠,请留个名"
);
return
false
;
}
if
(
TextUtils
.
isEmpty
(
et_nick
.
getText
().
toString
()))
{
ToastHelper
.
Companion
.
show
(
"昵称最多5个字哦"
);
return
false
;
}
return
true
;
}
private
static
final
int
REQUEST_CODE_CUT
=
21003
;
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
resultCode
==
RESULT_OK
)
{
switch
(
requestCode
)
{
case
REQUEST_CODE_FILL_CAMER_HEAD:
imgUri
=
null
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
if
(
head_filec
.
exists
())
{
startPhotoZoom
(
Uri
.
fromFile
(
head_filec
));
}
}
else
{
Uri
uri
=
RxFileTool
.
getImageContentUri
(
FillInfoActivity
.
this
,
head_filec
);
if
(
uri
!=
null
)
{
startPhotoZoom
(
uri
);
}
}
break
;
case
REQUEST_CODE_CUT:
if
(
imgUri
!=
null
)
{
String
path
=
RxFileTool
.
getPathFromUri
(
this
,
imgUri
);
Bitmap
bitmap
=
BitmapFactory
.
decodeFile
(
path
);
bitmap
=
RxImageTool
.
compressByQuality
(
bitmap
,
200
);
RxImageTool
.
save
(
bitmap
,
path
,
Bitmap
.
CompressFormat
.
PNG
);
File
out_file
=
new
File
(
path
);
uploadImage
(
out_file
.
getAbsolutePath
(),
1002
);
imgUri
=
null
;
}
break
;
}
}
}
/**
* 裁剪图片方法实现
*/
public
void
startPhotoZoom
(
Uri
uri
)
{
Intent
intent
=
new
Intent
(
"com.android.camera.action.CROP"
);
intent
.
setDataAndType
(
uri
,
"image/*"
);
// 设置裁剪
intent
.
putExtra
(
"crop"
,
"true"
);
// 图片拉伸,就不会出现黑框了
intent
.
putExtra
(
"scaleUpIfNeeded"
,
true
);
//宽高的比例
intent
.
putExtra
(
"aspectX"
,
1
);
intent
.
putExtra
(
"aspectY"
,
1
);
//裁剪图片宽高
intent
.
putExtra
(
"outputX"
,
200
);
intent
.
putExtra
(
"outputY"
,
200
);
if
(
imgUri
!=
null
)
{
// 输出路径
RxFileTool
.
isFileExists
(
head_dir
);
imgUri
=
Uri
.
fromFile
(
new
File
(
head_dir
+
System
.
currentTimeMillis
()
+
"my_head1.jpg"
));
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
imgUri
);
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
PNG
.
toString
());
// return-data=true传递的为缩略图,小米手机默认传递大图,所以会导致onActivityResult调用失败
intent
.
putExtra
(
"return-data"
,
false
);
// 是否需要人脸识别
// intent.putExtra("noFaceDetection", false);
startActivityForResult
(
intent
,
REQUEST_CODE_CUT
);
}
else
{
File
bigfile
=
new
File
(
head_path
);
imgUri
=
Uri
.
fromFile
(
bigfile
);
intent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
imgUri
);
intent
.
putExtra
(
"outputFormat"
,
Bitmap
.
CompressFormat
.
PNG
.
toString
());
// return-data=true传递的为缩略图,小米手机默认传递大图,所以会导致onActivityResult调用失败
intent
.
putExtra
(
"return-data"
,
false
);
// 是否需要人脸识别
intent
.
putExtra
(
"noFaceDetection"
,
false
);
startActivityForResult
(
intent
,
REQUEST_CODE_CUT
);
}
}
/**
* 上传图片
*/
void
uploadImage
(
final
String
path
,
final
int
requestCode
)
{
UserHttp
userHttp
=
UserHttpImpl
.
Companion
.
getInstance
();
File
outputFile
=
FileUtils
.
INSTANCE
.
getFileByUri
(
FillInfoActivity
.
this
,
path
);
userHttp
.
uploadHead
(
new
HeadParam
(
outputFile
))
.
compose
(
RxUtils
.
resultData
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnSubscribe
(
disposable
->
{
dismissProgressDialog
();
GlideApp
.
with
(
FillInfoActivity
.
this
).
load
(
R
.
drawable
.
user_loading2
).
into
(
sdv_head
);
})
.
subscribe
(
o
->
{
Map
map
=
(
Map
)
o
;
String
head_url
=
(
String
)
map
.
get
(
"url"
);
isSelected
=
true
;
GlideApp
.
with
(
FillInfoActivity
.
this
)
.
load
(
path
)
.
fitCenter
()
.
error
(
R
.
drawable
.
user_regist_photo
)
.
into
(
sdv_head
);
head
=
head_url
;
},
new
ThrowableConsumer
()
{
@Override
public
void
accept
(
@NotNull
String
msg
)
{
ToastHelper
.
Companion
.
show
(
msg
);
}
});
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
}
}
m-user/src/main/res/drawable-xhdpi/user_loading2.gif
deleted
100644 → 0
View file @
e94cf267
34.2 KB
m-user/src/main/res/drawable-xhdpi/user_regist_photo.png
deleted
100644 → 0
View file @
e94cf267
5.43 KB
m-user/src/main/res/drawable/bg_1da1f2_corner_8.xml
0 → 100644
View file @
e06a3bed
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"8dp"
/>
<solid
android:color=
"@color/color_1DA1F2"
/>
</shape>
\ No newline at end of file
m-user/src/main/res/drawable/bg_c3c4ca_corner_8.xml
0 → 100644
View file @
e06a3bed
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"8dp"
/>
<solid
android:color=
"@color/color_C3C4CA"
/>
</shape>
\ No newline at end of file
m-user/src/main/res/layout/activity_modify_avatar.xml
0 → 100644
View file @
e06a3bed
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"#E6000000"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<com.ydl.ydlcommon.view.TitleBar
android:id=
"@+id/tip_bar"
android:background=
"@color/color_2E2E30"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
app:pa_left_start_icon=
"@drawable/platform_common_back_un"
app:pa_title_text=
"头像"
app:pa_title_bar_text_color=
"@android:color/white"
app:pa_divide_visibility=
"false"
/>
<TextView
android:id=
"@id/tv_tip1"
app:layout_constraintBottom_toTopOf=
"@id/iv_avatar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"@color/color_C3C4CA"
android:gravity=
"center"
android:textSize=
"12sp"
tools:text=
"抱歉,七天内只能修改一次头像"
/>
<ImageView
android:id=
"@+id/iv_avatar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintDimensionRatio=
"1:1"
/>
<ImageView
android:id=
"@+id/iv_warn"
android:layout_width=
"12dp"
android:layout_height=
"12dp"
app:layout_constraintEnd_toStartOf=
"@id/tv_tip2"
app:layout_constraintTop_toTopOf=
"@id/tv_tip2"
android:layout_marginEnd=
"2dp"
android:layout_marginTop=
"2dp"
android:visibility=
"gone"
tools:visibility=
"visible"
android:src=
"@drawable/modify_warn"
/>
<TextView
android:id=
"@+id/tv_tip2"
android:layout_marginTop=
"12dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/iv_avatar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"12sp"
android:visibility=
"gone"
tools:visibility=
"visible"
android:gravity=
"center"
android:textColor=
"@color/color_C3C4CA"
tools:text=
"审核失败,该头像提交不规范,请修改后重新提交审核。\n如有疑问联系客服小壹"
/>
<TextView
android:id=
"@+id/tv_modify"
android:layout_width=
"333dp"
android:layout_height=
"54dp"
app:layout_constraintStart_toStartOf=
"parent"
android:layout_marginBottom=
"50dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:gravity=
"center"
android:textSize=
"18sp"
android:background=
"@drawable/bg_1da1f2_corner_8"
android:textColor=
"@android:color/white"
android:text=
"修改头像"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
m-user/src/main/res/layout/
user_mine_activity_set
_info.xml
→
m-user/src/main/res/layout/
activity_modify
_info.xml
View file @
e06a3bed
File moved
m-user/src/main/res/layout/user_activity_fill_info.xml
deleted
100644 → 0
View file @
e94cf267
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<com.ydl.ydlcommon.view.TitleBar
android:id=
"@+id/tb_title"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/title_bar_height"
app:pa_left_text=
"退出"
android:background=
"@color/platform_white"
app:pa_title_text=
"完善资料"
/>
<com.ydl.ydlcommon.view.CircleImageView
android:id=
"@+id/sdv_head"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_marginTop=
"30dp"
android:src=
"@drawable/user_regist_photo"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/user_divide_line_stroke_width"
android:layout_marginTop=
"36dp"
android:background=
"@color/platform_divide_color"
/>
<TextView
android:id=
"@+id/tv_sex"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/platform_white"
android:gravity=
"center"
android:hint=
"@string/platform_please_select_gender"
android:padding=
"@dimen/platform_default_dis_size_huge"
android:textColorHint=
"#777777"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/user_divide_line_stroke_width"
android:background=
"@color/platform_divide_color"
/>
<EditText
android:id=
"@+id/et_nick"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/platform_white"
android:gravity=
"center"
android:hint=
"@string/platform_nickname_hint"
android:maxLength=
"10"
android:padding=
"@dimen/platform_default_dis_size_huge"
android:singleLine=
"true"
android:textColorHint=
"#777777"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/user_divide_line_stroke_width"
android:background=
"@color/platform_divide_color"
/>
<com.ydl.ydlcommon.view.RoundCornerButton
android:id=
"@+id/rcb_submit"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/platform_default_dis_size_big"
android:layout_marginRight=
"@dimen/platform_default_dis_size_big"
android:layout_marginTop=
"@dimen/platform_default_dis_size_huge"
android:text=
"@string/platform_finish"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_default_text_size_big"
app:pa_round_btn_active_bg=
"@color/platform_white"
app:pa_round_btn_bg=
"@color/platform_main_theme"
app:pa_round_btn_radio_size=
"5dp"
/>
</LinearLayout>
m-user/src/main/res/layout/user_mine_activity_personal_des.xml
deleted
100644 → 0
View file @
e94cf267
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:background=
"#f5f5f5"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<RelativeLayout
android:id=
"@+id/rela_toolBar"
android:layout_width=
"match_parent"
android:background=
"@color/white"
android:layout_height=
"45dp"
>
<ImageView
android:id=
"@+id/image_back"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:paddingLeft=
"15dp"
android:paddingRight=
"20dp"
android:gravity=
"center_vertical"
android:src=
"@drawable/platform_common_back"
/>
<TextView
android:id=
"@+id/tv_center_title"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_centerHorizontal=
"true"
android:ellipsize=
"end"
android:gravity=
"center"
android:maxEms=
"12"
android:maxLines=
"1"
android:text=
"简介"
android:textColor=
"#555555"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/text_save"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
android:layout_alignParentRight=
"true"
android:paddingRight=
"20dp"
android:text=
"保存"
/>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/divide_line_stroke_width"
android:layout_alignParentBottom=
"true"
android:background=
"#EDEDED"
/>
</RelativeLayout>
<EditText
android:id=
"@+id/edit_des"
android:layout_width=
"match_parent"
android:layout_height=
"300dp"
android:gravity=
"start"
android:maxLength=
"150"
android:padding=
"10dp"
android:background=
"@color/white"
android:textColorHint=
"#cbd0d8"
android:hint=
"一句话介绍下自己"
/>
</LinearLayout>
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/FileUtils.java
View file @
e06a3bed
...
...
@@ -37,7 +37,7 @@ public class FileUtils {
/**
* sd卡的根目录
*/
private
static
String
mSdRootPath
=
Environment
.
getExternalStorageDirectory
().
getPath
();
private
static
final
String
mSdRootPath
=
Environment
.
getExternalStorageDirectory
().
getPath
();
/**
* 手机的缓存根目录
*/
...
...
@@ -47,12 +47,8 @@ public class FileUtils {
*/
private
final
static
String
FOLDER_NAME
=
"/yidianling"
;
private
static
Context
mContext
;
public
FileUtils
(
Context
context
)
{
mDataRootPath
=
context
.
getCacheDir
().
getPath
();
mContext
=
context
;
}
...
...
@@ -76,9 +72,9 @@ public class FileUtils {
mSdRootPath
:
mDataRootPath
;
}
public
File
S
aveBitmap
(
Bitmap
mBitmap
,
String
path
)
throws
IOException
{
public
static
File
s
aveBitmap
(
Bitmap
mBitmap
,
String
path
)
throws
IOException
{
File
file
;
isFil
l
eExit
(
path
);
isFileExit
(
path
);
File
f
=
new
File
(
path
);
try
{
f
.
createNewFile
();
...
...
@@ -99,7 +95,7 @@ public class FileUtils {
}
public
void
SaveBitmap
(
Bitmap
mBitmap
,
String
path
,
String
filen_name
)
throws
IOException
{
isFil
l
eExit
(
path
);
isFileExit
(
path
);
File
f
=
new
File
(
path
+
filen_name
);
try
{
f
.
createNewFile
();
...
...
@@ -173,13 +169,12 @@ public class FileUtils {
* @param path
* @return
*/
public
static
boolean
isFil
l
eExit
(
String
path
)
{
B
oolean
isexit
=
false
;
public
static
boolean
isFileExit
(
String
path
)
{
b
oolean
isexit
=
false
;
File
f
=
new
File
(
path
);
if
(
f
.
exists
())
{
isexit
=
true
;
}
else
{
isexit
=
false
;
if
(!
f
.
exists
())
{
try
{
f
.
mkdirs
();
...
...
@@ -195,7 +190,7 @@ public class FileUtils {
* 删除该目录下所有文件
* @param root
*/
public
void
deleteAllFiles
(
File
root
)
{
public
static
void
deleteAllFiles
(
File
root
)
{
File
files
[]
=
root
.
listFiles
();
if
(
files
!=
null
)
for
(
File
f
:
files
)
{
...
...
@@ -223,7 +218,7 @@ public class FileUtils {
* @param imageFile
* @return
*/
public
Uri
getImageContentUri
(
Context
context
,
File
imageFile
)
{
public
static
Uri
getImageContentUri
(
Context
context
,
File
imageFile
)
{
String
filePath
=
imageFile
.
getAbsolutePath
();
Cursor
cursor
=
context
.
getContentResolver
().
query
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
...
...
@@ -234,9 +229,11 @@ public class FileUtils {
if
(
cursor
!=
null
&&
cursor
.
moveToFirst
())
{
int
id
=
cursor
.
getInt
(
cursor
.
getColumnIndex
(
MediaStore
.
MediaColumns
.
_ID
));
cursor
.
close
();
Uri
baseUri
=
Uri
.
parse
(
"content://media/external/images/media"
);
return
Uri
.
withAppendedPath
(
baseUri
,
""
+
id
);
}
else
{
if
(
cursor
!=
null
)
cursor
.
close
();
if
(
imageFile
.
exists
())
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
MediaStore
.
Images
.
Media
.
DATA
,
filePath
);
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/view/ListNoCancelDialog.java
View file @
e06a3bed
...
...
@@ -63,15 +63,11 @@ public class ListNoCancelDialog extends Dialog {
return
this
;
}
public
ListNoCancelDialog
.
Builder
S
etOnItemClickLister
(
ListNoCancelDialog
.
Builder
.
OnItemClickLister
lister
)
{
public
ListNoCancelDialog
.
Builder
s
etOnItemClickLister
(
ListNoCancelDialog
.
Builder
.
OnItemClickLister
lister
)
{
this
.
mOnItemClickLister
=
lister
;
return
this
;
}
public
ListNoCancelDialog
create
()
{
LayoutInflater
inflater
=
(
LayoutInflater
)
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/view/TitleBar.java
View file @
e06a3bed
...
...
@@ -38,6 +38,8 @@ public class TitleBar extends RelativeLayout {
int
buttom_color
;
//左侧图标颜色
int
mLeftStartIconColor
;
//下划线是否可见
private
boolean
mDividerVisibility
;
//文字内容
String
mLeftText
,
mTitle
,
mRightText
;
...
...
@@ -196,26 +198,27 @@ public class TitleBar extends RelativeLayout {
void
initRoot
(
AttributeSet
attrs
,
int
defStyleAttr
)
{
final
TypedArray
a
=
getContext
().
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
Platform_
TitleBar
,
defStyleAttr
,
0
);
attrs
,
R
.
styleable
.
TitleBar
,
defStyleAttr
,
0
);
mLeftText
=
a
.
getString
(
R
.
styleable
.
Platform_
TitleBar_pa_left_text
);
mLeftStartIcon
=
a
.
getDrawable
(
R
.
styleable
.
Platform_
TitleBar_pa_left_start_icon
);
mLeftEndIcon
=
a
.
getDrawable
(
R
.
styleable
.
Platform_
TitleBar_pa_left_end_icon
);
mRight
=
a
.
getDrawable
(
R
.
styleable
.
Platform_
TitleBar_pa_right_iv
);
mLeftText
=
a
.
getString
(
R
.
styleable
.
TitleBar_pa_left_text
);
mLeftStartIcon
=
a
.
getDrawable
(
R
.
styleable
.
TitleBar_pa_left_start_icon
);
mLeftEndIcon
=
a
.
getDrawable
(
R
.
styleable
.
TitleBar_pa_left_end_icon
);
mRight
=
a
.
getDrawable
(
R
.
styleable
.
TitleBar_pa_right_iv
);
mTitle
=
a
.
getString
(
R
.
styleable
.
Platform_
TitleBar_pa_title_text
);
mTitle
=
a
.
getString
(
R
.
styleable
.
TitleBar_pa_title_text
);
mRightText
=
a
.
getString
(
R
.
styleable
.
Platform_
TitleBar_pa_right_text
);
mRightStartIcon
=
a
.
getDrawable
(
R
.
styleable
.
Platform_
TitleBar_pa_right_start_icon
);
mRightEndIcon
=
a
.
getDrawable
(
R
.
styleable
.
Platform_
TitleBar_pa_right_end_icon
);
mRightText
=
a
.
getString
(
R
.
styleable
.
TitleBar_pa_right_text
);
mRightStartIcon
=
a
.
getDrawable
(
R
.
styleable
.
TitleBar_pa_right_start_icon
);
mRightEndIcon
=
a
.
getDrawable
(
R
.
styleable
.
TitleBar_pa_right_end_icon
);
mTextColor
=
a
.
getColor
(
R
.
styleable
.
Platform_
TitleBar_pa_title_bar_text_color
,
0xff3c3c3c
);
mSideTextColor
=
a
.
getColor
(
R
.
styleable
.
Platform_
TitleBar_pa_side_text_color
,
0xff3c3c3c
);
mTextColor
=
a
.
getColor
(
R
.
styleable
.
TitleBar_pa_title_bar_text_color
,
0xff3c3c3c
);
mSideTextColor
=
a
.
getColor
(
R
.
styleable
.
TitleBar_pa_side_text_color
,
0xff3c3c3c
);
//底部线颜色
buttom_color
=
a
.
getColor
(
R
.
styleable
.
Platform_
TitleBar_pa_bm_line_color
,
getResources
().
getColor
(
R
.
color
.
platform_divide_color
));
buttom_color
=
a
.
getColor
(
R
.
styleable
.
TitleBar_pa_bm_line_color
,
getResources
().
getColor
(
R
.
color
.
platform_divide_color
));
//左侧图标颜色
mLeftStartIconColor
=
a
.
getColor
(
R
.
styleable
.
Platform_TitleBar_pa_left_start_icon_color
,
0xffffff
);
mLeftStartIconColor
=
a
.
getColor
(
R
.
styleable
.
TitleBar_pa_left_start_icon_color
,
0xffffff
);
mDividerVisibility
=
a
.
getBoolean
(
R
.
styleable
.
TitleBar_pa_divide_visibility
,
true
);
a
.
recycle
();
setGravity
(
Gravity
.
CENTER_VERTICAL
);
...
...
@@ -256,6 +259,7 @@ public class TitleBar extends RelativeLayout {
//底部线
iv_title_divide
.
setBackgroundColor
(
buttom_color
);
iv_title_divide
.
setVisibility
(
mDividerVisibility
?
View
.
VISIBLE
:
View
.
GONE
);
//设置点击事件
setupTextClick
();
...
...
ydl-platform/src/main/res/values/attrs.xml
View file @
e06a3bed
...
...
@@ -2,7 +2,7 @@
<resources>
<!--头部bar-->
<declare-styleable
name=
"
Platform_
TitleBar"
>
<declare-styleable
name=
"TitleBar"
>
<attr
name=
"pa_left_text"
/>
<attr
name=
"pa_left_start_icon"
format=
"reference"
/>
<attr
name=
"pa_left_end_icon"
format=
"reference"
/>
...
...
@@ -15,6 +15,7 @@
<attr
name=
"pa_bm_line_color"
format=
"color"
/>
<attr
name=
"pa_right_iv"
format=
"reference"
/>
<attr
name=
"pa_left_start_icon_color"
format=
"color"
/>
<attr
name=
"pa_divide_visibility"
format=
"boolean"
/>
</declare-styleable>
<attr
name=
"pa_left_text"
format=
"string"
/>
<attr
name=
"pa_right_text"
format=
"string"
/>
...
...
ydl-platform/src/main/res/values/colors.xml
View file @
e06a3bed
...
...
@@ -133,5 +133,7 @@
<color
name=
"color_242424"
>
#242424
</color>
<color
name=
"color_9d9ea7"
>
#9D9EA7
</color>
<color
name=
"color_C3C4CA"
>
#C3C4CA
</color>
<color
name=
"color_2E2E30"
>
#2E2E30
</color>
<color
name=
"color_191919"
>
#191919
</color>
</resources>
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