Commit 9977f540 by mReturn

客服微信号动态获取

parent 08ab87f5
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
<TextView style="@style/line" /> <TextView style="@style/line" />
<RelativeLayout <RelativeLayout
android:visibility="gone"
android:id="@+id/set_message" android:id="@+id/set_message"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="54dp" android:layout_height="54dp"
......
package com.dayu.utils; package com.dayu.utils;
import android.app.Activity; import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
...@@ -165,6 +167,13 @@ public class CommonUtils { ...@@ -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 * List转String
* *
......
...@@ -1016,6 +1016,8 @@ C) 在甲方使用大鱼平å°æœåŠ¡è¿‡ç¨‹ä¸­äº§ç”Ÿçš„业务数æ®ï¼Œå®¢æˆ·æ•°æ ...@@ -1016,6 +1016,8 @@ C) 在甲方使用大鱼平å°æœåŠ¡è¿‡ç¨‹ä¸­äº§ç”Ÿçš„业务数æ®ï¼Œå®¢æˆ·æ•°æ
<string name="moment_take_video">点击开始录制</string> <string name="moment_take_video">点击开始录制</string>
<string name="moment_permission_4">应用需要录音权限来拍摄视频</string> <string name="moment_permission_4">应用需要录音权限来拍摄视频</string>
<string name="request_permission_failure">获取权限失败</string> <string name="request_permission_failure">获取权限失败</string>
<string name="copy_success">复制成功</string>
</resources> </resources>
...@@ -5,8 +5,8 @@ buildscript { ...@@ -5,8 +5,8 @@ buildscript {
ext.build_tools_version = "27.0.3" ext.build_tools_version = "27.0.3"
ext.min_sdk_version = 16 ext.min_sdk_version = 16
ext.target_sdk_version = 26 ext.target_sdk_version = 26
ext.version_code = 253 ext.version_code = 254
ext.verson_name = "2.5.3" ext.verson_name = "2.5.4"
ext.gradle_version = '3.1.4' ext.gradle_version = '3.1.4'
ext.isReleaseMinify = false ext.isReleaseMinify = false
ext.isDebugMinify = 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 { ...@@ -66,7 +66,6 @@ public interface UserService2 {
Observable<BaseResponse<Boolean>> updateBankInfo(@Body EditBankData data); Observable<BaseResponse<Boolean>> updateBankInfo(@Body EditBankData data);
/** /**
* 设置地址信息 * 设置地址信息
* *
...@@ -221,8 +220,9 @@ public interface UserService2 { ...@@ -221,8 +220,9 @@ public interface UserService2 {
/** /**
* 奖励明细 * 奖励明细
** @param type 1工程师 2小程序用户 * * @param type 1工程师 2小程序用户
* @param rewardType 1:销售 2:服务 3:邀请 4:平台 *
* @param rewardType 1:销售 2:服务 3:邀请 4:平台
* @return * @return
*/ */
@GET(Constants.API_7800 + "/payAccountRewardItem") @GET(Constants.API_7800 + "/payAccountRewardItem")
...@@ -234,11 +234,20 @@ public interface UserService2 { ...@@ -234,11 +234,20 @@ public interface UserService2 {
/** /**
* 用户页-现金到账,销售奖励,服务收入,邀请奖励,平台奖励 * 用户页-现金到账,销售奖励,服务收入,邀请奖励,平台奖励
*
* @param accountId * @param accountId
* @return * @return
*/ */
@GET(Constants.API_7800 + "/payAccountRewardItem/engineerIncome/accountId/{accountId}") @GET(Constants.API_7800 + "/payAccountRewardItem/engineerIncome/accountId/{accountId}")
Observable<BaseResponse<UserIncomeBean>> getIncoms(@Path("accountId") int 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; ...@@ -8,6 +8,8 @@ import com.dayu.usercenter.data.protocol.OrderRecord;
import com.dayu.usercenter.data.protocol.TodayAchievement; import com.dayu.usercenter.data.protocol.TodayAchievement;
import com.dayu.usercenter.model.bean.UserIncomeBean; import com.dayu.usercenter.model.bean.UserIncomeBean;
import java.util.List;
/** /**
* Created by luo on 2016/8/4. * Created by luo on 2016/8/4.
*/ */
...@@ -40,6 +42,8 @@ public interface HomeUserContract { ...@@ -40,6 +42,8 @@ public interface HomeUserContract {
void setIncomData(UserIncomeBean data); void setIncomData(UserIncomeBean data);
void setWechatData(List<String> wechats);
} }
abstract class Presenter extends BasePresenter<View> { abstract class Presenter extends BasePresenter<View> {
......
...@@ -44,8 +44,10 @@ public class HomeUserPresenter extends HomeUserContract.Presenter { ...@@ -44,8 +44,10 @@ public class HomeUserPresenter extends HomeUserContract.Presenter {
getUserInfo(); getUserInfo();
getRecordInfo(); getRecordInfo();
getIncomData(); getIncomData();
getWechtData();
} }
public void getUserInfo() { public void getUserInfo() {
UserApiFactory.getEngineerInfo(mUid).subscribe(baseObserver(data ->{ UserApiFactory.getEngineerInfo(mUid).subscribe(baseObserver(data ->{
mInviteCode = data.getInvitationCode(); mInviteCode = data.getInvitationCode();
...@@ -65,6 +67,10 @@ public class HomeUserPresenter extends HomeUserContract.Presenter { ...@@ -65,6 +67,10 @@ public class HomeUserPresenter extends HomeUserContract.Presenter {
.subscribe(baseObserver(data->mView.setIncomData(data))); .subscribe(baseObserver(data->mView.setIncomData(data)));
} }
private void getWechtData() {
Api.getService(UserService2.class).getServiceWechat().compose(Api.applySchedulers())
.subscribe(baseObserver(wechats->mView.setWechatData(wechats)));
}
@Override @Override
public void dumpToSetting() { public void dumpToSetting() {
......
...@@ -7,6 +7,7 @@ import android.content.Intent; ...@@ -7,6 +7,7 @@ import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -19,6 +20,7 @@ import com.dayu.event.UserInfo; ...@@ -19,6 +20,7 @@ import com.dayu.event.UserInfo;
import com.dayu.provider.event.CertificationEvent; import com.dayu.provider.event.CertificationEvent;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.usercenter.R; import com.dayu.usercenter.R;
import com.dayu.usercenter.adapter.ServiceWechatAdapter;
import com.dayu.usercenter.data.protocol.EngineerInfo; import com.dayu.usercenter.data.protocol.EngineerInfo;
import com.dayu.usercenter.data.protocol.OrderRecord; import com.dayu.usercenter.data.protocol.OrderRecord;
import com.dayu.usercenter.data.protocol.TodayAchievement; import com.dayu.usercenter.data.protocol.TodayAchievement;
...@@ -30,6 +32,7 @@ import com.dayu.usercenter.presenter.homeuser.HomeUserContract; ...@@ -30,6 +32,7 @@ import com.dayu.usercenter.presenter.homeuser.HomeUserContract;
import com.dayu.usercenter.presenter.homeuser.HomeUserPresenter; import com.dayu.usercenter.presenter.homeuser.HomeUserPresenter;
import com.dayu.usercenter.ui.activity.WithdrawalsActivity; import com.dayu.usercenter.ui.activity.WithdrawalsActivity;
import com.dayu.usercenter.ui.activity2.CommonRecordActivity; import com.dayu.usercenter.ui.activity2.CommonRecordActivity;
import com.dayu.utils.CommonUtils;
import com.dayu.utils.ProgressUtil; import com.dayu.utils.ProgressUtil;
import com.dayu.utils.SPUtils; import com.dayu.utils.SPUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
...@@ -40,6 +43,8 @@ import org.greenrobot.eventbus.EventBus; ...@@ -40,6 +43,8 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
/** /**
* Created by luofan * Created by luofan
* on 2017/11/20. * on 2017/11/20.
...@@ -163,6 +168,13 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -163,6 +168,13 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
mBind.tvPlatformReward.setText("¥" + data.getPlatformRewardPrice()); 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 @Override
public void showAlipayDialog() { public void showAlipayDialog() {
...@@ -181,10 +193,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -181,10 +193,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
@Override @Override
public void copyWechat(String wechatNum) { public void copyWechat(String wechatNum) {
ClipboardManager cm = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); CommonUtils.copyText(mActivity,wechatNum);
ClipData mClipData = ClipData.newPlainText("", wechatNum);
cm.setPrimaryClip(mClipData);
showToast(R.string.copy_success);
} }
......
...@@ -369,76 +369,13 @@ ...@@ -369,76 +369,13 @@
android:text="@string/add_service_wechat" android:text="@string/add_service_wechat"
android:paddingLeft="18dp" 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 <TextView
android:id="@+id/apply_part" android:id="@+id/apply_part"
android:layout_width="match_parent" 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 @@ ...@@ -42,5 +42,4 @@
<string name="invite_new_share_content">邀请师傅瓜分千万佣金!</string> <string name="invite_new_share_content">邀请师傅瓜分千万佣金!</string>
<string name="add_service_wechat">添加客服微信获得更多派单</string> <string name="add_service_wechat">添加客服微信获得更多派单</string>
<string name="copy_wechat_num">复制微信号</string> <string name="copy_wechat_num">复制微信号</string>
<string name="copy_success">复制成功</string>
</resources> </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