Commit 9977f540 by mReturn

客服微信号动态获取

parent 08ab87f5
......@@ -36,7 +36,6 @@
<TextView style="@style/line" />
<RelativeLayout
android:visibility="gone"
android:id="@+id/set_message"
android:layout_width="match_parent"
android:layout_height="54dp"
......
package com.dayu.utils;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
......@@ -165,6 +167,13 @@ public class CommonUtils {
}
}
public static void copyText(Context context,String text) {
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData mClipData = ClipData.newPlainText("", text);
cm.setPrimaryClip(mClipData);
ToastUtils.showShortToast(R.string.copy_success);
}
/**
* List转String
*
......
......@@ -1016,6 +1016,8 @@ C) 在甲方使用大鱼平å°æœåŠ¡è¿‡ç¨‹ä¸­äº§ç”Ÿçš„业务数æ®ï¼Œå®¢æˆ·æ•°æ
<string name="moment_take_video">点击开始录制</string>
<string name="moment_permission_4">应用需要录音权限来拍摄视频</string>
<string name="request_permission_failure">获取权限失败</string>
<string name="copy_success">复制成功</string>
</resources>
......@@ -5,8 +5,8 @@ buildscript {
ext.build_tools_version = "27.0.3"
ext.min_sdk_version = 16
ext.target_sdk_version = 26
ext.version_code = 253
ext.verson_name = "2.5.3"
ext.version_code = 254
ext.verson_name = "2.5.4"
ext.gradle_version = '3.1.4'
ext.isReleaseMinify = false
ext.isDebugMinify = false
......
package com.dayu.usercenter.adapter;
import android.support.annotation.Nullable;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dayu.usercenter.R;
import com.dayu.utils.CommonUtils;
import java.util.List;
public class ServiceWechatAdapter extends BaseQuickAdapter<String,BaseViewHolder> {
public ServiceWechatAdapter(@Nullable List<String> data) {
super(R.layout.item_service_wechat,data);
}
@Override
protected void convert(BaseViewHolder helper, String item) {
helper.setText(R.id.tv_desc,"客服"+(mData.indexOf(item)+1)+":");
TextView tvPhone = helper.getView(R.id.tv_phone);
TextView tvCopy = helper.getView(R.id.tv_copy);
tvPhone.setText(item);
tvPhone.setOnClickListener(view -> CommonUtils.dialPhone(item));
tvCopy.setOnClickListener(view -> CommonUtils.copyText(mContext,item));
}
}
......@@ -66,7 +66,6 @@ public interface UserService2 {
Observable<BaseResponse<Boolean>> updateBankInfo(@Body EditBankData data);
/**
* 设置地址信息
*
......@@ -221,7 +220,8 @@ public interface UserService2 {
/**
* 奖励明细
** @param type 1工程师 2小程序用户
* * @param type 1工程师 2小程序用户
*
* @param rewardType 1:销售 2:服务 3:邀请 4:平台
* @return
*/
......@@ -234,11 +234,20 @@ public interface UserService2 {
/**
* 用户页-现金到账,销售奖励,服务收入,邀请奖励,平台奖励
*
* @param accountId
* @return
*/
@GET(Constants.API_7800 + "/payAccountRewardItem/engineerIncome/accountId/{accountId}")
Observable<BaseResponse<UserIncomeBean>> getIncoms(@Path("accountId") int accountId);
/**
* 获取客服微信
*
* @return
*/
@GET(Constants.API_7100 + "/account/dynamic")
Observable<BaseResponse<List<String>>> getServiceWechat();
}
......@@ -8,6 +8,8 @@ import com.dayu.usercenter.data.protocol.OrderRecord;
import com.dayu.usercenter.data.protocol.TodayAchievement;
import com.dayu.usercenter.model.bean.UserIncomeBean;
import java.util.List;
/**
* Created by luo on 2016/8/4.
*/
......@@ -40,6 +42,8 @@ public interface HomeUserContract {
void setIncomData(UserIncomeBean data);
void setWechatData(List<String> wechats);
}
abstract class Presenter extends BasePresenter<View> {
......
......@@ -44,8 +44,10 @@ public class HomeUserPresenter extends HomeUserContract.Presenter {
getUserInfo();
getRecordInfo();
getIncomData();
getWechtData();
}
public void getUserInfo() {
UserApiFactory.getEngineerInfo(mUid).subscribe(baseObserver(data ->{
mInviteCode = data.getInvitationCode();
......@@ -65,6 +67,10 @@ public class HomeUserPresenter extends HomeUserContract.Presenter {
.subscribe(baseObserver(data->mView.setIncomData(data)));
}
private void getWechtData() {
Api.getService(UserService2.class).getServiceWechat().compose(Api.applySchedulers())
.subscribe(baseObserver(wechats->mView.setWechatData(wechats)));
}
@Override
public void dumpToSetting() {
......
......@@ -7,6 +7,7 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.ImageView;
......@@ -19,6 +20,7 @@ import com.dayu.event.UserInfo;
import com.dayu.provider.event.CertificationEvent;
import com.dayu.provider.router.RouterPath;
import com.dayu.usercenter.R;
import com.dayu.usercenter.adapter.ServiceWechatAdapter;
import com.dayu.usercenter.data.protocol.EngineerInfo;
import com.dayu.usercenter.data.protocol.OrderRecord;
import com.dayu.usercenter.data.protocol.TodayAchievement;
......@@ -30,6 +32,7 @@ import com.dayu.usercenter.presenter.homeuser.HomeUserContract;
import com.dayu.usercenter.presenter.homeuser.HomeUserPresenter;
import com.dayu.usercenter.ui.activity.WithdrawalsActivity;
import com.dayu.usercenter.ui.activity2.CommonRecordActivity;
import com.dayu.utils.CommonUtils;
import com.dayu.utils.ProgressUtil;
import com.dayu.utils.SPUtils;
import com.dayu.utils.UserManager;
......@@ -40,6 +43,8 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
/**
* Created by luofan
* on 2017/11/20.
......@@ -163,6 +168,13 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
mBind.tvPlatformReward.setText("¥" + data.getPlatformRewardPrice());
}
@Override
public void setWechatData(List<String> wechats) {
ServiceWechatAdapter adapter = new ServiceWechatAdapter(wechats);
mBind.rvWechat.setLayoutManager(new LinearLayoutManager(mActivity));
mBind.rvWechat.setAdapter(adapter);
}
@Override
public void showAlipayDialog() {
......@@ -181,10 +193,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
@Override
public void copyWechat(String wechatNum) {
ClipboardManager cm = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData mClipData = ClipData.newPlainText("", wechatNum);
cm.setPrimaryClip(mClipData);
showToast(R.string.copy_success);
CommonUtils.copyText(mActivity,wechatNum);
}
......
......@@ -369,76 +369,13 @@
android:text="@string/add_service_wechat"
android:paddingLeft="18dp"
/>
<LinearLayout
style="@style/ll_service_wechat"
>
<TextView
style="@style/common_text_style"
android:text="客服1:"
/>
<TextView
style="@style/common_text_style"
android:text="18611425625"
android:textColor="@color/text_common_blue"
android:onClick='@{()->presenter.dial("18611425625")}'
android:layout_marginLeft="10dp"
/>
<View
style="@style/fill_horizontal"
/>
<TextView
style="@style/tv_copy_wecht_btn"
android:onClick='@{()->presenter.copy("18611425625")}'
/>
</LinearLayout>
<LinearLayout
style="@style/ll_service_wechat"
>
<TextView
style="@style/common_text_style"
android:text="客服2:"
/>
<TextView
style="@style/common_text_style"
android:text="18513980231"
android:textColor="@color/text_common_blue"
android:onClick='@{()->presenter.dial("18513980231")}'
android:layout_marginLeft="10dp"
/>
<View
style="@style/fill_horizontal"
/>
<TextView
style="@style/tv_copy_wecht_btn"
android:onClick='@{()->presenter.copy("18513980231")}'
/>
</LinearLayout>
<LinearLayout
style="@style/ll_service_wechat"
android:layout_marginBottom="5dp"
>
<TextView
style="@style/common_text_style"
android:text="客服3:"
/>
<TextView
style="@style/common_text_style"
android:text="18610528225"
android:textColor="@color/text_common_blue"
android:onClick='@{()->presenter.dial("18610528225")}'
android:layout_marginLeft="10dp"
/>
<View
style="@style/fill_horizontal"
/>
<TextView
style="@style/tv_copy_wecht_btn"
android:onClick='@{()->presenter.copy("18610528225")}'
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_wechat"
android:layout_width="match_parent"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/apply_part"
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/ll_service_wechat"
android:layout_marginBottom="5dp">
<TextView
android:id="@+id/tv_desc"
style="@style/common_text_style"
android:text="客服:" />
<TextView
android:id="@+id/tv_phone"
style="@style/common_text_style"
android:layout_marginLeft="10dp"
android:textColor="@color/text_common_blue" />
<View style="@style/fill_horizontal" />
<TextView
android:id="@+id/tv_copy"
style="@style/tv_copy_wecht_btn"
/>
</LinearLayout>
......@@ -42,5 +42,4 @@
<string name="invite_new_share_content">邀请师傅瓜分千万佣金!</string>
<string name="add_service_wechat">添加客服微信获得更多派单</string>
<string name="copy_wechat_num">复制微信号</string>
<string name="copy_success">复制成功</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment