update
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.shayu.onetoone.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.GiftListAdapter;
|
||||
import com.shayu.onetoone.bean.GiftBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GiftDialog extends AbsDialogPopupWindow {
|
||||
RecyclerView gifList;
|
||||
GiftListAdapter mAdapter;
|
||||
TextView money;
|
||||
Button topUpBtn;
|
||||
Button sendBtn;
|
||||
|
||||
|
||||
public GiftDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.view_message_input_gift;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
gifList = findViewById(R.id.gift_list);
|
||||
money = findViewById(R.id.money);
|
||||
topUpBtn = findViewById(R.id.top_up_btn);
|
||||
sendBtn = findViewById(R.id.send_btn);
|
||||
|
||||
mAdapter = new GiftListAdapter(mContext);
|
||||
gifList.setAdapter(mAdapter);
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getGiftList(new HttpCallback<List<GiftBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<GiftBean> data) {
|
||||
mAdapter.setList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.shayu.onetoone.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.yunbao.common.dialog.AbsDialogCenterPopupWindow;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
public class TipsDialog extends AbsDialogCenterPopupWindow {
|
||||
private String title, content;
|
||||
private OnDialogClickListener onDialogClickListener;
|
||||
TextView mTitle,mContent;
|
||||
Button mCancel,mApply;
|
||||
|
||||
public TipsDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public TipsDialog setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TipsDialog setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TipsDialog setOnDialogClickListener(OnDialogClickListener onDialogClickListener) {
|
||||
this.onDialogClickListener = onDialogClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_tips1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
mTitle=findViewById(R.id.title);
|
||||
mContent=findViewById(R.id.content);
|
||||
mCancel=findViewById(R.id.cancel);
|
||||
mApply=findViewById(R.id.apply);
|
||||
|
||||
if(StringUtil.isEmpty(title)){
|
||||
mTitle.setVisibility(GONE);
|
||||
}else{
|
||||
mTitle.setText(title);
|
||||
}
|
||||
if(StringUtil.isEmpty(content)){
|
||||
mContent.setVisibility(GONE);
|
||||
}else{
|
||||
mContent.setText(content);
|
||||
}
|
||||
mCancel.setOnClickListener(v -> {
|
||||
if(onDialogClickListener!=null){
|
||||
onDialogClickListener.onCancel(dialog);
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
mApply.setOnClickListener(v ->{
|
||||
if(onDialogClickListener!=null){
|
||||
onDialogClickListener.onApply(dialog);
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user