Commit e06a3bed by 王佳洋

1.修改昵称

2.修改简介
3.修改头像
parent e94cf267
......@@ -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.SetOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
builder.setOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
override fun onItemClick(dialog: Dialog, view: View, position1: Int) {
val tag = name[position1]
when (tag) {
......
......@@ -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" />
......
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
......@@ -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
......@@ -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>> {
......
......@@ -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
......
......@@ -63,7 +63,7 @@ class ChooseAccountActivity : BaseActivity() {
list.add("编辑")
list.add("删除")
val builder = ListNoCancelDialog.Builder(this, list, 0)
builder.SetOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
builder.setOnItemClickLister(object : ListNoCancelDialog.Builder.OnItemClickLister {
override fun onItemClick(dialog: Dialog?, view: View?, index: Int) {
val name = list[index]
when (name) {
......
......@@ -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
......@@ -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
......
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);
}
});
}
}
<?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
<?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
<?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
<?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>
<?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
......@@ -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 SaveBitmap(Bitmap mBitmap, String path) throws IOException {
public static File saveBitmap(Bitmap mBitmap, String path) throws IOException {
File file;
isFilleExit(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 {
isFilleExit(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 isFilleExit(String path) {
Boolean isexit = false;
public static boolean isFileExit(String path) {
boolean 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);
......
......@@ -63,15 +63,11 @@ public class ListNoCancelDialog extends Dialog {
return this;
}
public ListNoCancelDialog.Builder SetOnItemClickLister(ListNoCancelDialog.Builder.OnItemClickLister lister) {
public ListNoCancelDialog.Builder setOnItemClickLister(ListNoCancelDialog.Builder.OnItemClickLister lister) {
this.mOnItemClickLister = lister;
return this;
}
public ListNoCancelDialog create() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
......
......@@ -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();
......
......@@ -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" />
......
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment