update 联系方式

This commit is contained in:
zlzw 2023-03-27 16:16:23 +08:00
parent 0c6eac2936
commit 2b56eff39a
12 changed files with 417 additions and 45 deletions

View File

@ -0,0 +1,162 @@
package com.yunbao.common.bean;
import androidx.annotation.NonNull;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.annotations.SerializedName;
/**
* 联系方式
*/
public class LiveAnchorCallMeModel extends BaseModel {
@SerializedName("id")
private int id;
@SerializedName("isShow")
private int isShow;
@SerializedName("gift_id")
private int giftId;
@SerializedName("giftImage")
private String giftImage;
@SerializedName("content")
private String content;
@SerializedName("wechat")
private AppBean wechat;
@SerializedName("line")
private AppBean line;
@SerializedName("whatsApp")
private AppBean whatsApp;
public LiveAnchorCallMeModel() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getGiftImage() {
return giftImage;
}
public void setGiftImage(String giftImage) {
this.giftImage = giftImage;
}
public int getIsShow() {
return isShow;
}
public void setIsShow(int isShow) {
this.isShow = isShow;
}
public int getGiftId() {
return giftId;
}
public void setGiftId(int giftId) {
this.giftId = giftId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public AppBean getWechat() {
if (wechat == null) {
wechat = new AppBean();
}
return wechat;
}
public void setWechat(AppBean wechat) {
this.wechat = wechat;
}
public AppBean getLine() {
if (line == null) {
line = new AppBean();
}
return line;
}
public void setLine(AppBean line) {
this.line = line;
}
public AppBean getWhatsApp() {
if (whatsApp == null) {
whatsApp = new AppBean();
}
return whatsApp;
}
public void setWhatsApp(AppBean whatsApp) {
this.whatsApp = whatsApp;
}
@Override
public String toString() {
return "LiveAnchorCallMeModel{" +
"id=" + id +
", isShow=" + isShow +
", giftId=" + giftId +
", giftImage='" + giftImage + '\'' +
", content='" + content + '\'' +
", wechat=" + wechat +
", line=" + line +
", whatsApp=" + whatsApp +
'}';
}
public static class AppBean {
private String number;
private int isShow;
public AppBean() {
}
public AppBean(String number, int isShow) {
this.number = number;
this.isShow = isShow;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public int getIsShow() {
return isShow;
}
public void setIsShow(int isShow) {
this.isShow = isShow;
}
@NonNull
@Override
public String toString() {
return "AppBean{" +
"number='" + number + '\'' +
", isShow=" + isShow +
'}';
}
public JSONObject toJSONObject() {
return (JSONObject) JSON.toJSON(this);
}
}
}

View File

@ -44,7 +44,7 @@ public class API extends BaseApi {
public PDLiveApi pdLiveApi(Context context) {
if (null == pdLiveApi) {
//实例化gson
pdLiveApi=createPDLiveApi(true);
pdLiveApi = createPDLiveApi(true, true);
}
return pdLiveApi;
}
@ -52,10 +52,23 @@ public class API extends BaseApi {
/**
* 创建新的PDLiveApi兼容部分接口需要控制是否添加UID参数
* 仅有需要不添加uid的接口使用默认请用pdLiveApi()
*
* @param isNeedUid 是否需要用户uid参数
* @return PDLiveApi
*/
public PDLiveApi createPDLiveApi(boolean isNeedUid){
public PDLiveApi createPDLiveApi(boolean isNeedUid) {
return createPDLiveApi(isNeedUid, true);
}
/**
* 创建新的PDLiveApi兼容部分接口需要控制是否添加UID参数
* 仅有需要不添加uid或token的接口使用默认请用pdLiveApi()
*
* @param isNeedUid 是否需要用户uid参数
* @param isNeedToken 是否需要用户Token
* @return PDLiveApi
*/
public PDLiveApi createPDLiveApi(boolean isNeedUid, boolean isNeedToken) {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
@ -64,20 +77,20 @@ public class API extends BaseApi {
OkHttpClient.Builder builder = new OkHttpClient()
.newBuilder()
.addInterceptor(initQuery(isNeedUid,CommonAppContext.sInstance.getApplicationContext()))
.addInterceptor(initQuery(isNeedUid, isNeedToken, CommonAppContext.sInstance.getApplicationContext()))
.addInterceptor(loggingInterceptor);
return create(builder.build(),
GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class);
}
//公共参数
public Interceptor initQuery(boolean isNeedUid,final Context context) {
public Interceptor initQuery(boolean isNeedUid, boolean isNeedToken, final Context context) {
Interceptor addQueryParameterInterceptor = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//配置公共参数
request = new ParamsContext(request, context).getInRequest(isNeedUid);
request = new ParamsContext(request, context).getInRequest(isNeedUid, isNeedToken);
return chain.proceed(request);
}
};

View File

@ -1,5 +1,6 @@
package com.yunbao.common.http;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.BaseModel;
@ -14,6 +15,7 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
@ -575,4 +577,27 @@ public interface PDLiveApi {
Observable<ResponseModel<List<ListInfoMessageModel>>> getAnchorMsg(
@Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit
);
/**
* 设置主播联系方式
*/
@GET("/api/public/?service=Live.setAnchorContact")
Observable<ResponseModel<String>> setAnchorContact(
@Query("liveuid") String liveUid,
@Query("isShow") int show,
@Query("gift_id") int giftId,
@Query("content") String content,
@Query("wechat") JSONObject wechat,
@Query("line") JSONObject line,
@Query("whatsApp") JSONObject whatsApp
);
/**
* 获取主播联系方式
*/
@GET("/api/public/?service=Live.getContactInfo")
Observable<ResponseModel<LiveAnchorCallMeModel>> getContactInfo(
@Query("liveuid") String liveUid
);
}

View File

@ -20,7 +20,7 @@ public class GetRequestParams implements IRequestParam {
* @return
*/
@Override
public Request getRequest(boolean isNeedUid, Request request, Context context) {
public Request getRequest(boolean isNeedUid,boolean isNeedToken, Request request, Context context) {
//添加公共参数
if (IMLoginManager.isLogin(context)) {
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
@ -36,8 +36,10 @@ public class GetRequestParams implements IRequestParam {
if (isNeedUid) {
builder.addQueryParameter("uid", String.valueOf(model.getId()));
}
if(isNeedToken) {
builder.addQueryParameter("token", model.getToken());
}
}
return request.newBuilder().url(builder.build()).build();

View File

@ -5,5 +5,5 @@ import android.content.Context;
import okhttp3.Request;
public interface IRequestParam {
Request getRequest(boolean isNeedUid,Request request, Context context);
Request getRequest(boolean isNeedUid,boolean isNeedToken, Request request, Context context);
}

View File

@ -14,7 +14,7 @@ public class ParamsContext {
this.request = request;
}
public Request getInRequest(boolean isNeedUid) {
public Request getInRequest(boolean isNeedUid,boolean isNeedToken) {
switch (request.method()) {
case "GET":
iRequestParam = new GetRequestParams();
@ -23,6 +23,6 @@ public class ParamsContext {
iRequestParam = new PostRequestParams();
break;
}
return iRequestParam.getRequest(isNeedUid,request, context);
return iRequestParam.getRequest(isNeedUid,isNeedToken,request, context);
}
}

View File

@ -12,7 +12,7 @@ import okhttp3.Request;
public class PostRequestParams implements IRequestParam {
@Override
public Request getRequest(boolean isNeedUid, Request request, Context context) {
public Request getRequest(boolean isNeedUid,boolean isNeedToken, Request request, Context context) {
if (request.body() instanceof FormBody) {
FormBody.Builder bodyBuilder = new FormBody.Builder();
@ -32,7 +32,9 @@ public class PostRequestParams implements IRequestParam {
if (isNeedUid) {
bodyBuilder.addEncoded("uid", String.valueOf(model.getId()));
}
if(isNeedToken) {
bodyBuilder.addEncoded("token", model.getToken());
}
formBody = bodyBuilder.build();
}
}

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.Constants;
import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveModel;
@ -16,6 +17,7 @@ import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
@ -45,6 +47,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import retrofit2.http.Query;
/**
@ -1145,6 +1148,56 @@ public class LiveNetManager {
}).isDisposed();
}
/**
* 设置主播联系方式
* @param liveUid 直播间id
* @param callMe 载体
* @param callback 回调
*/
public void setAnchorCallMe(String liveUid,
LiveAnchorCallMeModel callMe,
HttpCallback<String> callback) {
API.get().createPDLiveApi(false, false)
.setAnchorContact(liveUid,
callMe.getIsShow(),
callMe.getGiftId(),
callMe.getContent(),
callMe.getWechat().toJSONObject(),
callMe.getLine().toJSONObject(),
callMe.getWhatsApp().toJSONObject())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}, throwable -> {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}).isDisposed();
}
/**
* 获取主播联系方式
*
* @param liveUid 直播间id
* @param callback 回调
*/
public void getContactInfo(String liveUid, HttpCallback<LiveAnchorCallMeModel> callback) {
API.get().pdLiveApi(mContext)
.getContactInfo(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}, throwable -> {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}).isDisposed();
}
/**
* 直播间取消网络请求
*/

View File

@ -13,6 +13,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.PrankGiftBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
@ -86,6 +87,7 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
return list.size();
}
public static class TmpData {
private String value;
private int status;
@ -153,6 +155,9 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
@Override
public void setData(TmpData data, int position) {
super.setData(data, position);
if (!StringUtil.isEmpty(data.getValue())) {
ImgLoader.display(mContext, data.getValue(), giftIcon);
}
}
@ -163,6 +168,9 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
public void onSelectGift(PrankGiftBean bean) {
if (bean != null) {
ImgLoader.display(mContext, bean.getIcon(), giftIcon);
if (onItemClickListener != null) {
onItemClickListener.onItemClick(new TmpData(bean.getGiftId() + "", 1, TYPE_GIFT), getAbsoluteAdapterPosition());
}
}
}
@ -187,10 +195,19 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
letter = itemView.findViewById(R.id.letterText);
edit = itemView.findViewById(R.id.edit);
edit.setOnClickListener(v -> {
new LiveAnchorEditCallMeEditAppDialog(mContext, LiveAnchorEditCallMeEditAppDialog.TYPE_LETTER).setOnValueListener(new OnItemClickListener<String>() {
new LiveAnchorEditCallMeEditAppDialog(mContext, TYPE_LETTER).setDefValue(list.get(1).getValue()).setOnValueListener(new OnItemClickListener<String>() {
@Override
public void onItemClick(String bean, int position) {
if (StringUtil.isEmpty(bean)) {
letter.setText("未填写");
letter.setTextColor(Color.parseColor("#80FFFFFF"));
} else {
letter.setText(bean);
letter.setTextColor(Color.WHITE);
}
if (onItemClickListener != null) {
onItemClickListener.onItemClick(new TmpData(letter.getText().toString(), 1, TYPE_LETTER), getAbsoluteAdapterPosition());
}
}
}).showDialog();
});
@ -215,20 +232,17 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
edit = itemView.findViewById(R.id.app_edit);
status = itemView.findViewById(R.id.app_switch);
icon = itemView.findViewById(R.id.gift_icon);
itemView.setOnClickListener(v -> {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(list.get(getAbsoluteAdapterPosition()), getAbsoluteAdapterPosition());
}
});
}
@Override
public void setData(TmpData data, int position) {
super.setData(data, position);
if (StringUtil.isEmpty(data.getValue())) {
contact.setTag(null);
contact.setText("未填写");
contact.setTextColor(Color.parseColor("#80FFFFFF"));
} else {
contact.setTag(data.getValue());
contact.setText(data.getValue());
contact.setTextColor(Color.WHITE);
}
@ -237,11 +251,40 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter<LiveAnchor
} else if (data.getStatus() == 1) {
status.setImageResource(R.mipmap.special_icon_on);
}
status.setTag(data.getStatus());
status.setOnClickListener(v -> {
if (StringUtil.isEmpty((String) contact.getTag())) {
ToastUtil.show("请填写联系方式后再启用");
return;
}
int tag = (int) v.getTag();
if (tag == 0) {
status.setImageResource(R.mipmap.special_icon_on);
status.setTag(1);
} else {
status.setImageResource(R.mipmap.special_icon_off);
status.setTag(0);
}
if (onItemClickListener != null) {
onItemClickListener.onItemClick(new TmpData((String) contact.getTag(), (Integer) status.getTag(), data.getType()), position);
}
});
edit.setOnClickListener(v -> {
new LiveAnchorEditCallMeEditAppDialog(mContext, data.getType()).setOnValueListener(new OnItemClickListener<String>() {
new LiveAnchorEditCallMeEditAppDialog(mContext, data.getType()).setDefValue((String) contact.getTag()).setOnValueListener(new OnItemClickListener<String>() {
@Override
public void onItemClick(String bean, int position) {
if (StringUtil.isEmpty(bean)) {
contact.setTag(null);
contact.setText("未填写");
contact.setTextColor(Color.parseColor("#80FFFFFF"));
} else {
contact.setTag(bean);
contact.setText(bean);
contact.setTextColor(Color.WHITE);
}
if (onItemClickListener != null) {
onItemClickListener.onItemClick(new TmpData((String) contact.getTag(), (Integer) status.getTag(), data.getType()), position);
}
}
}).showDialog();
});

View File

@ -1,24 +1,22 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.bean.PrankGiftBean;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter;
import com.yunbao.live.adapter.LivePrankRecyclerAdapter;
import java.util.ArrayList;
import java.util.List;
@ -26,7 +24,9 @@ import java.util.List;
public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow {
String mLiveUid = "98275";
RecyclerView list;
LiveAnchorCallMeModel callMeModel;
LiveAnchorEditCallMeAdapter adapter;
ImageView status;
public LiveAnchorEditCallMeDialog(@NonNull Context context) {
super(context);
@ -51,23 +51,86 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow {
}
private void initData() {
List<LiveAnchorEditCallMeAdapter.TmpData> data = new ArrayList<>();
data.add(new LiveAnchorEditCallMeAdapter.TmpData(null, 1, LiveAnchorEditCallMeAdapter.TYPE_GIFT));
data.add(new LiveAnchorEditCallMeAdapter.TmpData("测试测试", 1, LiveAnchorEditCallMeAdapter.TYPE_LETTER));
data.add(new LiveAnchorEditCallMeAdapter.TmpData("13333333333", 1, LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT));
data.add(new LiveAnchorEditCallMeAdapter.TmpData("13333333333", 0, LiveAnchorEditCallMeAdapter.TYPE_APP_LINE));
data.add(new LiveAnchorEditCallMeAdapter.TmpData(null, 0, LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP));
adapter.setList(data);
LiveNetManager.get(getContext())
.getContactInfo(mLiveUid, new HttpCallback<LiveAnchorCallMeModel>() {
@Override
public void onSuccess(LiveAnchorCallMeModel data) {
callMeModel = data;
List<LiveAnchorEditCallMeAdapter.TmpData> list = new ArrayList<>();
list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getGiftImage(), 1, LiveAnchorEditCallMeAdapter.TYPE_GIFT));
list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getContent(), 1, LiveAnchorEditCallMeAdapter.TYPE_LETTER));
list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getWechat().getNumber(), data.getWechat().getIsShow(), LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT));
list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getLine().getNumber(), data.getLine().getIsShow(), LiveAnchorEditCallMeAdapter.TYPE_APP_LINE));
list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getWhatsApp().getNumber(), data.getWhatsApp().getIsShow(), LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP));
adapter.setList(list);
}
@Override
public void onError(String error) {
}
});
}
private void initView() {
list = findViewById(R.id.anchor_call_list);
adapter = new LiveAnchorEditCallMeAdapter(getContext(),getRootView());
status = findViewById(R.id.say_switch);
findViewById(R.id.btn_close).setOnClickListener(v -> dismiss());
adapter = new LiveAnchorEditCallMeAdapter(getContext(), getRootView());
adapter.setOnItemClickListener(new OnItemClickListener<LiveAnchorEditCallMeAdapter.TmpData>() {
@Override
public void onItemClick(LiveAnchorEditCallMeAdapter.TmpData bean, int position) {
if (callMeModel == null) {
callMeModel = new LiveAnchorCallMeModel();
}
if (position == 0) {
callMeModel.setGiftId(Integer.parseInt(bean.getValue()));
} else if (position == 1) {
callMeModel.setContent(bean.getValue());
} else if (bean.getType() == LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT) {
callMeModel.setWechat(new LiveAnchorCallMeModel.AppBean(bean.getValue(), bean.getStatus()));
} else if (bean.getType() == LiveAnchorEditCallMeAdapter.TYPE_APP_LINE) {
callMeModel.setLine(new LiveAnchorCallMeModel.AppBean(bean.getValue(), bean.getStatus()));
} else if (bean.getType() == LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP) {
callMeModel.setWhatsApp(new LiveAnchorCallMeModel.AppBean(bean.getValue(), bean.getStatus()));
}
}
});
status.setTag(0);
status.setOnClickListener(v -> {
int tag = (int) v.getTag();
if (tag == 0) {
status.setImageResource(R.mipmap.special_icon_on);
status.setTag(1);
} else {
status.setImageResource(R.mipmap.special_icon_off);
status.setTag(0);
}
callMeModel.setIsShow((Integer) status.getTag());
});
list.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
list.setAdapter(adapter);
}
@Override
protected void onDismiss() {
super.onDismiss();
if (callMeModel == null) {
return;
}
LiveNetManager.get(getContext())
.setAnchorCallMe(mLiveUid, callMeModel, new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
ToastUtil.show("成功");
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
}

View File

@ -1,8 +1,12 @@
package com.yunbao.live.dialog;
import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_APP_LINE;
import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT;
import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP;
import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_LETTER;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
@ -15,10 +19,6 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.live.R;
public class LiveAnchorEditCallMeEditAppDialog extends AbsDialogPopupWindow {
public static final int TYPE_LETTER = 0;
public static final int TYPE_APP_WECHAT = 2;
public static final int TYPE_APP_LINE = 3;
public static final int TYPE_APP_WHATSAPP = 4;
OnItemClickListener<String> clickListener;
private int type;
private String defValue;
@ -49,8 +49,9 @@ public class LiveAnchorEditCallMeEditAppDialog extends AbsDialogPopupWindow {
return R.layout.dialog_anchor_call_edit_app;
}
public void setDefValue(String defValue) {
public LiveAnchorEditCallMeEditAppDialog setDefValue(String defValue) {
this.defValue = defValue;
return this;
}
public LiveAnchorEditCallMeEditAppDialog setOnValueListener(OnItemClickListener<String> clickListener) {
@ -58,6 +59,13 @@ public class LiveAnchorEditCallMeEditAppDialog extends AbsDialogPopupWindow {
return this;
}
@Override
protected void onDismiss() {
super.onDismiss();
((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
@Override
protected void onCreate() {
super.onCreate();
@ -100,7 +108,7 @@ public class LiveAnchorEditCallMeEditAppDialog extends AbsDialogPopupWindow {
edit = findViewById(R.id.edit);
findViewById(R.id.btn_back).setOnClickListener(v -> dismiss());
findViewById(R.id.submit).setOnClickListener(v -> {
clickListener.onItemClick(edit.getText().toString(), 0);
clickListener.onItemClick(edit.getText().toString(), type);
dismiss();
});
}

View File

@ -37,8 +37,9 @@
android:textSize="16sp" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/btn_close"
android:layout_width="19dp"
android:layout_height="match_parent"
android:layout_marginEnd="16dp"
app:srcCompat="@mipmap/live_close" />