add 新增消息设置
add 新增消息-语音设置 add 新增接单设置
@ -221,5 +221,8 @@ dependencies {
|
||||
//samsung插件包
|
||||
api project(':IAP6Helper')
|
||||
|
||||
//時間選擇器
|
||||
api 'com.contrarywind:Android-PickerView:4.1.9'
|
||||
|
||||
|
||||
}
|
||||
|
25
common/src/main/java/com/yunbao/common/bean/AvatarBean.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class AvatarBean extends BaseModel {
|
||||
private String avatar;
|
||||
private String avatarThumb;
|
||||
|
||||
public AvatarBean() {
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
public void setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
}
|
||||
}
|
101
common/src/main/java/com/yunbao/common/bean/MessageHiBean.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MessageHiBean extends BaseModel {
|
||||
public static final int TYPE_TEXT = 1;
|
||||
public static final int TYPE_IMAGE = 2;
|
||||
public static final int TYPE_AUDIO = 3;
|
||||
private int id;
|
||||
private int uid;
|
||||
private String content;
|
||||
private int duration;
|
||||
private String base64;
|
||||
private int type;
|
||||
private long createTime;
|
||||
private long updateTime;
|
||||
private int status;
|
||||
|
||||
// Getter方法
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public String getBase64() {
|
||||
return base64;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public long getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
// Setter方法
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void setBase64(String base64) {
|
||||
this.base64 = base64;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(long updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
// 转换时间戳为Date(可选)
|
||||
public Date getCreateTimeAsDate() {
|
||||
return new Date(createTime * 1000); // 假设时间戳是秒单位
|
||||
}
|
||||
|
||||
public Date getUpdateTimeAsDate() {
|
||||
return new Date(updateTime * 1000); // 假设时间戳是秒单位
|
||||
}
|
||||
}
|
@ -86,6 +86,12 @@ public class MessageUserInfoBean extends BaseModel{
|
||||
private String career;
|
||||
private String height;
|
||||
private String age;
|
||||
@SerializedName("open_off")
|
||||
private int openOff;//接单设置 1开启 2关闭
|
||||
|
||||
public int getOpenOff() {
|
||||
return openOff;
|
||||
}
|
||||
|
||||
public String getAge() {
|
||||
if(StringUtil.isEmpty(age)){
|
||||
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@ -45,6 +46,7 @@ import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.MessageChatIsAnchor;
|
||||
import com.yunbao.common.bean.MessageChatUserBean;
|
||||
import com.yunbao.common.bean.MessageHiBean;
|
||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
@ -81,10 +83,14 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.MultipartBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Part;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
@ -1169,17 +1175,68 @@ public interface PDLiveApi {
|
||||
|
||||
@GET("/api/public/?service=Pdluser.friend")
|
||||
Observable<ResponseModel<List<MessageChatUserBean>>> getPdluserFriend(@Query("p") int p);
|
||||
|
||||
@GET("/api/public/?service=Pdluser.follow")
|
||||
Observable<ResponseModel<List<MessageChatUserBean>>> getPdluserFollow(@Query("p") int p);
|
||||
|
||||
@GET("/api/public/?service=Pdluser.fans")
|
||||
Observable<ResponseModel<List<MessageChatUserBean>>> getPdluserFans(@Query("p") int p);
|
||||
|
||||
@GET("/api/public/?service=Pdluser.search")
|
||||
Observable<ResponseModel<List<MessageChatUserBean>>> addressBookSearch(@Query("user_nicename") String key);
|
||||
|
||||
@GET("/api/public/?service=Pdlinfos.getOtherInfo")
|
||||
Observable<ResponseModel<MessageUserInfoBean>> getOtherInfo(@Query("tuid") String tuid);
|
||||
|
||||
@GET("/api/public/?service=Userhome.getUserHomeBanner")
|
||||
Observable<ResponseModel<List<String>>> getUserHomeBanner(@Query("select_uid") String tuid);
|
||||
|
||||
@GET("/api/public/?service=Pdlinfos.getIsAnchor")
|
||||
Observable<ResponseModel<MessageChatIsAnchor>> getIsAnchor();
|
||||
|
||||
@GET("/api/public/?service=Pdlinfos.getText")
|
||||
Observable<ResponseModel<List<MessageHiBean>>> getHiConfig();
|
||||
|
||||
@POST("/api/public/?service=Pdlinfos.addText")
|
||||
Observable<ResponseModel<List<BaseModel>>> setHiConfig(
|
||||
@Body JSONObject content,
|
||||
@Query("uid")String uid,
|
||||
@Query("token")String token
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Pdlinfos.editText")
|
||||
Observable<ResponseModel<List<BaseModel>>> updateHiConfig(
|
||||
@Query("id") int id,
|
||||
@Query("content") String content,
|
||||
@Query("type") int type,
|
||||
@Query("duration") int duration,
|
||||
@Query("status") int status
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Pdlinfos.delText")
|
||||
Observable<ResponseModel<List<BaseModel>>> delHiConfig(
|
||||
@Query("id") int id
|
||||
);
|
||||
@Multipart
|
||||
@POST("/api/public/?service=Friendappinfos.updateAvatar")
|
||||
Observable<ResponseModel<AvatarBean>> updateFile(@Part MultipartBody.Part file, @Query("uid") String uid, @Query("token") String token);
|
||||
@Multipart
|
||||
@POST("/api/public/?service=Pdlinfos.updateMp3")
|
||||
Observable<ResponseModel<AvatarBean>> updateFileToMp3(@Part MultipartBody.Part file, @Query("uid") String uid, @Query("token") String token);
|
||||
@GET("/api/public/?service=Pdlinfos.setInfo")
|
||||
Observable<ResponseModel<List<BaseModel>>> initUserInfo(
|
||||
@Query("sex") int sex,
|
||||
@Query("user_nicename") String user_nicename,
|
||||
@Query("avatar") String avatar,
|
||||
@Query("birthday") String birthday
|
||||
);
|
||||
|
||||
/**
|
||||
* 接单设置
|
||||
* @param status 1开启 2关闭
|
||||
*/
|
||||
@GET("/api/public/?service=Pdlinfos.setOpenOff")
|
||||
Observable<ResponseModel<List<BaseModel>>> setOpenOff(
|
||||
@Query("open_off") int status
|
||||
);
|
||||
}
|
||||
|
@ -4,9 +4,12 @@ import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@ -28,6 +31,7 @@ import com.yunbao.common.bean.GiftNamingInfoModel;
|
||||
import com.yunbao.common.bean.GiftWallGiftDetail;
|
||||
import com.yunbao.common.bean.GiftWallModel;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.ListInfoMessageModel;
|
||||
@ -45,6 +49,7 @@ import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.MessageChatIsAnchor;
|
||||
import com.yunbao.common.bean.MessageChatUserBean;
|
||||
import com.yunbao.common.bean.MessageHiBean;
|
||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
@ -76,8 +81,10 @@ import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -87,6 +94,10 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
|
||||
/**
|
||||
@ -2934,6 +2945,7 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
public void getPdluserFriend(int p, HttpCallback<List<MessageChatUserBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPdluserFriend(p)
|
||||
@ -2953,6 +2965,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getPdluserFollow(int p, HttpCallback<List<MessageChatUserBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPdluserFollow(p)
|
||||
@ -2972,6 +2985,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getPdluserFans(int p, HttpCallback<List<MessageChatUserBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPdluserFans(p)
|
||||
@ -2991,6 +3005,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void addressBookSearch(String search, HttpCallback<List<MessageChatUserBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.addressBookSearch(search)
|
||||
@ -3010,6 +3025,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getOtherInfo(String touid, HttpCallback<MessageUserInfoBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getOtherInfo(touid)
|
||||
@ -3029,6 +3045,7 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getUserHomeBanner(String search, HttpCallback<List<String>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getUserHomeBanner(search)
|
||||
@ -3068,6 +3085,190 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getHiConfig(HttpCallback<List<MessageHiBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getHiConfig()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(roomMicStatusModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void setHiConfig(
|
||||
JSONObject content,
|
||||
HttpCallback<List<BaseModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setHiConfig(content, CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(roomMicStatusModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void updateHiConfig(
|
||||
int id,
|
||||
String content,
|
||||
int type,
|
||||
int duration,
|
||||
HttpCallback<List<BaseModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.updateHiConfig(id, content, type, duration, 1)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(roomMicStatusModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void delHiConfig(
|
||||
int id,
|
||||
HttpCallback<List<BaseModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.delHiConfig(id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(roomMicStatusModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void updateFile(File file, HttpCallback<AvatarBean> callback) {
|
||||
MultipartBody.Part uploadFile = createUploadFile(file);
|
||||
API.get().pdLiveApi(mContext)
|
||||
.updateFile(uploadFile, CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<AvatarBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<AvatarBean> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void updateFileToMp3(File file, HttpCallback<AvatarBean> callback) {
|
||||
MultipartBody.Part uploadFile = createUploadFile(file);
|
||||
API.get().pdLiveApi(mContext)
|
||||
.updateFileToMp3(uploadFile, CommonAppConfig.getInstance().getUid(), CommonAppConfig.getInstance().getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<AvatarBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<AvatarBean> model) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(model.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void initUserInfo(
|
||||
int sex,
|
||||
String user_nicename,
|
||||
String avatar,
|
||||
String birthday,
|
||||
HttpCallback<List<BaseModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.initUserInfo(sex, user_nicename, avatar, birthday)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(roomMicStatusModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void setOpenOff(
|
||||
int status,
|
||||
HttpCallback<List<BaseModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setOpenOff(status)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(roomMicStatusModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -1,16 +1,38 @@
|
||||
package com.yunbao.common.interfaces;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/29.
|
||||
*/
|
||||
|
||||
public interface ImageResultCallback {
|
||||
public abstract class ImageResultCallback {
|
||||
//跳转相机前执行
|
||||
void beforeCamera();
|
||||
|
||||
void onSuccess(File file);
|
||||
|
||||
void onFailure();
|
||||
public void beforeCamera() {
|
||||
}
|
||||
|
||||
public void onSuccess(File file) {
|
||||
}
|
||||
|
||||
public void onFailure() {
|
||||
}
|
||||
|
||||
public void onSuccessToUrl(File file, OnItemClickListener<String> listener) {
|
||||
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||
.updateFile(file, new com.yunbao.common.http.base.HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
listener.onItemClick(data.getAvatar(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
listener.onItemClick(null, -1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,7 @@ public class ViewUtils {
|
||||
public static <T extends View> T findViewById(View view,int id,Class<T> clazz){
|
||||
return view.findViewById(id);
|
||||
}
|
||||
public static <T extends View> T findViewById(View view,int id){
|
||||
return view.findViewById(id);
|
||||
}
|
||||
}
|
||||
|
BIN
common/src/main/res/drawable/bg_msg_more.9.png
Normal file
After Width: | Height: | Size: 932 B |
@ -164,6 +164,12 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".activity.MsgAddressBookActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".activity.MessageHiConfigActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".activity.MessageHiConfigRecordActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".activity.CompleteUserInfoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,240 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder;
|
||||
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
|
||||
import com.bigkoo.pickerview.view.TimePickerView;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.ViewUtils;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.dialog.UserAvatarPopup;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CompleteUserInfoActivity extends AbsActivity {
|
||||
ImageView avatar;
|
||||
View avatarChange;
|
||||
EditText userName;
|
||||
View man, woman, birthday;
|
||||
Button submit;
|
||||
ProcessImageUtil cameraUtil;
|
||||
private File mAvatarFile;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_user_info;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
super.main(savedInstanceState);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
year = calendar.get(Calendar.YEAR) - 18;
|
||||
month = calendar.get(Calendar.MONTH);
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
cameraUtil = new ProcessImageUtil(this);
|
||||
|
||||
initView();
|
||||
}
|
||||
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
|
||||
void initView() {
|
||||
avatar = findViewById(R.id.avatar);
|
||||
avatarChange = findViewById(R.id.btn_change);
|
||||
userName = findViewById(R.id.edit_text);
|
||||
man = findViewById(R.id.sex_man);
|
||||
woman = findViewById(R.id.sex_woman);
|
||||
birthday = findViewById(R.id.birthday);
|
||||
submit = findViewById(R.id.submit);
|
||||
|
||||
initSexView();
|
||||
initBirthdayView();
|
||||
initAvatarView();
|
||||
submit.setOnClickListener(view -> {
|
||||
if (avatar.getTag() == null) {
|
||||
ToastUtil.show("請選擇頭像");
|
||||
return;
|
||||
}
|
||||
if (StringUtil.isEmpty(userName.getText().toString())) {
|
||||
ToastUtil.show("請輸入用戶名");
|
||||
return;
|
||||
}
|
||||
if (man.getTag() == null && woman.getTag() == null) {
|
||||
ToastUtil.show("請選擇性別");
|
||||
return;
|
||||
}
|
||||
|
||||
LiveNetManager.get(mContext)
|
||||
.initUserInfo(
|
||||
man.getTag() != null ? 1 : 2,
|
||||
userName.getText().toString(),
|
||||
(String) avatar.getTag(),
|
||||
year + "-" + (month + 1) + "-" + day,
|
||||
new HttpCallback<List<BaseModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<BaseModel> data) {
|
||||
ToastUtil.show("註冊成功");
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private void initBirthdayView() {
|
||||
ViewUtils.findViewById(birthday, R.id.audio_text, TextView.class).setText(String.format(Locale.getDefault(), "%d %s %d %s %d %s",
|
||||
year,
|
||||
WordUtil.getNewString(R.string.year),
|
||||
month + 1,
|
||||
WordUtil.getNewString(R.string.month),
|
||||
day,
|
||||
WordUtil.getNewString(R.string.day)));
|
||||
birthday.setOnClickListener(view -> {
|
||||
Calendar selectedDate = Calendar.getInstance();
|
||||
selectedDate.set(year, month, day);
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
startCalendar.set(1990, 1, 1);
|
||||
endCalendar.setTime(new Date());
|
||||
TimePickerView pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() {
|
||||
@Override
|
||||
public void onTimeSelect(Date date, View v) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
|
||||
year = calendar.get(Calendar.YEAR);
|
||||
month = calendar.get(Calendar.MONTH);
|
||||
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
ViewUtils.findViewById(birthday, R.id.audio_text, TextView.class).setText(String.format(Locale.getDefault(), "%d %s %d %s %d %s",
|
||||
year,
|
||||
WordUtil.getNewString(R.string.year),
|
||||
month + 1,
|
||||
WordUtil.getNewString(R.string.month),
|
||||
day,
|
||||
WordUtil.getNewString(R.string.day)
|
||||
));
|
||||
}
|
||||
}).setRangDate(startCalendar, endCalendar).setCancelText(WordUtil.getNewString(R.string.activity_reg_user_info_birthday_title))
|
||||
.setSubmitColor(Color.parseColor("#A279E4"))
|
||||
.setSubmitText(WordUtil.getNewString(R.string.complete))
|
||||
.setContentTextSize(20)
|
||||
.setDate(selectedDate)
|
||||
.build();
|
||||
pvTime.show();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Dialog loading;
|
||||
|
||||
private void initAvatarView() {
|
||||
ImgLoader.display(this, "https://downs.yaoulive.com/defaultblue.jpg", avatar);
|
||||
avatar.setTag("https://downs.yaoulive.com/defaultblue.jpg");
|
||||
avatarChange.setOnClickListener(view -> {
|
||||
UserAvatarPopup userAvatarPopup = new UserAvatarPopup(this, userAvatar1 -> {
|
||||
avatar.setTag(userAvatar1);
|
||||
ImgLoader.display(this, userAvatar1, avatar);
|
||||
//txtChoose.setVisibility(View.GONE);
|
||||
}, isCamera -> {
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera();
|
||||
} else {
|
||||
cameraUtil.getImageByAlumb();
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(mContext).asCustom(userAvatarPopup).show();
|
||||
|
||||
});
|
||||
cameraUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
loading = DialogUitl.loadingDialog(mContext);
|
||||
loading.show();
|
||||
L.e("cameraUtil.setImageResultCallback:");
|
||||
onSuccessToUrl(file, new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
avatar.setTag(bean);
|
||||
loading.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void initSexView() {
|
||||
ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select);
|
||||
ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF")));
|
||||
ViewUtils.findViewById(man, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF")));
|
||||
ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_unselect);
|
||||
ViewUtils.findViewById(woman, R.id.sex_icon, ImageView.class).setImageResource(R.mipmap.ic_woman);
|
||||
ViewUtils.findViewById(woman, R.id.sex_top_icon, ImageView.class).setImageResource(R.mipmap.ic_woman_avatar);
|
||||
ViewUtils.findViewById(woman, R.id.sex_text, TextView.class).setText(R.string.activity_reg_user_info_sex_woman);
|
||||
ViewUtils.findViewById(woman, R.id.sex_text, TextView.class).setTextColor(Color.parseColor("#333333"));
|
||||
ViewUtils.findViewById(man, R.id.sex_text, TextView.class).setTextColor(Color.parseColor("#00A3FF"));
|
||||
man.setTag("man");
|
||||
woman.setTag(null);
|
||||
man.setOnClickListener(view -> {
|
||||
ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select);
|
||||
ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_unselect);
|
||||
ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF")));
|
||||
ViewUtils.findViewById(man, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF")));
|
||||
ViewUtils.findViewById(woman, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#333333")));
|
||||
ViewUtils.findViewById(woman, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#333333")));
|
||||
ViewUtils.findViewById(woman, R.id.sex_text, TextView.class).setTextColor(Color.parseColor("#333333"));
|
||||
ViewUtils.findViewById(man, R.id.sex_text, TextView.class).setTextColor(Color.parseColor("#00A3FF"));
|
||||
man.setTag("man");
|
||||
woman.setTag(null);
|
||||
});
|
||||
woman.setOnClickListener(view -> {
|
||||
ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select);
|
||||
ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_unselect);
|
||||
ViewUtils.findViewById(woman, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#FF4874")));
|
||||
ViewUtils.findViewById(woman, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#FF4874")));
|
||||
ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#333333")));
|
||||
ViewUtils.findViewById(man, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#333333")));
|
||||
ViewUtils.findViewById(man, R.id.sex_text, TextView.class).setTextColor(Color.parseColor("#333333"));
|
||||
ViewUtils.findViewById(woman, R.id.sex_text, TextView.class).setTextColor(Color.parseColor("#FF4874"));
|
||||
man.setTag(null);
|
||||
woman.setTag("man");
|
||||
});
|
||||
}
|
||||
}
|
@ -119,6 +119,7 @@ import com.yunbao.main.http.MainHttpUtil;
|
||||
import com.yunbao.main.interfaces.MainAppBarLayoutListener;
|
||||
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
|
||||
import com.yunbao.main.utils.GenerateTestUserSig;
|
||||
import com.yunbao.main.utils.UserInfoManager;
|
||||
import com.yunbao.main.views.FloatBannerView;
|
||||
import com.yunbao.main.views.MainHomeCommunityViewHolder;
|
||||
import com.yunbao.main.views.MainHomeLiveViewHolder;
|
||||
@ -220,6 +221,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
ActivityCompat.postponeEnterTransition(this);
|
||||
ConversationIMListManager.get(this);
|
||||
OpenAdManager.getInstance();
|
||||
UserInfoManager.updateMyInfo(this, null);
|
||||
//在请求一下这个接口给我后台版本号
|
||||
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
|
||||
@Override
|
||||
|
@ -0,0 +1,424 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.CacheMemoryUtils;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.MessageHiBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.ViewUtils;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MessageHiConfigActivity extends AbsActivity {
|
||||
View text1, text2, text3;
|
||||
View audio1, audio2, audio3;
|
||||
View image1, image2, image3;
|
||||
ProcessImageUtil imageUtil;
|
||||
|
||||
MessageHiBean[] audios = new MessageHiBean[3];
|
||||
MessageHiBean[] texts = new MessageHiBean[3];
|
||||
MessageHiBean[] images = new MessageHiBean[3];
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_message_hi_config;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
super.main(savedInstanceState);
|
||||
imageUtil = new ProcessImageUtil(this);
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
String cache = CacheMemoryUtils.getInstance().get(MessageHiConfigRecordActivity.RECORD_CACHE_URL);
|
||||
if (StringUtil.isEmpty(cache)) {
|
||||
return;
|
||||
}
|
||||
if (audio1.getTag() == null) {
|
||||
toAudio(audio1);
|
||||
} else if (audio2.getTag() == null) {
|
||||
toAudio(audio2);
|
||||
} else if (audio3.getTag() == null) {
|
||||
toAudio(audio3);
|
||||
}
|
||||
}
|
||||
|
||||
private void toAudio(View audio) {
|
||||
MessageHiBean bean = new MessageHiBean();
|
||||
bean.setContent(CacheMemoryUtils.getInstance().get(MessageHiConfigRecordActivity.RECORD_CACHE_URL));
|
||||
bean.setDuration(CacheMemoryUtils.getInstance().get(MessageHiConfigRecordActivity.RECORD_CACHE_TIME));
|
||||
bean.setType(MessageHiBean.TYPE_AUDIO);
|
||||
CacheMemoryUtils.getInstance().remove(MessageHiConfigRecordActivity.RECORD_CACHE_URL);
|
||||
CacheMemoryUtils.getInstance().remove(MessageHiConfigRecordActivity.RECORD_CACHE_TIME);
|
||||
audio.setTag(bean);
|
||||
setAudio(audio);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
text1 = findViewById(R.id.text_1);
|
||||
text2 = findViewById(R.id.text_2);
|
||||
text3 = findViewById(R.id.text_3);
|
||||
audio1 = findViewById(R.id.audio_1);
|
||||
audio2 = findViewById(R.id.audio_2);
|
||||
audio3 = findViewById(R.id.audio_3);
|
||||
image1 = findViewById(R.id.image_1);
|
||||
image2 = findViewById(R.id.image_2);
|
||||
image3 = findViewById(R.id.image_3);
|
||||
|
||||
findViewById(R.id.rootView).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
text1.clearFocus();
|
||||
text2.clearFocus();
|
||||
text3.clearFocus();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btn_save).setOnClickListener(view -> {
|
||||
List<MessageHiBean> list = new ArrayList<>();
|
||||
|
||||
text1.clearFocus();
|
||||
text2.clearFocus();
|
||||
text3.clearFocus();
|
||||
|
||||
boolean audioReady = false;
|
||||
boolean textReady = false;
|
||||
boolean imageReady = false;
|
||||
|
||||
if (audio1.getTag() != null) {
|
||||
list.add((MessageHiBean) audio1.getTag());
|
||||
audioReady = true;
|
||||
}
|
||||
if (audio2.getTag() != null) {
|
||||
list.add((MessageHiBean) audio2.getTag());
|
||||
audioReady = true;
|
||||
}
|
||||
if (audio3.getTag() != null) {
|
||||
list.add((MessageHiBean) audio3.getTag());
|
||||
audioReady = true;
|
||||
}
|
||||
if (text1.getTag() != null) {
|
||||
list.add((MessageHiBean) text1.getTag());
|
||||
textReady = true;
|
||||
}
|
||||
if (text2.getTag() != null) {
|
||||
list.add((MessageHiBean) text2.getTag());
|
||||
textReady = true;
|
||||
}
|
||||
if (text3.getTag() != null) {
|
||||
list.add((MessageHiBean) text3.getTag());
|
||||
textReady = true;
|
||||
}
|
||||
if (image1.getTag() != null) {
|
||||
list.add((MessageHiBean) image1.getTag());
|
||||
imageReady = true;
|
||||
}
|
||||
if (image2.getTag() != null) {
|
||||
list.add((MessageHiBean) image2.getTag());
|
||||
imageReady = true;
|
||||
}
|
||||
if (image3.getTag() != null) {
|
||||
list.add((MessageHiBean) image3.getTag());
|
||||
imageReady = true;
|
||||
}
|
||||
if (!audioReady) {
|
||||
ToastUtil.show(R.string.dialog_msg_hi_config_audio_refuse_save_audio);
|
||||
return;
|
||||
}
|
||||
if (!textReady) {
|
||||
ToastUtil.show(R.string.dialog_msg_hi_config_audio_refuse_save_text);
|
||||
return;
|
||||
}
|
||||
if (!imageReady) {
|
||||
ToastUtil.show(R.string.dialog_msg_hi_config_audio_refuse_save_image);
|
||||
return;
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("content", list);
|
||||
System.out.println(">>>>> " + json);
|
||||
LiveNetManager.get(mContext)
|
||||
.setHiConfig(json, new HttpCallback<List<BaseModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<BaseModel> data) {
|
||||
MessageHiConfigActivity.this.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void updateUi() {
|
||||
//bg_msg_list_item
|
||||
if (audios[0] != null) {
|
||||
audio1.setTag(audios[0]);
|
||||
}
|
||||
if (audios[1] != null) {
|
||||
audio2.setTag(audios[1]);
|
||||
}
|
||||
if (audios[2] != null) {
|
||||
audio3.setTag(audios[2]);
|
||||
}
|
||||
if (texts[0] != null) {
|
||||
text1.setTag(texts[0]);
|
||||
}
|
||||
if (texts[1] != null) {
|
||||
text2.setTag(texts[1]);
|
||||
}
|
||||
if (texts[2] != null) {
|
||||
text3.setTag(texts[2]);
|
||||
}
|
||||
if (images[0] != null) {
|
||||
image1.setTag(images[0]);
|
||||
}
|
||||
if (images[1] != null) {
|
||||
image2.setTag(images[1]);
|
||||
}
|
||||
if (images[2] != null) {
|
||||
image3.setTag(images[2]);
|
||||
}
|
||||
setAudio(audio1);
|
||||
setAudio(audio2);
|
||||
setAudio(audio3);
|
||||
setText(text1);
|
||||
setText(text2);
|
||||
setText(text3);
|
||||
setImage(image1);
|
||||
setImage(image2);
|
||||
setImage(image3);
|
||||
|
||||
}
|
||||
|
||||
private void setAudio(View view) {
|
||||
MessageHiBean bean = (MessageHiBean) view.getTag();
|
||||
if (bean == null) {
|
||||
ViewUtils.findViewById(view, R.id.audio_text, TextView.class).setText(R.string.dialog_msg_hi_config_record);
|
||||
ViewUtils.findViewById(view, R.id.audio_play).setVisibility(View.GONE);
|
||||
ViewUtils.findViewById(view, R.id.audio_del).setVisibility(View.GONE);
|
||||
ViewUtils.findViewById(view, R.id.audio_image, ImageView.class).setImageResource(R.mipmap.ic_message_hi_config_record);
|
||||
view.setBackgroundResource(R.drawable.dialog_bg_msg_hi_config_unselect);
|
||||
view.setOnClickListener(v -> {
|
||||
mContext.startActivity(new Intent(mContext, MessageHiConfigRecordActivity.class));
|
||||
});
|
||||
return;
|
||||
}
|
||||
ViewUtils.findViewById(view, R.id.audio_text, TextView.class).setText(bean.getDuration() + "s");
|
||||
ViewUtils.findViewById(view, R.id.audio_image, ImageView.class).setImageResource(R.mipmap.ic_message_hi_config_audio);
|
||||
ViewUtils.findViewById(view, R.id.audio_play).setVisibility(View.VISIBLE);
|
||||
ViewUtils.findViewById(view, R.id.audio_del).setVisibility(View.VISIBLE);
|
||||
view.setBackgroundResource(R.drawable.dialog_bg_chat_status_config);
|
||||
ViewUtils.findViewById(view, R.id.audio_play).setOnClickListener(v -> {
|
||||
play(bean.getContent());
|
||||
});
|
||||
ViewUtils.findViewById(view, R.id.audio_del).setOnClickListener(v -> {
|
||||
view.setTag(null);
|
||||
setAudio(view);
|
||||
});
|
||||
view.setOnClickListener(v -> {
|
||||
play(bean.getContent());
|
||||
});
|
||||
}
|
||||
|
||||
private void setText(View view) {
|
||||
setText(view, null, false);
|
||||
}
|
||||
|
||||
private void setText(View view, String defText, boolean isFocusable) {
|
||||
MessageHiBean bean = (MessageHiBean) view.getTag();
|
||||
if (bean == null) {
|
||||
ViewUtils.findViewById(view, R.id.edit_text, EditText.class).setEnabled(true);
|
||||
ViewUtils.findViewById(view, R.id.edit_edit).setVisibility(View.GONE);
|
||||
ViewUtils.findViewById(view, R.id.edit_del).setVisibility(View.GONE);
|
||||
view.setBackgroundResource(R.drawable.dialog_bg_msg_hi_config_unselect);
|
||||
ViewUtils.findViewById(view, R.id.edit_text, EditText.class).setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean b) {
|
||||
View parent = (View) view.getParent();
|
||||
if (b) {
|
||||
parent.setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select);
|
||||
} else {
|
||||
parent.setBackgroundResource(R.drawable.dialog_bg_msg_hi_config_unselect);
|
||||
String string = ((EditText) view).getText().toString();
|
||||
if (!StringUtil.isEmpty(string)) {
|
||||
MessageHiBean hi = new MessageHiBean();
|
||||
hi.setType(MessageHiBean.TYPE_TEXT);
|
||||
hi.setContent(string);
|
||||
((View) view.getParent()).setTag(hi);
|
||||
setText((View) view.getParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (isFocusable) {
|
||||
ViewUtils.findViewById(view, R.id.edit_text, EditText.class).requestFocus();
|
||||
}
|
||||
if (StringUtil.isEmpty(defText)) {
|
||||
ViewUtils.findViewById(view, R.id.edit_text, EditText.class).setText(defText);
|
||||
}
|
||||
return;
|
||||
}
|
||||
ViewUtils.findViewById(view, R.id.edit_text, EditText.class).setText(bean.getContent());
|
||||
ViewUtils.findViewById(view, R.id.edit_text, EditText.class).setEnabled(false);
|
||||
view.setBackgroundResource(R.drawable.bg_msg_list_item);
|
||||
ViewUtils.findViewById(view, R.id.edit_edit).setVisibility(View.VISIBLE);
|
||||
ViewUtils.findViewById(view, R.id.edit_del).setVisibility(View.VISIBLE);
|
||||
ViewUtils.findViewById(view, R.id.edit_edit).setOnClickListener(v -> {
|
||||
View parent = (View) v.getParent();
|
||||
ViewUtils.findViewById(parent, R.id.edit_text, EditText.class).setText("");
|
||||
parent.setTag(null);
|
||||
setText(parent, ((EditText) v).getText().toString(), true);
|
||||
});
|
||||
ViewUtils.findViewById(view, R.id.edit_del).setOnClickListener(v -> {
|
||||
View parent = (View) v.getParent();
|
||||
ViewUtils.findViewById(parent, R.id.edit_text, EditText.class).setText("");
|
||||
parent.setTag(null);
|
||||
setText(parent);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setImage(View view) {
|
||||
MessageHiBean bean = (MessageHiBean) view.getTag();
|
||||
if (bean == null) {
|
||||
ViewUtils.findViewById(view, R.id.img_img, ImageView.class).setImageResource(R.mipmap.ic_message_hi_config_image_add);
|
||||
view.setOnClickListener(v -> {
|
||||
uploadImage(view);
|
||||
});
|
||||
return;
|
||||
}
|
||||
ImgLoader.display(mContext, bean.getContent(), ViewUtils.findViewById(view, R.id.img_img, ImageView.class));
|
||||
ViewUtils.findViewById(view, R.id.img_close).setVisibility(View.VISIBLE);
|
||||
|
||||
ViewUtils.findViewById(view, R.id.img_close).setOnClickListener(v -> {
|
||||
view.setTag(null);
|
||||
setImage(view);
|
||||
});
|
||||
view.setOnClickListener(v -> {
|
||||
});
|
||||
}
|
||||
|
||||
Dialog loading;
|
||||
|
||||
private void uploadImage(View view) {
|
||||
imageUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
onSuccessToUrl(file, new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String url, int position) {
|
||||
if (position == -1) {
|
||||
loading.dismiss();
|
||||
ToastUtil.show("连接超时");
|
||||
return;
|
||||
}
|
||||
loading.dismiss();
|
||||
MessageHiBean item = new MessageHiBean();
|
||||
item.setContent(url);
|
||||
item.setType(MessageHiBean.TYPE_IMAGE);
|
||||
item.setStatus(1);
|
||||
view.setTag(item);
|
||||
setImage(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
super.onFailure();
|
||||
if(loading!=null){
|
||||
loading.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
imageUtil.getImageByAlumb();
|
||||
loading = DialogUitl.loadingDialog(mContext);
|
||||
loading.show();
|
||||
}
|
||||
|
||||
private void play(String url) {
|
||||
try {
|
||||
MediaPlayer mediaPlayer = new MediaPlayer();
|
||||
mediaPlayer.setAudioAttributes(
|
||||
new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.build()
|
||||
);
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mediaPlayer) {
|
||||
mediaPlayer.release();
|
||||
}
|
||||
});
|
||||
mediaPlayer.setDataSource(url);
|
||||
mediaPlayer.prepare(); // might take long! (for buffering, etc)
|
||||
mediaPlayer.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getHiConfig(new HttpCallback<List<MessageHiBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<MessageHiBean> data) {
|
||||
int textLength = 0;
|
||||
int audioLength = 0;
|
||||
int imageLength = 0;
|
||||
for (MessageHiBean bean : data) {
|
||||
if (bean.getType() == MessageHiBean.TYPE_TEXT) {
|
||||
texts[textLength++] = bean;
|
||||
} else if (bean.getType() == MessageHiBean.TYPE_IMAGE) {
|
||||
images[imageLength++] = bean;
|
||||
} else if (bean.getType() == MessageHiBean.TYPE_AUDIO) {
|
||||
audios[audioLength++] = bean;
|
||||
}
|
||||
}
|
||||
updateUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,224 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.CacheMemoryUtils;
|
||||
import com.blankj.utilcode.util.PermissionUtils;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.utils.AudioRecordManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.rong.imkit.manager.AudioPlayManager;
|
||||
import io.rong.imkit.utils.PermissionCheckUtil;
|
||||
|
||||
public class MessageHiConfigRecordActivity extends AbsActivity {
|
||||
public static final String RECORD_CACHE_URL = "cache_hi_config_record_url";
|
||||
public static final String RECORD_CACHE_TIME = "cache_hi_config_record_time";
|
||||
View imgRecording;
|
||||
Button resetBtn, saveBtn, recordBtn;
|
||||
TextView timerText, tipsText;
|
||||
private float mLastTouchY;
|
||||
private long smStartRecTime;
|
||||
|
||||
private boolean mUpDirection;
|
||||
private boolean isAudio;
|
||||
private boolean isDownload = false;
|
||||
private File recordFile;
|
||||
private int recordTime;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_hi_config_record;
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
super.main(savedInstanceState);
|
||||
imgRecording = findViewById(R.id.img_recording);
|
||||
resetBtn = findViewById(R.id.btn_reset);
|
||||
saveBtn = findViewById(R.id.btn_save);
|
||||
recordBtn = findViewById(R.id.btn_record);
|
||||
timerText = findViewById(R.id.timer);
|
||||
tipsText = findViewById(R.id.text_tips_long);
|
||||
|
||||
recordBtn.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
System.out.println("点击事件:" + event.getAction() + " isAudio = " + isAudio);
|
||||
float mOffsetLimit = 70.0F * v.getContext().getResources().getDisplayMetrics().density;
|
||||
String[] permissions = new String[]{Manifest.permission.RECORD_AUDIO};
|
||||
if (!PermissionCheckUtil.checkPermissions(v.getContext(), permissions) && event.getAction() == 0) {
|
||||
PermissionCheckUtil.requestPermissions(mContext, permissions, 100);
|
||||
PermissionUtils.permission(Manifest.permission.RECORD_AUDIO).request();
|
||||
System.out.println("点击事件 没权限掉了");
|
||||
return true;
|
||||
} else {
|
||||
isDownload = true;
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
isAudio = true;
|
||||
System.out.println("点击事件:点下 isAudio = " + isAudio);
|
||||
if (isAudio) {
|
||||
if (onDown(v, event.getY())) {
|
||||
System.out.println("点击事件:内部点击,返回掉了");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
System.out.println("点击事件,准备进token");
|
||||
}
|
||||
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
if (isAudio) {
|
||||
onMove(v, event, mOffsetLimit);
|
||||
}
|
||||
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
isDownload = false;
|
||||
if (isAudio) {
|
||||
onUp(v, event);
|
||||
}
|
||||
}
|
||||
if (isAudio) {
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
resetBtn.setOnClickListener(view -> {
|
||||
recordFile = null;
|
||||
recordTime = 0;
|
||||
resetBtn.setVisibility(View.GONE);
|
||||
saveBtn.setVisibility(View.GONE);
|
||||
tipsText.setText(R.string.dialog_msg_hi_config_audio_btn);
|
||||
timerText.setText("");
|
||||
timerText.setVisibility(View.GONE);
|
||||
});
|
||||
saveBtn.setOnClickListener(view -> {
|
||||
Dialog loading = DialogUitl.loadingDialog(mContext);
|
||||
loading.show();
|
||||
LiveNetManager.get(mContext)
|
||||
.updateFileToMp3(recordFile, new HttpCallback<AvatarBean>() {
|
||||
@Override
|
||||
public void onSuccess(AvatarBean data) {
|
||||
CacheMemoryUtils.getInstance().put(RECORD_CACHE_URL, data.getAvatar());
|
||||
CacheMemoryUtils.getInstance().put(RECORD_CACHE_TIME, recordTime);
|
||||
loading.dismiss();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
loading.dismiss();
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private boolean onDown(View v, float mLastTouchY) {
|
||||
System.out.println("点击事件 mLastTouchY = " + mLastTouchY);
|
||||
|
||||
if (saveBtn.getVisibility() == View.VISIBLE) {
|
||||
play(recordFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (AudioPlayManager.getInstance().isPlaying()) {
|
||||
AudioPlayManager.getInstance().stopPlay();
|
||||
}
|
||||
|
||||
|
||||
MessageHiConfigRecordActivity.this.mLastTouchY = mLastTouchY;
|
||||
MessageHiConfigRecordActivity.this.mUpDirection = false;
|
||||
smStartRecTime = SystemClock.elapsedRealtime();
|
||||
resetBtn.setVisibility(View.GONE);
|
||||
saveBtn.setVisibility(View.GONE);
|
||||
AudioRecordManager.getInstance().startRecord(v.getRootView(), new AudioRecordManager.IAudioRecordStateChangeListener() {
|
||||
@Override
|
||||
public void onTimer(int timer) {
|
||||
System.out.println("------------》时间 " + timer);
|
||||
timerText.setText(timer + "s");
|
||||
timerText.setVisibility(View.VISIBLE);
|
||||
if (timer >= 5) {
|
||||
AudioRecordManager.getInstance().stopRecord();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDone(File file, int timer) {
|
||||
recordFile = file;
|
||||
recordTime = timer;
|
||||
resetBtn.setVisibility(View.VISIBLE);
|
||||
saveBtn.setVisibility(View.VISIBLE);
|
||||
tipsText.setVisibility(View.VISIBLE);
|
||||
tipsText.setText(R.string.dialog_msg_hi_config_audio_btn_play);
|
||||
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onMove(View v, MotionEvent event, float mOffsetLimit) {
|
||||
if (MessageHiConfigRecordActivity.this.mLastTouchY - event.getY() > mOffsetLimit && !MessageHiConfigRecordActivity.this.mUpDirection) {
|
||||
AudioRecordManager.getInstance().willCancelRecord();
|
||||
MessageHiConfigRecordActivity.this.mUpDirection = true;
|
||||
} else if (event.getY() - MessageHiConfigRecordActivity.this.mLastTouchY > -mOffsetLimit && MessageHiConfigRecordActivity.this.mUpDirection) {
|
||||
AudioRecordManager.getInstance().continueRecord();
|
||||
MessageHiConfigRecordActivity.this.mUpDirection = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onUp(View v, MotionEvent event) {
|
||||
AudioRecordManager.getInstance().stopRecord();
|
||||
isAudio = false;
|
||||
if (mUpDirection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void play(File file) {
|
||||
try {
|
||||
MediaPlayer mediaPlayer = new MediaPlayer();
|
||||
mediaPlayer.setAudioAttributes(
|
||||
new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.build()
|
||||
);
|
||||
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mediaPlayer) {
|
||||
mediaPlayer.release();
|
||||
}
|
||||
});
|
||||
mediaPlayer.setDataSource(getApplicationContext(), Uri.fromFile(file));
|
||||
mediaPlayer.prepare();
|
||||
mediaPlayer.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package com.yunbao.main.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.custom.RatioRoundImageView;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserAvatarSelectAdapter2 extends RecyclerView.Adapter<UserAvatarSelectAdapter2.AvatarSelectViewHolder> {
|
||||
private Context mContext;
|
||||
private List<UserAvatarSelectBean> list = new ArrayList<>();
|
||||
private OnItemClickListener<UserAvatarSelectBean> onClickListener;
|
||||
private int selectId = -1;
|
||||
private int defId = -1;
|
||||
private UserAvatarSelectBean selectInfo;
|
||||
|
||||
public void setList(List<UserAvatarSelectBean> list) {
|
||||
this.list = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public int getSelect() {
|
||||
if (selectId == -1 && getItemCount() > 0) {
|
||||
return list.get(0).getId();
|
||||
}
|
||||
return selectId;
|
||||
}
|
||||
|
||||
public void setOnClickListener(OnItemClickListener<UserAvatarSelectBean> onClickListener) {
|
||||
this.onClickListener = onClickListener;
|
||||
}
|
||||
|
||||
public int getDefId() {
|
||||
return defId;
|
||||
}
|
||||
|
||||
public UserAvatarSelectAdapter2(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AvatarSelectViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new AvatarSelectViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_user_avatar_select, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AvatarSelectViewHolder holder, int position) {
|
||||
holder.setData(list.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void setDef(int id) {
|
||||
this.defId = id;
|
||||
}
|
||||
|
||||
public class AvatarSelectViewHolder extends RecyclerView.ViewHolder {
|
||||
private View hide;
|
||||
private View show;
|
||||
private RatioRoundImageView avatar;
|
||||
|
||||
public AvatarSelectViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
hide = itemView.findViewById(R.id.hideCover);
|
||||
show = itemView.findViewById(R.id.showCover);
|
||||
avatar = itemView.findViewById(R.id.avatar);
|
||||
itemView.setOnClickListener(v -> {
|
||||
selectInfo = (UserAvatarSelectBean) v.getTag();
|
||||
selectId = selectInfo.getId();
|
||||
notifyDataSetChanged();
|
||||
onClickListener.onItemClick(selectInfo, defId);
|
||||
});
|
||||
}
|
||||
|
||||
public void setData(UserAvatarSelectBean bean, int position) {
|
||||
ImgLoader.display(itemView.getContext(), bean.getPath(), avatar);
|
||||
if (selectId == -1 && bean.getChecked() == 1) {
|
||||
selectId = bean.getId();
|
||||
defId = bean.getId();
|
||||
selectInfo = bean;
|
||||
}
|
||||
hide.setVisibility(View.GONE);
|
||||
/*if (select == bean.getId()) {
|
||||
show.setVisibility(View.VISIBLE);
|
||||
hide.setVisibility(View.GONE);
|
||||
} else {
|
||||
show.setVisibility(View.INVISIBLE);
|
||||
hide.setVisibility(View.VISIBLE);
|
||||
}*/
|
||||
itemView.setTag(bean);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.yunbao.main.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.dialog.AbsDialogCenterPopupWindow;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.utils.UserInfoManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MessageStatusConfigDialog extends AbsDialogCenterPopupWindow {
|
||||
RadioGroup radioGroup;
|
||||
|
||||
public MessageStatusConfigDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_message_status_config;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
radioGroup = findViewById(R.id.radioGroup);
|
||||
if (UserInfoManager.getMyInfo() != null) {
|
||||
if (UserInfoManager.getMyInfo().getInfo().getOpenOff() == 1) {
|
||||
((RadioButton) radioGroup.getChildAt(0)).setChecked(true);
|
||||
} else {
|
||||
((RadioButton) radioGroup.getChildAt(1)).setChecked(true);
|
||||
}
|
||||
}
|
||||
findViewById(R.id.save).setOnClickListener(view -> {
|
||||
String tag = findViewById(radioGroup.getCheckedRadioButtonId()).getTag().toString();
|
||||
int status = 2;
|
||||
if (tag.equals(WordUtil.getString(R.string.dialog_msg_status_online_config))) {
|
||||
status = 1;
|
||||
}
|
||||
LiveNetManager.get(mContext)
|
||||
.setOpenOff(status, new HttpCallback<List<BaseModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<BaseModel> data) {
|
||||
ToastUtil.show("成功");
|
||||
dismiss();
|
||||
UserInfoManager.updateMyInfo(mContext, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
54
main/src/main/java/com/yunbao/main/dialog/MsgMoreDialog.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.yunbao.main.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.AttachPopupView;
|
||||
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.activity.MessageHiConfigActivity;
|
||||
|
||||
/**
|
||||
* 消息右上角更多菜单
|
||||
*/
|
||||
public class MsgMoreDialog extends AttachPopupView{
|
||||
View config, read;
|
||||
|
||||
public MsgMoreDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_msg_more;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
config = findViewById(R.id.ll_config);
|
||||
read = findViewById(R.id.ll_read);
|
||||
ViewClicksAntiShake.clicksAntiShake(config, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
getContext().startActivity(new Intent(getContext(), MessageHiConfigActivity.class));
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(read, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new MessageStatusConfigDialog(getContext())
|
||||
.showDialog();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
126
main/src/main/java/com/yunbao/main/dialog/UserAvatarPopup.java
Normal file
@ -0,0 +1,126 @@
|
||||
package com.yunbao.main.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.adapter.UserAvatarSelectAdapter;
|
||||
import com.yunbao.main.adapter.UserAvatarSelectAdapter2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserAvatarPopup extends BottomPopupView implements View.OnClickListener {
|
||||
|
||||
RecyclerView recyclerView;
|
||||
private Button camera;
|
||||
private Button album;
|
||||
private Context mContext;
|
||||
|
||||
UserAvatarSelectAdapter2 adapter;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public UserAvatarPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public interface OnItemClickListener<T> {
|
||||
void onItemClick(String userAvatar);
|
||||
}
|
||||
|
||||
private onIsCameraClickListener onIsCameraClickListener;
|
||||
|
||||
public interface onIsCameraClickListener {
|
||||
void onIsCamera(boolean isCamera);
|
||||
}
|
||||
|
||||
public UserAvatarPopup(@NonNull Context context, OnItemClickListener onItemClickListener, onIsCameraClickListener onIsCameraClickListener) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
this.onIsCameraClickListener = onIsCameraClickListener;
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_user_avatar;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
initDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载系统头像
|
||||
*/
|
||||
private void initDate() {
|
||||
adapter = new UserAvatarSelectAdapter2(mContext);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(mContext, 4));
|
||||
|
||||
ItemDecoration decoration1 = new ItemDecoration(mContext, 0x00000000, 0, 0);
|
||||
decoration1.setOnlySetItemOffsetsButNoDraw(true);
|
||||
recyclerView.addItemDecoration(decoration1);
|
||||
|
||||
recyclerView.setAdapter(adapter);
|
||||
adapter.setOnClickListener(new com.yunbao.common.interfaces.OnItemClickListener<UserAvatarSelectBean>() {
|
||||
@Override
|
||||
public void onItemClick(UserAvatarSelectBean bean, int position) {
|
||||
onItemClickListener.onItemClick(bean.getPath());
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
LiveNetManager.get(mContext).getSystemUserAvatar(new HttpCallback<List<UserAvatarSelectBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<UserAvatarSelectBean> data) {
|
||||
adapter.setList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
adapter.setList(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
camera = findViewById(R.id.camera);
|
||||
album = findViewById(R.id.album);
|
||||
camera.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onIsCameraClickListener.onIsCamera(true);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
album.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onIsCameraClickListener.onIsCamera(false);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
840
main/src/main/java/com/yunbao/main/utils/AudioRecordManager.java
Normal file
@ -0,0 +1,840 @@
|
||||
package com.yunbao.main.utils;
|
||||
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaRecorder;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import io.rong.common.RLog;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imkit.feature.destruct.DestructManager;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.common.SavePathUtils;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.ConversationIdentifier;
|
||||
import io.rong.imlib.typingmessage.TypingMessageManager;
|
||||
import io.rong.message.HQVoiceMessage;
|
||||
import io.rong.message.VoiceMessage;
|
||||
|
||||
public class AudioRecordManager implements Handler.Callback {
|
||||
private static final String TAG = "AudioRecordManager";
|
||||
private static final int RC_SAMPLE_RATE_8000 = 8000;
|
||||
private static final int RC_SAMPLE_RATE_16000 = 16000;
|
||||
private static final String VOICE_PATH = "/voice/";
|
||||
private final int AUDIO_RECORD_EVENT_TRIGGER;
|
||||
private final int AUDIO_RECORD_EVENT_SAMPLING;
|
||||
private final int AUDIO_RECORD_EVENT_WILL_CANCEL;
|
||||
private final int AUDIO_RECORD_EVENT_CONTINUE;
|
||||
private final int AUDIO_RECORD_EVENT_RELEASE;
|
||||
private final int AUDIO_RECORD_EVENT_ABORT;
|
||||
private final int AUDIO_RECORD_EVENT_TIME_OUT;
|
||||
private final int AUDIO_RECORD_EVENT_TICKER;
|
||||
private final int AUDIO_RECORD_EVENT_SEND_FILE;
|
||||
private final int AUDIO_AA_ENCODING_BIT_RATE;
|
||||
AudioRecordManager.IAudioState idleState;
|
||||
AudioRecordManager.IAudioState recordState;
|
||||
AudioRecordManager.IAudioState sendingState;
|
||||
AudioRecordManager.IAudioState cancelState;
|
||||
AudioRecordManager.IAudioState timerState;
|
||||
private int RECORD_INTERVAL;
|
||||
private AudioRecordManager.SamplingRate mSampleRate;
|
||||
private AudioRecordManager.IAudioState mCurAudioState;
|
||||
private View mRootView;
|
||||
private Context mContext;
|
||||
private Handler mHandler;
|
||||
private AudioManager mAudioManager;
|
||||
private MediaRecorder mMediaRecorder;
|
||||
private Uri mAudioPath;
|
||||
private long smStartRecTime;
|
||||
private AudioManager.OnAudioFocusChangeListener mAfChangeListener;
|
||||
private PopupWindow mRecordWindow;
|
||||
private ImageView mStateIV;
|
||||
private TextView mStateTV;
|
||||
private TextView mTimerTV;
|
||||
private int recordTime = 0;
|
||||
private IAudioRecordStateChangeListener recordStateChangeListener;
|
||||
|
||||
@TargetApi(21)
|
||||
private AudioRecordManager() {
|
||||
this.AUDIO_RECORD_EVENT_TRIGGER = 1;
|
||||
this.AUDIO_RECORD_EVENT_SAMPLING = 2;
|
||||
this.AUDIO_RECORD_EVENT_WILL_CANCEL = 3;
|
||||
this.AUDIO_RECORD_EVENT_CONTINUE = 4;
|
||||
this.AUDIO_RECORD_EVENT_RELEASE = 5;
|
||||
this.AUDIO_RECORD_EVENT_ABORT = 6;
|
||||
this.AUDIO_RECORD_EVENT_TIME_OUT = 7;
|
||||
this.AUDIO_RECORD_EVENT_TICKER = 8;
|
||||
this.AUDIO_RECORD_EVENT_SEND_FILE = 9;
|
||||
this.AUDIO_AA_ENCODING_BIT_RATE = 32000;
|
||||
this.idleState = new AudioRecordManager.IdleState();
|
||||
this.recordState = new AudioRecordManager.RecordState();
|
||||
this.sendingState = new AudioRecordManager.SendingState();
|
||||
this.cancelState = new AudioRecordManager.CancelState();
|
||||
this.timerState = new AudioRecordManager.TimerState();
|
||||
this.RECORD_INTERVAL = 60;
|
||||
this.mSampleRate = AudioRecordManager.SamplingRate.RC_SAMPLE_RATE_8000;
|
||||
RLog.d("AudioRecordManager", "AudioRecordManager");
|
||||
this.mHandler = new Handler(Looper.getMainLooper(), this);
|
||||
this.mCurAudioState = this.idleState;
|
||||
this.idleState.enter();
|
||||
}
|
||||
|
||||
public static AudioRecordManager getInstance() {
|
||||
return AudioRecordManager.SingletonHolder.sInstance;
|
||||
}
|
||||
|
||||
public final boolean handleMessage(Message msg) {
|
||||
RLog.i("AudioRecordManager", "handleMessage " + msg.what);
|
||||
AudioRecordManager.AudioStateMessage m;
|
||||
switch (msg.what) {
|
||||
case 2:
|
||||
this.sendEmptyMessage(2);
|
||||
break;
|
||||
case 7:
|
||||
m = new AudioRecordManager.AudioStateMessage();
|
||||
m.what = msg.what;
|
||||
m.obj = msg.obj;
|
||||
this.sendMessage(m);
|
||||
break;
|
||||
case 8:
|
||||
m = new AudioRecordManager.AudioStateMessage();
|
||||
m.what = 7;
|
||||
m.obj = msg.obj;
|
||||
this.sendMessage(m);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void initView(View root) {
|
||||
LayoutInflater inflater = LayoutInflater.from(root.getContext());
|
||||
View view = inflater.inflate(io.rong.imkit.R.layout.rc_voice_record_popup, (ViewGroup) null);
|
||||
this.mStateIV = (ImageView) view.findViewById(io.rong.imkit.R.id.rc_audio_state_image);
|
||||
this.mStateTV = (TextView) view.findViewById(io.rong.imkit.R.id.rc_audio_state_text);
|
||||
this.mTimerTV = (TextView) view.findViewById(io.rong.imkit.R.id.rc_audio_timer);
|
||||
this.mRecordWindow = new PopupWindow(view, -1, -1);
|
||||
this.mRecordWindow.showAtLocation(root, 17, 0, 0);
|
||||
this.mRecordWindow.setFocusable(true);
|
||||
this.mRecordWindow.setOutsideTouchable(false);
|
||||
this.mRecordWindow.setTouchable(false);
|
||||
}
|
||||
|
||||
private void setTimeoutView(int counter) {
|
||||
if (counter > 0) {
|
||||
if (this.mRecordWindow != null) {
|
||||
this.mStateIV.setVisibility(View.GONE);
|
||||
this.mStateTV.setVisibility(View.VISIBLE);
|
||||
this.mStateTV.setText(io.rong.imkit.R.string.rc_voice_rec);
|
||||
// this.mStateTV.setBackgroundResource(17170445);
|
||||
this.mTimerTV.setText(String.format("%s", counter));
|
||||
this.mTimerTV.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (this.mRecordWindow != null) {
|
||||
this.mStateIV.setVisibility(View.VISIBLE);
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_warning);
|
||||
this.mStateTV.setText(io.rong.imkit.R.string.rc_voice_too_long);
|
||||
// this.mStateTV.setBackgroundResource(17170445);
|
||||
this.mTimerTV.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setRecordingView() {
|
||||
RLog.d("AudioRecordManager", "setRecordingView");
|
||||
if (this.mRecordWindow != null) {
|
||||
this.mStateIV.setVisibility(View.VISIBLE);
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_1);
|
||||
this.mStateTV.setVisibility(View.VISIBLE);
|
||||
this.mStateTV.setText(io.rong.imkit.R.string.rc_voice_rec);
|
||||
// this.mStateTV.setBackgroundResource(17170445);
|
||||
this.mTimerTV.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setCancelView() {
|
||||
RLog.d("AudioRecordManager", "setCancelView");
|
||||
if (this.mRecordWindow != null) {
|
||||
this.mTimerTV.setVisibility(View.GONE);
|
||||
this.mStateIV.setVisibility(View.VISIBLE);
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_cancel);
|
||||
this.mStateTV.setVisibility(View.VISIBLE);
|
||||
this.mStateTV.setText(io.rong.imkit.R.string.rc_voice_cancel);
|
||||
this.mStateTV.setBackgroundResource(io.rong.imkit.R.drawable.rc_voice_cancel_background);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setCallStateChangeListener() {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
try {
|
||||
if (this.mContext == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TelephonyManager manager = (TelephonyManager) this.mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
manager.listen(new PhoneStateListener() {
|
||||
public void onCallStateChanged(int state, String incomingNumber) {
|
||||
switch (state) {
|
||||
case 1:
|
||||
AudioRecordManager.this.sendEmptyMessage(6);
|
||||
case 0:
|
||||
case 2:
|
||||
default:
|
||||
super.onCallStateChanged(state, incomingNumber);
|
||||
}
|
||||
}
|
||||
}, 32);
|
||||
} catch (SecurityException var2) {
|
||||
RLog.e("AudioRecordManager", "AudioRecordManager", var2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void destroyView() {
|
||||
RLog.d("AudioRecordManager", "destroyView");
|
||||
if (this.mRecordWindow != null) {
|
||||
this.mHandler.removeMessages(7);
|
||||
this.mHandler.removeMessages(8);
|
||||
this.mHandler.removeMessages(2);
|
||||
this.mRecordWindow.dismiss();
|
||||
this.mRecordWindow = null;
|
||||
this.mStateIV = null;
|
||||
this.mStateTV = null;
|
||||
this.mTimerTV = null;
|
||||
this.mContext = null;
|
||||
this.mRootView = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getMaxVoiceDuration() {
|
||||
return this.RECORD_INTERVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void setMaxVoiceDuration(int maxVoiceDuration) {
|
||||
this.RECORD_INTERVAL = maxVoiceDuration;
|
||||
}
|
||||
|
||||
public void startRecord(View rootView, IAudioRecordStateChangeListener recordStateChangeListener) {
|
||||
this.recordStateChangeListener = recordStateChangeListener;
|
||||
if (rootView != null) {
|
||||
this.mRootView = rootView;
|
||||
this.mContext = rootView.getContext().getApplicationContext();
|
||||
this.mAudioManager = (AudioManager) this.mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||
if (this.mAfChangeListener != null) {
|
||||
this.mAudioManager.abandonAudioFocus(this.mAfChangeListener);
|
||||
this.mAfChangeListener = null;
|
||||
}
|
||||
|
||||
this.mAfChangeListener = new AudioManager.OnAudioFocusChangeListener() {
|
||||
public void onAudioFocusChange(int focusChange) {
|
||||
RLog.d("AudioRecordManager", "OnAudioFocusChangeListener " + focusChange);
|
||||
if (focusChange == -1) {
|
||||
AudioRecordManager.this.mAudioManager.abandonAudioFocus(AudioRecordManager.this.mAfChangeListener);
|
||||
AudioRecordManager.this.mAfChangeListener = null;
|
||||
AudioRecordManager.this.mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
AudioRecordManager.this.sendEmptyMessage(6);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
this.sendEmptyMessage(1);
|
||||
recordTime = 0;
|
||||
new Timer().schedule(getTask(), 0, 1000);
|
||||
/* if (TypingMessageManager.getInstance().isShowMessageTyping() && conversationIdentifier.getType().equals(Conversation.ConversationType.PRIVATE)) {
|
||||
RongIMClient.getInstance().sendTypingStatus(conversationIdentifier.getType(), this.mConversationIdentifier.getTargetId(), "RC:VcMsg");
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private TimerTask task;
|
||||
|
||||
private TimerTask getTask() {
|
||||
task = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
mHandler.post(() -> {
|
||||
recordStateChangeListener.onTimer(recordTime++);
|
||||
});
|
||||
}
|
||||
};
|
||||
return task;
|
||||
}
|
||||
|
||||
public void willCancelRecord() {
|
||||
this.sendEmptyMessage(3);
|
||||
}
|
||||
|
||||
public void continueRecord() {
|
||||
this.sendEmptyMessage(4);
|
||||
}
|
||||
|
||||
public void stopRecord() {
|
||||
this.sendEmptyMessage(5);
|
||||
}
|
||||
|
||||
public void destroyRecord() {
|
||||
AudioRecordManager.AudioStateMessage msg = new AudioRecordManager.AudioStateMessage();
|
||||
msg.obj = true;
|
||||
msg.what = 5;
|
||||
this.sendMessage(msg);
|
||||
}
|
||||
|
||||
void sendMessage(AudioRecordManager.AudioStateMessage message) {
|
||||
this.mCurAudioState.handleMessage(message);
|
||||
}
|
||||
|
||||
void sendEmptyMessage(int event) {
|
||||
AudioRecordManager.AudioStateMessage message = new AudioRecordManager.AudioStateMessage();
|
||||
message.what = event;
|
||||
this.mCurAudioState.handleMessage(message);
|
||||
}
|
||||
|
||||
private void startRec() {
|
||||
RLog.d("AudioRecordManager", "startRec");
|
||||
|
||||
try {
|
||||
this.muteAudioFocus(this.mAudioManager, true);
|
||||
this.mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
this.mMediaRecorder = new MediaRecorder();
|
||||
this.mMediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() {
|
||||
public void onError(MediaRecorder mr, int what, int extra) {
|
||||
RLog.e("AudioRecordManager", "MediaRecorder:onError: what = " + what + ", extra = " + extra);
|
||||
}
|
||||
});
|
||||
int bpsNb = RongConfigCenter.featureConfig().getAudioNBEncodingBitRate();
|
||||
int bpsWb = RongConfigCenter.featureConfig().getAudioWBEncodingBitRate();
|
||||
if (RongConfigCenter.featureConfig().getVoiceMessageType() == IMCenter.VoiceMessageType.HighQuality) {
|
||||
this.mMediaRecorder.setAudioEncodingBitRate(32000);
|
||||
} else {
|
||||
this.mMediaRecorder.setAudioSamplingRate(this.mSampleRate.value);
|
||||
if (this.mSampleRate.equals(AudioRecordManager.SamplingRate.RC_SAMPLE_RATE_8000)) {
|
||||
this.mMediaRecorder.setAudioEncodingBitRate(bpsNb);
|
||||
} else {
|
||||
this.mMediaRecorder.setAudioEncodingBitRate(bpsWb);
|
||||
}
|
||||
}
|
||||
|
||||
this.mMediaRecorder.setAudioChannels(1);
|
||||
this.mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
|
||||
if (RongConfigCenter.featureConfig().getVoiceMessageType().equals(IMCenter.VoiceMessageType.HighQuality)) {
|
||||
this.mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
|
||||
this.mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
|
||||
} else if (this.mSampleRate.equals(AudioRecordManager.SamplingRate.RC_SAMPLE_RATE_8000)) {
|
||||
this.mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
|
||||
this.mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
|
||||
} else {
|
||||
this.mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_WB);
|
||||
this.mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);
|
||||
}
|
||||
|
||||
File savePath = SavePathUtils.getSavePath(this.mContext.getCacheDir());
|
||||
if (!savePath.exists()) {
|
||||
throw new FileNotFoundException(savePath.getPath());
|
||||
}
|
||||
|
||||
if (!savePath.canWrite()) {
|
||||
boolean result = savePath.setWritable(true, true);
|
||||
if (!result) {
|
||||
String msg = savePath.getPath() + " could not be writable.";
|
||||
throw new IOException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
this.mAudioPath = Uri.fromFile(new File(savePath, System.currentTimeMillis() + "temp.voice"));
|
||||
this.mMediaRecorder.setOutputFile(this.mAudioPath.getPath());
|
||||
this.mMediaRecorder.prepare();
|
||||
this.mMediaRecorder.start();
|
||||
Message message = Message.obtain();
|
||||
message.what = 7;
|
||||
message.obj = 10;
|
||||
this.mHandler.removeMessages(7);
|
||||
this.mHandler.sendMessageDelayed(message, (long) (this.RECORD_INTERVAL * 1000 - 10000));
|
||||
} catch (RuntimeException | IOException var6) {
|
||||
RLog.e("AudioRecordManager", "startRec", var6);
|
||||
this.mMediaRecorder.release();
|
||||
this.mMediaRecorder = null;
|
||||
this.mHandler.sendEmptyMessage(6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean checkAudioTimeLength() {
|
||||
long delta = SystemClock.elapsedRealtime() - this.smStartRecTime;
|
||||
return delta < 1000L;
|
||||
}
|
||||
|
||||
private void stopRec() {
|
||||
RLog.d("AudioRecordManager", "stopRec");
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
try {
|
||||
this.muteAudioFocus(this.mAudioManager, false);
|
||||
if (this.mMediaRecorder != null) {
|
||||
this.mMediaRecorder.stop();
|
||||
this.mMediaRecorder.release();
|
||||
this.mMediaRecorder = null;
|
||||
}
|
||||
} catch (Exception var2) {
|
||||
RLog.e("AudioRecordManager", "stopRec", var2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void deleteAudioFile() {
|
||||
RLog.d("AudioRecordManager", "deleteAudioFile");
|
||||
if (this.mAudioPath != null) {
|
||||
File file = new File(this.mAudioPath.getPath());
|
||||
if (file.exists()) {
|
||||
boolean deleteResult = file.delete();
|
||||
if (!deleteResult) {
|
||||
RLog.e("AudioRecordManager", "deleteAudioFile delete file failed. path :" + this.mAudioPath.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendAudioFile() {
|
||||
RLog.d("AudioRecordManager", "sendAudioFile path = " + this.mAudioPath);
|
||||
if (this.mAudioPath != null) {
|
||||
File file = new File(this.mAudioPath.getPath());
|
||||
if (!file.exists() || file.length() == 0L) {
|
||||
RLog.e("AudioRecordManager", "sendAudioFile fail cause of file length 0 or audio permission denied");
|
||||
return;
|
||||
}
|
||||
|
||||
int duration = (int) (SystemClock.elapsedRealtime() - this.smStartRecTime) / 1000;
|
||||
Log.i(TAG, "sendAudioFile: 语音文件:" + file.getAbsoluteFile() + "|时间:" + duration);
|
||||
recordStateChangeListener.onDone(file, duration);
|
||||
/*if (RongConfigCenter.featureConfig().getVoiceMessageType() == IMCenter.VoiceMessageType.HighQuality) {
|
||||
HQVoiceMessage hqVoiceMessage = HQVoiceMessage.obtain(this.mAudioPath, Math.min(duration, this.RECORD_INTERVAL));
|
||||
if (DestructManager.isActive()) {
|
||||
hqVoiceMessage.setDestructTime((long)DestructManager.VOICE_DESTRUCT_TIME);
|
||||
}
|
||||
|
||||
io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(this.mConversationIdentifier, hqVoiceMessage);
|
||||
IMCenter.getInstance().sendMediaMessage(message, DestructManager.isActive() ? this.mContext.getResources().getString(io.rong.imkit.R.string.rc_conversation_summary_content_burn) : null, (String)null, new IRongCallback.ISendMediaMessageCallback() {
|
||||
public void onProgress(io.rong.imlib.model.Message message, int progress) {
|
||||
}
|
||||
|
||||
public void onCanceled(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
RLog.d("AudioRecordManager", "onError = " + errorCode.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
VoiceMessage voiceMessage = VoiceMessage.obtain(this.mAudioPath, Math.min(duration, this.RECORD_INTERVAL));
|
||||
if (DestructManager.isActive()) {
|
||||
voiceMessage.setDestructTime((long)DestructManager.VOICE_DESTRUCT_TIME);
|
||||
}
|
||||
|
||||
IMCenter.getInstance().sendMessage(io.rong.imlib.model.Message.obtain(this.mConversationIdentifier, voiceMessage), DestructManager.isActive() ? this.mContext.getResources().getString(io.rong.imkit.R.string.rc_conversation_summary_content_burn) : null, (String)null, new IRongCallback.ISendMessageCallback() {
|
||||
public void onAttached(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
public void onSuccess(io.rong.imlib.model.Message message) {
|
||||
}
|
||||
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void audioDBChanged() {
|
||||
if (this.mMediaRecorder != null) {
|
||||
int db = 0;
|
||||
|
||||
try {
|
||||
db = this.mMediaRecorder.getMaxAmplitude() / 600;
|
||||
} catch (IllegalStateException var3) {
|
||||
RLog.e("AudioRecordManager", "audioDBChanged IllegalStateException");
|
||||
}
|
||||
|
||||
switch (db / 5) {
|
||||
case 0:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_1);
|
||||
break;
|
||||
case 1:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_2);
|
||||
break;
|
||||
case 2:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_3);
|
||||
break;
|
||||
case 3:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_4);
|
||||
break;
|
||||
case 4:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_5);
|
||||
break;
|
||||
case 5:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_6);
|
||||
break;
|
||||
default:
|
||||
this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void muteAudioFocus(AudioManager audioManager, boolean bMute) {
|
||||
if (Build.VERSION.SDK_INT < 8) {
|
||||
RLog.d("AudioRecordManager", "muteAudioFocus Android 2.1 and below can not stop music");
|
||||
} else if (audioManager == null) {
|
||||
RLog.e("AudioRecordManager", "audioManager is null");
|
||||
} else {
|
||||
if (bMute) {
|
||||
audioManager.requestAudioFocus(this.mAfChangeListener, 3, 2);
|
||||
} else {
|
||||
audioManager.abandonAudioFocus(this.mAfChangeListener);
|
||||
this.mAfChangeListener = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getSamplingRate() {
|
||||
return this.mSampleRate.getValue();
|
||||
}
|
||||
|
||||
public void setSamplingRate(AudioRecordManager.SamplingRate sampleRate) {
|
||||
this.mSampleRate = sampleRate;
|
||||
}
|
||||
|
||||
class AudioStateMessage {
|
||||
public int what;
|
||||
public Object obj;
|
||||
|
||||
AudioStateMessage() {
|
||||
}
|
||||
|
||||
public AudioRecordManager.AudioStateMessage obtain() {
|
||||
return AudioRecordManager.this.new AudioStateMessage();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class IAudioState {
|
||||
IAudioState() {
|
||||
}
|
||||
|
||||
void enter() {
|
||||
}
|
||||
|
||||
abstract void handleMessage(AudioRecordManager.AudioStateMessage message);
|
||||
}
|
||||
|
||||
class TimerState extends AudioRecordManager.IAudioState {
|
||||
TimerState() {
|
||||
super();
|
||||
}
|
||||
|
||||
void handleMessage(AudioRecordManager.AudioStateMessage msg) {
|
||||
RLog.d("AudioRecordManager", this.getClass().getSimpleName() + " handleMessage : " + msg.what);
|
||||
switch (msg.what) {
|
||||
case 3:
|
||||
AudioRecordManager.this.setCancelView();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.cancelState;
|
||||
case 4:
|
||||
default:
|
||||
break;
|
||||
case 5:
|
||||
AudioRecordManager.this.mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.sendAudioFile();
|
||||
AudioRecordManager.this.destroyView();
|
||||
}
|
||||
}, 500L);
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
AudioRecordManager.this.idleState.enter();
|
||||
break;
|
||||
case 6:
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.destroyView();
|
||||
AudioRecordManager.this.deleteAudioFile();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
AudioRecordManager.this.idleState.enter();
|
||||
break;
|
||||
case 7:
|
||||
int counter = (Integer) msg.obj;
|
||||
if (counter >= 0) {
|
||||
Message message = Message.obtain();
|
||||
message.what = 8;
|
||||
message.obj = counter - 1;
|
||||
AudioRecordManager.this.mHandler.sendMessageDelayed(message, 1000L);
|
||||
AudioRecordManager.this.setTimeoutView(counter);
|
||||
} else {
|
||||
AudioRecordManager.this.mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.sendAudioFile();
|
||||
AudioRecordManager.this.destroyView();
|
||||
}
|
||||
}, 500L);
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class CancelState extends AudioRecordManager.IAudioState {
|
||||
CancelState() {
|
||||
super();
|
||||
}
|
||||
|
||||
void handleMessage(AudioRecordManager.AudioStateMessage msg) {
|
||||
RLog.d("AudioRecordManager", this.getClass().getSimpleName() + " handleMessage : " + msg.what);
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
break;
|
||||
case 4:
|
||||
AudioRecordManager.this.setRecordingView();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.recordState;
|
||||
AudioRecordManager.this.sendEmptyMessage(2);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.destroyView();
|
||||
AudioRecordManager.this.deleteAudioFile();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
AudioRecordManager.this.idleState.enter();
|
||||
break;
|
||||
case 7:
|
||||
int counter = (Integer) msg.obj;
|
||||
if (counter > 0) {
|
||||
Message message = Message.obtain();
|
||||
message.what = 8;
|
||||
message.obj = counter - 1;
|
||||
AudioRecordManager.this.mHandler.sendMessageDelayed(message, 1000L);
|
||||
} else {
|
||||
AudioRecordManager.this.mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.sendAudioFile();
|
||||
AudioRecordManager.this.destroyView();
|
||||
}
|
||||
}, 500L);
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
AudioRecordManager.this.idleState.enter();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class SendingState extends AudioRecordManager.IAudioState {
|
||||
SendingState() {
|
||||
super();
|
||||
}
|
||||
|
||||
void handleMessage(AudioRecordManager.AudioStateMessage message) {
|
||||
RLog.d("AudioRecordManager", "SendingState handleMessage " + message.what);
|
||||
switch (message.what) {
|
||||
case 9:
|
||||
AudioRecordManager.this.stopRec();
|
||||
if ((Boolean) message.obj) {
|
||||
AudioRecordManager.this.sendAudioFile();
|
||||
}
|
||||
|
||||
AudioRecordManager.this.destroyView();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RecordState extends AudioRecordManager.IAudioState {
|
||||
RecordState() {
|
||||
super();
|
||||
}
|
||||
|
||||
void handleMessage(AudioRecordManager.AudioStateMessage msg) {
|
||||
RLog.d("AudioRecordManager", this.getClass().getSimpleName() + " handleMessage : " + msg.what);
|
||||
switch (msg.what) {
|
||||
case 2:
|
||||
AudioRecordManager.this.audioDBChanged();
|
||||
AudioRecordManager.this.mHandler.sendEmptyMessageDelayed(2, 150L);
|
||||
break;
|
||||
case 3:
|
||||
AudioRecordManager.this.setCancelView();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.cancelState;
|
||||
case 4:
|
||||
default:
|
||||
break;
|
||||
case 5:
|
||||
final boolean checked = AudioRecordManager.this.checkAudioTimeLength();
|
||||
boolean activityFinished = false;
|
||||
if (msg.obj != null) {
|
||||
activityFinished = (Boolean) msg.obj;
|
||||
}
|
||||
|
||||
if (checked && !activityFinished) {
|
||||
AudioRecordManager.this.mStateIV.setImageResource(io.rong.imkit.R.drawable.rc_voice_volume_warning);
|
||||
AudioRecordManager.this.mStateTV.setText(io.rong.imkit.R.string.rc_voice_short);
|
||||
AudioRecordManager.this.mHandler.removeMessages(2);
|
||||
}
|
||||
|
||||
if (!activityFinished && AudioRecordManager.this.mHandler != null) {
|
||||
AudioRecordManager.this.mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
AudioRecordManager.AudioStateMessage message = AudioRecordManager.this.new AudioStateMessage();
|
||||
message.what = 9;
|
||||
message.obj = !checked;
|
||||
AudioRecordManager.this.sendMessage(message);
|
||||
}
|
||||
}, 500L);
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.sendingState;
|
||||
} else {
|
||||
AudioRecordManager.this.stopRec();
|
||||
if (!checked && activityFinished) {
|
||||
AudioRecordManager.this.sendAudioFile();
|
||||
}
|
||||
|
||||
AudioRecordManager.this.destroyView();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.destroyView();
|
||||
AudioRecordManager.this.deleteAudioFile();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
AudioRecordManager.this.idleState.enter();
|
||||
break;
|
||||
case 7:
|
||||
int counter = (Integer) msg.obj;
|
||||
AudioRecordManager.this.setTimeoutView(counter);
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.timerState;
|
||||
if (counter >= 0) {
|
||||
Message message = Message.obtain();
|
||||
message.what = 8;
|
||||
message.obj = counter - 1;
|
||||
AudioRecordManager.this.mHandler.sendMessageDelayed(message, 1000L);
|
||||
} else {
|
||||
AudioRecordManager.this.mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
AudioRecordManager.this.stopRec();
|
||||
AudioRecordManager.this.sendAudioFile();
|
||||
AudioRecordManager.this.destroyView();
|
||||
}
|
||||
}, 500L);
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.idleState;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class IdleState extends AudioRecordManager.IAudioState {
|
||||
public IdleState() {
|
||||
super();
|
||||
RLog.d("AudioRecordManager", "IdleState");
|
||||
}
|
||||
|
||||
void enter() {
|
||||
super.enter();
|
||||
if (AudioRecordManager.this.mHandler != null) {
|
||||
AudioRecordManager.this.mHandler.removeMessages(7);
|
||||
AudioRecordManager.this.mHandler.removeMessages(8);
|
||||
AudioRecordManager.this.mHandler.removeMessages(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void handleMessage(AudioRecordManager.AudioStateMessage msg) {
|
||||
RLog.d("AudioRecordManager", "IdleState handleMessage : " + msg.what);
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
AudioRecordManager.this.initView(AudioRecordManager.this.mRootView);
|
||||
AudioRecordManager.this.setRecordingView();
|
||||
AudioRecordManager.this.startRec();
|
||||
AudioRecordManager.this.setCallStateChangeListener();
|
||||
AudioRecordManager.this.smStartRecTime = SystemClock.elapsedRealtime();
|
||||
AudioRecordManager.this.mCurAudioState = AudioRecordManager.this.recordState;
|
||||
AudioRecordManager.this.sendEmptyMessage(2);
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class SingletonHolder {
|
||||
static AudioRecordManager sInstance = new AudioRecordManager();
|
||||
|
||||
SingletonHolder() {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum SamplingRate {
|
||||
RC_SAMPLE_RATE_8000(8000),
|
||||
RC_SAMPLE_RATE_16000(16000);
|
||||
|
||||
private int value;
|
||||
|
||||
private SamplingRate(int sampleRate) {
|
||||
this.value = sampleRate;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IAudioRecordStateChangeListener {
|
||||
void onTimer(int timer);
|
||||
|
||||
void onDone(File file, int timer);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.yunbao.main.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.MessageUserInfoBean;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.main.dialog.UserAvatarPopup;
|
||||
|
||||
public class UserInfoManager {
|
||||
private static MessageUserInfoBean myInfo;
|
||||
|
||||
public static MessageUserInfoBean getMyInfo() {
|
||||
return myInfo;
|
||||
}
|
||||
|
||||
public static void updateMyInfo(Context context, OnItemClickListener<MessageUserInfoBean> listener) {
|
||||
LiveNetManager.get(context)
|
||||
.getOtherInfo(CommonAppConfig.getInstance().getUid(), new HttpCallback<MessageUserInfoBean>() {
|
||||
@Override
|
||||
public void onSuccess(MessageUserInfoBean data) {
|
||||
if (listener != null) {
|
||||
listener.onItemClick(data, 0);
|
||||
}
|
||||
myInfo = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.binioter.guideview.Guide;
|
||||
import com.binioter.guideview.GuideBuilder;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
@ -31,12 +32,15 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.bean.ImUserInfoModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.MessageChatIsAnchor;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
@ -50,8 +54,11 @@ import com.yunbao.live.bean.ImUserBean;
|
||||
import com.yunbao.live.event.RecommendLiveRoomEvent;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.activity.CompleteUserInfoActivity;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
import com.yunbao.main.activity.MessageHiConfigRecordActivity;
|
||||
import com.yunbao.main.adapter.SystemMessageAdapter;
|
||||
import com.yunbao.main.dialog.MsgMoreDialog;
|
||||
import com.yunbao.main.fragment.MainMessageChatFragment;
|
||||
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
|
||||
|
||||
@ -80,8 +87,9 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
private Handler netHandler;
|
||||
private MainActivity mContext;
|
||||
private View contacts;
|
||||
private View more;
|
||||
private EditText search;
|
||||
|
||||
XPopup.Builder moreXPopup;
|
||||
private String homeZdyPop;
|
||||
|
||||
public MainMessageViewHolder setHomeZdyPop(String homeZdyPop) {
|
||||
@ -126,10 +134,13 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
imgSystemMessages = (ImageView) findViewById(R.id.img_system_messages);
|
||||
imgNewsOnline = (ImageView) findViewById(R.id.img_news_online);
|
||||
contacts = findViewById(R.id.news_icon_contacts);
|
||||
more = findViewById(R.id.news_icon_more);
|
||||
search = findViewById(R.id.search);
|
||||
contacts.setOnClickListener(view -> {
|
||||
//通讯录
|
||||
RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK);
|
||||
// RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK);
|
||||
// mContext.startActivity(new Intent(mContext, CompleteUserInfoActivity.class));
|
||||
mContext.startActivity(new Intent(mContext, MessageHiConfigRecordActivity.class));
|
||||
});
|
||||
search.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
@ -152,7 +163,10 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
}
|
||||
});
|
||||
netHandler = new Handler();
|
||||
|
||||
moreXPopup = new XPopup.Builder(mContext).atView(more);
|
||||
more.setOnClickListener(view -> {
|
||||
moreXPopup.asCustom(new MsgMoreDialog(mContext)).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -240,7 +254,23 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
MessageIMManager.get(mContext).getSystemMessages();
|
||||
}
|
||||
});
|
||||
LiveNetManager.get(mContext)
|
||||
.getIsAnchor(new com.yunbao.common.http.base.HttpCallback<MessageChatIsAnchor>() {
|
||||
@Override
|
||||
public void onSuccess(MessageChatIsAnchor data) {
|
||||
AppManager.runDebugCode(() -> {
|
||||
more.setVisibility(View.VISIBLE);
|
||||
});
|
||||
if (data.getIsAnchor() == 1) {
|
||||
more.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="46dp" android:height="34dp">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:type="linear" android:useLevel="true" android:startColor="#fffeffd8" android:endColor="#ffeb6fff" android:angle="225" />
|
||||
<corners android:topLeftRadius="10dp" android:topRightRadius="10dp" android:bottomLeftRadius="10dp" android:bottomRightRadius="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="64dp" android:height="64dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ffeaeaea" />
|
||||
<corners android:radius="360dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="64dp" android:height="64dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#333333" />
|
||||
<corners android:radius="360dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
7
main/src/main/res/drawable/bg_user_avatar.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp" />
|
||||
<solid android:color="#F4F7FC" />
|
||||
</shape>
|
10
main/src/main/res/drawable/dialog_bg_chat_status_config.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="250dp" android:height="229dp">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="#00000000" />
|
||||
<solid android:color="#ffffffff" />
|
||||
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="100dp" android:height="100dp">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="#ffeb6fff" />
|
||||
<solid android:color="#fffefbff" />
|
||||
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="100dp" android:height="100dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ffefefef" />
|
||||
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="345dp" android:height="60dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#ffeaeaea" />
|
||||
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/dialog_bg_chat_status_config_select" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/dialog_bg_chat_status_config_unselect" android:state_checked="false"/>
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@mipmap/ic_dialog_status_config_off_select" android:state_checked="true" />
|
||||
<item android:drawable="@mipmap/ic_dialog_status_config_off_unselect" android:state_checked="false"/>
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@mipmap/ic_dialog_status_config_online_select" android:state_checked="true" />
|
||||
<item android:drawable="@mipmap/ic_dialog_status_config_online_unselect" android:state_checked="false"/>
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#EB6FFF" android:state_checked="true" />
|
||||
<item android:color="#777777" android:state_checked="false"/>
|
||||
</selector>
|
5
main/src/main/res/drawable/view_btn_hi_config_record.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@mipmap/ic_btn_hi_config_record" android:state_pressed="false" />
|
||||
<item android:drawable="@mipmap/ic_btn_hi_config_record_in" android:state_pressed="true"/>
|
||||
</selector>
|
193
main/src/main/res/layout/activity_hi_config_record.xml
Normal file
@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView11"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitStart"
|
||||
android:src="@mipmap/bg_activity_message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingTop="24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_msg_m_config"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="backClick"
|
||||
android:scaleType="center"
|
||||
android:src="@mipmap/ic_back" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="46dp"
|
||||
android:text="@string/dialog_msg_hi_config_audio_title"
|
||||
android:textColor="#333333"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/infoLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@mipmap/bg_hi_config_record_info"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView12">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/dialog_msg_hi_config_audio_tips1"
|
||||
android:textColor="#777777"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/dialog_msg_hi_config_audio_tips2"
|
||||
android:textColor="#777777"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/dialog_msg_hi_config_audio_tips3"
|
||||
android:textColor="#333333"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/dialog_msg_hi_config_audio_tips4"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_record"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:background="@drawable/view_btn_hi_config_record"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_tips_long"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_msg_hi_config_audio_btn"
|
||||
android:textColor="#333333"
|
||||
android:textSize="15sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="@+id/btn_record"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_record"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_record"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btn_record"
|
||||
app:layout_constraintEnd_toEndOf="@+id/btn_record"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_record"
|
||||
tools:text="5s"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_reset"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/bg_btn_hi_config_record_reset"
|
||||
android:stateListAnimator="@null"
|
||||
android:text="@string/dialog_msg_hi_config_audio_btn_reset"
|
||||
android:textColor="#333333"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_record"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_record"
|
||||
app:layout_constraintTop_toBottomOf="@+id/timer"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/bg_btn_hi_config_record_save"
|
||||
android:stateListAnimator="@null"
|
||||
android:text="@string/dialog_msg_hi_config_audio_btn_save"
|
||||
android:textColor="#FFF"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_record"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_record"
|
||||
app:layout_constraintTop_toBottomOf="@+id/timer"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_recording"
|
||||
android:layout_width="174dp"
|
||||
android:layout_height="87dp"
|
||||
android:layout_marginBottom="29dp"
|
||||
android:src="@mipmap/ic_hi_config_record_img"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btn_record"
|
||||
app:layout_constraintEnd_toEndOf="@+id/btn_record"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_record"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
172
main/src/main/res/layout/activity_message_hi_config.xml
Normal file
@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingTop="24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/dialog_msg_m_config"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:onClick="backClick"
|
||||
android:scaleType="center"
|
||||
android:src="@mipmap/ic_back" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rootView"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_msg_hi_config_audio"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/audio_1"
|
||||
layout="@layout/view_message_hi_config_item"
|
||||
android:tag="audio1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/audio_2"
|
||||
layout="@layout/view_message_hi_config_item"
|
||||
android:tag="audio2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/audio_3"
|
||||
android:tag="audio3"
|
||||
layout="@layout/view_message_hi_config_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/dialog_msg_hi_config_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/text_1"
|
||||
layout="@layout/view_message_hi_config_item_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:tag="text1"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/text_2"
|
||||
android:tag="text2"
|
||||
layout="@layout/view_message_hi_config_item_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/text_3"
|
||||
android:tag="text3"
|
||||
layout="@layout/view_message_hi_config_item_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/dialog_msg_hi_config_image"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="start"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
<include
|
||||
android:id="@+id/image_1"
|
||||
android:tag="image1"
|
||||
layout="@layout/view_message_hi_config_image_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="95dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
<include
|
||||
android:id="@+id/image_2"
|
||||
android:tag="image2"
|
||||
layout="@layout/view_message_hi_config_image_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="95dp"
|
||||
android:layout_marginEnd="10dp" />
|
||||
<include
|
||||
android:id="@+id/image_3"
|
||||
android:tag="image3"
|
||||
layout="@layout/view_message_hi_config_image_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="95dp"
|
||||
android:layout_marginEnd="10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="186dp"
|
||||
android:layout_height="54dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:background="@drawable/bg_msg_address_book_user_btn_fan"
|
||||
android:text="@string/dialog_msg_hi_config_save"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
149
main/src/main/res/layout/activity_user_info.xml
Normal file
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView11"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitStart"
|
||||
android:src="@mipmap/bg_activity_message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="28dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:text="@string/activity_reg_user_info_title"
|
||||
android:textColor="#333333"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginStart="27dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:src="@mipmap/ic_message_hi_config_image_add"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||
app:riv_corner_radius="10dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_change"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginTop="-34dp"
|
||||
android:background="@drawable/bg_btn_activity_user_info_avatar_change"
|
||||
android:text="更换"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/avatar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/avatar" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="27dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/activity_reg_user_info_sex_title"
|
||||
android:textColor="#333333"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="27dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/activity_reg_user_info_birthday_title"
|
||||
android:textColor="#333333"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sex_layout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="27dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="昵称"
|
||||
android:textColor="#333333"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/avatar" />
|
||||
|
||||
<include
|
||||
android:id="@+id/text_1"
|
||||
layout="@layout/view_message_hi_config_item_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:tag="text1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title1" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sex_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title2">
|
||||
|
||||
<include
|
||||
android:id="@+id/sex_man"
|
||||
layout="@layout/view_user_info_sex"
|
||||
android:layout_width="153dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:layout_height="72dp"/>
|
||||
<include
|
||||
android:id="@+id/sex_woman"
|
||||
layout="@layout/view_user_info_sex"
|
||||
android:layout_width="153dp"
|
||||
android:layout_height="72dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/birthday"
|
||||
layout="@layout/view_user_info_birthday"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title3" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:text="@string/aristocrat_determine"
|
||||
android:background="@drawable/bg_msg_address_book_user_btn_fan"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
65
main/src/main/res/layout/dialog_message_status_config.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="228dp"
|
||||
android:background="@drawable/dialog_bg_chat_status_config">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton2"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/view_btn_chat_status_config"
|
||||
android:bufferType="spannable"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:drawableTop="@drawable/view_btn_chat_status_config_online_color"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center"
|
||||
android:overScrollMode="never"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:tag="@string/dialog_msg_status_online_config"
|
||||
android:text="@string/dialog_msg_status_online_config"
|
||||
android:textColor="@drawable/view_btn_chat_status_config_textcolor" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioButton3"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:background="@drawable/view_btn_chat_status_config"
|
||||
android:button="@null"
|
||||
android:checked="false"
|
||||
android:drawableTop="@drawable/view_btn_chat_status_config_off_color"
|
||||
android:gravity="center"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:tag="@string/dialog_msg_status_offline_config"
|
||||
android:text="@string/dialog_msg_status_offline_config"
|
||||
android:textColor="@drawable/view_btn_chat_status_config_textcolor" />
|
||||
</RadioGroup>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:background="@drawable/bg_msg_address_book_user_btn_fan"
|
||||
android:text="@string/aristocrat_determine"
|
||||
android:textColor="#FFFFFF"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
61
main/src/main/res/layout/dialog_msg_more.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?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="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_msg_more"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_config"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="start"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@mipmap/ic_msg_m_config" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_msg_m_config"
|
||||
android:textColor="#333333"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_read"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@mipmap/ic_msg_status_config" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_msg_status_config"
|
||||
android:textColor="#333333"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
47
main/src/main/res/layout/dialog_user_avatar.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:background="@drawable/bg_user_avatar"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="4"
|
||||
tools:itemCount="18"
|
||||
tools:listitem="@layout/item_user_avatar_select" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#00000000"
|
||||
android:text="@string/dialog_user_info_camera"
|
||||
android:drawableTop="@mipmap/ic_user_info_camera" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/album"
|
||||
android:background="#00000000"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/dialog_user_info_album"
|
||||
android:drawableTop="@mipmap/ic_user_info_album" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -49,10 +49,23 @@
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@mipmap/ic_msg_contacts"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/news_icon_more"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_weight="0.1"
|
||||
tools:visibility="visible"
|
||||
android:src="@mipmap/btn_more_black"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="95dp"
|
||||
android:layout_height="95dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
app:riv_corner_radius="10dp"
|
||||
android:id="@+id/img_img"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@mipmap/ic_message_hi_config_image_add"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_close" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
51
main/src/main/res/layout/view_message_hi_config_item.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="60dp"
|
||||
android:background="@drawable/dialog_bg_msg_hi_config_unselect">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/audio_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/dialog_msg_hi_config_record"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:src="@mipmap/ic_message_hi_config_record"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/audio_text"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_del" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/audio_del"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_play" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="60dp"
|
||||
android:background="@drawable/dialog_bg_msg_hi_config_unselect">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/dialog_msg_hi_config_text_hint"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/edit_edit"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_del" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/edit_del"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_edit" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
54
main/src/main/res/layout/view_user_info_birthday.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/birthday_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/dialog_bg_msg_hi_config_unselect">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/audio_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/activity_reg_user_info_birthday_text"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_image"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@mipmap/icon_arrow_right"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tint="#777777" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_del" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_play"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/audio_del"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_message_hi_config_play" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
52
main/src/main/res/layout/view_user_info_sex.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="153dp"
|
||||
android:layout_height="82dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/sex_bg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/dialog_bg_chat_status_config_select"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sex_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@mipmap/ic_man" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sex_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/activity_reg_user_info_sex_man" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sex_top_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_man_avatar" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
main/src/main/res/mipmap-xxhdpi/bg_hi_config_record_info.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_btn_hi_config_record.png
Normal file
After Width: | Height: | Size: 87 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_btn_hi_config_record_in.png
Normal file
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_hi_config_record_img.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_man.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_man_avatar.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_message_hi_config_audio.png
Normal file
After Width: | Height: | Size: 659 B |
BIN
main/src/main/res/mipmap-xxhdpi/ic_message_hi_config_close.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_message_hi_config_del.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_message_hi_config_edit.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 5.4 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_message_hi_config_play.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_message_hi_config_record.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_msg_m_config.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_msg_status_config.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_user_info_album.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_user_info_camera.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_woman.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
main/src/main/res/mipmap-xxhdpi/ic_woman_avatar.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
@ -37,4 +37,37 @@
|
||||
<string name="activity_msg_addressbook_tab_fan2">回關</string>
|
||||
<string name="activity_msg_addressbook_tab_mutual">互相關注</string>
|
||||
<string name="activity_msg_chat_top_tip1">赠送礼物陪伴TA~</string>
|
||||
<string name="dialog_msg_m_config">消息設置</string>
|
||||
<string name="dialog_msg_status_config">接單設置</string>
|
||||
<string name="dialog_msg_status_online_config">在線</string>
|
||||
<string name="dialog_msg_status_offline_config">離線</string>
|
||||
<string name="dialog_msg_hi_config_save">保存設置</string>
|
||||
<string name="dialog_msg_hi_config_audio">語音</string>
|
||||
<string name="dialog_msg_hi_config_text">文案</string>
|
||||
<string name="dialog_msg_hi_config_image">圖片</string>
|
||||
<string name="dialog_msg_hi_config_record">開始錄製</string>
|
||||
<string name="dialog_msg_hi_config_text_hint">請輸入文案</string>
|
||||
<string name="dialog_msg_hi_config_audio_title">語音簽名</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips1">錄製一段自己的聲音</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips2">可以是自我介紹,交友意向,唱歌等,最多5秒</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips3">例如:</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips4">1.我願變成童話裡,你愛的那個天使 \n2.我還是很喜歡你,像風走了八千裡,不問歸期 \n3.我想吃碗面。什麼面?你的心裡面</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn">長按錄製</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn_play">點擊播放</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn_reset">重錄</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn_save">保存</string>
|
||||
<string name="dialog_msg_hi_config_audio_refuse_save_image">至少传一张图片</string>
|
||||
<string name="dialog_msg_hi_config_audio_refuse_save_text">至少传一条文字消息</string>
|
||||
<string name="dialog_msg_hi_config_audio_refuse_save_audio">至少传一条语音消息</string>
|
||||
<string name="activity_reg_user_info_title">完善個人信息</string>
|
||||
<string name="activity_reg_user_info_sex_title">性别</string>
|
||||
<string name="activity_reg_user_info_sex_man">男生</string>
|
||||
<string name="activity_reg_user_info_sex_woman">女生</string>
|
||||
<string name="activity_reg_user_info_birthday_title">生日</string>
|
||||
<string name="activity_reg_user_info_birthday_text">选择你的生日</string>
|
||||
<string name="dialog_user_info_album">圖庫</string>
|
||||
<string name="dialog_user_info_camera">相機</string>
|
||||
<string name="year">年</string>
|
||||
<string name="month">月</string>
|
||||
<string name="day">日</string>
|
||||
</resources>
|
@ -37,4 +37,37 @@
|
||||
<string name="activity_msg_addressbook_tab_fan2">Return</string>
|
||||
<string name="activity_msg_addressbook_tab_mutual">Mutual</string>
|
||||
<string name="activity_msg_chat_top_tip1">Present a gift to accompany him/her~</string>
|
||||
<string name="dialog_msg_m_config">Message Settings</string>
|
||||
<string name="dialog_msg_status_config">Order Settings</string>
|
||||
<string name="dialog_msg_status_online_config">Online</string>
|
||||
<string name="dialog_msg_status_offline_config">Offline</string>
|
||||
<string name="dialog_msg_hi_config_save">Save</string>
|
||||
<string name="dialog_msg_hi_config_audio">Audio</string>
|
||||
<string name="dialog_msg_hi_config_text">Text</string>
|
||||
<string name="dialog_msg_hi_config_image">Image</string>
|
||||
<string name="dialog_msg_hi_config_record">Please enter the text</string>
|
||||
<string name="dialog_msg_hi_config_text_hint">Start recording</string>
|
||||
<string name="dialog_msg_hi_config_audio_title">Audio Sign</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips1">錄製一段自己的聲音</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips2">可以是自我介紹,交友意向,唱歌等,最多5秒</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips3">例如:</string>
|
||||
<string name="dialog_msg_hi_config_audio_tips4">1.我願變成童話裡,你愛的那個天使 \n2.我還是很喜歡你,像風走了八千裡,不問歸期 \n3.我想吃碗面。什麼面?你的心裡面</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn">長按錄製</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn_play">點擊播放</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn_reset">重錄</string>
|
||||
<string name="dialog_msg_hi_config_audio_btn_save">保存</string>
|
||||
<string name="dialog_msg_hi_config_audio_refuse_save_image">至少传一张图片</string>
|
||||
<string name="dialog_msg_hi_config_audio_refuse_save_text">至少传一条文字消息</string>
|
||||
<string name="dialog_msg_hi_config_audio_refuse_save_audio">至少传一条语音消息</string>
|
||||
<string name="activity_reg_user_info_title">完善個人信息</string>
|
||||
<string name="activity_reg_user_info_sex_title">Sex</string>
|
||||
<string name="activity_reg_user_info_sex_man">Man</string>
|
||||
<string name="activity_reg_user_info_sex_woman">Woman</string>
|
||||
<string name="activity_reg_user_info_birthday_title">Birthday</string>
|
||||
<string name="activity_reg_user_info_birthday_text">Select your Birthday</string>
|
||||
<string name="dialog_user_info_album">Album</string>
|
||||
<string name="dialog_user_info_camera">Camera</string>
|
||||
<string name="year">年</string>
|
||||
<string name="month">月</string>
|
||||
<string name="day">日</string>
|
||||
</resources>
|
||||
|