Merge remote-tracking branch 'origin/dev_6.5.5_语聊' into dev_6.5.5_语聊
# Conflicts: # OneToOne/src/main/java/com/shayu/onetoone/manager/OTONetManager.java # OneToOne/src/main/java/com/shayu/onetoone/network/OneToOneApi.java
This commit is contained in:
@@ -2,6 +2,11 @@ package com.shayu.onetoone.activity;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -10,11 +15,17 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.DiamondExchangeAdapter;
|
||||
import com.shayu.onetoone.bean.ExchangeModel;
|
||||
import com.shayu.onetoone.event.DiamondExchangeEvent;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,6 +33,12 @@ import java.util.List;
|
||||
public class DiamondExchangeActivity extends AbsOTOActivity {
|
||||
private RecyclerView diamondExchangeList;
|
||||
private DiamondExchangeAdapter exchangeAdapter;
|
||||
private TextView title, totalConvertibility;
|
||||
private String type = "yuanbao";
|
||||
|
||||
private EditText diamondExchangeInput;
|
||||
private String number;
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -30,23 +47,150 @@ public class DiamondExchangeActivity extends AbsOTOActivity {
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
diamondExchangeList = findViewById(R.id.diamond_exchange_list);
|
||||
title = findViewById(R.id.title);
|
||||
diamondExchangeInput = findViewById(R.id.diamond_exchange_input);
|
||||
totalConvertibility = findViewById(R.id.total_convertibility);
|
||||
diamondExchangeList.addItemDecoration(new ItemDecoration(mContext, Color.parseColor("#ffffff"), 10, 2));
|
||||
diamondExchangeList.setLayoutManager(new GridLayoutManager(mContext, 3));
|
||||
exchangeAdapter = new DiamondExchangeAdapter();
|
||||
diamondExchangeList.setAdapter(exchangeAdapter);
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.arn_toggle), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (TextUtils.equals(type, "yuanbao")) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "coin");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE, bundle);
|
||||
finish();
|
||||
} else {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "yuanbao");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE, bundle);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exchange_record), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (TextUtils.equals(type, "yuanbao")) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "coin");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_EXCHANGE_RECORD, bundle);
|
||||
} else {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "yuanbao");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_EXCHANGE_RECORD, bundle);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.immediate_exchange), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
String exchangeNumber = "";
|
||||
if (TextUtils.isEmpty(number)) {
|
||||
exchangeNumber = diamondExchangeInput.getText().toString();
|
||||
} else {
|
||||
exchangeNumber = number;
|
||||
}
|
||||
OTONetManager.getInstance(mContext).getTransform(type, exchangeNumber, new HttpCallback<List<ExchangeModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ExchangeModel> 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<List<ExchangeModel>>() {
|
||||
|
||||
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<List<ExchangeModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ExchangeModel> 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("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<List<ExchangeRecordModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ExchangeRecordModel> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<List<FriendAppMoneyLogModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<FriendAppMoneyLogModel> 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<FriendAppMoneySumModel>() {
|
||||
@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<List<FriendAppMoneyLogModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<FriendAppMoneyLogModel> data) {
|
||||
myArnAdapter.showData(data);
|
||||
}
|
||||
refreshMyArn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
private void onConversationListLoadMore() {
|
||||
page++;
|
||||
refreshMyArn();
|
||||
mRefreshLayout.finishLoadMore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ public class MyFragment extends BaseFragment implements OnItemClickListener<User
|
||||
* 设置
|
||||
*/
|
||||
private void forwardSetting() {
|
||||
// mContext.startActivity(new Intent(mContext, SettingActivity.class));
|
||||
mContext.startActivity(new Intent(mContext, SettingActivity.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.shayu.onetoone.bean.LabelBean;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
@@ -47,6 +48,8 @@ public class ChooseLabelActivity extends AbsOTOActivity {
|
||||
|
||||
Button submit; //提交
|
||||
|
||||
boolean isUserHome;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_choose_label;
|
||||
@@ -59,6 +62,9 @@ public class ChooseLabelActivity extends AbsOTOActivity {
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
|
||||
isUserHome = getIntent().getBooleanExtra("isUserHome", false);
|
||||
|
||||
OTONetManager.getInstance(mContext).getSysLabel(new HttpCallback<List<LabelBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LabelBean> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<SearchUserBean> {
|
||||
|
||||
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<SearchUserBean>() {
|
||||
@Override
|
||||
public RefreshAdapter<SearchUserBean> 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<SearchUserBean> processData(String[] info) {
|
||||
return JSON.parseArray(Arrays.toString(info), SearchUserBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<SearchUserBean> list, int listCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<SearchUserBean> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<HttpCallbackModel>() {
|
||||
@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();
|
||||
}
|
||||
}
|
||||
@@ -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<ResponseData>() {
|
||||
@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<MsgSwitchDetailModel>() {
|
||||
@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<ResponseData>() {
|
||||
@Override
|
||||
public void onSuccess(ResponseData data) {
|
||||
|
||||
if (data.getCode() == 200) {
|
||||
ret = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -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<ConfigBean>() {
|
||||
// @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<ConfigBean>() {
|
||||
@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();
|
||||
|
||||
@@ -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<HttpCallbackModel>() {
|
||||
@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<AuthBean>() {
|
||||
@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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user