diff --git a/OneToOne/src/main/AndroidManifest.xml b/OneToOne/src/main/AndroidManifest.xml index 4f1f2dfc4..84e2ac6ad 100644 --- a/OneToOne/src/main/AndroidManifest.xml +++ b/OneToOne/src/main/AndroidManifest.xml @@ -86,11 +86,11 @@ - + + @@ -162,10 +168,10 @@ android:windowSoftInputMode="stateHidden|adjustResize" /> + android:windowSoftInputMode="stateHidden|adjustResize" /> + android:windowSoftInputMode="stateHidden|adjustResize" /> + + + + >() { + @Override + public void onSuccess(List data) { + if (data.size() > 0) { + if ((data.size() - 1) > index && index > 0) { + data.get(index).setSelect(true); + totalConvertibility.setText(String.valueOf(data.get(0).getNum())); + number = data.get(index).getNum(); + } else { + if (TextUtils.isEmpty(diamondExchangeInput.getText().toString())) { + data.get(0).setSelect(true); + totalConvertibility.setText(String.valueOf(data.get(0).getNum())); + number = data.get(0).getNum(); + } else { + totalConvertibility.setText(String.valueOf(data.get(0).getNum())); + for (int i = 0; i < data.size(); i++) { + data.get(i).setSelect(false); + } + } + + } + + exchangeAdapter.addData(data); + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } + }); + diamondExchangeInput.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + if (!TextUtils.isEmpty(diamondExchangeInput.getText().toString()) && !TextUtils.isEmpty(number)) { + exchangeAdapter.unSelect(); + number = null; + index = -1; + } + + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_back), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + finish(); + } + }); } private void initData() { - OTONetManager.getInstance(mContext).getExchangeList("yuanbao", new HttpCallback>() { + + if (getIntent() != null && getIntent().getBundleExtra("bundle") != null) { + type = getIntent().getBundleExtra("bundle").getString("type"); + if (TextUtils.equals(type, "yuanbao")) { + title.setText(getString(R.string.my_arnings_exchange_star)); + } else { + title.setText(getString(R.string.my_arnings_exchange_diamond)); + } + } + OTONetManager.getInstance(mContext).getExchangeList(type, new HttpCallback>() { @Override public void onSuccess(List data) { - exchangeAdapter.addData(data); + if (data.size() > 0) { + data.get(0).setSelect(true); + totalConvertibility.setText(String.valueOf(data.get(0).getNum())); + number = data.get(0).getNum(); + exchangeAdapter.addData(data); + } + } @Override @@ -55,4 +199,11 @@ public class DiamondExchangeActivity extends AbsOTOActivity { } }); } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onExchangeModel(DiamondExchangeEvent event) { + number = event.getNum(); + index = event.getIndex(); + diamondExchangeInput.setText(""); + } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/ExchangeRecordActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/ExchangeRecordActivity.java new file mode 100644 index 000000000..a2ef40e51 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/ExchangeRecordActivity.java @@ -0,0 +1,114 @@ +package com.shayu.onetoone.activity; + +import android.os.Bundle; +import android.text.TextUtils; + +import androidx.annotation.NonNull; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.shayu.onetoone.R; +import com.shayu.onetoone.adapter.ExchangeRecordAdapter; +import com.shayu.onetoone.bean.ExchangeRecordModel; +import com.shayu.onetoone.manager.OTONetManager; +import com.shayu.onetoone.manager.RouteManager; +import com.yanzhenjie.recyclerview.SwipeRecyclerView; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.util.List; + +import io.rong.imkit.widget.refresh.SmartRefreshLayout; +import io.rong.imkit.widget.refresh.api.RefreshLayout; +import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener; +import io.rong.imkit.widget.refresh.listener.OnRefreshListener; +import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader; + +@Route(path = RouteManager.ACTIVITY_EXCHANGE_RECORD) +public class ExchangeRecordActivity extends AbsOTOActivity { + private ExchangeRecordAdapter recordAdapter; + private SmartRefreshLayout mRefreshLayout; + private SwipeRecyclerView recyclerView; + private int page = 1; + + private String type = "10"; + private String mType = "10"; + + @Override + protected int getLayoutId() { + return R.layout.activity_exchange_record; + + } + + @Override + protected void main(Bundle savedInstanceState) { + if (getIntent() != null && getIntent().getBundleExtra("bundle") != null) { + mType = getIntent().getBundleExtra("bundle").getString("type"); + if (TextUtils.equals(mType, "yuanbao")) { + type = "11"; + } else { + type = "10"; + } + } + initView(); + initData(); + + } + + private void initView() { + recyclerView = findViewById(R.id.recyclerView); + mRefreshLayout = findViewById(R.id.swipeRefreshLayout); + recordAdapter = new ExchangeRecordAdapter(); + recyclerView.setAdapter(recordAdapter); + mRefreshLayout.setNestedScrollingEnabled(false); + mRefreshLayout.setRefreshHeader(new RongRefreshHeader(mContext)); + mRefreshLayout.setRefreshFooter(new RongRefreshHeader(mContext)); + mRefreshLayout.setOnRefreshListener(new OnRefreshListener() { + public void onRefresh(@NonNull RefreshLayout refreshLayout) { + page = 1; + initData(); + } + }); + this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() { + public void onLoadMore(@NonNull RefreshLayout refreshLayout) { + onConversationListLoadMore(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_back), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + finish(); + } + }); + } + + private void initData() { + OTONetManager.getInstance(mContext). + getExchangeRecord(type, "3", "2", page, new HttpCallback>() { + @Override + public void onSuccess(List data) { + if (page != 1 && data.isEmpty()) { + mRefreshLayout.finishLoadMore(); + return; + } + if (page != 1) { + recordAdapter.addLst(data); + } else { + recordAdapter.setList(data); + } + mRefreshLayout.finishRefresh(); + } + + @Override + public void onError(String error) { + mRefreshLayout.finishRefresh(); + } + }); + + } + + private void onConversationListLoadMore() { + page++; + initData(); + mRefreshLayout.finishLoadMore(); + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/MyArnActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/MyArnActivity.java index 3f35eddb0..19165d452 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/MyArnActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/MyArnActivity.java @@ -4,8 +4,8 @@ package com.shayu.onetoone.activity; import android.os.Bundle; import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import com.alibaba.android.arouter.facade.annotation.Route; import com.shayu.onetoone.R; @@ -14,19 +14,28 @@ import com.shayu.onetoone.bean.FriendAppMoneyLogModel; import com.shayu.onetoone.bean.FriendAppMoneySumModel; import com.shayu.onetoone.manager.OTONetManager; import com.shayu.onetoone.manager.RouteManager; +import com.yanzhenjie.recyclerview.SwipeRecyclerView; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import java.util.List; +import io.rong.imkit.widget.refresh.SmartRefreshLayout; +import io.rong.imkit.widget.refresh.api.RefreshLayout; +import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener; +import io.rong.imkit.widget.refresh.listener.OnRefreshListener; +import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader; + @Route(path = RouteManager.ACTIVITY_MY_ARN) public class MyArnActivity extends AbsOTOActivity { - private TextView todayEarnings, cumulativeIncome; + private TextView todayEarnings, cumulativeIncome, withdrawalSum,withdrawalMoney; private MyArnAdapter myArnAdapter; - private RecyclerView myArnList; + private SwipeRecyclerView myArnList; + private SmartRefreshLayout mRefreshLayout; + private int page = 1; @Override protected int getLayoutId() { @@ -44,9 +53,26 @@ public class MyArnActivity extends AbsOTOActivity { todayEarnings = findViewById(R.id.today_earnings); cumulativeIncome = findViewById(R.id.cumulative_income); myArnList = findViewById(R.id.my_arn_list); + withdrawalSum = findViewById(R.id.withdrawal_sum); + withdrawalMoney = findViewById(R.id.withdrawal_money); + mRefreshLayout = findViewById(R.id.swipeRefreshLayout); myArnList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); myArnAdapter = new MyArnAdapter(); myArnList.setAdapter(myArnAdapter); + mRefreshLayout.setNestedScrollingEnabled(false); + mRefreshLayout.setRefreshHeader(new RongRefreshHeader(mContext)); + mRefreshLayout.setRefreshFooter(new RongRefreshHeader(mContext)); + mRefreshLayout.setOnRefreshListener(new OnRefreshListener() { + public void onRefresh(@NonNull RefreshLayout refreshLayout) { + page = 1; + refreshMyArn(); + } + }); + this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() { + public void onLoadMore(@NonNull RefreshLayout refreshLayout) { + onConversationListLoadMore(); + } + }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.my_arn_back), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -56,18 +82,49 @@ public class MyArnActivity extends AbsOTOActivity { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.diamond_star_coins), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE); + Bundle bundle = new Bundle(); + bundle.putString("type", "yuanbao"); + RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE, bundle); } }); } + private void refreshMyArn() { + OTONetManager.getInstance(mContext).getFriendAppMoneyLogModel("3", "1", page, new HttpCallback>() { + @Override + public void onSuccess(List data) { + if (page != 1 && data.isEmpty()) { + mRefreshLayout.finishLoadMore(); + return; + } + if (page != 1) { + myArnAdapter.addLst(data); + } else { + myArnAdapter.showData(data); + } + mRefreshLayout.finishRefresh(); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + mRefreshLayout.finishRefresh(); + } + }); + } + private void initData() { OTONetManager.getInstance(mContext).getFriendAppMoneySum(new HttpCallback() { @Override public void onSuccess(FriendAppMoneySumModel data) { todayEarnings.setText(data.getToday()); cumulativeIncome.setText(data.getSum()); + withdrawalSum.setText(data.getWithdrawalModel().getSum()); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("$ ") + .append(data.getWithdrawalModel().getMoney()); + withdrawalMoney.setText(stringBuffer.toString()); } @Override @@ -75,16 +132,12 @@ public class MyArnActivity extends AbsOTOActivity { ToastUtil.show(error); } }); - OTONetManager.getInstance(mContext).getFriendAppMoneyLogModel("3", "1", new HttpCallback>() { - @Override - public void onSuccess(List data) { - myArnAdapter.showData(data); - } + refreshMyArn(); + } - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); + private void onConversationListLoadMore() { + page++; + refreshMyArn(); + mRefreshLayout.finishLoadMore(); } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java index 57e3fc193..797a489b8 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java @@ -539,7 +539,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener>() { @Override public void onSuccess(List data) { @@ -134,8 +140,12 @@ public class ChooseLabelActivity extends AbsOTOActivity { public void onSuccess(HttpCallbackModel data) { Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show(); if (data.getCode() == 0) { - RouteManager.forwardMainActivity(); - finish(); + if (isUserHome) { + finish(); + } else { + RouteManager.forwardMainActivity(); + finish(); + } } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/CompleteActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/CompleteActivity.java index 3ad8fe451..ea01f7485 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/CompleteActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/CompleteActivity.java @@ -3,7 +3,6 @@ package com.shayu.onetoone.activity.login; import android.annotation.SuppressLint; import android.app.Dialog; -import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; @@ -21,13 +20,11 @@ import com.blankj.utilcode.util.StringUtils; import com.lxj.xpopup.XPopup; import com.shayu.onetoone.R; import com.shayu.onetoone.activity.AbsOTOActivity; -import com.shayu.onetoone.activity.MainActivity; import com.shayu.onetoone.bean.AvatarBean; import com.shayu.onetoone.manager.OTONetManager; import com.shayu.onetoone.manager.RouteManager; import com.shayu.onetoone.view.UserAvatarPopup; import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.Constants; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; @@ -204,7 +201,7 @@ public class CompleteActivity extends AbsOTOActivity { public void onSuccess(HttpCallbackModel data) { Toast.makeText(mContext, data.getMsg(), Toast.LENGTH_SHORT).show(); if (data.getCode() == 0) { - RouteManager.forwardChooseActivity(); + RouteManager.forwardChooseLabelActivity(false); finish(); } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/FollowActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/FollowActivity.java new file mode 100644 index 000000000..144b73ea3 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/FollowActivity.java @@ -0,0 +1,151 @@ +package com.shayu.onetoone.activity.setting; + +import android.content.Context; +import android.content.Intent; +import android.text.TextUtils; + +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.shayu.onetoone.R; +import com.shayu.onetoone.adapter.SearchAdapter; +import com.shayu.onetoone.bean.SearchUserBean; +import com.shayu.onetoone.utils.MainHttpConsts; +import com.shayu.onetoone.utils.MainHttpUtil; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.event.FollowEvent; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.utils.RouteUtil; + +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + +import java.util.Arrays; +import java.util.List; + +/** + * 我的关注 TA的关注 + */ + +public class FollowActivity extends AbsActivity implements OnItemClickListener { + + public static void forward(Context context, String toUid, int isBlack) { + Intent intent = new Intent(context, FollowActivity.class); + intent.putExtra(Constants.TO_UID, toUid); + intent.putExtra(Constants.isBlack, isBlack); + context.startActivity(intent); + } + + private CommonRefreshView mRefreshView; + private SearchAdapter mAdapter; + private String mToUid; + private int isBlack; + private int intoIndex = 0; + + @Override + protected int getLayoutId() { + return R.layout.activity_follow; + } + + @Override + protected void main() { + mToUid = getIntent().getStringExtra(Constants.TO_UID); + isBlack = getIntent().getIntExtra(Constants.isBlack, 0); + if (TextUtils.isEmpty(mToUid)) { + return; + } + mRefreshView = findViewById(R.id.refreshView); + if (isBlack == 1) { + setTitle(mContext.getString(R.string.my_black)); + } else if (mToUid.equals(CommonAppConfig.getInstance().getUid())) { + setTitle(mContext.getString(R.string.follow_my_follow)); + mRefreshView.setEmptyLayoutId(R.layout.view_no_data_follow); + } else { + setTitle(mContext.getString(R.string.follow_ta_follow)); + mRefreshView.setEmptyLayoutId(R.layout.view_no_data_follow_2); + } + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + if (mAdapter == null) { + mAdapter = new SearchAdapter(mContext, Constants.FOLLOW_FROM_FOLLOW); + mAdapter.setOnItemClickListener(FollowActivity.this); + } + return mAdapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + if (isBlack == 1) { + MainHttpUtil.getBlackList(p, callback); + } else { + MainHttpUtil.getFollowList(mToUid, p, callback); + } + } + + @Override + public List processData(String[] info) { + return JSON.parseArray(Arrays.toString(info), SearchUserBean.class); + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + EventBus.getDefault().register(this); + mRefreshView.initData(); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onFollowEvent(FollowEvent e) { + if (mAdapter != null) { + mAdapter.updateItem(e.getToUid(), e.getIsAttention()); + } + } + + @Override + protected void onDestroy() { + EventBus.getDefault().unregister(this); + MainHttpUtil.cancel(MainHttpConsts.GET_FOLLOW_LIST); + super.onDestroy(); + } + + @Override + public void onItemClick(SearchUserBean bean, int position) { + RouteUtil.forwardUserHome(mContext, bean.getId(), 0); + intoIndex = 1; + } + + + @Override + protected void onResume() { + super.onResume(); + if (intoIndex == 1) { + intoIndex = 0; + mRefreshView.initData(); + } + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/ModifyPwdActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/ModifyPwdActivity.java new file mode 100644 index 000000000..bacfc3b2e --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/ModifyPwdActivity.java @@ -0,0 +1,91 @@ +package com.shayu.onetoone.activity.setting; + +import android.text.TextUtils; +import android.view.View; +import android.widget.EditText; + +import com.alibaba.fastjson.JSON; +import com.shayu.onetoone.R; +import com.shayu.onetoone.activity.user.AuthActivity; +import com.shayu.onetoone.manager.OTONetManager; +import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.utils.ToastUtil; + +import java.util.List; + +/** + * 重置密码 + */ + +public class ModifyPwdActivity extends AbsActivity implements View.OnClickListener { + + private EditText mEditOld; + private EditText mEditNew; + private EditText mEditConfirm; + + @Override + protected int getLayoutId() { + return R.layout.activity_modify_pwd; + } + + @Override + protected void main() { + setTitle(mContext.getString(R.string.modify_pwd)); + mEditOld = (EditText) findViewById(R.id.edit_old); + mEditNew = (EditText) findViewById(R.id.edit_new); + mEditConfirm = (EditText) findViewById(R.id.edit_confirm); + findViewById(R.id.btn_confirm).setOnClickListener(this); + } + + @Override + public void onClick(View v) { + modify(); + } + + private void modify() { + String pwdOld = mEditOld.getText().toString().trim(); + if (TextUtils.isEmpty(pwdOld)) { + mEditOld.setError(mContext.getString(R.string.modify_pwd_old_1)); + return; + } + String pwdNew = mEditNew.getText().toString().trim(); + if (TextUtils.isEmpty(pwdNew)) { + mEditNew.setError(mContext.getString(R.string.modify_pwd_new_1)); + return; + } + String pwdConfirm = mEditConfirm.getText().toString().trim(); + if (TextUtils.isEmpty(pwdConfirm)) { + mEditConfirm.setError(mContext.getString(R.string.modify_pwd_confirm_1)); + return; + } + if (!pwdNew.equals(pwdConfirm)) { + mEditConfirm.setError(mContext.getString(R.string.reg_pwd_error)); + return; + } + + OTONetManager.getInstance(ModifyPwdActivity.this).updatePass(pwdOld, pwdNew, pwdConfirm, new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + if (data.getCode() == 0) { + ToastUtil.show(data.getMsg()); + finish(); + } else { + ToastUtil.show(data.getMsg()); + } + } + + @Override + public void onError(String error) { + + } + }); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/OneMsgSettActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/OneMsgSettActivity.java new file mode 100644 index 000000000..f71749eb0 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/OneMsgSettActivity.java @@ -0,0 +1,268 @@ +package com.shayu.onetoone.activity.setting; + +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.ImageView; + +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.shayu.onetoone.R; +import com.shayu.onetoone.activity.AbsOTOActivity; +import com.yunbao.common.adapter.MsgFollowAdapter; +import com.yunbao.common.bean.MsgSwitchDetailModel; +import com.yunbao.common.http.ResponseData; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.main.MainNetManager; +import com.yunbao.common.utils.SpUtil; +import com.yunbao.common.utils.ToastUtil; + +public class OneMsgSettActivity extends AbsOTOActivity { + ImageView dt_switch, hdd_switch, lt_switch, xt_switch, kb_switch, privateChatMessageSwitch; + public static final String SWITCH_PRIVATE_CHAT_MSG = "private_chat_message_switch"; + + RecyclerView follow_list; + + @Override + protected int getLayoutId() { + return R.layout.activity_msg_sett; + } + + @Override + protected void main(Bundle savedInstanceState) { + setTitle(getString(R.string.alerts)); + follow_list = (RecyclerView) findViewById(R.id.follow_list); + dt_switch = (ImageView) findViewById(R.id.dt_switch); + hdd_switch = (ImageView) findViewById(R.id.hdd_switch); + lt_switch = (ImageView) findViewById(R.id.lt_switch); + xt_switch = (ImageView) findViewById(R.id.xt_switch); + kb_switch = (ImageView) findViewById(R.id.kb_switch); + privateChatMessageSwitch = findViewById(R.id.private_chat_switch); + getData(); + dt_switch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //打开的 + if (dt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + if (setMsgMasterSwitch("2", "1")) { + dt_switch.setImageResource(R.mipmap.special_icon_off); + } + ; + } else { + if (setMsgMasterSwitch("1", "1")) { + dt_switch.setImageResource(R.mipmap.special_icon_on); + } + ; + } + } + }); + + hdd_switch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //打开的 + if (hdd_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + if (setMsgMasterSwitch("2", "2")) { + hdd_switch.setImageResource(R.mipmap.special_icon_off); + } + ; + } else { + if (setMsgMasterSwitch("1", "2")) { + hdd_switch.setImageResource(R.mipmap.special_icon_on); + } + ; + } + } + }); + + lt_switch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //打开的 + if (lt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + if (setMsgMasterSwitch("2", "3")) { + lt_switch.setImageResource(R.mipmap.special_icon_off); + } + ; + } else { + if (setMsgMasterSwitch("1", "3")) { + lt_switch.setImageResource(R.mipmap.special_icon_on); + } + ; + } + } + }); + + xt_switch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //打开的 + if (xt_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + if (setMsgMasterSwitch("2", "4")) { + xt_switch.setImageResource(R.mipmap.special_icon_off); + } + ; + } else { + if (setMsgMasterSwitch("1", "4")) { + xt_switch.setImageResource(R.mipmap.special_icon_on); + } + ; + } + } + }); + + follow_list.setVisibility(View.GONE); + kb_switch.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int is = 1; + //打开的 + if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + is = 2; + } else { + is = 1; + } + MainNetManager.get(OneMsgSettActivity.this).setBeginShowMsgSwitch(is + "", "1", "", new HttpCallback() { + @Override + public void onSuccess(ResponseData data) { + + Log.e("ds", data.getCode() + ""); + if (data.getCode() == 200) { + Log.e("ds", kb_switch.getDrawable().getCurrent().getConstantState() + ""); + if (kb_switch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + kb_switch.setImageResource(R.mipmap.special_icon_off); + follow_list.setVisibility(View.GONE); + } else { + getData(); + } + } + + } + + @Override + public void onError(String error) { + Log.e("ds", kb_switch.getDrawable().getCurrent().getConstantState() + "11" + error); + + } + }); + } + }); + /* privateChatMessageSwitch.setOnClickListener(view -> { + if (privateChatMessageSwitch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())){ + if(setMsgMasterSwitch("2","5")){ + privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off); + } + }else{ + if(setMsgMasterSwitch("1","5")){ + privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on); + } + } + });*/ + privateChatMessageSwitch.setOnClickListener(view -> { + if (privateChatMessageSwitch.getDrawable().getCurrent().getConstantState().equals(getResources().getDrawable(R.mipmap.special_icon_on).getConstantState())) { + privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off); + SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG, false); + } else { + privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on); + SpUtil.getInstance().setBooleanValue(SWITCH_PRIVATE_CHAT_MSG, true); + } + }); + + follow_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + follow_list.setHasFixedSize(true); + follow_list.setNestedScrollingEnabled(true); + } + + public void getData() { + MainNetManager.get(this) + .getMsgSwitchDetail(new HttpCallback() { + @Override + public void onSuccess(MsgSwitchDetailModel data) { + + if (data.getDynamic_msg_switch().equals("2")) { + dt_switch.setImageResource(R.mipmap.special_icon_off); + } else { + dt_switch.setImageResource(R.mipmap.special_icon_on); + } + + if (data.getInteraction_show_msg_switch().equals("2")) { + hdd_switch.setImageResource(R.mipmap.special_icon_off); + } else { + hdd_switch.setImageResource(R.mipmap.special_icon_on); + } + + if (data.getChat_msg_switch().equals("2")) { + lt_switch.setImageResource(R.mipmap.special_icon_off); + } else { + lt_switch.setImageResource(R.mipmap.special_icon_on); + } + + if (data.getChat_msg_switch().equals("2")) { + lt_switch.setImageResource(R.mipmap.special_icon_off); + } else { + lt_switch.setImageResource(R.mipmap.special_icon_on); + } + + if (data.getSystem_msg_switch().equals("2")) { + xt_switch.setImageResource(R.mipmap.special_icon_off); + } else { + xt_switch.setImageResource(R.mipmap.special_icon_on); + } + + if (data.getSystem_msg_switch().equals("2")) { + xt_switch.setImageResource(R.mipmap.special_icon_off); + } else { + xt_switch.setImageResource(R.mipmap.special_icon_on); + } + + for (int i = 0; i < data.getFollowList().size(); i++) { + if (!data.getFollowList().get(i).getStatus().equals("2")) { + kb_switch.setImageResource(R.mipmap.special_icon_on); + follow_list.setVisibility(View.VISIBLE); + break; + } + + } + if (SpUtil.getInstance().getBooleanValue(SWITCH_PRIVATE_CHAT_MSG)) { + privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_on); + } else { + privateChatMessageSwitch.setImageResource(R.mipmap.special_icon_off); + } + + MsgFollowAdapter topAdapter = new MsgFollowAdapter(OneMsgSettActivity.this, data.getFollowList()); + follow_list.setAdapter(topAdapter); + follow_list.setVisibility(View.VISIBLE); + kb_switch.setImageResource(R.mipmap.special_icon_on); + } + + @Override + public void onError(String error) { + ToastUtil.show(R.string.net_error); + } + }); + } + + boolean ret = false; + + public boolean setMsgMasterSwitch(String status, String type) { + ret = false; + MainNetManager.get(this).setMsgMasterSwitch(status, type, new HttpCallback() { + @Override + public void onSuccess(ResponseData data) { + + if (data.getCode() == 200) { + ret = true; + } + + } + + @Override + public void onError(String error) { + + } + }); + + return true; + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java index 3133109a2..91c2c7e53 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/setting/SettingActivity.java @@ -1,8 +1,10 @@ package com.shayu.onetoone.activity.setting; +import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Intent; import android.os.Handler; +import android.widget.TextView; import com.alibaba.android.arouter.facade.annotation.Route; import com.shayu.onetoone.R; @@ -11,14 +13,17 @@ import com.shayu.onetoone.manager.RouteManager; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; +import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.GlideCatchUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import java.io.File; @@ -27,13 +32,16 @@ import cn.rongcloud.rtc.api.RCRTCEngine; import io.rong.imlib.RongIMClient; /** - * Created by cxf on 2018/9/30. + * 设置 */ @Route(path = RouteUtil.PATH_SETTING) public class SettingActivity extends AbsActivity { private Handler mHandler; + private TextView versionCode; + private TextView cacheSize; + @Override protected int getLayoutId() { return R.layout.activity_setting; @@ -44,14 +52,28 @@ public class SettingActivity extends AbsActivity { setTitle(mContext.getString(R.string.set_up)); IMLoginModel model = IMLoginManager.get(mContext).getUserInfo(); - //跳转自己 + versionCode = findViewById(R.id.versionCode); + cacheSize = findViewById(R.id.cacheSize); + + //编辑资料 ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.personSet), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { RouteUtil.forwardEditProfileActivity(); } }); - + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.change_the_password), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + forwardModifyPwd(); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.blacklist), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUserBean().getId(), 1); + } + }); // 达人认证 ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.toBlogger), new ViewClicksAntiShake.ViewClicksCallBack() { @Override @@ -60,30 +82,59 @@ public class SettingActivity extends AbsActivity { RouteManager.forwardAuthBloggerInletActivity(); } }); + //清除緩存 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.clearCaChe), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + clearCache(); + } + }); + //检查版本更新 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.checkVersion), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + checkVersion(); + } + }); + //退出登录 ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.logout), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { logout(); } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.layout_alerts), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + startActivity(new Intent(SettingActivity.this, OneMsgSettActivity.class)); + } + }); + intiData(); } + @SuppressLint("SetTextI18n") + private void intiData() { + versionCode.setText(VersionUtil.getVersion()); + cacheSize.setText(GlideCatchUtil.getInstance().getCacheSize() + "MB"); + } + + /** * 检查更新 */ private void checkVersion() { -// CommonAppConfig.getInstance().getConfig(new CommonCallback() { -// @Override -// public void callback(ConfigBean configBean) { -// if (configBean != null) { -// if (VersionUtil.isLatest(configBean.getVersion())) { -// ToastUtil.show(R.string.version_latest); -// } else { -// VersionUtil.showDialog(mContext, configBean, configBean.getDownloadApkUrl()); -// } -// } -// } -// }); + CommonAppConfig.getInstance().getConfig(new CommonCallback() { + @Override + public void callback(ConfigBean configBean) { + if (configBean != null) { + if (VersionUtil.isLatest(configBean.getVersion())) { + ToastUtil.show(R.string.version_latest); + } else { + VersionUtil.showDialog(mContext, configBean, configBean.getDownloadApkUrl()); + } + } + } + }); } /** @@ -103,7 +154,7 @@ public class SettingActivity extends AbsActivity { * 修改密码 */ private void forwardModifyPwd() { - //startActivity(new Intent(mContext, ModifyPwdActivity.class)); + startActivity(new Intent(mContext, ModifyPwdActivity.class)); } /** @@ -116,7 +167,7 @@ public class SettingActivity extends AbsActivity { /** * 清除缓存 */ - private void clearCache(final int position) { + private void clearCache() { final Dialog dialog = DialogUitl.loadingDialog(mContext, getString(R.string.setting_clear_cache_ing)); dialog.show(); GlideCatchUtil.getInstance().clearImageAllCache(); diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java index d5181c2b0..36c3cf8d6 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/user/EditProfileActivity.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.text.TextUtils; import android.view.View; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -18,6 +19,7 @@ import com.sahooz.library.Country; import com.sahooz.library.CountryPicker; import com.sahooz.library.OnPick; import com.shayu.onetoone.R; +import com.shayu.onetoone.bean.AuthBean; import com.shayu.onetoone.bean.AvatarBean; import com.shayu.onetoone.manager.OTONetManager; import com.shayu.onetoone.manager.RouteManager; @@ -75,6 +77,7 @@ public class EditProfileActivity extends AbsActivity { private TextView mSex; private TextView mCity; private TextView tv_bind_phone; + private TextView auth_status; private ProcessImageUtil cameraUtil; private UserBean mUserBean; private String mProvinceVal; @@ -88,6 +91,8 @@ public class EditProfileActivity extends AbsActivity { int userSex; + AuthBean authBean; + @Override protected int getLayoutId() { return R.layout.activity_edit_profile; @@ -96,6 +101,7 @@ public class EditProfileActivity extends AbsActivity { @Override protected void main() { setTitle(mContext.getString(R.string.edit_profile)); + auth_status = findViewById(R.id.auth_status); mAvatar = (ImageView) findViewById(R.id.avatar); mName = (TextView) findViewById(R.id.name); mSign = (TextView) findViewById(R.id.sign); @@ -247,6 +253,12 @@ public class EditProfileActivity extends AbsActivity { } else { showTaskDialog(); } + } else if (i == R.id.btn_like) { + if (isInto) { + editLabel(); + } else { + showTaskDialog(); + } } else if (i == R.id.btn_sign) { if (isInto) { forwardSign(); @@ -263,7 +275,6 @@ public class EditProfileActivity extends AbsActivity { public void onSex(int sex) { userSex = sex; - OTONetManager.getInstance(EditProfileActivity.this).setFiled("sex", String.valueOf(sex), new com.yunbao.common.http.base.HttpCallback() { @Override public void onSuccess(HttpCallbackModel data) { @@ -323,6 +334,10 @@ public class EditProfileActivity extends AbsActivity { } } + private void editLabel() { + RouteManager.forwardChooseLabelActivity(true); + } + private void editName() { Intent intent = new Intent(mContext, EditNameActivity.class); intent.putExtra(Constants.NICK_NAME, mUserBean.getUserNiceName()); @@ -665,6 +680,32 @@ public class EditProfileActivity extends AbsActivity { } }*/ + OTONetManager.getInstance(EditProfileActivity.this).getAuthInfo(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(AuthBean data) { + authBean = data; + if (data.getName_auth() == 2) {//已通过 + auth_status.setText("認證通過"); + auth_status.setTextColor(getResources().getColor(R.color.green_81c160)); + auth_status.setVisibility(View.GONE); + findViewById(R.id.img_auth_status).setVisibility(View.VISIBLE); + } else if (data.getName_auth() == 3) {//已提交 + auth_status.setText("審核中"); + auth_status.setTextColor(getResources().getColor(R.color.gray1)); + } else if (data.getName_auth() == 4) { + auth_status.setText("審核失敗重新提交"); + auth_status.setTextColor(getResources().getColor(R.color.red)); + } else { + auth_status.setText("去認證"); + auth_status.setTextColor(getResources().getColor(R.color.black2)); + } + } + + @Override + public void onError(String error) { + + } + }); } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/adapter/DiamondExchangeAdapter.java b/OneToOne/src/main/java/com/shayu/onetoone/adapter/DiamondExchangeAdapter.java index 8e2280552..dd649372c 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/adapter/DiamondExchangeAdapter.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/adapter/DiamondExchangeAdapter.java @@ -27,7 +27,16 @@ public class DiamondExchangeAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { DiamondExchangeViewHolder exchangeViewHolder = (DiamondExchangeViewHolder) holder; - exchangeViewHolder.showData(exchangeModels.get(position)); + exchangeViewHolder.showData(exchangeModels.get(position), position); + exchangeViewHolder.setListener(new DiamondExchangeViewHolder.DiamondExchangeClickListener() { + @Override + public void onDiamondExchangeClickListener(ExchangeModel model, int position) { + for (int i = 0; i < exchangeModels.size(); i++) { + exchangeModels.get(i).setSelect(i == position); + } + notifyDataSetChanged(); + } + }); } @Override @@ -38,5 +47,13 @@ public class DiamondExchangeAdapter extends RecyclerView.Adapter { public void addData(List mExchangeModels) { exchangeModels.clear(); exchangeModels.addAll(mExchangeModels); + notifyDataSetChanged(); + } + + public void unSelect() { + for (int i = 0; i < exchangeModels.size(); i++) { + exchangeModels.get(i).setSelect(false); + } + notifyDataSetChanged(); } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/adapter/ExchangeRecordAdapter.java b/OneToOne/src/main/java/com/shayu/onetoone/adapter/ExchangeRecordAdapter.java new file mode 100644 index 000000000..ad16ca98d --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/adapter/ExchangeRecordAdapter.java @@ -0,0 +1,46 @@ +package com.shayu.onetoone.adapter; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.shayu.onetoone.R; +import com.shayu.onetoone.bean.ExchangeRecordModel; +import com.shayu.onetoone.view.ExchangeRecordViewHolder; + +import java.util.ArrayList; +import java.util.List; + +public class ExchangeRecordAdapter extends RecyclerView.Adapter { + private List exchangeRecordModels = new ArrayList<>(); + + @NonNull + @Override + public ExchangeRecordViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View bodyView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_exchange_record_item_holder, parent, false); + return new ExchangeRecordViewHolder(bodyView); + } + + @Override + public void onBindViewHolder(@NonNull ExchangeRecordViewHolder holder, int position) { + holder.setData(exchangeRecordModels.get(position), position); + } + + @Override + public int getItemCount() { + return exchangeRecordModels.size(); + } + + public void setList(List mExchangeRecordModels) { + this.exchangeRecordModels = mExchangeRecordModels; + notifyDataSetChanged(); + } + + public void addLst(List mExchangeRecordModels) { + this.exchangeRecordModels.addAll(mExchangeRecordModels); + notifyDataSetChanged(); + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/adapter/MyArnAdapter.java b/OneToOne/src/main/java/com/shayu/onetoone/adapter/MyArnAdapter.java index f11933518..ca90a92f0 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/adapter/MyArnAdapter.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/adapter/MyArnAdapter.java @@ -40,4 +40,9 @@ public class MyArnAdapter extends RecyclerView.Adapter { friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels); notifyDataSetChanged(); } + + public void addLst(List mFriendAppMoneyLogModels) { + this.friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels); + notifyDataSetChanged(); + } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/adapter/SearchAdapter.java b/OneToOne/src/main/java/com/shayu/onetoone/adapter/SearchAdapter.java new file mode 100644 index 000000000..b420d9af5 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/adapter/SearchAdapter.java @@ -0,0 +1,218 @@ +package com.shayu.onetoone.adapter; + +import android.content.Context; +import android.text.TextUtils; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.fastjson.JSON; +import com.shayu.onetoone.R; +import com.shayu.onetoone.bean.SearchUserBean; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.custom.MyRadioButton; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.CommonHttpUtil; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; +import com.yunbao.common.utils.RouteUtil; + +import java.util.List; + +import pl.droidsonroids.gif.GifImageView; + +/** + * Created by cxf on 2018/9/29. + */ + +public class SearchAdapter extends RefreshAdapter { + + private View.OnClickListener mFollowClickListener; + private View.OnClickListener mClickListener; + private String mFollow; + private String mFollowing; + private int mFrom; + private String mUid; + + public SearchAdapter(Context context, int from) { + super(context); + mFrom = from; + mFollow =mContext.getString(R.string.follow); + mFollowing =mContext.getString(R.string.following); + mFollowClickListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + if (!canClick()) { + return; + } + Object tag = v.getTag(); + if (tag == null) { + return; + } + SearchUserBean bean = (SearchUserBean) tag; + CommonHttpUtil.setAttention(bean.getId(), null); + } + }; + mClickListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + if (!canClick()) { + return; + } + Object tag = v.getTag(); + if (tag == null) { + return; + } + SearchUserBean bean = (SearchUserBean) tag; + if (mOnItemClickListener != null) { + mOnItemClickListener.onItemClick(bean, 0); + } + } + }; + mUid = CommonAppConfig.getInstance().getUid(); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new Vh(mInflater.inflate(R.layout.item_search, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position, @NonNull List payloads) { + Object payload = payloads.size() > 0 ? payloads.get(0) : null; + ((Vh) vh).setData(mList.get(position), position, payload); + } + + public void updateItem(String id, int attention) { + if (TextUtils.isEmpty(id)) { + return; + } + for (int i = 0, size = mList.size(); i < size; i++) { + SearchUserBean bean = mList.get(i); + if (bean != null && id.equals(bean.getId())) { + bean.setAttention(attention); + notifyItemChanged(i, Constants.PAYLOAD); + break; + } + } + } + + + class Vh extends RecyclerView.ViewHolder { + + ImageView mAvatar; + TextView mName; + TextView mSign; + ImageView mSex; + ImageView mLevelAnchor; + ImageView mLevel; + MyRadioButton mBtnFollow; + GifImageView btn_live; + + public Vh(View itemView) { + super(itemView); + mAvatar = (ImageView) itemView.findViewById(R.id.avatar); + mName = (TextView) itemView.findViewById(R.id.name); + mSign = (TextView) itemView.findViewById(R.id.sign); + mSex = (ImageView) itemView.findViewById(R.id.sex); + mLevelAnchor = (ImageView) itemView.findViewById(R.id.level_anchor); + mLevel = (ImageView) itemView.findViewById(R.id.level); + mBtnFollow = (MyRadioButton) itemView.findViewById(R.id.btn_follow); + btn_live = (GifImageView) itemView.findViewById(R.id.btn_live); + itemView.setOnClickListener(mClickListener); + mBtnFollow.setOnClickListener(mFollowClickListener); + } + + void setData(final SearchUserBean bean, int position, Object payload) { + itemView.setTag(bean); + mBtnFollow.setTag(bean); + if (payload == null) { + ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar); + mName.setText(bean.getUserNiceName()); + mSign.setText(bean.getSignature()); + mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); + btn_live.setVisibility(View.GONE); + if (bean.getIslive() != null && bean.getIslive().equals("1")) { + btn_live.setVisibility(View.VISIBLE); + + } + btn_live.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + gotoLive(bean.getId()); + } + }); + LevelBean anchorLevelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor()); + if (anchorLevelBean != null) { + ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevelAnchor); + } + LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); + if (levelBean != null) { + ImgLoader.display(mContext, levelBean.getThumb(), mLevel); + } + } +// if (mUid.equals(bean.getId())) { +// if (mBtnFollow.getVisibility() == View.VISIBLE) { +// mBtnFollow.setVisibility(View.INVISIBLE); +// } +// } else { +// if (mBtnFollow.getVisibility() != View.VISIBLE) { +// mBtnFollow.setVisibility(View.VISIBLE); +// } +// if (bean.getAttention() == 1) { +// mBtnFollow.doChecked(true); +// mBtnFollow.setText(mFollowing); +// } else { +// mBtnFollow.doChecked(false); +// mBtnFollow.setText(mFollow); +// } +// } + } + + } + + + private void gotoLive(final String live_id) { + LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + if (liveBean == null) { + return; + } + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } else { + RouteUtil.forwardUserHome(mContext, live_id, 0); + } + } + }); + } + +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeModel.java b/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeModel.java index 8fc31278a..a952a364c 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeModel.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeModel.java @@ -12,7 +12,17 @@ public class ExchangeModel extends BaseModel { @SerializedName("title") private String title; @SerializedName("num") - private int num; + private String num; + private boolean select = false; + + public boolean isSelect() { + return select; + } + + public ExchangeModel setSelect(boolean select) { + this.select = select; + return this; + } public String getTop() { return top; @@ -41,11 +51,11 @@ public class ExchangeModel extends BaseModel { return this; } - public int getNum() { + public String getNum() { return num; } - public ExchangeModel setNum(int num) { + public ExchangeModel setNum(String num) { this.num = num; return this; } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeRecordModel.java b/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeRecordModel.java new file mode 100644 index 000000000..a71322dc4 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/bean/ExchangeRecordModel.java @@ -0,0 +1,140 @@ +package com.shayu.onetoone.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class ExchangeRecordModel extends BaseModel { + + @SerializedName("id") + private int id; + @SerializedName("uid") + private int uid; + @SerializedName("income") + private int income; + @SerializedName("before_money") + private String beforeMoney; + @SerializedName("money") + private String money; + @SerializedName("after_money") + private String afterMoney; + @SerializedName("memo") + private String memo; + @SerializedName("type") + private String type; + @SerializedName("currency_type") + private String currencyType; + @SerializedName("service_id") + private String serviceId; + @SerializedName("create_time") + private long createTime; + @SerializedName("tuid") + private int tuid; + + public int getId() { + return id; + } + + public ExchangeRecordModel setId(int id) { + this.id = id; + return this; + } + + public int getUid() { + return uid; + } + + public ExchangeRecordModel setUid(int uid) { + this.uid = uid; + return this; + } + + public int getIncome() { + return income; + } + + public ExchangeRecordModel setIncome(int income) { + this.income = income; + return this; + } + + public String getBeforeMoney() { + return beforeMoney; + } + + public ExchangeRecordModel setBeforeMoney(String beforeMoney) { + this.beforeMoney = beforeMoney; + return this; + } + + public String getMoney() { + return money; + } + + public ExchangeRecordModel setMoney(String money) { + this.money = money; + return this; + } + + public String getAfterMoney() { + return afterMoney; + } + + public ExchangeRecordModel setAfterMoney(String afterMoney) { + this.afterMoney = afterMoney; + return this; + } + + public String getMemo() { + return memo; + } + + public ExchangeRecordModel setMemo(String memo) { + this.memo = memo; + return this; + } + + public String getType() { + return type; + } + + public ExchangeRecordModel setType(String type) { + this.type = type; + return this; + } + + public String getCurrencyType() { + return currencyType; + } + + public ExchangeRecordModel setCurrencyType(String currencyType) { + this.currencyType = currencyType; + return this; + } + + public String getServiceId() { + return serviceId; + } + + public ExchangeRecordModel setServiceId(String serviceId) { + this.serviceId = serviceId; + return this; + } + + public long getCreateTime() { + return createTime; + } + + public ExchangeRecordModel setCreateTime(long createTime) { + this.createTime = createTime; + return this; + } + + public int getTuid() { + return tuid; + } + + public ExchangeRecordModel setTuid(int tuid) { + this.tuid = tuid; + return this; + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/bean/FriendAppMoneySumModel.java b/OneToOne/src/main/java/com/shayu/onetoone/bean/FriendAppMoneySumModel.java index 1016cd6e6..33bfb7845 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/bean/FriendAppMoneySumModel.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/bean/FriendAppMoneySumModel.java @@ -9,6 +9,17 @@ public class FriendAppMoneySumModel extends BaseModel { private String today; @SerializedName("sum") private String sum; + @SerializedName("withdrawal") + private WithdrawalModel withdrawalModel; + + public WithdrawalModel getWithdrawalModel() { + return withdrawalModel; + } + + public FriendAppMoneySumModel setWithdrawalModel(WithdrawalModel withdrawalModel) { + this.withdrawalModel = withdrawalModel; + return this; + } public String getToday() { return today; diff --git a/OneToOne/src/main/java/com/shayu/onetoone/bean/SearchUserBean.java b/OneToOne/src/main/java/com/shayu/onetoone/bean/SearchUserBean.java new file mode 100644 index 000000000..87d85bcd7 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/bean/SearchUserBean.java @@ -0,0 +1,62 @@ +package com.shayu.onetoone.bean; + +import android.os.Parcel; + +import com.alibaba.fastjson.annotation.JSONField; +import com.yunbao.common.bean.UserBean; + +/** + * Created by cxf on 2018/9/29. + */ + +public class SearchUserBean extends UserBean { + + private int attention; + private String isblack; + @JSONField(name = "isattention") + public int getAttention() { + return attention; + } + + @JSONField(name = "isblack") + public String getBlack() { + return isblack; + } + + @JSONField(name = "isblack") + public void setBlack(String black) { + this.isblack = black; + } + + @JSONField(name = "isattention") + public void setAttention(int attention) { + this.attention = attention; + } + + public SearchUserBean() { + + } + +// @Override +// public void writeToParcel(Parcel dest, int flags) { +// super.writeToParcel(dest, flags); +// dest.writeInt(this.attention); +// } + + public SearchUserBean(Parcel in) { + super(in); + this.attention = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public SearchUserBean[] newArray(int size) { + return new SearchUserBean[size]; + } + + @Override + public SearchUserBean createFromParcel(Parcel in) { + return new SearchUserBean(in); + } + }; +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/bean/WithdrawalModel.java b/OneToOne/src/main/java/com/shayu/onetoone/bean/WithdrawalModel.java new file mode 100644 index 000000000..42fef9a69 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/bean/WithdrawalModel.java @@ -0,0 +1,28 @@ +package com.shayu.onetoone.bean; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class WithdrawalModel extends BaseModel { + + @SerializedName("sum") + private String sum; + @SerializedName("money") + private int money; + + public String getSum() { + return sum; + } + + public void setSum(String sum) { + this.sum = sum; + } + + public int getMoney() { + return money; + } + + public void setMoney(int money) { + this.money = money; + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/event/DiamondExchangeEvent.java b/OneToOne/src/main/java/com/shayu/onetoone/event/DiamondExchangeEvent.java new file mode 100644 index 000000000..a3ad6babd --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/event/DiamondExchangeEvent.java @@ -0,0 +1,57 @@ +package com.shayu.onetoone.event; + +import com.yunbao.common.bean.BaseModel; + +public class DiamondExchangeEvent extends BaseModel { + private String top; + private String name; + private String title; + private String num; + + private int index = 0; + + public int getIndex() { + return index; + } + + public DiamondExchangeEvent setIndex(int index) { + this.index = index; + return this; + } + + public String getTop() { + return top; + } + + public DiamondExchangeEvent setTop(String top) { + this.top = top; + return this; + } + + public String getName() { + return name; + } + + public DiamondExchangeEvent setName(String name) { + this.name = name; + return this; + } + + public String getTitle() { + return title; + } + + public DiamondExchangeEvent setTitle(String title) { + this.title = title; + return this; + } + + public String getNum() { + return num; + } + + public DiamondExchangeEvent setNum(String num) { + this.num = num; + return this; + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/manager/OTONetManager.java b/OneToOne/src/main/java/com/shayu/onetoone/manager/OTONetManager.java index faf38f81b..27e169fcc 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/manager/OTONetManager.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/manager/OTONetManager.java @@ -9,6 +9,7 @@ import com.shayu.onetoone.bean.AuthBean; import com.shayu.onetoone.bean.AuthBloggerBean; import com.shayu.onetoone.bean.AvatarBean; import com.shayu.onetoone.bean.ExchangeModel; +import com.shayu.onetoone.bean.ExchangeRecordModel; import com.shayu.onetoone.bean.FollowBean; import com.shayu.onetoone.bean.FriendAppMoneyLogModel; import com.shayu.onetoone.bean.FriendAppMoneySumModel; @@ -1121,9 +1122,9 @@ public class OTONetManager { * @param currencyType 1星币 2砖石 3社交新币种 * @param income 1收入 2支出 */ - public void getFriendAppMoneyLogModel(String currencyType, String income, HttpCallback> callback) { + public void getFriendAppMoneyLogModel(String currencyType, String income, int page, HttpCallback> callback) { API.get().otoApi(mContext). - getFriendAppMoneyLogModel(currencyType, income) + getFriendAppMoneyLogModel(currencyType, income,page) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>>() { @@ -1170,8 +1171,7 @@ public class OTONetManager { } /** - * - * @param type coin砖石 yuanbao 星币 + * @param type coin砖石 yuanbao 星币 * @param callback */ public void getExchangeList(String type, HttpCallback> callback) { @@ -1197,6 +1197,95 @@ public class OTONetManager { } }).isDisposed(); } + + /** + * 收益转换星币或砖石 + * + * @param type coin砖石 yuanbao 星币 + * @param number 转换 星币 或 砖石 数量 + * @param callback + */ + public void getTransform(String type, String number, HttpCallback> callback) { + API.get().otoApi(mContext). + getTransform(type, number) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (listResponseModel.getData().getCode() == 0) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } else { + callback.onError(listResponseModel.getData().getMsg()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(com.yunbao.common.R.string.net_error)); + } + } + }).isDisposed(); + } + + /** + * @param type 10 转换星币 11转换砖石 + * @param currencyType 1星币 2砖石 3社交新币种 + * @param income 1收入 2支出 + * @param page + * @param callback + */ + public void getExchangeRecord(String type, String currencyType, String income, int page, HttpCallback> callback) { + API.get().otoApi(mContext). + getExchangeRecord(type, currencyType, income, page) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (listResponseModel.getData().getCode() == 0) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } else { + callback.onError(listResponseModel.getData().getMsg()); + } + } + }, new Consumer() { + @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 updatePass( + String name, String mobile, String card_no, + HttpCallback callback) { + + API.get().otoApi(mContext) + .updaePass(name, mobile, card_no) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (listResponseModel.getData().getCode() == 0) { + callback.onSuccess(new HttpCallbackModel(listResponseModel.getData().getCode(), listResponseModel.getData().getMsg())); + } else { + callback.onError(listResponseModel.getData().getMsg()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + + } + }).isDisposed(); + } + public void getFriends(int page,HttpCallback> callback) { API.get().otoApi(mContext). getFriends(page+"") diff --git a/OneToOne/src/main/java/com/shayu/onetoone/manager/RouteManager.java b/OneToOne/src/main/java/com/shayu/onetoone/manager/RouteManager.java index ba37fbba0..ecfd4a37f 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/manager/RouteManager.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/manager/RouteManager.java @@ -19,6 +19,7 @@ public class RouteManager { public static final String ACTIVITY_HOME_RANK = "/activity/HomepageRankingActivity"; public static final String ACTIVITY_MY_ARN = "/activity/MyAarningsActivity"; public static final String ACTIVITY_DIAMOND_EXCHANGE = "/activity/DiamondExchangeActivity"; + public static final String ACTIVITY_EXCHANGE_RECORD = "/activity/ExchangeRecordActivity"; public static final String ACTIVITY_HOME_SEARCH = "/activity/HomeSearchActivity"; public static final String ACTIVITY_HOME_SCREEN = "/activity/HomeScreenActivity"; public static final String ACTIVITY_CALL_VIDEO = "/activity/CallVideoActivity"; @@ -40,6 +41,7 @@ public class RouteManager { public static final String ACTIVITY_AUTH_BLOGGER_INLET = "/activity/AuthBloggerInletActivity"; public static final String ACTIVITY_END_CALL="/activity/EndCallActivity"; + public static final String ACTIVITY_BLACK_LIST = "/activity/AuthBloggerInletActivity"; /** * 达人认证入口 @@ -66,8 +68,8 @@ public class RouteManager { /** * 选择标签 */ - public static void forwardChooseActivity() { - ARouter.getInstance().build(ACTIVITY_CHOOSE_LABEL).navigation(); + public static void forwardChooseLabelActivity(boolean isUserHome) { + ARouter.getInstance().build(ACTIVITY_CHOOSE_LABEL).withBoolean("isUserHome",isUserHome).navigation(); } /** diff --git a/OneToOne/src/main/java/com/shayu/onetoone/network/OneToOneApi.java b/OneToOne/src/main/java/com/shayu/onetoone/network/OneToOneApi.java index 5e2b5eea2..e67aea458 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/network/OneToOneApi.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/network/OneToOneApi.java @@ -4,6 +4,7 @@ import com.shayu.onetoone.bean.AuthBean; import com.shayu.onetoone.bean.AuthBloggerBean; import com.shayu.onetoone.bean.AvatarBean; import com.shayu.onetoone.bean.ExchangeModel; +import com.shayu.onetoone.bean.ExchangeRecordModel; import com.shayu.onetoone.bean.FollowBean; import com.shayu.onetoone.bean.FriendAppMoneyLogModel; import com.shayu.onetoone.bean.FriendAppMoneySumModel; @@ -226,7 +227,8 @@ public interface OneToOneApi { @GET("/api/public/?service=Friendappmoney.logs") Observable>> getFriendAppMoneyLogModel( @Query("currency_type") String currencyType, - @Query("income") String income + @Query("income") String income, + @Query("p") int page ); /** @@ -305,6 +307,40 @@ public interface OneToOneApi { @GET("/api/public/?service=Friendappinfos.getSage") Observable> getBloggerInfo( ); + /** + * 收益转换星币或砖石 + */ + @GET("/api/public/?service=Friendappmoney.transform") + Observable>> getTransform( + @Query("type") String type, + @Query("num") String number + ); + + /** + * 收益转换星币或砖石 + */ + @GET("/api/public/?service=Friendappmoney.logs") + Observable>> getExchangeRecord( + @Query("type") String type, + @Query("currency_type") String currencyType, + @Query("income") String income, + @Query("p") int page + ); + + /** + * 修改密码 + * @param oldpass + * @param pass + * @param pass2 + * @return + */ + @GET("/api/public/?service=User.updatePass") + Observable>> updaePass( + @Query("oldpass") String oldpass, + @Query("pass") String pass, + @Query("pass2") String pass2); + + @GET("/api/public/?service=Friendappuser.friend") Observable>> getFriends(@Query("p")String p); diff --git a/OneToOne/src/main/java/com/shayu/onetoone/utils/MainHttpUtil.java b/OneToOne/src/main/java/com/shayu/onetoone/utils/MainHttpUtil.java index 35c1b01e1..9413e6ff0 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/utils/MainHttpUtil.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/utils/MainHttpUtil.java @@ -360,6 +360,7 @@ public class MainHttpUtil { public static void getBlackList(int p, HttpCallback callback) { HttpClient.getInstance().get("User.getBlackList", "User.getBlackList") .params("p", p) + .params("touid", "1") .execute(callback); } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/view/DiamondExchangeViewHolder.java b/OneToOne/src/main/java/com/shayu/onetoone/view/DiamondExchangeViewHolder.java index 984ca3020..cfc96be51 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/view/DiamondExchangeViewHolder.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/view/DiamondExchangeViewHolder.java @@ -1,5 +1,7 @@ package com.shayu.onetoone.view; +import android.graphics.Color; +import android.text.TextUtils; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; @@ -9,6 +11,9 @@ import androidx.recyclerview.widget.RecyclerView; import com.shayu.onetoone.R; import com.shayu.onetoone.bean.ExchangeModel; +import com.shayu.onetoone.event.DiamondExchangeEvent; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; public class DiamondExchangeViewHolder extends RecyclerView.ViewHolder { private LinearLayout diamondExchangeBtn; @@ -22,7 +27,57 @@ public class DiamondExchangeViewHolder extends RecyclerView.ViewHolder { goldCoin = itemView.findViewById(R.id.gold_coin); } - public void showData(ExchangeModel model) { + public void showData(ExchangeModel model, int position) { + diamondExchangeBtn.setSelected(model.isSelect()); + coins.setText(model.getName()); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("(") + .append(model.getTitle()) + .append(")"); + goldCoin.setText(stringBuffer); + if (!TextUtils.isEmpty(model.getTop())) { + fullConversion.setVisibility(View.VISIBLE); + fullConversion.setText(model.getTop()); + if (model.isSelect()) { + fullConversion.setTextColor(Color.parseColor("#C274EC")); + } else { + fullConversion.setTextColor(Color.parseColor("#333333")); + } + } else { + fullConversion.setVisibility(View.GONE); + } + if (model.isSelect()) { + coins.setTextColor(Color.parseColor("#C274EC")); + goldCoin.setTextColor(Color.parseColor("#C274EC")); + } else { + coins.setTextColor(Color.parseColor("#333333")); + goldCoin.setTextColor(Color.parseColor("#333333")); + } + ViewClicksAntiShake.clicksAntiShake(diamondExchangeBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (listener != null) { + listener.onDiamondExchangeClickListener(model, position); + Bus.get().post(new DiamondExchangeEvent() + .setName(model.getName()) + .setTitle(model.getTitle()) + .setTop(model.getTop()) + .setNum(model.getNum()) + .setIndex(position)); + } + } + }); + } + + private DiamondExchangeClickListener listener; + + public DiamondExchangeViewHolder setListener(DiamondExchangeClickListener listener) { + this.listener = listener; + return this; + } + + public interface DiamondExchangeClickListener { + void onDiamondExchangeClickListener(ExchangeModel model, int position); } } diff --git a/OneToOne/src/main/java/com/shayu/onetoone/view/ExchangeRecordViewHolder.java b/OneToOne/src/main/java/com/shayu/onetoone/view/ExchangeRecordViewHolder.java new file mode 100644 index 000000000..8d8de835e --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/view/ExchangeRecordViewHolder.java @@ -0,0 +1,41 @@ +package com.shayu.onetoone.view; + +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.shayu.onetoone.R; +import com.shayu.onetoone.bean.ExchangeRecordModel; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class ExchangeRecordViewHolder extends RecyclerView.ViewHolder { + private TextView memoName, createTime, money; + + public ExchangeRecordViewHolder(@NonNull View itemView) { + super(itemView); + memoName = itemView.findViewById(R.id.memo_name); + createTime = itemView.findViewById(R.id.create_time); + money = itemView.findViewById(R.id.money); + } + + public void setData(ExchangeRecordModel model, int position) { + StringBuilder builder = new StringBuilder(); + builder + .append(model.getMoney()); + memoName.setText(model.getMemo()); + money.setText(builder.toString()); + createTime.setText(getDateStr(new Date((model.getCreateTime()) * 1000), null)); + } + + public String getDateStr(Date date, String format) { + if (format == null || format.isEmpty()) { + format = "yyyy-MM-dd HH:mm"; + } + SimpleDateFormat formatter = new SimpleDateFormat(format); + return formatter.format(date); + } +} diff --git a/OneToOne/src/main/res/layout/activity_auth_blogger_inlet.xml b/OneToOne/src/main/res/layout/activity_auth_blogger_inlet.xml index 2fbf41295..9e00dbf04 100644 --- a/OneToOne/src/main/res/layout/activity_auth_blogger_inlet.xml +++ b/OneToOne/src/main/res/layout/activity_auth_blogger_inlet.xml @@ -7,104 +7,113 @@ - - - - + android:layout_height="match_parent" + android:background="@color/white" + android:orientation="vertical"> - - - - - - - - + android:layout_marginLeft="10dp" + android:layout_marginTop="10dp" + android:text="真人說明" + android:textColor="@color/black2" + android:textSize="18sp" + android:textStyle="bold" /> + android:layout_marginLeft="10dp" + android:text="請上傳您的身份證正反面完成真人認證,完成認證可獲得跟多消息推送并提高聊天,收禮的收益比例" + android:textColor="@color/text_gray" + android:textSize="14sp" /> + + + + + + + + + + + + + + + + + + + + - - - diff --git a/OneToOne/src/main/res/layout/activity_diamond_exchange.xml b/OneToOne/src/main/res/layout/activity_diamond_exchange.xml index 8ad6e253d..fc064d93f 100644 --- a/OneToOne/src/main/res/layout/activity_diamond_exchange.xml +++ b/OneToOne/src/main/res/layout/activity_diamond_exchange.xml @@ -16,7 +16,17 @@ android:layout_height="wrap_content" android:layout_marginTop="30dp"> + + + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="29dp" + android:layout_marginEnd="16dp" />